Skip to content
Snippets Groups Projects
Select Git revision
  • cc9ee5a69a6145c576d5ca3de83c47ef9ce34e22
  • main default protected
  • Kelvinrr-patch-3
  • radius_update
  • revert-616-apollo_pan
  • vims
  • 0.10
  • Kelvinrr-patch-2
  • revert-563-minirf_fix
  • Kelvinrr-patch-1
  • 0.9
  • acpaquette-patch-3
  • acpaquette-patch-2
  • acpaquette-patch-1
  • spiceql
  • ci-coverage
  • 0.10.0
  • 0.9.1
  • 0.9.0
  • 0.8.7
  • 0.8.8
  • 0.8.6
  • 0.8.3
  • 0.8.4
  • 0.8.5
  • 0.8.2
  • 0.8.1
  • 0.8.0
  • 0.7.3
  • 0.7.2
  • 0.7.1
  • 0.7.0
  • 0.6.5
  • 0.6.4
  • 0.6.3
  • 0.6.2
36 results

test_lro_drivers.py

Blame
    • acpaquette's avatar
      cc9ee5a6
      Two sun positions (#542) · cc9ee5a6
      acpaquette authored
      * Enforced getting two sun positions if instrument is not a framer
      
      * Updated tests
      
      * Updated changelog
      
      * Removed leftover prints
      
      * One more leftover print
      Two sun positions (#542)
      acpaquette authored
      * Enforced getting two sun positions if instrument is not a framer
      
      * Updated tests
      
      * Updated changelog
      
      * Removed leftover prints
      
      * One more leftover print
    store.js 2.31 KiB
    /* Vuex store, for centralized state management */
    
    import Vue from 'vue';
    import Vuex from 'vuex';
    import client from 'api-client';
    import main from './main';
    
    Vue.use(Vuex);
    
    export default new Vuex.Store({
      state: {
        path: '',
        loading: true,
        tapeButtonEnabled: false,
        jobs: [],
        user: 'anonymous'
      },
      mutations: {
        setLoading(state, loading) {
          state.loading = loading;
        },
        setPath(state, value) {
          if (!value) {
            value = '';
          }
          state.path = value;
        },
        setTapeButtonEnabled(state, value) {
          state.tapeButtonEnabled = value;
        },
        setJobs(state, jobs) {
          // empty the array
          state.jobs.splice(0, jobs.length);
          // fill again
          for (let i = 0; i < jobs.length; i++) {
            state.jobs.push(jobs[i]);
          }
        },
        addJob(state, job) {
          state.jobs.push(job);
        },
        setUsername(state, username) {
          state.user = username;
        }
      },
      actions: {
        setPath({ state, commit, dispatch }, path) {
          commit('setPath', path);
          client.getNode(state.path)
            .then(res => {
              document.getElementById('nodes').outerHTML = res;
              let checkboxes = document.querySelectorAll('#nodes input[type="checkbox"]');
              for (let i = 0; i < checkboxes.length; i++) {
                checkboxes[i].addEventListener('change', function() {
                  dispatch('computeButtonVisibility');
                });
              }
              dispatch('computeButtonVisibility');
            });
        },
        computeButtonVisibility({ commit }) {
          commit('setTapeButtonEnabled', document.querySelectorAll('#nodes input.tape:checked').length > 0);
        },
        startRecallFromTapeJob({ commit }) {
          let tapeCheckboxes = document.querySelectorAll('#nodes input:checked'); // temporary: it should be input.tape
          let paths = [];
          for (let i = 0; i < tapeCheckboxes.length; i++) {
            paths.push(tapeCheckboxes[i].getAttribute('data-node'));
          }
          client.startRecallFromTapeJob(paths)
            .then(job => {
              main.showInfo('Job started');
              commit('addJob', job);
            });
        },
        loadJobs({ commit }) {
          client.loadJobs()
            .then(jobs => commit('setJobs', jobs));
        },
        loadUserInfo({ commit }) {
          client.getUserInfo()
            .then(res => commit('setUsername', res.username));
        }
      }
    });