mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 11:16:39 +00:00
refactor(gui): Move shared models to app/models
This commit is contained in:
parent
6232cc7d49
commit
687e0b563b
@ -36,13 +36,13 @@ const release = require('../../shared/release')
|
|||||||
const store = require('./models/store')
|
const store = require('./models/store')
|
||||||
const errors = require('../../shared/errors')
|
const errors = require('../../shared/errors')
|
||||||
const packageJSON = require('../../../package.json')
|
const packageJSON = require('../../../package.json')
|
||||||
const flashState = require('../../shared/models/flash-state')
|
const flashState = require('./models/flash-state')
|
||||||
const settings = require('./models/settings')
|
const settings = require('./models/settings')
|
||||||
const windowProgress = require('./os/window-progress')
|
const windowProgress = require('./os/window-progress')
|
||||||
const analytics = require('./modules/analytics')
|
const analytics = require('./modules/analytics')
|
||||||
const updateNotifier = require('./components/update-notifier')
|
const updateNotifier = require('./components/update-notifier')
|
||||||
const availableDrives = require('../../shared/models/available-drives')
|
const availableDrives = require('./models/available-drives')
|
||||||
const selectionState = require('../../shared/models/selection-state')
|
const selectionState = require('./models/selection-state')
|
||||||
const driveScanner = require('./modules/drive-scanner')
|
const driveScanner = require('./modules/drive-scanner')
|
||||||
const osDialog = require('./os/dialog')
|
const osDialog = require('./os/dialog')
|
||||||
const exceptionReporter = require('./modules/exception-reporter')
|
const exceptionReporter = require('./modules/exception-reporter')
|
||||||
|
@ -21,8 +21,8 @@ const _ = require('lodash')
|
|||||||
const Bluebird = require('bluebird')
|
const Bluebird = require('bluebird')
|
||||||
const constraints = require('../../../../../shared/drive-constraints')
|
const constraints = require('../../../../../shared/drive-constraints')
|
||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
const availableDrives = require('../../../../../shared/models/available-drives')
|
const availableDrives = require('../../../models/available-drives')
|
||||||
const selectionState = require('../../../../../shared/models/selection-state')
|
const selectionState = require('../../../models/selection-state')
|
||||||
const utils = require('../../../../../shared/utils')
|
const utils = require('../../../../../shared/utils')
|
||||||
|
|
||||||
module.exports = function (
|
module.exports = function (
|
||||||
|
@ -37,7 +37,7 @@ const Storage = require('../../../models/storage')
|
|||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
const middleEllipsis = require('../../../utils/middle-ellipsis')
|
const middleEllipsis = require('../../../utils/middle-ellipsis')
|
||||||
const files = require('../../../../../shared/files')
|
const files = require('../../../../../shared/files')
|
||||||
const selectionState = require('../../../../../shared/models/selection-state')
|
const selectionState = require('../../../models/selection-state')
|
||||||
const imageStream = require('../../../../../sdk/image-stream')
|
const imageStream = require('../../../../../sdk/image-stream')
|
||||||
const errors = require('../../../../../shared/errors')
|
const errors = require('../../../../../shared/errors')
|
||||||
const messages = require('../../../../../shared/messages')
|
const messages = require('../../../../../shared/messages')
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const flashState = require('../../../../../shared/models/flash-state')
|
const flashState = require('../../../models/flash-state')
|
||||||
const selectionState = require('../../../../../shared/models/selection-state')
|
const selectionState = require('../../../models/selection-state')
|
||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
|
|
||||||
module.exports = function (WarningModalService) {
|
module.exports = function (WarningModalService) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const store = require('../../gui/app/models/store')
|
const store = require('./store')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Check if there are available drives
|
* @summary Check if there are available drives
|
@ -17,8 +17,8 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const store = require('../../gui/app/models/store')
|
const store = require('./store')
|
||||||
const units = require('../units')
|
const units = require('../../../shared/units')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Reset flash state
|
* @summary Reset flash state
|
@ -17,7 +17,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const store = require('../../gui/app/models/store')
|
const store = require('./store')
|
||||||
const availableDrives = require('./available-drives')
|
const availableDrives = require('./available-drives')
|
||||||
|
|
||||||
/**
|
/**
|
@ -24,14 +24,14 @@ const ipc = require('node-ipc')
|
|||||||
const isRunningInAsar = require('electron-is-running-in-asar')
|
const isRunningInAsar = require('electron-is-running-in-asar')
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const settings = require('../models/settings')
|
const settings = require('../models/settings')
|
||||||
const flashState = require('../../../shared/models/flash-state')
|
const flashState = require('../models/flash-state')
|
||||||
const errors = require('../../../shared/errors')
|
const errors = require('../../../shared/errors')
|
||||||
const permissions = require('../../../shared/permissions')
|
const permissions = require('../../../shared/permissions')
|
||||||
const windowProgress = require('../os/window-progress')
|
const windowProgress = require('../os/window-progress')
|
||||||
const analytics = require('../modules/analytics')
|
const analytics = require('../modules/analytics')
|
||||||
const updateLock = require('./update-lock')
|
const updateLock = require('./update-lock')
|
||||||
const packageJSON = require('../../../../package.json')
|
const packageJSON = require('../../../../package.json')
|
||||||
const selectionState = require('../../../shared/models/selection-state')
|
const selectionState = require('../models/selection-state')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Number of threads per CPU to allocate to the UV_THREADPOOL
|
* @summary Number of threads per CPU to allocate to the UV_THREADPOOL
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const settings = require('../../../models/settings')
|
const settings = require('../../../models/settings')
|
||||||
const flashState = require('../../../../../shared/models/flash-state')
|
const flashState = require('../../../models/flash-state')
|
||||||
const selectionState = require('../../../../../shared/models/selection-state')
|
const selectionState = require('../../../models/selection-state')
|
||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
const updateLock = require('../../../modules/update-lock')
|
const updateLock = require('../../../modules/update-lock')
|
||||||
const messages = require('../../../../../shared/messages')
|
const messages = require('../../../../../shared/messages')
|
||||||
|
@ -20,7 +20,7 @@ const _ = require('lodash')
|
|||||||
const angular = require('angular')
|
const angular = require('angular')
|
||||||
const prettyBytes = require('pretty-bytes')
|
const prettyBytes = require('pretty-bytes')
|
||||||
const settings = require('../../../models/settings')
|
const settings = require('../../../models/settings')
|
||||||
const selectionState = require('../../../../../shared/models/selection-state')
|
const selectionState = require('../../../models/selection-state')
|
||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
const exceptionReporter = require('../../../modules/exception-reporter')
|
const exceptionReporter = require('../../../modules/exception-reporter')
|
||||||
const utils = require('../../../../../shared/utils')
|
const utils = require('../../../../../shared/utils')
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const messages = require('../../../../../shared/messages')
|
const messages = require('../../../../../shared/messages')
|
||||||
const flashState = require('../../../../../shared/models/flash-state')
|
const flashState = require('../../../models/flash-state')
|
||||||
const driveScanner = require('../../../modules/drive-scanner')
|
const driveScanner = require('../../../modules/drive-scanner')
|
||||||
const progressStatus = require('../../../modules/progress-status')
|
const progressStatus = require('../../../modules/progress-status')
|
||||||
const notification = require('../../../os/notification')
|
const notification = require('../../../os/notification')
|
||||||
@ -27,7 +27,8 @@ const imageWriter = require('../../../modules/image-writer')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const store = require('../../../models/store')
|
const store = require('../../../models/store')
|
||||||
const constraints = require('../../../../../shared/drive-constraints')
|
const constraints = require('../../../../../shared/drive-constraints')
|
||||||
const availableDrives = require('../../../../../shared/models/available-drives')
|
const availableDrives = require('../../../models/available-drives')
|
||||||
|
const debug = require('debug')('etcher:controller:flash')
|
||||||
|
|
||||||
module.exports = function (
|
module.exports = function (
|
||||||
$q,
|
$q,
|
||||||
@ -139,7 +140,10 @@ module.exports = function (
|
|||||||
|
|
||||||
// Trigger Angular digests along with store updates, as the flash state
|
// Trigger Angular digests along with store updates, as the flash state
|
||||||
// updates. Without this there is essentially no progress to watch.
|
// updates. Without this there is essentially no progress to watch.
|
||||||
const unsubscribe = store.subscribe($timeout)
|
const unsubscribe = store.subscribe(() => {
|
||||||
|
debug('store.onChange')
|
||||||
|
$timeout()
|
||||||
|
})
|
||||||
|
|
||||||
const iconPath = '../../../assets/icon.png'
|
const iconPath = '../../../assets/icon.png'
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ const errors = require('../../../../../shared/errors')
|
|||||||
const imageStream = require('../../../../../sdk/image-stream')
|
const imageStream = require('../../../../../sdk/image-stream')
|
||||||
const supportedFormats = require('../../../../../shared/supported-formats')
|
const supportedFormats = require('../../../../../shared/supported-formats')
|
||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
const selectionState = require('../../../../../shared/models/selection-state')
|
const selectionState = require('../../../models/selection-state')
|
||||||
const osDialog = require('../../../os/dialog')
|
const osDialog = require('../../../os/dialog')
|
||||||
const exceptionReporter = require('../../../modules/exception-reporter')
|
const exceptionReporter = require('../../../modules/exception-reporter')
|
||||||
|
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const settings = require('../../../models/settings')
|
const settings = require('../../../models/settings')
|
||||||
const flashState = require('../../../../../shared/models/flash-state')
|
const flashState = require('../../../models/flash-state')
|
||||||
const analytics = require('../../../modules/analytics')
|
const analytics = require('../../../modules/analytics')
|
||||||
const exceptionReporter = require('../../../modules/exception-reporter')
|
const exceptionReporter = require('../../../modules/exception-reporter')
|
||||||
const availableDrives = require('../../../../../shared/models/available-drives')
|
const availableDrives = require('../../../models/available-drives')
|
||||||
const selectionState = require('../../../../../shared/models/selection-state')
|
const selectionState = require('../../../models/selection-state')
|
||||||
const driveConstraints = require('../../../../../shared/drive-constraints')
|
const driveConstraints = require('../../../../../shared/drive-constraints')
|
||||||
const messages = require('../../../../../shared/messages')
|
const messages = require('../../../../../shared/messages')
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ const m = require('mochainon')
|
|||||||
const ipc = require('node-ipc')
|
const ipc = require('node-ipc')
|
||||||
const angular = require('angular')
|
const angular = require('angular')
|
||||||
const Bluebird = require('bluebird')
|
const Bluebird = require('bluebird')
|
||||||
const flashState = require('../../../lib/shared/models/flash-state')
|
const flashState = require('../../../lib/gui/app/models/flash-state')
|
||||||
const imageWriter = require('../../../lib/gui/app/modules/image-writer')
|
const imageWriter = require('../../../lib/gui/app/modules/image-writer')
|
||||||
require('angular-mocks')
|
require('angular-mocks')
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@ const fs = require('fs')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const supportedFormats = require('../../../lib/shared/supported-formats')
|
const supportedFormats = require('../../../lib/shared/supported-formats')
|
||||||
const angular = require('angular')
|
const angular = require('angular')
|
||||||
const flashState = require('../../../lib/shared/models/flash-state')
|
const flashState = require('../../../lib/gui/app/models/flash-state')
|
||||||
const availableDrives = require('../../../lib/shared/models/available-drives')
|
const availableDrives = require('../../../lib/gui/app/models/available-drives')
|
||||||
const selectionState = require('../../../lib/shared/models/selection-state')
|
const selectionState = require('../../../lib/gui/app/models/selection-state')
|
||||||
require('angular-mocks')
|
require('angular-mocks')
|
||||||
|
|
||||||
// Mock HTML requires by reading from the file-system
|
// Mock HTML requires by reading from the file-system
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
const m = require('mochainon')
|
const m = require('mochainon')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const availableDrives = require('../../../lib/shared/models/available-drives')
|
const availableDrives = require('../../../lib/gui/app/available-drives')
|
||||||
const selectionState = require('../../../lib/shared/models/selection-state')
|
const selectionState = require('../../../lib/gui/app/selection-state')
|
||||||
const constraints = require('../../../lib/shared/drive-constraints')
|
const constraints = require('../../../lib/shared/drive-constraints')
|
||||||
|
|
||||||
describe('Model: availableDrives', function () {
|
describe('Model: availableDrives', function () {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
const m = require('mochainon')
|
const m = require('mochainon')
|
||||||
const flashState = require('../../../lib/shared/models/flash-state')
|
const flashState = require('../../../lib/gui/app/models/flash-state')
|
||||||
|
|
||||||
describe('Model: flashState', function () {
|
describe('Model: flashState', function () {
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
const m = require('mochainon')
|
const m = require('mochainon')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const availableDrives = require('../../../lib/shared/models/available-drives')
|
const availableDrives = require('../../../lib/gui/app/available-drives')
|
||||||
const selectionState = require('../../../lib/shared/models/selection-state')
|
const selectionState = require('../../../lib/gui/app/selection-state')
|
||||||
|
|
||||||
describe('Model: selectionState', function () {
|
describe('Model: selectionState', function () {
|
||||||
describe('given a clean state', function () {
|
describe('given a clean state', function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user