diff --git a/ui/src/components/NewRequest.vue b/ui/src/components/NewRequest.vue index e8199a5..aa7ea28 100644 --- a/ui/src/components/NewRequest.vue +++ b/ui/src/components/NewRequest.vue @@ -112,11 +112,11 @@ }, computed: { editorReady() { - return this.form && this.offliner_def !== null; }, + return this.form && this.offliner_flags !== null; }, form_fields() { let fields = []; - for (var i=0;i Constants.zimit_fields.indexOf(field.key) > -1); - parent.$store.dispatch('setOfflinerDef', definition); + parent.$store.dispatch('setOfflinerDef', response.data); if (on_success) { on_success(); } }) diff --git a/ui/src/components/mixins.js b/ui/src/components/mixins.js index 68e35bd..e8366cb 100644 --- a/ui/src/components/mixins.js +++ b/ui/src/components/mixins.js @@ -8,7 +8,7 @@ export default { }, computed: { publicPath() { return process.env.BASE_URL; }, // for static files linking - offliner_def() { return this.$store.getters.offliner_def; }, // offliner def for requests + offliner_flags() { return this.$store.getters.offliner_flags; }, // offliner flags for requests }, methods: { toggleLoader(text) { // shortcut to store's loader status changer diff --git a/ui/src/store.js b/ui/src/store.js index c3590d2..d48a08e 100644 --- a/ui/src/store.js +++ b/ui/src/store.js @@ -1,6 +1,7 @@ import Vue from 'vue' import Vuex from 'vuex' +import Constants from './constants.js' Vue.use(Vuex); @@ -9,7 +10,7 @@ const store = new Vuex.Store({ loading: false, loading_text: "", - offliner_def: [], + offliner_def: null, }, mutations: { setLoading (state, payload) { // toggle GUI loader @@ -31,6 +32,12 @@ const store = new Vuex.Store({ getters: { loadingStatus(state) { return {should_display: state.loading, text: state.loading_text};}, offliner_def(state) { return state.offliner_def; }, + offliner_flags(state) { + if (!state.offliner_def) { + return [] + } + return state.offliner_def.flags.filter(field => Constants.zimit_fields.indexOf(field.key) > -1); + }, } })