mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
refactor: move most models to lib/shared/ (#1596)
Now that the Redux store is no longer front-end dependent, we can move most of the models to lib/shared. Currently, lib/shared is a mess, and contains all sorts of functionality, however moving things out of the GUI is the first step. Once we have everything decoupled, we can organise all the code we have there. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
This commit is contained in:
parent
3a42331875
commit
4122e0bf1d
@ -35,13 +35,13 @@ const s3Packages = require('../shared/s3-packages');
|
||||
const release = require('../shared/release');
|
||||
const store = require('../shared/store');
|
||||
const packageJSON = require('../../package.json');
|
||||
const flashState = require('./models/flash-state');
|
||||
const flashState = require('../shared/models/flash-state');
|
||||
const settings = require('./models/settings');
|
||||
const windowProgress = require('./os/window-progress');
|
||||
const analytics = require('./modules/analytics');
|
||||
const updateNotifier = require('./components/update-notifier');
|
||||
const availableDrives = require('./models/available-drives');
|
||||
const selectionState = require('./models/selection-state');
|
||||
const availableDrives = require('../shared/models/available-drives');
|
||||
const selectionState = require('../shared/models/selection-state');
|
||||
const driveScanner = require('./modules/drive-scanner');
|
||||
const osDialog = require('./os/dialog');
|
||||
const exceptionReporter = require('./modules/exception-reporter');
|
||||
|
@ -21,8 +21,8 @@ const _ = require('lodash');
|
||||
const messages = require('../../../../shared/messages');
|
||||
const constraints = require('../../../../shared/drive-constraints');
|
||||
const analytics = require('../../../modules/analytics');
|
||||
const availableDrives = require('../../../models/available-drives');
|
||||
const selectionState = require('../../../models/selection-state');
|
||||
const availableDrives = require('../../../../shared/models/available-drives');
|
||||
const selectionState = require('../../../../shared/models/selection-state');
|
||||
|
||||
module.exports = function(
|
||||
$q,
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const flashState = require('../../../models/flash-state');
|
||||
const selectionState = require('../../../models/selection-state');
|
||||
const flashState = require('../../../../shared/models/flash-state');
|
||||
const selectionState = require('../../../../shared/models/selection-state');
|
||||
const analytics = require('../../../modules/analytics');
|
||||
|
||||
module.exports = function(WarningModalService) {
|
||||
|
@ -24,7 +24,7 @@ const angular = require('angular');
|
||||
const _ = require('lodash');
|
||||
const childWriter = require('../../child-writer');
|
||||
const settings = require('../models/settings');
|
||||
const flashState = require('../models/flash-state');
|
||||
const flashState = require('../../shared/models/flash-state');
|
||||
const windowProgress = require('../os/window-progress');
|
||||
const analytics = require('../modules/analytics');
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
'use strict';
|
||||
|
||||
const settings = require('../../../models/settings');
|
||||
const flashState = require('../../../models/flash-state');
|
||||
const selectionState = require('../../../models/selection-state');
|
||||
const flashState = require('../../../../shared/models/flash-state');
|
||||
const selectionState = require('../../../../shared/models/selection-state');
|
||||
const analytics = require('../../../modules/analytics');
|
||||
|
||||
module.exports = function($state) {
|
||||
|
@ -17,7 +17,7 @@
|
||||
'use strict';
|
||||
|
||||
const settings = require('../../../models/settings');
|
||||
const selectionState = require('../../../models/selection-state');
|
||||
const selectionState = require('../../../../shared/models/selection-state');
|
||||
const analytics = require('../../../modules/analytics');
|
||||
const exceptionReporter = require('../../../modules/exception-reporter');
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
const messages = require('../../../../shared/messages');
|
||||
const settings = require('../../../models/settings');
|
||||
const flashState = require('../../../models/flash-state');
|
||||
const flashState = require('../../../../shared/models/flash-state');
|
||||
const driveScanner = require('../../../modules/drive-scanner');
|
||||
const utils = require('../../../../shared/utils');
|
||||
const notification = require('../../../os/notification');
|
||||
|
@ -24,7 +24,7 @@ const errors = require('../../../../shared/errors');
|
||||
const imageStream = require('../../../../image-stream');
|
||||
const supportedFormats = require('../../../../shared/supported-formats');
|
||||
const analytics = require('../../../modules/analytics');
|
||||
const selectionState = require('../../../models/selection-state');
|
||||
const selectionState = require('../../../../shared/models/selection-state');
|
||||
const osDialog = require('../../../os/dialog');
|
||||
const exceptionReporter = require('../../../modules/exception-reporter');
|
||||
|
||||
|
@ -17,11 +17,11 @@
|
||||
'use strict';
|
||||
|
||||
const settings = require('../../../models/settings');
|
||||
const flashState = require('../../../models/flash-state');
|
||||
const flashState = require('../../../../shared/models/flash-state');
|
||||
const analytics = require('../../../modules/analytics');
|
||||
const exceptionReporter = require('../../../modules/exception-reporter');
|
||||
const availableDrives = require('../../../models/available-drives');
|
||||
const selectionState = require('../../../models/selection-state');
|
||||
const availableDrives = require('../../../../shared/models/available-drives');
|
||||
const selectionState = require('../../../../shared/models/selection-state');
|
||||
|
||||
module.exports = function(
|
||||
TooltipModalService,
|
||||
|
@ -17,7 +17,7 @@
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const store = require('../../shared/store');
|
||||
const store = require('../store');
|
||||
|
||||
/**
|
||||
* @summary Check if there are available drives
|
@ -16,13 +16,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @module Etcher.Models.FlashState
|
||||
*/
|
||||
|
||||
const _ = require('lodash');
|
||||
const store = require('../../shared/store');
|
||||
const units = require('../../shared/units');
|
||||
const store = require('../store');
|
||||
const units = require('../units');
|
||||
|
||||
/**
|
||||
* @summary Reset flash state
|
@ -17,7 +17,7 @@
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const store = require('../../shared/store');
|
||||
const store = require('../store');
|
||||
const availableDrives = require('./available-drives');
|
||||
|
||||
/**
|
@ -2,7 +2,7 @@
|
||||
|
||||
const m = require('mochainon');
|
||||
const angular = require('angular');
|
||||
const flashState = require('../../../lib/gui/models/flash-state');
|
||||
const flashState = require('../../../lib/shared/models/flash-state');
|
||||
require('angular-mocks');
|
||||
|
||||
describe('Browser: ImageWriter', function() {
|
||||
|
@ -6,9 +6,9 @@ const path = require('path');
|
||||
const supportedFormats = require('../../../lib/shared/supported-formats');
|
||||
const angular = require('angular');
|
||||
const settings = require('../../../lib/gui/models/settings');
|
||||
const flashState = require('../../../lib/gui/models/flash-state');
|
||||
const availableDrives = require('../../../lib/gui/models/available-drives');
|
||||
const selectionState = require('../../../lib/gui/models/selection-state');
|
||||
const flashState = require('../../../lib/shared/models/flash-state');
|
||||
const availableDrives = require('../../../lib/shared/models/available-drives');
|
||||
const selectionState = require('../../../lib/shared/models/selection-state');
|
||||
require('angular-mocks');
|
||||
|
||||
describe('Browser: MainPage', function() {
|
||||
|
@ -1,11 +1,27 @@
|
||||
/*
|
||||
* 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';
|
||||
|
||||
const m = require('mochainon');
|
||||
const path = require('path');
|
||||
const availableDrives = require('../../../lib/gui/models/available-drives');
|
||||
const selectionState = require('../../../lib/gui/models/selection-state');
|
||||
const availableDrives = require('../../../lib/shared/models/available-drives');
|
||||
const selectionState = require('../../../lib/shared/models/selection-state');
|
||||
|
||||
describe('Browser: availableDrives', function() {
|
||||
describe('Model: availableDrives', function() {
|
||||
|
||||
describe('availableDrives', function() {
|
||||
|
@ -1,9 +1,25 @@
|
||||
/*
|
||||
* 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';
|
||||
|
||||
const m = require('mochainon');
|
||||
const flashState = require('../../../lib/gui/models/flash-state');
|
||||
const flashState = require('../../../lib/shared/models/flash-state');
|
||||
|
||||
describe('Browser: flashState', function() {
|
||||
describe('Model: flashState', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
flashState.resetState();
|
@ -1,12 +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';
|
||||
|
||||
const m = require('mochainon');
|
||||
const _ = require('lodash');
|
||||
const path = require('path');
|
||||
const availableDrives = require('../../../lib/gui/models/available-drives');
|
||||
const selectionState = require('../../../lib/gui/models/selection-state');
|
||||
const availableDrives = require('../../../lib/shared/models/available-drives');
|
||||
const selectionState = require('../../../lib/shared/models/selection-state');
|
||||
|
||||
describe('Browser: selectionState', function() {
|
||||
describe('Model: selectionState', function() {
|
||||
|
||||
describe('given a clean state', function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user