Added plugin schemas to Vuex store
This commit is contained in:
parent
e60fd375e3
commit
36eb3b4396
1 changed files with 27 additions and 0 deletions
27
src/store.js
27
src/store.js
|
|
@ -15,6 +15,7 @@ export default new Vuex.Store({
|
||||||
error: '',
|
error: '',
|
||||||
apiConfig: {},
|
apiConfig: {},
|
||||||
apiState: {},
|
apiState: {},
|
||||||
|
apiPlugins: [],
|
||||||
globalSettings: {
|
globalSettings: {
|
||||||
disableStream: false,
|
disableStream: false,
|
||||||
autoGpuPreview: false,
|
autoGpuPreview: false,
|
||||||
|
|
@ -38,6 +39,9 @@ export default new Vuex.Store({
|
||||||
commitState(state, stateData) {
|
commitState(state, stateData) {
|
||||||
state.apiState = stateData;
|
state.apiState = stateData;
|
||||||
},
|
},
|
||||||
|
commitPlugins(state, pluginData) {
|
||||||
|
state.apiPlugins = pluginData;
|
||||||
|
},
|
||||||
changeSetting(state, [key, value]) {
|
changeSetting(state, [key, value]) {
|
||||||
state.globalSettings[key] = value;
|
state.globalSettings[key] = value;
|
||||||
},
|
},
|
||||||
|
|
@ -47,6 +51,7 @@ export default new Vuex.Store({
|
||||||
state.error = null
|
state.error = null
|
||||||
state.apiConfig = {}
|
state.apiConfig = {}
|
||||||
state.apiState = {}
|
state.apiState = {}
|
||||||
|
state.apiPlugins = []
|
||||||
},
|
},
|
||||||
setConnected(state) {
|
setConnected(state) {
|
||||||
state.waiting = false
|
state.waiting = false
|
||||||
|
|
@ -72,6 +77,9 @@ export default new Vuex.Store({
|
||||||
.then (() => {
|
.then (() => {
|
||||||
context.dispatch('updateState')
|
context.dispatch('updateState')
|
||||||
})
|
})
|
||||||
|
.then (() => {
|
||||||
|
context.dispatch('updatePlugins')
|
||||||
|
})
|
||||||
.then (() => {
|
.then (() => {
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
|
@ -116,6 +124,25 @@ export default new Vuex.Store({
|
||||||
return new Promise(sendRequest)
|
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]) {
|
pollTask(context, [taskId, timeout, interval]) {
|
||||||
var endTime = Number(new Date()) + (timeout*1000 || 30000);
|
var endTime = Number(new Date()) + (timeout*1000 || 30000);
|
||||||
interval = interval*1000 || 500;
|
interval = interval*1000 || 500;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue