Skip to content

Commit

Permalink
Set active button to only shows things not gone
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadin El-Yabroudi authored and jamesog committed Feb 3, 2020
1 parent c09a0cb commit 10d8dfa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ type indexData struct {
Authenticated bool
User User
URI string
AllResults bool
ActiveOnly bool
Submission submission
scanData
}
Expand Down Expand Up @@ -469,7 +469,7 @@ func index(w http.ResponseWriter, r *http.Request) {
ip := q.Get("ip")
firstSeen := q.Get("firstseen")
lastSeen := q.Get("lastseen")
_, allResults := q["all"]
_, activeOnly := q["active"]

results, err := resultData(ip, firstSeen, lastSeen)
if err != nil {
Expand All @@ -487,7 +487,7 @@ func index(w http.ResponseWriter, r *http.Request) {
Authenticated: true,
User: user,
URI: r.URL.Path,
AllResults: allResults,
ActiveOnly: activeOnly,
Submission: sub,
scanData: results,
}
Expand Down
2 changes: 1 addition & 1 deletion views/_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</div>
</form>
<a class="btn btn-primary navbar-btn" href="/job">New scan</a>
<a class="btn btn-{{ if not .AllResults }}success{{ else }}default{{ end }} navbar-btn" href="/{{ if not .AllResults }}?all{{ end }}">Active only</a>
<a class="btn btn-{{ if not .ActiveOnly}}success{{ else }}default{{ end }} navbar-btn" href="/{{ if not .ActiveOnly }}?active{{ end }}">Active only</a>
{{ end }}
{{- if ne .User.Email "" }}
<ul class="nav navbar-nav navbar-right">
Expand Down
3 changes: 3 additions & 0 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
</tr>
</thead>
<tbody>
{{- $ActiveOnly := .ActiveOnly }}
{{- range .Results }}
<tr>
{{- if not (and $ActiveOnly .Gone) }}
<td>
{{- if .New }}<span class="label label-danger">New</span>{{ end -}}
{{- if .Gone }}<span class="label label-success">Gone</span>{{ end -}}
Expand All @@ -26,6 +28,7 @@
<td>{{ .Proto }}</td>
<td>{{ .FirstSeen }}</td>
<td>{{ .LastSeen }}</td>
{{- end }}
</tr>
{{- else }}
<div class="panel panel-warning center-block" style="width: 25%">
Expand Down

0 comments on commit 10d8dfa

Please sign in to comment.