mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-22 02:36:32 +00:00
Merge pull request #229 from resin-io/refactor/settings-page
Move all settings related components to a settings page subdirectory
This commit is contained in:
commit
6a11232eea
@ -30,7 +30,6 @@ const currentWindow = BrowserWindow.fromId(1);
|
|||||||
require('angular-ui-bootstrap');
|
require('angular-ui-bootstrap');
|
||||||
require('angular-ui-router');
|
require('angular-ui-router');
|
||||||
require('./browser/modules/selection-state');
|
require('./browser/modules/selection-state');
|
||||||
require('./browser/modules/settings');
|
|
||||||
require('./browser/modules/drive-scanner');
|
require('./browser/modules/drive-scanner');
|
||||||
require('./browser/modules/image-writer');
|
require('./browser/modules/image-writer');
|
||||||
require('./browser/modules/path');
|
require('./browser/modules/path');
|
||||||
@ -40,6 +39,7 @@ require('./browser/controllers/navigation');
|
|||||||
require('./browser/components/progress-button/progress-button');
|
require('./browser/components/progress-button/progress-button');
|
||||||
require('./browser/components/drive-selector');
|
require('./browser/components/drive-selector');
|
||||||
require('./browser/pages/finish/finish');
|
require('./browser/pages/finish/finish');
|
||||||
|
require('./browser/pages/settings/settings');
|
||||||
|
|
||||||
const app = angular.module('Etcher', [
|
const app = angular.module('Etcher', [
|
||||||
'ui.router',
|
'ui.router',
|
||||||
@ -48,7 +48,6 @@ const app = angular.module('Etcher', [
|
|||||||
// Etcher modules
|
// Etcher modules
|
||||||
'Etcher.path',
|
'Etcher.path',
|
||||||
'Etcher.selection-state',
|
'Etcher.selection-state',
|
||||||
'Etcher.settings',
|
|
||||||
'Etcher.drive-scanner',
|
'Etcher.drive-scanner',
|
||||||
'Etcher.image-writer',
|
'Etcher.image-writer',
|
||||||
'Etcher.notifier',
|
'Etcher.notifier',
|
||||||
@ -62,7 +61,8 @@ const app = angular.module('Etcher', [
|
|||||||
'Etcher.Components.DriveSelector',
|
'Etcher.Components.DriveSelector',
|
||||||
|
|
||||||
// Pages
|
// Pages
|
||||||
'Etcher.Pages.Finish'
|
'Etcher.Pages.Finish',
|
||||||
|
'Etcher.Pages.Settings'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
app.config(function($stateProvider, $urlRouterProvider) {
|
app.config(function($stateProvider, $urlRouterProvider) {
|
||||||
@ -73,11 +73,6 @@ app.config(function($stateProvider, $urlRouterProvider) {
|
|||||||
url: '/main',
|
url: '/main',
|
||||||
controller: 'AppController as app',
|
controller: 'AppController as app',
|
||||||
templateUrl: './partials/main.html'
|
templateUrl: './partials/main.html'
|
||||||
})
|
|
||||||
.state('settings', {
|
|
||||||
url: '/settings',
|
|
||||||
controller: 'SettingsController as settings',
|
|
||||||
templateUrl: './partials/settings.html'
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -31,9 +31,10 @@ window.MIXPANEL_CUSTOM_LIB_URL = '../bower_components/mixpanel/mixpanel.js';
|
|||||||
|
|
||||||
require('../../../bower_components/mixpanel/mixpanel-jslib-snippet.js');
|
require('../../../bower_components/mixpanel/mixpanel-jslib-snippet.js');
|
||||||
require('../../../bower_components/angular-mixpanel/src/angular-mixpanel');
|
require('../../../bower_components/angular-mixpanel/src/angular-mixpanel');
|
||||||
|
require('../pages/settings/settings');
|
||||||
const analytics = angular.module('Etcher.analytics', [
|
const analytics = angular.module('Etcher.analytics', [
|
||||||
'analytics.mixpanel',
|
'analytics.mixpanel',
|
||||||
'Etcher.settings'
|
'Etcher.Pages.Settings'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
analytics.config(function($mixpanelProvider) {
|
analytics.config(function($mixpanelProvider) {
|
||||||
|
@ -29,10 +29,10 @@ if (window.mocha) {
|
|||||||
var writer = electron.remote.require('./src/writer');
|
var writer = electron.remote.require('./src/writer');
|
||||||
}
|
}
|
||||||
|
|
||||||
require('./settings');
|
require('../pages/settings/settings');
|
||||||
require('./notifier');
|
require('./notifier');
|
||||||
const imageWriter = angular.module('Etcher.image-writer', [
|
const imageWriter = angular.module('Etcher.image-writer', [
|
||||||
'Etcher.settings',
|
'Etcher.Pages.Settings',
|
||||||
'Etcher.notifier'
|
'Etcher.notifier'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -30,15 +30,15 @@ const angular = require('angular');
|
|||||||
require('angular-ui-router');
|
require('angular-ui-router');
|
||||||
require('../../modules/selection-state');
|
require('../../modules/selection-state');
|
||||||
require('../../modules/image-writer');
|
require('../../modules/image-writer');
|
||||||
require('../../modules/settings');
|
|
||||||
require('../../modules/analytics');
|
require('../../modules/analytics');
|
||||||
|
require('../settings/settings');
|
||||||
|
|
||||||
const FinishPage = angular.module('Etcher.Pages.Finish', [
|
const FinishPage = angular.module('Etcher.Pages.Finish', [
|
||||||
'ui.router',
|
'ui.router',
|
||||||
'Etcher.selection-state',
|
'Etcher.selection-state',
|
||||||
'Etcher.image-writer',
|
'Etcher.image-writer',
|
||||||
'Etcher.settings',
|
'Etcher.analytics',
|
||||||
'Etcher.analytics'
|
'Etcher.Pages.Settings'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
FinishPage.controller('FinishController', require('./controllers/finish'));
|
FinishPage.controller('FinishController', require('./controllers/finish'));
|
||||||
|
28
lib/browser/pages/settings/controllers/settings.js
Normal file
28
lib/browser/pages/settings/controllers/settings.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Resin.io
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function(SettingsService) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Settings data
|
||||||
|
* @type Object
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
this.storage = SettingsService.data;
|
||||||
|
|
||||||
|
};
|
@ -16,18 +16,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/**
|
module.exports = function($localStorage) {
|
||||||
* @module Etcher.settings
|
|
||||||
*/
|
|
||||||
|
|
||||||
const angular = require('angular');
|
|
||||||
|
|
||||||
require('ngstorage');
|
|
||||||
const settings = angular.module('Etcher.settings', [
|
|
||||||
'ngStorage'
|
|
||||||
]);
|
|
||||||
|
|
||||||
settings.service('SettingsService', function($localStorage) {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Settings data
|
* @summary Settings data
|
||||||
@ -39,15 +28,4 @@ settings.service('SettingsService', function($localStorage) {
|
|||||||
unmountOnSuccess: true
|
unmountOnSuccess: true
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
};
|
||||||
|
|
||||||
settings.controller('SettingsController', function(SettingsService) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @summary Settings data
|
|
||||||
* @type Object
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
this.storage = SettingsService.data;
|
|
||||||
|
|
||||||
});
|
|
42
lib/browser/pages/settings/settings.js
Normal file
42
lib/browser/pages/settings/settings.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Resin.io
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @module Etcher.Pages.Settings
|
||||||
|
*/
|
||||||
|
|
||||||
|
const angular = require('angular');
|
||||||
|
require('angular-ui-router');
|
||||||
|
require('ngstorage');
|
||||||
|
|
||||||
|
const SettingsPage = angular.module('Etcher.Pages.Settings', [
|
||||||
|
'ui.router',
|
||||||
|
'ngStorage'
|
||||||
|
]);
|
||||||
|
|
||||||
|
SettingsPage.controller('SettingsController', require('./controllers/settings'));
|
||||||
|
SettingsPage.service('SettingsService', require('./services/settings'));
|
||||||
|
|
||||||
|
SettingsPage.config(function($stateProvider) {
|
||||||
|
$stateProvider
|
||||||
|
.state('settings', {
|
||||||
|
url: '/settings',
|
||||||
|
controller: 'SettingsController as settings',
|
||||||
|
templateUrl: './browser/pages/settings/templates/settings.tpl.html'
|
||||||
|
});
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user