Version information and extended header for admin panel.
This commit is contained in:
parent
db01edcb71
commit
124f330895
|
@ -74,6 +74,7 @@
|
||||||
|
|
||||||
<script src="js/validation/constraints.js"></script>
|
<script src="js/validation/constraints.js"></script>
|
||||||
|
|
||||||
|
<script src="js/views/version.js"></script>
|
||||||
<script src="js/views/mailActionButton.js"></script>
|
<script src="js/views/mailActionButton.js"></script>
|
||||||
<script src="js/views/taskActionButton.js"></script>
|
<script src="js/views/taskActionButton.js"></script>
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,23 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
|
||||||
var admin = nga.application('Knotenverwaltung - Admin-Panel');
|
var admin = nga.application('Knotenverwaltung - Admin-Panel');
|
||||||
|
|
||||||
admin
|
admin
|
||||||
|
.header(
|
||||||
|
'<div class="navbar-header">' +
|
||||||
|
'<a class="navbar-brand" href="#" ng-click="appController.displayHome()">' +
|
||||||
|
'Knotenverwaltung - Admin-Panel <small style="font-size: 0.7em;">(<fa-version></fa-version>)</small>' +
|
||||||
|
'</a>' +
|
||||||
|
'</div>' +
|
||||||
|
'<p class="navbar-text navbar-right">' +
|
||||||
|
'<a href="https://github.com/freifunkhamburg/ffffng" target="_blank">' +
|
||||||
|
'<i class="fa fa-github" aria-hidden="true"></i> Source Code' +
|
||||||
|
'</a>' +
|
||||||
|
'</p>' +
|
||||||
|
'<p class="navbar-text navbar-right">' +
|
||||||
|
'<a href="/" target="_blank">' +
|
||||||
|
'<i class="fa fa-external-link" aria-hidden="true"></i> Frontend' +
|
||||||
|
'</a>' +
|
||||||
|
'</p>'
|
||||||
|
)
|
||||||
.baseApiUrl('/internal/api/')
|
.baseApiUrl('/internal/api/')
|
||||||
.debug(true);
|
.debug(true);
|
||||||
|
|
||||||
|
|
22
admin/js/views/version.js
Normal file
22
admin/js/views/version.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('ffffngAdmin')
|
||||||
|
.directive('faVersion', function ($http, $state, notification) {
|
||||||
|
var link = function (scope) {
|
||||||
|
scope.version = '?';
|
||||||
|
$http.get('/internal/api/version')
|
||||||
|
.then(function (result) { scope.version = result.data.version; })
|
||||||
|
.catch(function (e) {
|
||||||
|
notification.log('Error: ' + e.data, { addnCls: 'humane-flatty-error' });
|
||||||
|
console.error(e);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
'link': link,
|
||||||
|
'restrict': 'E',
|
||||||
|
'scope': {},
|
||||||
|
|
||||||
|
'template': '{{version}}'
|
||||||
|
};
|
||||||
|
});
|
|
@ -5,7 +5,8 @@ var commandLineUsage = require('command-line-usage');
|
||||||
|
|
||||||
var commandLineDefs = [
|
var commandLineDefs = [
|
||||||
{ name: 'help', alias: 'h', type: Boolean, description: 'Show this help' },
|
{ name: 'help', alias: 'h', type: Boolean, description: 'Show this help' },
|
||||||
{ name: 'config', alias: 'c', type: String, description: 'Location of config.json' }
|
{ name: 'config', alias: 'c', type: String, description: 'Location of config.json' },
|
||||||
|
{ name: 'version', alias: 'v', type: Boolean, description: 'Show ffffng version' }
|
||||||
];
|
];
|
||||||
|
|
||||||
var commandLineOptions;
|
var commandLineOptions;
|
||||||
|
@ -17,18 +18,38 @@ try {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commandLineOptions.help || !commandLineOptions.config) {
|
var fs = require('graceful-fs');
|
||||||
|
|
||||||
|
var packageJsonFile = __dirname + '/../package.json';
|
||||||
|
var version = 'unknown';
|
||||||
|
if (fs.existsSync(packageJsonFile)) {
|
||||||
|
version = JSON.parse(fs.readFileSync(packageJsonFile, 'utf8')).version;
|
||||||
|
}
|
||||||
|
|
||||||
|
function usage() {
|
||||||
console.log(commandLineUsage([
|
console.log(commandLineUsage([
|
||||||
{
|
{
|
||||||
header: 'ffffng - Freifunk node management form',
|
header: 'ffffng - ' + version + ' - Freifunk node management form',
|
||||||
optionList: commandLineDefs
|
optionList: commandLineDefs
|
||||||
}
|
}
|
||||||
]));
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commandLineOptions.help) {
|
||||||
|
usage();
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commandLineOptions.version) {
|
||||||
|
console.log('ffffng - ' + version);
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!commandLineOptions.config) {
|
||||||
|
usage();
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var fs = require('graceful-fs');
|
|
||||||
var deepExtend = require('deep-extend');
|
var deepExtend = require('deep-extend');
|
||||||
|
|
||||||
var defaultConfig = {
|
var defaultConfig = {
|
||||||
|
@ -108,3 +129,4 @@ var config = deepExtend({}, defaultConfig, configJSON);
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
|
||||||
angular.module('ffffng').constant('config', config);
|
angular.module('ffffng').constant('config', config);
|
||||||
|
angular.module('ffffng').constant('version', version);
|
||||||
|
|
|
@ -28,6 +28,7 @@ require('./utils/resources');
|
||||||
require('./utils/strings');
|
require('./utils/strings');
|
||||||
require('./utils/urlBuilder');
|
require('./utils/urlBuilder');
|
||||||
|
|
||||||
|
require('./resources/versionResource');
|
||||||
require('./resources/frontendResource');
|
require('./resources/frontendResource');
|
||||||
require('./resources/taskResource');
|
require('./resources/taskResource');
|
||||||
require('./resources/mailResource');
|
require('./resources/mailResource');
|
||||||
|
|
17
server/resources/versionResource.js
Normal file
17
server/resources/versionResource.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('ffffng').factory('VersionResource', function (
|
||||||
|
version,
|
||||||
|
Resources
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
get: function (req, res) {
|
||||||
|
return Resources.success(
|
||||||
|
res,
|
||||||
|
{
|
||||||
|
version: version
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
angular.module('ffffng').factory('Router', function (
|
angular.module('ffffng').factory('Router', function (
|
||||||
app,
|
app,
|
||||||
|
VersionResource,
|
||||||
FrontendResource,
|
FrontendResource,
|
||||||
NodeResource,
|
NodeResource,
|
||||||
MonitoringResource,
|
MonitoringResource,
|
||||||
|
@ -20,6 +21,8 @@ angular.module('ffffng').factory('Router', function (
|
||||||
app.put('/api/monitoring/confirm/:token', MonitoringResource.confirm);
|
app.put('/api/monitoring/confirm/:token', MonitoringResource.confirm);
|
||||||
app.put('/api/monitoring/disable/:token', MonitoringResource.disable);
|
app.put('/api/monitoring/disable/:token', MonitoringResource.disable);
|
||||||
|
|
||||||
|
app.get('/internal/api/version', VersionResource.get);
|
||||||
|
|
||||||
app.get('/internal/api/tasks', TaskResource.getAll);
|
app.get('/internal/api/tasks', TaskResource.getAll);
|
||||||
app.put('/internal/api/tasks/run/:id', TaskResource.run);
|
app.put('/internal/api/tasks/run/:id', TaskResource.run);
|
||||||
app.put('/internal/api/tasks/enable/:id', TaskResource.enable);
|
app.put('/internal/api/tasks/enable/:id', TaskResource.enable);
|
||||||
|
|
Loading…
Reference in a new issue