Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Implemented column hide/show functionality and name change #339

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 20 additions & 2 deletions server/config/default.json
Expand Up @@ -29,9 +29,27 @@
],
"pdwMode": false,
"adminShow": false,
"apiSecurity": false,
"HideCapcode": false,
"HideSource": false,
"apiSecurity": false
"HideSource": false
},
"hide": {
"date": false,
"time": false,
"source": false,
"capcode": false,
"icon": false,
"alias": false,
"message": false
},
"columnname": {
"date": "Date",
"time": "Time",
"source": "Src",
"capcode": "Capcode",
"icon": "Icon",
"alias": "Alias",
"message": "Message"
},
"auth": {
"type": "local",
Expand Down
92 changes: 92 additions & 0 deletions server/public/templates/admin/settings.html
Expand Up @@ -268,6 +268,98 @@ <h5>Messages</h5>
</div>
</div>

<h5>Table</h5>
<div class="form-group">
<label for="hide.date" class="col-xs-4 col-sm-3 control-label">Date</label>
<div class="col-xs-8 col-sm-9">
<div class="checkbox">
<input type="text" class="form-control" placeholder="Date" ng-model="settings.columnName.date" disabled>
<span id="helpBlock" class="help-block">Set the column heading for the date.</span>
<label>
<input type="checkbox" name="hide.date" ng-model="settings.hide.date">
Hide the date column.
</label>
</div>
</div>
</div>
<div class="form-group" disabled>
<label for="hide.time" class="col-xs-4 col-sm-3 control-label">Time</label>
<div class="col-xs-8 col-sm-9">
<div class="checkbox">
<input type="text" class="form-control" placeholder="Time" ng-model="settings.columnName.time" disabled>
<span id="helpBlock" class="help-block">Set the column heading for the time.</span>
<label>
<input type="checkbox" name="hide.time" ng-model="settings.hide.time">
Hide the time column.
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="hide.source" class="col-xs-4 col-sm-3 control-label">Source</label>
<div class="col-xs-8 col-sm-9">
<div class="checkbox">
<input type="text" class="form-control" placeholder="Source" ng-model="settings.columnName.source">
<span id="helpBlock" class="help-block">Set the column heading for the source.</span>
<label>
<input type="checkbox" name="hide.source" ng-model="settings.hide.source">
Hide the source column.
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="hide.capcode" class="col-xs-4 col-sm-3 control-label">Capcode</label>
<div class="col-xs-8 col-sm-9">
<div class="checkbox">
<input type="text" class="form-control" placeholder="Capcode" ng-model="settings.columnName.capcode">
<span id="helpBlock" class="help-block">Set the column heading for the capcode.</span>
<label>
<input type="checkbox" name="hide.capcode" ng-model="settings.hide.capcode">
Hide the capcode column.
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="hide.icon" class="col-xs-4 col-sm-3 control-label">Icon</label>
<div class="col-xs-8 col-sm-9">
<div class="checkbox">
<input type="text" class="form-control" placeholder="Icon" ng-model="settings.columnName.icon">
<span id="helpBlock" class="help-block">Set the column heading for the icon.</span>
<label>
<input type="checkbox" name="hide.icon" ng-model="settings.hide.icon">
Hide the icon column.
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="hide.alias" class="col-xs-4 col-sm-3 control-label">Alias</label>
<div class="col-xs-8 col-sm-9">
<div class="checkbox">
<input type="text" class="form-control" placeholder="Alias" ng-model="settings.columnName.alias">
<span id="helpBlock" class="help-block">Set the column heading for the alias.</span>
<label>
<input type="checkbox" name="hide.alias" ng-model="settings.hide.alias">
Hide the alias column.
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="hide.message" class="col-xs-4 col-sm-3 control-label">Message</label>
<div class="col-xs-8 col-sm-9">
<div class="checkbox">
<input type="text" class="form-control" placeholder="Message" ng-model="settings.columnName.message">
<span id="helpBlock" class="help-block">Set the column heading for the message.</span>
<label>
<input type="checkbox" name="hide.message" ng-model="settings.hide.message">
Hide the message column.
</label>
</div>
</div>

<h5>Auth</h5>
<div class="form-group">
<fieldset disabled>
Expand Down
16 changes: 15 additions & 1 deletion server/routes/index.js
Expand Up @@ -11,9 +11,23 @@ require('../config/passport')(passport); // pass passport for configuration
router.use(function (req, res, next) {
res.locals.login = req.isAuthenticated();
res.locals.user = req.user || '';
res.locals.hidesource = nconf.get('messages:HideSource');
res.locals.hidecapcode = nconf.get('messages:HideCapcode');
res.locals.hidedate = nconf.get('hide:date');
res.locals.hidetime = nconf.get('hide:time');
res.locals.hidesourcecol = nconf.get('hide:source');
res.locals.hidecapcodecol = nconf.get('hide:capcode');
res.locals.hideicon = nconf.get('hide:icon');
res.locals.hidealias = nconf.get('hide:alias');
res.locals.hidemessage = nconf.get('hide:message');
res.locals.colnamedate = nconf.get('columnName:date');
res.locals.colnametime = nconf.get('columnName:time');
res.locals.colnamesource = nconf.get('columnName:source');
res.locals.colnamecapcode = nconf.get('columnName:capcode');
res.locals.colnameicon = nconf.get('columnName:icon');
res.locals.colnamealias = nconf.get('columnName:alias');
res.locals.colnamemessage = nconf.get('columnName:message');
res.locals.pdwmode = nconf.get('messages:pdwMode');
res.locals.hidesource = nconf.get('messages:HideSource');
res.locals.apisecurity = nconf.get('messages:apiSecurity');
res.locals.iconsize = nconf.get('messages:iconsize');
res.locals.gaEnable = nconf.get('monitoring:gaEnable');
Expand Down
40 changes: 30 additions & 10 deletions server/views/index.ejs
Expand Up @@ -39,34 +39,46 @@
</span>
</div>
</th>
<% if (!hidesource || login) { %>
<th class="noMobile noSmall" style="text-align: center;">Src</th>
<% if ((!hidesource || login) && !hidesourcecol) { %>
<th class="noMobile noSmall" style="text-align: center;"> <%- (login && colnamesource !== null) ? colnamesource : "Src" %> </th>
<% } %>
<% if (!hidecapcode || login) { %>
<th class="noMobile" style="text-align: center;">Capcode</th>
<% if ((!hidecapcode || login) && !hidecapcodecol) { %>
<th class="noMobile" style="text-align: center;"> <%- (login && colnamecapcode !== null) ? colnamecapcode : "Capcode" %></th>
<% } %>
<th class="noMobile noSmall"></th>
<th class="noMobile noSmall"></th>
<th style="text-align: center;">Message
<% if (!hideicon || !login) { %>
<th class="noMobile noSmall"><%- (login && colnameicon !== null) ? colnameicon : "Icon" %></th>
<% } %>
<% if (!hidealias || !login) { %>
<th class="noMobile noSmall"><%- (login && colnamealias !== null) ? colnamealias : "Alias" %></th>
<% } %>
<% if (!hidemessage || !login) { %>
<th style="text-align: center;"> <%- (login && colnamemessage !== null) ? colnamemessage : "Message" %>
<span ng-if="filter || hasQuery" class="pull-left" style="vertical-align: middle; padding-right: 10px;">
<strong>Filter:</strong> <a ng-href="/" style="margin-bottom: 3px;" class="btn btn-primary btn-xs">{{filter || origQuery}} <i class="fa fa-fw fa-times"></i></a>
</span></th>
<% } %>
</tr>
</thead>
<tbody>
<tr ng-repeat="message in messages | filter: search">
<% if (!hidedate || !login) { %>
<td class="shrink noMobile noSmall">{{message.date}}</td>
<% } %>
<% if (!hidetime || !login) { %>
<td class="shrink">{{message.timestamp}}</td>
<% if (!hidesource || login) { %>
<% } %>
<% if ((!hidesource || login) && !hidesourcecol) { %>
<td class="shrink noMobile noSmall clickable-td" uib-popover-template="'templates/popover.html'" popover-append-to-body=true ng-click="popoverEl = 'source'" popover-trigger="'outsideClick'" style="background-color: {{message.color || 'grey'}}; text-align: center;">
<span class="small" style="color: white; font-family: monospace;"><strong>{{message.source}}</strong></span>
</td>
<% } %>
<% if (!hidecapcode || login) { %>
<% if ((!hidecapcode || login) && !hidecapcodecol) { %>
<td class="shrink noMobile noSmall clickable-td" uib-popover-template="'templates/popover.html'" popover-append-to-body=true ng-click="popoverEl = 'address'" popover-trigger="'outsideClick'" style="background-color: {{message.color || 'grey'}}; text-align: center;">
<span class="small" style="color: white; font-family: monospace;"><strong>{{message.address}}</strong></span>
</td>
<% } %>

<% if (!hideicon || !login) { %>
<td class="shrink clickable-td" ng-if="message.agency" uib-popover-template="'templates/popover.html'" popover-append-to-body=true ng-click="popoverEl = 'agency'" popover-trigger="'outsideClick'">
<% if (iconsize == 'small') { %>
<span class="fa-stack fa-fw" style="color: {{message.color || 'grey'}};">
Expand All @@ -79,6 +91,7 @@
</span>
<strong style="vertical-align: middle;">{{message.agency || ''}}</strong>
</td>

<td class="shrink" ng-if="!message.agency">
<% if (iconsize == 'small') { %>
<span class="fa-stack fa-fw" style="color: {{message.color || 'grey'}};">
Expand All @@ -91,14 +104,21 @@
</span>
<strong style="vertical-align: middle;"></strong>
</td>
<% } %>

<% if (!hidealias || !login) { %>
<td class="shrink noMobile noSmall clickable-td" ng-if="user" uib-popover-template="'templates/popover.html'" popover-append-to-body=true ng-click="popoverEl = 'alias'" popover-trigger="'outsideClick'">
<span style="color: Maroon;">{{message.alias || 'Unknown'}}</span>
</td>
<td class="shrink noMobile noSmall" ng-if="!user">
<span>{{message.alias || ''}}</span>
</td>
<% } %>

<% if (!hidemessage || !login) { %>
<td class="expand"><div highlight="message.message" replacement="init.replaceText" class="pagerMessage"></td>
</tbody>
<% } %>
</tbody>
</table>
</div>
<div class="row" ng-if="messages.length == 0">
Expand Down