Splitting site field: Now we track site and domain.
This commit is contained in:
parent
7cec2788f8
commit
84b20b209e
|
@ -158,7 +158,8 @@ Dann die `config.json` anpassen nach belieben. Es gibt die folgenden Konfigurati
|
|||
* **`client.community.name`** Name der Freifunk-Community, z. B.: `"Freifunk Musterstadt"`
|
||||
* **`client.community.domain`** Domain der Freifunk-Community, z. B.: `"musterstadt.freifunk.net"`
|
||||
* **`client.community.contactEmail`** Kontakt-E-Mail-Adresse der Freifunk-Community, z. B.: `"kontakt@musterstadt.freifunk.net"`
|
||||
* **`client.community.sites`** Liste der gültige Site-Codes in der `nodes.json`, z. B.: `["ffms-domain1", "ffms-domain2"]`
|
||||
* **`client.community.sites`** Liste der gültige Site-Codes in der `nodes.json`, z. B.: `["ffms-site1", "ffms-site2"]`
|
||||
* **`client.community.domains`** Liste der gültige Domänen-Codes in der `nodes.json`, z. B.: `["ffms-domain1", "ffms-domain2"]`
|
||||
|
||||
* **`client.legal.privacyUrl`** optional: URL zum Impressum, z. B.: `"http://map.musterstadt.freifunk.net/impressum"`
|
||||
* **`client.legal.imprintUrl`** optional: URL zur Datenschutzerklärung, z. B.: `"http://map.musterstadt.freifunk.net/datenschutz"`
|
||||
|
|
|
@ -55,6 +55,15 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
|
|||
});
|
||||
}
|
||||
|
||||
var domainChoices = [];
|
||||
for (var i = 0; i < config.community.domains.length; i++) {
|
||||
var domain = config.community.domains[i];
|
||||
domainChoices.push({
|
||||
label: domain,
|
||||
value: domain
|
||||
});
|
||||
}
|
||||
|
||||
var header =
|
||||
'<div class="navbar-header">' +
|
||||
'<a class="navbar-brand" href="#" ng-click="appController.displayHome()">' +
|
||||
|
@ -139,6 +148,7 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
|
|||
: '<i class="fa fa-times vpn-key-unset" aria-hidden="true" title="no VPN key"></i>';
|
||||
}),
|
||||
nga.field('site').map(nullable).cssClasses(nodeClasses),
|
||||
nga.field('domain').map(nullable).cssClasses(nodeClasses),
|
||||
nga.field('coords').label('GPS').cssClasses(nodeClasses).template(function (node) {
|
||||
return node.values.coords
|
||||
? '<i class="fa fa-map-marker coords-set" aria-hidden="true" title="coordinates set"></i>'
|
||||
|
@ -170,6 +180,10 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
|
|||
.label('Site')
|
||||
.pinned(false)
|
||||
.choices(siteChoices),
|
||||
nga.field('domain', 'choice')
|
||||
.label('Domäne')
|
||||
.pinned(false)
|
||||
.choices(domainChoices),
|
||||
nga.field('hasKey', 'choice')
|
||||
.label('VPN key')
|
||||
.pinned(false)
|
||||
|
@ -270,6 +284,7 @@ angular.module('ffffngAdmin').config(function(NgAdminConfigurationProvider, Rest
|
|||
nga.field('hostname').cssClasses(monitoringStateClasses),
|
||||
nga.field('mac').cssClasses(monitoringStateClasses),
|
||||
nga.field('site').map(nullable).cssClasses(monitoringStateClasses),
|
||||
nga.field('domain').map(nullable).cssClasses(monitoringStateClasses),
|
||||
nga.field('monitoring_state').cssClasses(monitoringStateClasses).template(function (monitoringState) {
|
||||
switch (monitoringState.values.monitoring_state) {
|
||||
case 'active':
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
"name": "Freifunk Musterstadt",
|
||||
"domain": "musterstadt.freifunk.net",
|
||||
"contactEmail": "kontakt@musterstadt.freifunk.net",
|
||||
"sites": ["ffms-domain1", "ffms-domain2"]
|
||||
"sites": ["ffms-site1", "ffms-site2"],
|
||||
"domains": ["ffms-domain1", "ffms-domain2"]
|
||||
},
|
||||
"legal": {
|
||||
"privacyUrl": "http://map.musterstadt.freifunk.net/datenschutz",
|
||||
|
|
|
@ -97,7 +97,8 @@ var defaultConfig = {
|
|||
name: 'Freifunk Musterstadt',
|
||||
domain: 'musterstadt.freifunk.net',
|
||||
contactEmail: 'kontakt@musterstadt.freifunk.net',
|
||||
sites: []
|
||||
sites: [],
|
||||
domains: []
|
||||
},
|
||||
legal: {
|
||||
privacyUrl: null,
|
||||
|
|
1
server/db/patches/007_add_domain.sql
Normal file
1
server/db/patches/007_add_domain.sql
Normal file
|
@ -0,0 +1 @@
|
|||
ALTER TABLE node_state ADD COLUMN domain VARCHAR(32);
|
|
@ -128,6 +128,7 @@ angular.module('ffffng').factory('NodeResource', function (
|
|||
if (nodeState) {
|
||||
return deepExtend({}, node, {
|
||||
site: nodeState.site,
|
||||
domain: nodeState.domain,
|
||||
onlineState: nodeState.state
|
||||
});
|
||||
}
|
||||
|
@ -144,6 +145,7 @@ angular.module('ffffng').factory('NodeResource', function (
|
|||
'token',
|
||||
'mac',
|
||||
'site',
|
||||
'domain',
|
||||
'key',
|
||||
'onlineState'
|
||||
],
|
||||
|
@ -161,6 +163,7 @@ angular.module('ffffng').factory('NodeResource', function (
|
|||
'mac',
|
||||
'key',
|
||||
'site',
|
||||
'domain',
|
||||
'coords',
|
||||
'onlineState',
|
||||
'monitoringState'
|
||||
|
|
|
@ -44,12 +44,13 @@ angular.module('ffffng')
|
|||
|
||||
return Database.run(
|
||||
'INSERT INTO node_state ' +
|
||||
'(hostname, mac, site, monitoring_state, state, last_seen, import_timestamp, last_status_mail_sent, last_status_mail_type) ' +
|
||||
'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
||||
'(hostname, mac, site, domain, monitoring_state, state, last_seen, import_timestamp, last_status_mail_sent, last_status_mail_type) ' +
|
||||
'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
|
||||
[
|
||||
node.hostname,
|
||||
node.mac,
|
||||
nodeData.site,
|
||||
nodeData.domain,
|
||||
node.monitoringState,
|
||||
nodeData.state,
|
||||
nodeData.lastSeen.unix(),
|
||||
|
@ -84,6 +85,7 @@ angular.module('ffffng')
|
|||
'SET ' +
|
||||
'hostname = ?, ' +
|
||||
'site = ?, ' +
|
||||
'domain = ?, ' +
|
||||
'monitoring_state = ?, ' +
|
||||
'state = ?, ' +
|
||||
'last_seen = ?, ' +
|
||||
|
@ -93,6 +95,7 @@ angular.module('ffffng')
|
|||
[
|
||||
node.hostname,
|
||||
nodeData.site || row.site,
|
||||
nodeData.domain || row.domain,
|
||||
node.monitoringState,
|
||||
nodeData.state,
|
||||
nodeData.lastSeen.unix(),
|
||||
|
@ -119,6 +122,7 @@ angular.module('ffffng')
|
|||
nodeDataForStoring = {
|
||||
mac: node.mac,
|
||||
site: _.isUndefined(row) ? null : row.site,
|
||||
domain: _.isUndefined(row) ? null : row.domain,
|
||||
state: 'OFFLINE',
|
||||
// jshint -W106
|
||||
lastSeen: _.isUndefined(row) ? moment() : moment.unix(row.last_seen),
|
||||
|
@ -197,12 +201,20 @@ angular.module('ffffng')
|
|||
}
|
||||
// jshint +W106
|
||||
|
||||
var domain = null;
|
||||
// jshint -W106
|
||||
if (_.isPlainObject(nodeData.nodeinfo.system) && _.isString(nodeData.nodeinfo.system.domain_code)) {
|
||||
domain = nodeData.nodeinfo.system.domain_code;
|
||||
}
|
||||
// jshint +W106
|
||||
|
||||
return {
|
||||
mac: mac,
|
||||
importTimestamp: importTimestamp,
|
||||
state: isOnline ? 'ONLINE' : 'OFFLINE',
|
||||
lastSeen: lastSeen,
|
||||
site: site
|
||||
site: site,
|
||||
domain: domain
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -564,6 +576,7 @@ angular.module('ffffng')
|
|||
'hostname',
|
||||
'mac',
|
||||
'site',
|
||||
'domain',
|
||||
'monitoring_state',
|
||||
'state',
|
||||
'last_seen',
|
||||
|
|
|
@ -70,6 +70,11 @@ angular.module('ffffng').constant('Constraints', {
|
|||
type: 'string',
|
||||
regex: /^[a-z0-9_-]{1,32}$/,
|
||||
optional: true
|
||||
},
|
||||
domain: {
|
||||
type: 'string',
|
||||
regex: /^[a-z0-9_-]{1,32}$/,
|
||||
optional: true
|
||||
}
|
||||
},
|
||||
rest: {
|
||||
|
|
Loading…
Reference in a new issue