Loading src/store.js +27 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ export default new Vuex.Store({ error: '', apiConfig: {}, apiState: {}, apiPlugins: [], globalSettings: { disableStream: false, autoGpuPreview: false, Loading @@ -38,6 +39,9 @@ export default new Vuex.Store({ commitState(state, stateData) { state.apiState = stateData; }, commitPlugins(state, pluginData) { state.apiPlugins = pluginData; }, changeSetting(state, [key, value]) { state.globalSettings[key] = value; }, Loading @@ -47,6 +51,7 @@ export default new Vuex.Store({ state.error = null state.apiConfig = {} state.apiState = {} state.apiPlugins = [] }, setConnected(state) { state.waiting = false Loading @@ -72,6 +77,9 @@ export default new Vuex.Store({ .then (() => { context.dispatch('updateState') }) .then (() => { context.dispatch('updatePlugins') }) .then (() => { resolve() }) Loading Loading @@ -116,6 +124,25 @@ export default new Vuex.Store({ return new Promise(sendRequest) }, updatePlugins(context, uri=`${context.getters.uri}/plugin`) { context.commit('changeWaiting', true) var sendRequest = function(resolve, reject) { axios.get(uri) .then(response => { console.log("PLUGINS") console.log(response.data) context.commit('commitPlugins', response.data) context.commit('setConnected') resolve() }) .catch(error => { reject(new Error(error)) }) } return new Promise(sendRequest) }, pollTask(context, [taskId, timeout, interval]) { var endTime = Number(new Date()) + (timeout*1000 || 30000); interval = interval*1000 || 500; Loading Loading
src/store.js +27 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ export default new Vuex.Store({ error: '', apiConfig: {}, apiState: {}, apiPlugins: [], globalSettings: { disableStream: false, autoGpuPreview: false, Loading @@ -38,6 +39,9 @@ export default new Vuex.Store({ commitState(state, stateData) { state.apiState = stateData; }, commitPlugins(state, pluginData) { state.apiPlugins = pluginData; }, changeSetting(state, [key, value]) { state.globalSettings[key] = value; }, Loading @@ -47,6 +51,7 @@ export default new Vuex.Store({ state.error = null state.apiConfig = {} state.apiState = {} state.apiPlugins = [] }, setConnected(state) { state.waiting = false Loading @@ -72,6 +77,9 @@ export default new Vuex.Store({ .then (() => { context.dispatch('updateState') }) .then (() => { context.dispatch('updatePlugins') }) .then (() => { resolve() }) Loading Loading @@ -116,6 +124,25 @@ export default new Vuex.Store({ return new Promise(sendRequest) }, updatePlugins(context, uri=`${context.getters.uri}/plugin`) { context.commit('changeWaiting', true) var sendRequest = function(resolve, reject) { axios.get(uri) .then(response => { console.log("PLUGINS") console.log(response.data) context.commit('commitPlugins', response.data) context.commit('setConnected') resolve() }) .catch(error => { reject(new Error(error)) }) } return new Promise(sendRequest) }, pollTask(context, [taskId, timeout, interval]) { var endTime = Number(new Date()) + (timeout*1000 || 30000); interval = interval*1000 || 500; Loading