Commit 672d0de5 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Partial implementation of node collections controller

parent 9a25c600
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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({
+62 −0
Original line number Diff line number Diff line
<!--
  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>
+13 −0
Original line number Diff line number Diff line
<!--
  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>&nbsp;    
  </b-nav-item>
</b-navbar-nav>
</template>
}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -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: {
+15 −11
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ 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: [{
@@ -19,5 +20,8 @@ export default new VueRouter({
        }, {
            path: '/jobs',
            component: Jobs
        }, {
            path: '/collections',
            component: Collections
        }]
})