Commit 1b9dac12 authored by Joel Collins's avatar Joel Collins
Browse files

Handle long running task plugins

parent 5f19d639
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -18,7 +18,11 @@

      <hr>

      <tabIcon v-for="plugin in $store.state.apiPlugins" :key="plugin.id" :id="plugin.id" :uk-icon="plugin.icon" :requireConnection="plugin.requiresConnection" :currentTab="currentTab" @set-tab="setTab">
      <tabIcon v-for="plugin in $store.state.apiPlugins" @set-tab="setTab"
        :key="plugin.id" 
        :id="plugin.id" 
        :requireConnection="plugin.requiresConnection" 
        :currentTab="currentTab">
        <i class="material-icons">{{ plugin.icon || "extension" }}</i> 
      </tabIcon>

@@ -40,8 +44,17 @@
          <paneSettings/>
        </tabContent>

        <tabContent v-for="plugin in $store.state.apiPlugins" :key="plugin.id" :id="plugin.id" :requireConnection="plugin.requiresConnection" :currentTab="currentTab">
          <JsonForm  v-for="form in plugin.forms" :key="form.route" :route="form.route" :schema="form.schema"/>
        <tabContent v-for="plugin in $store.state.apiPlugins" 
          :key="plugin.id" 
          :id="plugin.id" 
          :requireConnection="plugin.requiresConnection" 
          :currentTab="currentTab">
          <JsonForm  v-for="form in plugin.forms" 
            :key="form.route" 
            :route="form.route"
            :isTask="form.isTask"
            :submitLabel="form.submitLabel"
            :schema="form.schema"/>
        </tabContent>
  
      </div>
+20 −4
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
      <div class="center-spinner" uk-spinner></div>
    </div>

    <button v-bind:hidden="taskRunning" type="submit" class="uk-button uk-button-primary uk-form-small uk-float-right uk-margin-small uk-width-1-1">Submit</button>
    <button v-bind:hidden="taskRunning" type="submit" class="uk-button uk-button-primary uk-form-small uk-float-right uk-margin-small uk-width-1-1">{{ submitLabel }}</button>

  </form>
</template>
@@ -58,6 +58,16 @@ export default {
    'route': {
      type: String,
      required: true
    },
    'isTask': {
      type: Boolean,
      required: false,
      default: false
    },
    'submitLabel': {
      type: String,
      required: false,
      default: "Submit"
    }
  },

@@ -75,7 +85,12 @@ export default {
    },

    submitForm() {
      if (this.isTask == true) {
        this.newLongRequest(this.formData)
      }
      else {
        this.newQuickRequest(this.formData)
      }
    },

    newQuickRequest: function(params) {
@@ -100,8 +115,9 @@ export default {
          // Start the store polling TaskId for success
          return this.$store.dispatch('pollTask', [response.data.id, null, null])
        })
        .then(() => {
          console.log("Successfully finished task")
        .then(response => {
          console.log("Successfully finished task with response:")
          console.log(response)
        })
        .catch(error => {
          this.modalError(error) // Let mixin handle error