diff --git a/src/components/wizard/wizard.html b/src/components/wizard/wizard.html index 4f5991f..67369c2 100644 --- a/src/components/wizard/wizard.html +++ b/src/components/wizard/wizard.html @@ -12,14 +12,31 @@
diff --git a/src/components/wizard/wizard.js b/src/components/wizard/wizard.js index 57e6bb4..856c8f3 100644 --- a/src/components/wizard/wizard.js +++ b/src/components/wizard/wizard.js @@ -11,14 +11,18 @@ export default module('app.components.wizard', [uiRouter]) name: 'wizard', component: 'wizard', resolve: { - // TODO: load config from router here - config: () => Promise.resolve({}), // André: 'ngInject' does not work for some reason, // so let's make it explicit here // catch error (we only want to wait for the check to finish) + config: ['connection', 'router', 'session', (connection, router, session) => { + if (!session.authentication) { + return {}; + } + return router.getConfig(); + }], online: ['online', online => online.currentProbe.catch(() => false)], // catch error (we only want to wait for the check to finish) - session: ['session', session => session.currentConnect.catch(() => false)], + connection: ['session', session => session.currentConnect.catch(() => false)], }, url: '/wizard', }); @@ -51,6 +55,12 @@ export default module('app.components.wizard', [uiRouter]) this.config = JSON.parse(content); } + loadConfigFromRouter() { + this.router.getConfig().then((config) => { + this.config = config; + }); + } + submit() { if (!this.session.connection) { return this.$q.reject(new Error('no connection to router')); diff --git a/src/nls/locale-en.json b/src/nls/locale-en.json index 1894748..2a22463 100644 --- a/src/nls/locale-en.json +++ b/src/nls/locale-en.json @@ -1,5 +1,10 @@ { "heading": "Configure your Router", + "subheading": "This configuration wizard helps you to set up your router.", + "configfilequestion": "Do you already have a config file?", + "loadconfigfilebutton": "Load config file", + "configfromrouterquestion": "Do you want to load your router config?", + "loadconfigfromrouterbutton": "Load router config", "intro": "Freifunk Berlin", "loadconfiglink": "Load existing config", "loadrouterinfolink": "Refresh information from router", diff --git a/src/services/router.js b/src/services/router.js index 4a951e0..17828e9 100644 --- a/src/services/router.js +++ b/src/services/router.js @@ -27,6 +27,10 @@ export default module('app.services.router', []) return this.call('ffwizard', 'apply', {config}); } + getConfig() { + return this.call('ffwizard', 'getConfig', {}); + } + getIwinfoFreqlist(device) { return this.call('iwinfo', 'freqlist', {device}); }