@@ -18,7 +18,8 @@ export const systemService = { | |||||
detectTimezone, | detectTimezone, | ||||
detectLocale, | detectLocale, | ||||
getAppLinks, | getAppLinks, | ||||
upgradeJar | |||||
checkForUpgrade, | |||||
upgrade | |||||
}; | }; | ||||
function loadIsActivated () { | function loadIsActivated () { | ||||
@@ -118,8 +119,15 @@ function getAppLinks (locale) { | |||||
.then(links => { return links; }); | .then(links => { return links; }); | ||||
} | } | ||||
function upgradeJar() { | |||||
const requestOptions =util.postWithAuth(); | |||||
function checkForUpgrade() { | |||||
const requestOptions = util.getWithAuth(); | |||||
return fetch(`${config.apiUrl}/me/upgrade`, requestOptions) | |||||
.then(util.handleBasicResponse) | |||||
.then(ok => { return true; }); | |||||
} | |||||
function upgrade() { | |||||
const requestOptions = util.postWithAuth(); | |||||
return fetch(`${config.apiUrl}/me/upgrade`, requestOptions) | return fetch(`${config.apiUrl}/me/upgrade`, requestOptions) | ||||
.then(util.handleBasicResponse) | .then(util.handleBasicResponse) | ||||
.then(configs => { return configs; }); | .then(configs => { return configs; }); | ||||
@@ -9,74 +9,61 @@ import { router } from '~/_router'; | |||||
import { account } from './account.module'; | import { account } from './account.module'; | ||||
const state = { | const state = { | ||||
configs: { | |||||
networkUuid: null, | |||||
allowRegistration: false, | |||||
paymentsEnabled: false, | |||||
sageLauncher: false, | |||||
bubbleNode: null, | |||||
entityClasses: [], | |||||
locales: ['en_US'], | |||||
cloudConfigs: {}, | |||||
sslPort: null, | |||||
locked: null, | |||||
launchLock: null, | |||||
promoCodePolicy: null, | |||||
requireSendMetrics: null, | |||||
awaitingRestore: false, | |||||
restoreInProgress: false, | |||||
support: {}, | |||||
securityLevels: null, | |||||
jarVersion: null, | |||||
jarUpgradeAvailable: null, | |||||
}, | |||||
entityConfigs: {}, | |||||
searchResults: [], | |||||
status: { | |||||
activating: false, | |||||
searching: false, | |||||
creatingEntity: false, | |||||
modelSetupInProgress: false, | |||||
upgrading: false, | |||||
}, | |||||
activated: null, | |||||
error: null, | |||||
messages: { | |||||
durationToMillis: function(count, units) { | |||||
if (typeof count === 'undefined' || count === null || count === '') | |||||
return null; | |||||
return ( | |||||
parseInt(count) * | |||||
parseInt(state.messages['time_duration_' + units + '_factor']) | |||||
); | |||||
configs: { | |||||
networkUuid: null, | |||||
allowRegistration: false, | |||||
paymentsEnabled: false, | |||||
sageLauncher: false, | |||||
bubbleNode: null, | |||||
entityClasses: [], | |||||
locales: ['en_US'], | |||||
cloudConfigs: {}, | |||||
sslPort: null, | |||||
locked: null, | |||||
launchLock: null, | |||||
promoCodePolicy: null, | |||||
requireSendMetrics: null, | |||||
awaitingRestore: false, | |||||
restoreInProgress: false, | |||||
support: {}, | |||||
securityLevels: null, | |||||
jarVersion: null, | |||||
jarUpgradeAvailable: null | |||||
}, | }, | ||||
millisToDuration: function(ms) { | |||||
const durations = state.timeDurationOptionsReversed; | |||||
for (let i = 0; i < durations.length; i++) { | |||||
const durationMillis = parseInt( | |||||
state.messages['time_duration_' + durations[i] + '_factor'] | |||||
); | |||||
if ( | |||||
ms >= durationMillis && | |||||
(ms % durationMillis === 0 || i === durations.length - 1) | |||||
) { | |||||
return { count: parseInt(ms) / durationMillis, units: durations[i] }; | |||||
entityConfigs: {}, | |||||
searchResults: [], | |||||
status: { activating: false, searching: false, creatingEntity: false, modelSetupInProgress: false }, | |||||
activated: null, | |||||
error: null, | |||||
messages: { | |||||
durationToMillis: function(count, units) { | |||||
if (typeof count === 'undefined' || count === null || count === '') return null; | |||||
return parseInt(count) * parseInt(state.messages['time_duration_'+units+'_factor']); | |||||
}, | |||||
millisToDuration: function (ms) { | |||||
const durations = state.timeDurationOptionsReversed; | |||||
for (let i=0; i<durations.length; i++) { | |||||
const durationMillis = parseInt(state.messages['time_duration_'+durations[i]+'_factor']); | |||||
if (ms >= durationMillis && ((ms % durationMillis) === 0 || i === durations.length-1)) { | |||||
return {count: parseInt(ms) / durationMillis, units: durations[i]}; | |||||
} | |||||
} | |||||
return {count: parseInt(ms), units: ''}; | |||||
} | } | ||||
} | |||||
return { count: parseInt(ms), units: '' }; | |||||
}, | }, | ||||
}, | |||||
messageGroupsLoaded: [], | |||||
countries: [], | |||||
locales: [], | |||||
timezones: [], | |||||
detectedTimezone: null, | |||||
detectedLocale: null, | |||||
accountDeletionOptions: [], | |||||
timeDurationOptions: [], | |||||
timeDurationOptionsReversed: [], | |||||
contactTypes: [], | |||||
appLinks: null, | |||||
messageGroupsLoaded: [], | |||||
countries: [], | |||||
locales: [], | |||||
timezones: [], | |||||
detectedTimezone: null, | |||||
detectedLocale: null, | |||||
accountDeletionOptions: [], | |||||
timeDurationOptions: [], | |||||
timeDurationOptionsReversed: [], | |||||
contactTypes: [], | |||||
appLinks: null, | |||||
upgradeCheck: null, | |||||
upgrading: null | |||||
}; | }; | ||||
const actions = { | const actions = { | ||||
@@ -100,105 +87,104 @@ const actions = { | |||||
); | ); | ||||
}, | }, | ||||
loadSystemConfigs({ commit }) { | |||||
commit('loadSystemConfigsRequest'); | |||||
systemService | |||||
.loadSystemConfigs() | |||||
.then( | |||||
(configs) => commit('loadSystemConfigsSuccess', configs), | |||||
(error) => commit('loadSystemConfigsFailure', error) | |||||
); | |||||
}, | |||||
loadEntityConfigs({ commit }) { | |||||
commit('loadEntityConfigsRequest'); | |||||
systemService | |||||
.loadEntityConfigs() | |||||
.then( | |||||
(configs) => commit('loadEntityConfigsSuccess', configs), | |||||
(error) => commit('loadEntityConfigsFailure', error) | |||||
); | |||||
}, | |||||
search({ commit }, type, query) { | |||||
commit('searchRequest'); | |||||
systemService | |||||
.search(type, query) | |||||
.then( | |||||
(results) => commit('searchSuccess', { type, query, results }), | |||||
(error) => commit('searchFailure', error) | |||||
); | |||||
}, | |||||
createEntity({ commit }, { entityConfig, json, messages, errors }) { | |||||
commit('createEntityRequest'); | |||||
systemService | |||||
.createEntity(entityConfig, json, messages, errors) | |||||
.then( | |||||
(entity) => commit('createEntitySuccess', entity), | |||||
(error) => commit('createEntityFailure', error) | |||||
); | |||||
}, | |||||
modelSetup({ commit }, { file, messages, errors }) { | |||||
commit('modelSetupRequest'); | |||||
systemService | |||||
.modelSetup(file, messages, errors) | |||||
.then( | |||||
(ok) => commit('modelSetupSuccess'), | |||||
(errors) => commit('modelSetupFailure', errors) | |||||
); | |||||
}, | |||||
loadMessages({ commit }, group, locale) { | |||||
commit('loadMessagesRequest'); | |||||
systemService | |||||
.loadMessages(group, locale) | |||||
.then( | |||||
(messages) => commit('loadMessagesSuccess', { group, messages }), | |||||
(error) => commit('loadMessagesFailure', error) | |||||
); | |||||
}, | |||||
loadTimezones({ commit }) { | |||||
commit('loadTimezonesRequest'); | |||||
systemService | |||||
.loadTimezones() | |||||
.then( | |||||
(timezones) => commit('loadTimezonesSuccess', timezones), | |||||
(error) => commit('loadTimezonesFailure', error) | |||||
); | |||||
}, | |||||
detectTimezone({ commit }) { | |||||
commit('detectTimezoneRequest'); | |||||
systemService | |||||
.detectTimezone() | |||||
.then( | |||||
(timezone) => commit('detectTimezoneSuccess', timezone), | |||||
(error) => commit('detectTimezoneFailure', error) | |||||
); | |||||
}, | |||||
detectLocale({ commit }) { | |||||
commit('detectLocaleRequest'); | |||||
systemService | |||||
.detectLocale() | |||||
.then( | |||||
(locales) => commit('detectLocaleSuccess', locales), | |||||
(error) => commit('detectLocaleFailure', error) | |||||
); | |||||
}, | |||||
getAppLinks({ commit }, locale) { | |||||
commit('getAppLinksRequest'); | |||||
systemService | |||||
.getAppLinks(locale) | |||||
.then( | |||||
(links) => commit('getAppLinksSuccess', links), | |||||
(error) => commit('getAppLinksFailure', error) | |||||
); | |||||
}, | |||||
upgradeJar({ commit }) { | |||||
commit('upgradeJarRequest'); | |||||
systemService | |||||
.upgradeJar(locale) | |||||
.then( | |||||
(configs) => commit('upgradeJarSuccess', configs), | |||||
(error) => commit('upgradeJarFailure', error) | |||||
); | |||||
}, | |||||
loadSystemConfigs({ commit }) { | |||||
commit('loadSystemConfigsRequest'); | |||||
systemService.loadSystemConfigs() | |||||
.then( | |||||
configs => commit('loadSystemConfigsSuccess', configs), | |||||
error => commit('loadSystemConfigsFailure', error) | |||||
); | |||||
}, | |||||
loadEntityConfigs({ commit }) { | |||||
commit('loadEntityConfigsRequest'); | |||||
systemService.loadEntityConfigs() | |||||
.then( | |||||
configs => commit('loadEntityConfigsSuccess', configs), | |||||
error => commit('loadEntityConfigsFailure', error) | |||||
); | |||||
}, | |||||
search({ commit }, type, query) { | |||||
commit('searchRequest'); | |||||
systemService.search(type, query) | |||||
.then( | |||||
results => commit('searchSuccess', {type, query, results}), | |||||
error => commit('searchFailure', error) | |||||
); | |||||
}, | |||||
createEntity({ commit }, {entityConfig, json, messages, errors}) { | |||||
commit('createEntityRequest'); | |||||
systemService.createEntity(entityConfig, json, messages, errors) | |||||
.then( | |||||
entity => commit('createEntitySuccess', entity), | |||||
error => commit('createEntityFailure', error) | |||||
); | |||||
}, | |||||
modelSetup({ commit }, {file, messages, errors}) { | |||||
commit('modelSetupRequest'); | |||||
systemService.modelSetup(file, messages, errors) | |||||
.then( | |||||
ok => commit('modelSetupSuccess'), | |||||
errors => commit('modelSetupFailure', errors) | |||||
); | |||||
}, | |||||
loadMessages({ commit }, group, locale) { | |||||
commit('loadMessagesRequest'); | |||||
systemService.loadMessages(group, locale) | |||||
.then( | |||||
messages => commit('loadMessagesSuccess', {group, messages}), | |||||
error => commit('loadMessagesFailure', error) | |||||
); | |||||
}, | |||||
loadTimezones({ commit }) { | |||||
commit('loadTimezonesRequest'); | |||||
systemService.loadTimezones().then( | |||||
timezones => commit('loadTimezonesSuccess', timezones), | |||||
error => commit('loadTimezonesFailure', error) | |||||
) | |||||
}, | |||||
detectTimezone({ commit }) { | |||||
commit('detectTimezoneRequest'); | |||||
systemService.detectTimezone().then( | |||||
timezone => commit('detectTimezoneSuccess', timezone), | |||||
error => commit('detectTimezoneFailure', error) | |||||
) | |||||
}, | |||||
detectLocale({ commit }) { | |||||
commit('detectLocaleRequest'); | |||||
systemService.detectLocale().then( | |||||
locales => commit('detectLocaleSuccess', locales), | |||||
error => commit('detectLocaleFailure', error) | |||||
) | |||||
}, | |||||
getAppLinks({ commit }, locale) { | |||||
commit('getAppLinksRequest'); | |||||
systemService.getAppLinks(locale).then( | |||||
links => commit('getAppLinksSuccess', links), | |||||
error => commit('getAppLinksFailure', error) | |||||
) | |||||
}, | |||||
checkForUpgrade({ commit }) { | |||||
if (state.upgradeCheck === null) { | |||||
commit('checkForUpgradeRequest'); | |||||
systemService.checkForUpgrade().then( | |||||
configs => commit('checkForUpgradeSuccess', configs), | |||||
error => commit('checkForUpgradeFailure', error) | |||||
); | |||||
} else { | |||||
console.log('checkForUpgrade: already checked ('+state.upgradeCheck+'), not checking again'); | |||||
} | |||||
}, | |||||
upgrade({ commit }) { | |||||
commit('upgradeRequest'); | |||||
systemService.upgrade().then( | |||||
configs => commit('upgradeSuccess', configs), | |||||
error => commit('upgradeFailure', error) | |||||
) | |||||
}, | |||||
upgradeComplete({ commit }) { | |||||
commit('upgradeCompleteRequest'); | |||||
commit('upgradeCompleteSuccess'); | |||||
} | |||||
}; | }; | ||||
const getters = { | const getters = { | ||||
@@ -494,14 +480,32 @@ const mutations = { | |||||
state.error = error; | state.error = error; | ||||
}, | }, | ||||
upgradeJarRequest(state) {}, | |||||
upgradeJarSuccess(state, configs) { | |||||
state.configs = configs; | |||||
state.status = Object.assign(state.status, { upgrading: true }); | |||||
}, | |||||
upgradeJarFailure(state, error) { | |||||
state.error = error; | |||||
}, | |||||
checkForUpgradeRequest(state) {}, | |||||
checkForUpgradeSuccess(state, ok) { | |||||
console.log('checkForUpgradeSuccess: ok'); | |||||
state.upgradeCheck = true; | |||||
}, | |||||
checkForUpgradeFailure(state, error) { | |||||
state.error = error; | |||||
}, | |||||
upgradeRequest(state) {}, | |||||
upgradeSuccess(state, configs) { | |||||
state.configs = configs; | |||||
state.upgrading = true; | |||||
}, | |||||
upgradeFailure(state, error) { | |||||
state.error = error; | |||||
}, | |||||
upgradeCompleteRequest(state) {}, | |||||
upgradeCompleteSuccess(state) { | |||||
state.upgrading = false; | |||||
}, | |||||
upgradeCompleteFailure(state, error) { | |||||
state.upgrading = false; | |||||
state.error = error; | |||||
} | |||||
}; | }; | ||||
export const system = { | export const system = { | ||||
@@ -47,6 +47,26 @@ | |||||
</div> | </div> | ||||
<div v-if="isSelfNetAndRunning"> | <div v-if="isSelfNetAndRunning"> | ||||
<div v-if="user.admin === true && checkingForUpgrade !== null && configs && configs.jarVersion && configs.jarUpgradeAvailable && configs.jarUpgradeAvailable.version"> | |||||
<hr/> | |||||
<h4>{{messages.message_jar_upgrade_available}}</h4> | |||||
<p> | |||||
{{messages.message_jar_current_version}} <b>{{configs.jarVersion}}</b><br/> | |||||
{{messages.message_jar_upgrade_version}} <b>{{configs.jarUpgradeAvailable.version}}</b> | |||||
</p> | |||||
<button v-if="!upgrading" :disabled="upgrading" @click="doUpgrade()">{{messages.button_label_jar_upgrade}}</button> | |||||
<button v-else-if="upgrading" :disabled="true">{{messages.button_label_jar_upgrading}}</button> | |||||
<p v-if="upgrading">{{messages.message_jar_upgrading}}</p> | |||||
<hr/> | |||||
</div> | |||||
<div v-else-if="user.admin === true && configs && configs.jarVersion"> | |||||
<hr/> | |||||
<h6>{{messages.message_jar_current_version}} <b>{{configs.jarVersion}}</b></h6> | |||||
<p v-if="checkingForUpgrade">{{messages.message_jar_checking_for_upgrade}}</p> | |||||
<hr/> | |||||
</div> | |||||
<button class="btn btn-secondary" @click="requestRestoreKey()" | <button class="btn btn-secondary" @click="requestRestoreKey()" | ||||
:disabled="loading && loading.requestNetworkKeys"> | :disabled="loading && loading.requestNetworkKeys"> | ||||
{{messages.link_network_action_request_keys}} | {{messages.link_network_action_request_keys}} | ||||
@@ -160,7 +180,9 @@ | |||||
stopRefresher: null, | stopRefresher: null, | ||||
restoreKeyCode: null, | restoreKeyCode: null, | ||||
restoreKeyPassword: null, | restoreKeyPassword: null, | ||||
loadingImgSrc: loadingImgSrc | |||||
loadingImgSrc: loadingImgSrc, | |||||
checkingForUpgrade: null, | |||||
upgradeRefresher: null | |||||
}; | }; | ||||
}, | }, | ||||
computed: { | computed: { | ||||
@@ -168,7 +190,7 @@ | |||||
'network', 'newNodeNotification', 'networkStatuses', 'networkNodes', 'networkKeysRequested', | 'network', 'newNodeNotification', 'networkStatuses', 'networkNodes', 'networkKeysRequested', | ||||
'deletedNetworkUuid', 'networkKeys', 'loading', 'restoreKey', 'backups' | 'deletedNetworkUuid', 'networkKeys', 'loading', 'restoreKey', 'backups' | ||||
]), | ]), | ||||
...mapState('system', ['messages', 'configs', 'appLinks']), | |||||
...mapState('system', ['messages', 'configs', 'appLinks', 'upgradeCheck', 'upgrading']), | |||||
showSetupHelp () { | showSetupHelp () { | ||||
return (this.network !== null && this.network.uuid !== this.configs.networkUuid | return (this.network !== null && this.network.uuid !== this.configs.networkUuid | ||||
&& (this.network.state === 'running' || this.network.state === 'starting' | && (this.network.state === 'running' || this.network.state === 'starting' | ||||
@@ -228,7 +250,7 @@ | |||||
'stopNetwork', 'queueBackup', 'restoreNetwork', 'deleteNetwork', 'requestNetworkKeys', | 'stopNetwork', 'queueBackup', 'restoreNetwork', 'deleteNetwork', 'requestNetworkKeys', | ||||
'retrieveNetworkKeys', 'getBackups', 'resetRestoreKey' | 'retrieveNetworkKeys', 'getBackups', 'resetRestoreKey' | ||||
]), | ]), | ||||
...mapActions('system', ['getAppLinks']), | |||||
...mapActions('system', ['getAppLinks', 'loadSystemConfigs', 'checkForUpgrade', 'upgrade']), | |||||
refreshStatus (userId) { | refreshStatus (userId) { | ||||
this.getNetworkById({userId: userId, networkId: this.networkId, messages: this.messages, errors: this.errors}); | this.getNetworkById({userId: userId, networkId: this.networkId, messages: this.messages, errors: this.errors}); | ||||
this.getStatusesByNetworkId({ | this.getStatusesByNetworkId({ | ||||
@@ -329,6 +351,9 @@ | |||||
messages: this.messages, | messages: this.messages, | ||||
errors: this.errors | errors: this.errors | ||||
}); | }); | ||||
}, | |||||
doUpgrade () { | |||||
this.upgrade(); | |||||
} | } | ||||
}, | }, | ||||
created () { | created () { | ||||
@@ -337,6 +362,7 @@ | |||||
this.startStatusRefresher(user); | this.startStatusRefresher(user); | ||||
this.restoreKeyCode = this.$route.query.keys_code; | this.restoreKeyCode = this.$route.query.keys_code; | ||||
this.getAppLinks(user.locale); | this.getAppLinks(user.locale); | ||||
this.loadSystemConfigs(); | |||||
}, | }, | ||||
beforeDestroy () { | beforeDestroy () { | ||||
this.clearRefresherInterval(this.refresher); | this.clearRefresherInterval(this.refresher); | ||||
@@ -380,6 +406,54 @@ | |||||
if (uuid && this.networkUuid && (uuid === this.networkUuid)) { | if (uuid && this.networkUuid && (uuid === this.networkUuid)) { | ||||
this.$router.replace({path: '/bubbles'}); | this.$router.replace({path: '/bubbles'}); | ||||
} | } | ||||
}, | |||||
configs (c) { | |||||
if (c) { | |||||
// console.log('watch.configs received: '+JSON.stringify(c)); | |||||
if (this.user.admin) { | |||||
if (this.upgradeRefresher !== null) { | |||||
this.checkingForUpgrade = false; | |||||
console.log('watch.configs: found c.jarVersion=' + c.jarVersion + ', c.jarUpgradeAvailable=' + JSON.stringify(c.jarUpgradeAvailable)); | |||||
// if there is no longer an upgrade available, then the upgrade succeeded | |||||
if (c.jarUpgradeAvailable === null) { | |||||
console.log('watch.configs: upgraded, reloading...'); | |||||
window.location.reload(); | |||||
// window.clearInterval(this.upgradeRefresher); | |||||
} | |||||
} else if (c.jarVersion && this.checkingForUpgrade === null) { | |||||
this.checkingForUpgrade = true; | |||||
console.log('watch.configs: checking for upgrade...') | |||||
this.checkForUpgrade(); | |||||
} | |||||
} else { | |||||
console.log('watch.configs: user is not admin, not checking for upgrade'); | |||||
} | |||||
} | |||||
}, | |||||
upgrading (u) { | |||||
console.log('watch.upgrading received: '+JSON.stringify(u)); | |||||
if (u) { | |||||
if (u && this.upgradeRefresher === null) { | |||||
console.log('watch.upgrading: starting refresher'); | |||||
const vue = this; | |||||
this.upgradeRefresher = window.setInterval(() => { | |||||
vue.loadSystemConfigs(); | |||||
}, 5000); | |||||
} | |||||
} | |||||
}, | |||||
upgradeCheck (u) { | |||||
if (u) { | |||||
console.log('watch.upgradeCheck received: '+JSON.stringify(u)+', setting checkingForUpgrade = true'); | |||||
this.checkingForUpgrade = true; | |||||
const vue = this; | |||||
window.setTimeout(() => { | |||||
console.log('reloading system configs in response to upgrade check') | |||||
vue.loadSystemConfigs(); | |||||
this.checkingForUpgrade = false; | |||||
}, 10000); | |||||
} | |||||
} | } | ||||
} | } | ||||
}; | }; | ||||
@@ -20,17 +20,6 @@ | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<div v-if="admin === true && configs && configs.jarVersion && configs.jarUpgradeAvailable && configs.jarUpgradeAvailable.version"> | |||||
<hr/> | |||||
<h2>{{messages.message_jar_upgrade_available}}</h2> | |||||
<p>{{messages.message_jar_upgrade_version}} {{configs.jarUpgradeAvailable.version}}</p> | |||||
<p>{{messages.message_jar_current_version}} {{configs.jarVersion}}</p> | |||||
<button v-if="!upgrading" :disabled="loading()" @click="doUpgradeJar()">{{messages.button_label_jar_upgrade}}</button> | |||||
<button v-else-if="upgrading" :disabled="true">{{messages.button_label_jar_upgrading}}</button> | |||||
<p v-if="upgrading">{{messages.message_jar_upgrading}}</p> | |||||
<hr/> | |||||
</div> | |||||
<form @submit.prevent="handleSubmit"> | <form @submit.prevent="handleSubmit"> | ||||
<div v-if="submitted && errors.has('user')" class="invalid-feedback d-block"><h5>{{ errors.first('user') }}</h5></div> | <div v-if="submitted && errors.has('user')" class="invalid-feedback d-block"><h5>{{ errors.first('user') }}</h5></div> | ||||
@@ -142,14 +131,12 @@ | |||||
newUser: null, | newUser: null, | ||||
submitted: false, | submitted: false, | ||||
subject: Object.assign({}, BLANK_SUBJECT), | subject: Object.assign({}, BLANK_SUBJECT), | ||||
loadingImgSrc: loadingImgSrc, | |||||
upgrading: false, | |||||
upgradeRefresher: null | |||||
loadingImgSrc: loadingImgSrc | |||||
}; | }; | ||||
}, | }, | ||||
computed: { | computed: { | ||||
...mapState('users', ['user']), | ...mapState('users', ['user']), | ||||
...mapState('system', ['messages', 'configs', 'status']) | |||||
...mapState('system', ['messages', 'configs']) | |||||
}, | }, | ||||
created () { | created () { | ||||
this.me = this.$route.path === '/me' || this.$route.path.startsWith('/me/'); | this.me = this.$route.path === '/me' || this.$route.path.startsWith('/me/'); | ||||
@@ -200,7 +187,7 @@ | |||||
next(); | next(); | ||||
}, | }, | ||||
methods: { | methods: { | ||||
...mapActions('system', ['loadSystemConfigs', 'upgradeJar']), | |||||
...mapActions('system', ['loadSystemConfigs']), | |||||
...mapActions('users', ['createUser', 'updateUser', 'updateSelf', 'getUserById']), | ...mapActions('users', ['createUser', 'updateUser', 'updateSelf', 'getUserById']), | ||||
...mapGetters('users', ['loading']), | ...mapGetters('users', ['loading']), | ||||
handleSubmit (e) { | handleSubmit (e) { | ||||
@@ -229,10 +216,6 @@ | |||||
console.log('invalid!'); | console.log('invalid!'); | ||||
} | } | ||||
}); | }); | ||||
}, | |||||
doUpgradeJar () { | |||||
this.upgrading = true; | |||||
this.upgradeJar(); | |||||
} | } | ||||
}, | }, | ||||
watch: { | watch: { | ||||
@@ -252,28 +235,6 @@ | |||||
this.subject = u; | this.subject = u; | ||||
} | } | ||||
} | } | ||||
}, | |||||
configs (c) { | |||||
if (c) { | |||||
console.log('watch.configs received: '+JSON.stringify(c)); | |||||
if (this.upgradeRefresher !== null) { | |||||
// does the new server version match our version? | |||||
if (c.jarVersion && c.jarUpgradeAvailable && c.jarUpgradeAvailable.version && c.jarVersion === c.jarUpgradeAvailable.version) { | |||||
window.clearInterval(this.upgradeRefresher); | |||||
} | |||||
} | |||||
} | |||||
}, | |||||
status (s) { | |||||
if (s) { | |||||
console.log('watch.status received: '+JSON.stringify(s)); | |||||
if (s.upgrading && this.upgradeRefresher === null) { | |||||
const vue = this; | |||||
this.upgradeRefresher = window.setInterval(() => { | |||||
vue.loadSystemConfigs(); | |||||
}, 5000); | |||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
}; | }; |