<!-- This file is part of vospace-ui Copyright (C) 2021 Istituto Nazionale di Astrofisica SPDX-License-Identifier: GPL-3.0-or-later --> <template> <div> <b-button variant="primary" class="float-right" @click="loadCollections">Reload</b-button> <h3>Collections</h3> <div class="mb-3"> <b-button variant="success" class="mr-2" v-b-modal.create-collection-modal>New collection</b-button> </div> <div v-if="jobs.length > 0" class="mb-3"> <table class="table b-table table-striped table-hover"> <thead> <tr> <th>Id</th> <th>Title</th> </tr> </thead> <tbody> <tr v-for="job in jobs" :key="job.id"> <td>{{job.type}}</td> <td>{{job.creationTime}}</td> <td>{{job.id}}</td> <td><a :href="'download?jobId=' + job.id" v-if="job.phase === 'COMPLETED' && job.type === 'ARCHIVE'">Download archive</a></td> <td>{{job.phase}}</td> </tr> </tbody> </table> </div> <div v-if="jobs.length === 0"> No jobs </div> <div id="jobs-loading" v-if="jobsLoading" class="loading"> <div class="spinner-wrapper"> <b-spinner variant="primary" style="width: 3rem; height: 3rem;" label="Loading"></b-spinner> </div> </div> <FAQModal/> <CreateCollectionModal /> </div> </template> <script> import FAQModal from './modal/FAQModal.vue' import CreateCollectionModal from './modal/CreateCollectionModal.vue' export default { components: { FAQModal, CreateCollectionModal }, computed: { jobs() { return this.$store.state.jobs }, jobsLoading() { return this.$store.state.jobsLoading } }, mounted() { this.loadJobs(); this.$store.commit('setLoading', false); }, methods: { loadJobs() { this.$store.dispatch('loadJobs'); } } } </script>