diff --git a/config-schema.json b/config-schema.json new file mode 100644 index 0000000..4569d93 --- /dev/null +++ b/config-schema.json @@ -0,0 +1,237 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "definitions": {}, + "id": "http://example.com/example.json", + "properties": { + "contact": { + "id": "/properties/contact", + "properties": { + "email": { + "id": "/properties/contact/properties/email", + "type": "string" + }, + "name": { + "description": "Nodemaintainer ", + "id": "/properties/contact/properties/name", + "type": "string" + }, + "sendToMap": { + "description": "Send entered email contact to Freifunkmap", + "id": "/properties/contact/properties/sendToMap", + "type": "boolean" + }, + "showOnContactPage": { + "id": "/properties/contact/properties/showOnContactPage", + "type": "boolean" + } + }, + "type": "object" + }, + "internet": { + "properties": { + "internetTunnel": { + "properties": { + "files": { + "properties": { + "config": { + "description": "VPN configuration file", + "type": "string" + }, + "cert": { + "description": "VPN certificate file", + "type": "string" + }, + "cacert": { + "description": "VPN ca certificate file", + "type": "string" + }, + "takey": { + "description": "TLS Auth key file", + "type": "string" + }, + "key": { + "description": "VPN key file", + "type": "string" + } + }, + "required": [ + "config" + ], + "type": "object" + }, + "type": { + "description": "type of VPN tunnel", + "enum": [ + null, + "openvpn" + ], + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + }, + "meshTunnel": { + "properties": { + "files": { + "properties": { + "config": { + "description": "VPN configuration file", + "type": "string" + }, + "cert": { + "description": "VPN certificate file", + "type": "string" + }, + "cacert": { + "description": "VPN ca certificate file", + "type": "string" + }, + "takey": { + "description": "TLS Auth key file", + "type": "string" + }, + "auth-user-pass": { + "description": "Auth User Pass file", + "type": "string" + }, + "secret": { + "description": "secret file", + "type": "string" + }, + "key": { + "description": "VPN key file", + "type": "string" + } + }, + "required": [ + "config" + ], + "type": "object" + }, + "type": { + "description": "type of VPN tunnel", + "enum": [ + null, + "openvpn" + ], + "type": "string" + } + }, + "type": "object" + }, + "share": { + "type": "boolean" + } + }, + "type": "object" + }, + "ip": { + "id": "/properties/ip", + "properties": { + "distribute": { + "description": "Distribute IP addresses to clients", + "id": "/properties/ip/properties/distribute", + "title": "", + "type": "boolean" + }, + "meshLan": { + "id": "/properties/ip/properties/meshLan", + "type": "boolean" + }, + "v4": { + "id": "/properties/ip/properties/v4", + "properties": { + "lan": { + "description": "mesh IP for LAN (Lanmesh)", + "id": "/properties/ip/properties/v4/properties/lan", + "type": "string" + }, + "radio0": { + "id": "/properties/ip/properties/v4/properties/radio0", + "type": "string" + }, + "radio1": { + "id": "/properties/ip/properties/v4/properties/radio1", + "type": "string" + } + }, + "type": "object" + }, + "v4ClientSubnet": { + "id": "/properties/ip/properties/v4ClientSubnet", + "type": "string" + }, + "v6Prefix": { + "id": "/properties/ip/properties/v6Prefix", + "type": "string" + } + }, + "type": "object" + }, + "location": { + "id": "/properties/location", + "properties": { + "city": { + "id": "/properties/location/properties/city", + "type": "string" + }, + "lat": { + "id": "/properties/location/properties/lat", + "type": "number" + }, + "lng": { + "description": "alternative lon", + "id": "/properties/location/properties/lng", + "type": "number" + }, + "postalCode": { + "id": "/properties/location/properties/postalCode", + "type": "string" + }, + "street": { + "id": "/properties/location/properties/street", + "type": "string" + } + }, + "type": "object" + }, + "monitoring": { + "id": "/properties/monitoring", + "properties": { + "enabled": { + "description": "", + "id": "/properties/monitoring/properties/enabled", + "type": "boolean" + } + }, + "type": "object" + }, + "router": { + "id": "/properties/router", + "properties": { + "name": { + "id": "/properties/router/properties/name", + "type": "string" + }, + "passwordHash": { + "id": "/properties/router/properties/passwordHash", + "type": "string" + }, + "sshkeys": { + "id": "/properties/router/properties/sshkeys", + "items": { + "id": "/properties/router/properties/sshkeys/items", + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } + }, + "type": "object" +} + diff --git a/package.json b/package.json index 33c45fa..86620d3 100644 --- a/package.json +++ b/package.json @@ -46,18 +46,21 @@ "webpack-dev-server": "^1.16.2" }, "dependencies": { + "@uirouter/angularjs": "^1.0.6", "angular": "^1.6.1", "angular-animate": "^1.6.1", "angular-bootstrap": "^0.12.2", "angular-messages": "^1.6.1", "angular-sanitize": "^1.6.1", + "angular-simple-logger": "^0.1.7", "angular-translate": "^2.13.1", "angular-translate-loader-static-files": "^2.13.1", "angular-ui-bootstrap": "^2.4.0", - "angular-ui-router": "^1.0.0-beta.3", "bootstrap": "^3.3.7", "font-awesome": "^4.7.0", "ip-address": "^5.0.2", + "leaflet": "^1.2.0", + "lodash": "^4.17.4", "nano-md5": "^1.0.3", "ssh-pub-key-validation": "^1.0.0", "ui-leaflet": "^2.0.0" diff --git a/src/components/home/home.js b/src/components/home/home.js index 310343b..c1d3333 100644 --- a/src/components/home/home.js +++ b/src/components/home/home.js @@ -1,5 +1,5 @@ import { module } from 'angular'; -import uiRouter from 'angular-ui-router'; +import uiRouter from '@uirouter/angularjs'; export default module('app.components.home', [uiRouter]) .config(($stateProvider) => { diff --git a/src/components/index.js b/src/components/index.js index ff518a9..4b80455 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -16,6 +16,8 @@ import wizardIp from './wizard-ip/wizard-ip'; import wizardLocation from './wizard-location/wizard-location'; import wizardMonitoring from './wizard-monitoring/wizard-monitoring'; import wizardRouter from './wizard-router/wizard-router'; +import wizardTunnel from './wizard-tunnel/wizard-tunnel'; +import loadFileForm from './load-file-form/load-file-form'; export default module('app.components', [ authenticateModal.name, @@ -34,4 +36,6 @@ export default module('app.components', [ wizardLocation.name, wizardMonitoring.name, wizardRouter.name, + wizardTunnel.name, + loadFileForm.name, ]); diff --git a/src/components/load-file-button/load-file-button.html b/src/components/load-file-button/load-file-button.html index 9d65de8..e644369 100644 --- a/src/components/load-file-button/load-file-button.html +++ b/src/components/load-file-button/load-file-button.html @@ -1,4 +1,4 @@ diff --git a/src/components/load-file-button/load-file-button.js b/src/components/load-file-button/load-file-button.js index 6feb719..8089060 100644 --- a/src/components/load-file-button/load-file-button.js +++ b/src/components/load-file-button/load-file-button.js @@ -6,6 +6,8 @@ export default module('app.components.load-file-button', []) .component('loadFileButton', { bindings: { accept: '@', + base64: '@', + required: '@', onDismiss: '&', onLoaded: '&', }, @@ -13,18 +15,33 @@ export default module('app.components.load-file-button', []) constructor($element, $scope, $window) { 'ngInject'; + this.$element = $element; this.$scope = $scope; this.$window = $window; - $element.on('change', this.load.bind(this)); + this.bindedLoad = this.load.bind(this); + $element.on('change', this.bindedLoad); } load(event) { if (!event.target.files || event.target.files.length === 0) return; const reader = new this.$window.FileReader(); reader.onload = frEvent => this.$scope.$apply(() => { - this.onLoaded({content: frEvent.target.result}); + if (this.base64) { + this.onLoaded({content: frEvent.target.result.split(',')[1]}); + } else { + this.onLoaded({content: frEvent.target.result}); + } }); - reader.readAsText(event.target.files[0]); + if (this.base64) { + reader.readAsDataURL(event.target.files[0]); + } else { + reader.readAsText(event.target.files[0]); + } + + // reset file + this.$element.off('change', this.bindedLoad); + event.target.value = ''; + this.$element.on('change', this.bindedLoad); } }, template: require('./load-file-button.html'), diff --git a/src/components/load-file-form/load-file-form.html b/src/components/load-file-form/load-file-form.html new file mode 100644 index 0000000..3a998b1 --- /dev/null +++ b/src/components/load-file-form/load-file-form.html @@ -0,0 +1,24 @@ +
+ +
+ + {{'load-file-form.' + $ctrl.details.property + '.select' | translate}} + +
+ +
+
+
diff --git a/src/components/load-file-form/load-file-form.js b/src/components/load-file-form/load-file-form.js new file mode 100644 index 0000000..1738dae --- /dev/null +++ b/src/components/load-file-form/load-file-form.js @@ -0,0 +1,24 @@ +import { module } from 'angular'; + +export default module('app.components.load-file-form', []) + .component('loadFileForm', { + bindings: { + details: '<', + onUpdate: '&', + fileContent: '<', + idPrefix: '@', + }, + controller: class WizardTunnelCtrl { + constructor($scope) { + 'ngInject'; + + $scope.$watch('$ctrl.fileContent', this.update.bind(this)); + } + + update() { + this.onUpdate({fileContent: this.fileContent}); + } + }, + template: require('./load-file-form.html'), + transclude: true, + }); diff --git a/src/components/status-olsr/status-olsr.js b/src/components/status-olsr/status-olsr.js index ed268bd..3756c16 100644 --- a/src/components/status-olsr/status-olsr.js +++ b/src/components/status-olsr/status-olsr.js @@ -1,5 +1,5 @@ import { module } from 'angular'; -import uiRouter from 'angular-ui-router'; +import uiRouter from '@uirouter/angularjs'; export default module('app.components.status-olsr', [uiRouter]) .config(($stateProvider) => { diff --git a/src/components/status-system/status-system.js b/src/components/status-system/status-system.js index 73cc005..766af0b 100644 --- a/src/components/status-system/status-system.js +++ b/src/components/status-system/status-system.js @@ -1,5 +1,5 @@ import { module } from 'angular'; -import uiRouter from 'angular-ui-router'; +import uiRouter from '@uirouter/angularjs'; require('./status-system.less'); diff --git a/src/components/wizard-internet/wizard-internet.html b/src/components/wizard-internet/wizard-internet.html index 55334ff..f19497f 100644 --- a/src/components/wizard-internet/wizard-internet.html +++ b/src/components/wizard-internet/wizard-internet.html @@ -1,5 +1,5 @@ - -
+ +

@@ -20,8 +20,8 @@

@@ -39,342 +39,131 @@

- +
-
- -
-
- -
-
- -
-
-
-
- .help -
-
-
-
- -
.down.help
-
-
- -
.up.help
-
-
-
-
-
+
+
+
- + +
- - -
- -
-
- -
+ +
+ +
+
+
+
-
- -
-
-
-
- -
-
- .conf.select -

 {{wizard.internet.vpn.conf.filename}} - -
-
-
- .conf.error.pattern -
-
-
-
-
-
-
-
- -
-
- .certificate.select -

 {{wizard.internet.vpn.cert.filename}} - -
-
-
- .cert.error.pattern -
-
-
-
-
-
-
-
- -
-
- .key.select -

 {{wizard.internet.vpn.key.filename}} - -
-
-
- .key.error.pattern -
-
-
-
-
-
-
-
- -
-
- .takey.select -

 {{wizard.internet.vpn.takey.filename}} - -
-
-
- .takey.error.pattern -
-
-
-
-
-
-
-
-
-
-
- - - .showlist -
-
-
    - .list -
-
-
-
+
+
+
- +
+ - -
-