Commit 4b7d6ede authored by Richard Bowman's avatar Richard Bowman 🔬
Browse files

added a button to flatten the lens shading table

parent 0fc19363
Loading
Loading
Loading
Loading
+21 −6
Original line number Diff line number Diff line
@@ -53,20 +53,29 @@
      </button>

      <!--Show auto calibrate if default plugin is enabled-->
      <div v-if="recalibrationUri">
      <div v-if="'recalibrate' in recalibrationLinks" class="uk-margin-small">
        <taskSubmitter
          :can-terminate="false"
          :requires-confirmation="true"
          :confirmation-message="
            'Start recalibration? This may take a while, and the microscope will be locked during this time.'
          "
          :submit-url="recalibrationUri"
          :submit-url="recalibrationLinks.recalibrate.href"
          :submit-label="'Auto-Calibrate'"
          @response="onRecalibrateResponse"
          @error="onRecalibrateError"
        >
        </taskSubmitter>
      </div>
      
      <div v-if="'flatten_lens_shading_table' in recalibrationLinks" class="uk-margin-small">
        <button
          class="uk-button uk-button-danger uk-form-small uk-float-right uk-margin-small uk-width-1-1"
          @click="flattenLensShadingTableRequest"
        >
          Disable flat-field correction
        </button>
      </div>
    </form>
  </div>
</template>
@@ -86,7 +95,7 @@ export default {
  data: function() {
    return {
      settings: null,
      recalibrationUri: null,
      recalibrationLinks: null,
      isCalibrating: false
    };
  },
@@ -102,7 +111,7 @@ export default {

  mounted() {
    this.updateSettings();
    this.updateRecalibrationUri();
    this.updateRecalibrationLinks();
  },

  methods: {
@@ -117,7 +126,7 @@ export default {
        });
    },

    updateRecalibrationUri: function() {
    updateRecalibrationLinks: function() {
      axios
        .get(this.pluginsUri) // Get a list of plugins
        .then(response => {
@@ -128,7 +137,9 @@ export default {
          // if AutocalibrationPlugin is enabled
          if (foundExtension) {
            // Get plugin action link
            this.recalibrationUri = foundExtension.links.recalibrate.href;
            this.recalibrationLinks = foundExtension.links;
          } else {
            this.recalibrationLinks = {}
          }
        })
        .catch(error => {
@@ -172,6 +183,10 @@ export default {

    onRecalibrateError: function(error) {
      this.modalError(error); // Let mixin handle error
    },

    flattenLensShadingTableRequest: function() {
      axios.post(this.recalibrationLinks.flatten_lens_shading_table.href)
    }
  }
};