diff --git a/vospace-ui-frontend/src/api/server/index.js b/vospace-ui-frontend/src/api/server/index.js index 1d6316268bb401635b95de16154d966eb60a8a0e..063b889ceda8bed2a13888585b0664e556600236 100644 --- a/vospace-ui-frontend/src/api/server/index.js +++ b/vospace-ui-frontend/src/api/server/index.js @@ -79,6 +79,17 @@ export default { } }, false, true); }, + loadNodeCollections() { + let url = BASE_API_URL + 'collections'; + return apiRequest({ + method: 'GET', + url: url, + withCredentials: true, + headers: { + 'Cache-Control': 'no-cache' + } + }, false, true); + }, getUserInfo() { let url = BASE_API_URL + 'user'; return apiRequest({ diff --git a/vospace-ui-frontend/src/components/Collections.vue b/vospace-ui-frontend/src/components/Collections.vue new file mode 100644 index 0000000000000000000000000000000000000000..6489d9710de764b64ceb7ac7fc3c442037e5f336 --- /dev/null +++ b/vospace-ui-frontend/src/components/Collections.vue @@ -0,0 +1,62 @@ +<!-- + 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 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/> +</div> +</template> + +<script> +import FAQModal from './modal/FAQModal.vue' + +export default { + components: { + FAQModal + }, + 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> diff --git a/vospace-ui-frontend/src/components/CollectionsMenuItem.vue b/vospace-ui-frontend/src/components/CollectionsMenuItem.vue new file mode 100644 index 0000000000000000000000000000000000000000..20df043d3fd545d5e59933e8b8135ef49355a2c6 --- /dev/null +++ b/vospace-ui-frontend/src/components/CollectionsMenuItem.vue @@ -0,0 +1,13 @@ +<!-- + This file is part of vospace-ui + Copyright (C) 2021 Istituto Nazionale di Astrofisica + SPDX-License-Identifier: GPL-3.0-or-later +--> +<template> +<b-navbar-nav v-if="this.$store.state.user !== 'anonymous'"> + <b-nav-item href="#/collections"> + <strong>Collections</strong> + </b-nav-item> +</b-navbar-nav> +</template> +} \ No newline at end of file diff --git a/vospace-ui-frontend/src/components/TopMenu.vue b/vospace-ui-frontend/src/components/TopMenu.vue index a3e8f1fcc7a25194511a6fabd78e387108fde97d..147614e22e56025d9f74cb8f134cd7ac5f3c5190 100644 --- a/vospace-ui-frontend/src/components/TopMenu.vue +++ b/vospace-ui-frontend/src/components/TopMenu.vue @@ -8,6 +8,7 @@ <b-navbar toggleable="lg" type="dark" id="top-menu"> <b-navbar-brand href="#/" class="d-none d-md-block">VOSpace<sup><b>v1.0</b></sup></b-navbar-brand> <JobsMenuItem /> + <CollectionsMenuItem /> <b-navbar-nav class="ml-auto"> <!--<b-nav-item right v-b-modal.modal-faq href="#">FAQ</b-nav-item>--> <FAQMenuItem /> @@ -22,11 +23,13 @@ <script> import JobsMenuItem from './JobsMenuItem.vue'; +import CollectionsMenuItem from './CollectionsMenuItem.vue'; import FAQMenuItem from './FAQMenuItem.vue'; export default { components: { JobsMenuItem, + CollectionsMenuItem, FAQMenuItem }, computed: { diff --git a/vospace-ui-frontend/src/router.js b/vospace-ui-frontend/src/router.js index d88906e26a7f88b53c5a028f58f384a741c95d08..34bfddae7abb9137e9103410e6c3a54ca9bf657b 100644 --- a/vospace-ui-frontend/src/router.js +++ b/vospace-ui-frontend/src/router.js @@ -7,17 +7,21 @@ import VueRouter from 'vue-router'; import Main from './components/Main.vue'; import Jobs from './components/Jobs.vue'; +import Collections from './components/Collections.vue' export default new VueRouter({ - routes: [{ - path: '/', - redirect: '/nodes/' - }, { - name: 'nodes', - path: '/nodes/:path(.*)', - component: Main - }, { - path: '/jobs', - component: Jobs - }] + routes: [{ + path: '/', + redirect: '/nodes/' + }, { + name: 'nodes', + path: '/nodes/:path(.*)', + component: Main + }, { + path: '/jobs', + component: Jobs + }, { + path: '/collections', + component: Collections + }] })