Browse Source

Add go example to "manage.py pygmentize" command.

Make sure the Go snippet shows up in the welcome page and also in the check details page.
pull/307/head
Pēteris Caune 5 years ago
parent
commit
6cd4e494e8
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
6 changed files with 33 additions and 12 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -0
      hc/front/management/commands/pygmentize.py
  3. +6
    -0
      templates/front/show_usage_modal.html
  4. +11
    -3
      templates/front/snippets/go.html
  5. +2
    -0
      templates/front/snippets/go.txt
  6. +12
    -9
      templates/front/welcome.html

+ 1
- 0
CHANGELOG.md View File

@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
- Add the "Last Duration" field in the "My Checks" page (#257)
- Add "last_duration" attribute to the Check API resource (#257)
- Upgrade to psycopg2 2.8.3
- Add Go usage example
### Bug Fixes
- Usernames now are uuid3(const, email). Prevents multiple accts with same email (#290)


+ 1
- 0
hc/front/management/commands/pygmentize.py View File

@ -34,6 +34,7 @@ class Command(BaseCommand):
_process("crontab", lexers.BashLexer())
_process("cs", lexers.CSharpLexer())
_process("node", lexers.JavascriptLexer())
_process("go", lexers.GoLexer())
_process("python_urllib2", lexers.PythonLexer())
_process("python_requests", lexers.PythonLexer())
_process("python_requests_fail", lexers.PythonLexer())


+ 6
- 0
templates/front/show_usage_modal.html View File

@ -20,6 +20,9 @@
<li class="hidden-xs">
<a href="#node" data-toggle="tab">Node.js</a>
</li>
<li class="hidden-xs">
<a href="#go" data-toggle="tab">Go</a>
</li>
<li class="hidden-xs">
<a href="#php" data-toggle="tab">PHP</a>
</li>
@ -57,6 +60,9 @@
<div role="tabpanel" class="tab-pane" id="node">
{% include "front/snippets/node.html" %}
</div>
<div role="tabpanel" class="tab-pane" id="go">
{% include "front/snippets/go.html" %}
</div>
<div role="tabpanel" class="tab-pane" id="php">
{% include "front/snippets/php.html" %}
</div>


+ 11
- 3
templates/front/snippets/go.html View File

@ -1,4 +1,12 @@
<div class="highlight"><pre><span></span><span class="nb">import</span> <span class="s1">&#34;net/http&#34;</span>
<span class="nb">import</span> <span class="s1">"fmt"</span>
<span class="nx">func main() { </span><span class="p">_, err := http.Head("PING_URL") }</span>
<div class="highlight"><pre><span></span><span class="kn">package</span> <span class="nx">main</span>
<span class="kn">import</span> <span class="s">&quot;fmt&quot;</span>
<span class="kn">import</span> <span class="s">&quot;net/http&quot;</span>
<span class="kd">func</span> <span class="nx">main</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">_</span><span class="p">,</span> <span class="nx">err</span> <span class="o">:=</span> <span class="nx">http</span><span class="p">.</span><span class="nx">Head</span><span class="p">(</span><span class="s">&quot;{{ ping_url }}&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="nx">err</span> <span class="o">!=</span> <span class="kc">nil</span> <span class="p">{</span>
<span class="nx">fmt</span><span class="p">.</span><span class="nx">Printf</span><span class="p">(</span><span class="s">&quot;%s&quot;</span><span class="p">,</span> <span class="nx">err</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>

+ 2
- 0
templates/front/snippets/go.txt View File

@ -1,3 +1,5 @@
package main
import "fmt"
import "net/http"


+ 12
- 9
templates/front/welcome.html View File

@ -99,6 +99,9 @@
<div role="tabpanel" class="tab-pane" id="node">
{% include "front/snippets/node.html" %}
</div>
<div role="tabpanel" class="tab-pane" id="go">
{% include "front/snippets/go.html" %}
</div>
<div role="tabpanel" class="tab-pane" id="php">
{% include "front/snippets/php.html" %}
</div>
@ -334,7 +337,7 @@
<h3>Apprise<br><small>Push Notifications</small></h3>
</div>
</div>
{% endif %}
{% endif %}
{% if enable_discord %}
<div class="col-md-2 col-sm-4 col-xs-6">
@ -343,8 +346,8 @@
<h3>Discord<br><small>Chat</small></h3>
</div>
</div>
{% endif %}
{% endif %}
{% if enable_matrix %}
<div class="col-md-2 col-sm-4 col-xs-6">
<div class="integration">
@ -353,13 +356,13 @@
</div>
</div>
{% endif %}
<div class="col-md-2 col-sm-4 col-xs-6">
<div class="integration">
<img src="{% static 'img/integrations/mattermost.png' %}" class="icon" alt="Mattermost icon" />
<h3>Mattermost<br><small>Chat</small></h3>
</div>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6">
<div class="integration">
@ -382,14 +385,14 @@
<img src="{% static 'img/integrations/pagerteam.png' %}" class="icon" alt="Pager Team icon" />
<h3>Pager Team <br><small>Incident Management</small></h3>
</div>
</div>
</div>
<div class="col-md-2 col-sm-4 col-xs-6">
<div class="integration">
<img src="{% static 'img/integrations/pagertree.png' %}" class="icon" alt="PagerTree icon" />
<h3>PagerTree<br><small>Incident Management</small></h3>
</div>
</div>
</div>
{% if enable_pushbullet %}
<div class="col-md-2 col-sm-4 col-xs-6">
@ -399,7 +402,7 @@
</div>
</div>
{% endif %}
{% if enable_pushover %}
<div class="col-md-2 col-sm-4 col-xs-6">
<div class="integration">
@ -441,7 +444,7 @@
<img src="{% static 'img/integrations/victorops.png' %}" class="icon" alt="VictorOps icon" />
<h3>VictorOps<br><small>Incident Management</small></h3>
</div>
</div>
</div>
{% if enable_whatsapp %}
<div class="col-md-2 col-sm-4 col-xs-6">


Loading…
Cancel
Save