Loading vospace-ui-frontend/src/api/mock/data/collections.json 0 → 100644 +9 −0 Original line number Diff line number Diff line [{ "id": "1", "title": "My collection 1" }, { "id": "2", "title": "My collection 2" } ] vospace-ui-frontend/src/api/mock/index.js +4 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ import folder1 from './data/nodes/folder1'; import folder2 from './data/nodes/folder2'; import job from './data/job'; import jobs from './data/jobs'; import collections from './data/collections'; import user from './data/user'; import sharing from './data/sharing'; Loading Loading @@ -49,6 +50,9 @@ export default { loadJobs() { return fetch(jobs, false); }, loadCollections() { return fetch(collections, false); }, getUserInfo() { return fetch(user, false); }, Loading vospace-ui-frontend/src/api/server/index.js +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ export default { } }, false, true); }, loadNodeCollections() { loadCollections() { let url = BASE_API_URL + 'collections'; return apiRequest({ method: 'GET', Loading vospace-ui-frontend/src/components/Collections.vue +12 −15 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ <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"> <div v-if="collections.length > 0" class="mb-3"> <table class="table b-table table-striped table-hover"> <thead> <tr> Loading @@ -19,20 +19,17 @@ </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 v-for="collection in collections" :key="collection.id"> <td>{{collection.id}}</td> <td>{{collection.title}}</td> </tr> </tbody> </table> </div> <div v-if="jobs.length === 0"> No jobs <div v-if="collections.length === 0"> No collections </div> <div id="jobs-loading" v-if="jobsLoading" class="loading"> <div id="collections-loading" v-if="collectionsLoading" class="loading"> <div class="spinner-wrapper"> <b-spinner variant="primary" style="width: 3rem; height: 3rem;" label="Loading"></b-spinner> </div> Loading @@ -52,16 +49,16 @@ export default { CreateCollectionModal }, computed: { jobs() { return this.$store.state.jobs }, jobsLoading() { return this.$store.state.jobsLoading } collections() { return this.$store.state.collections }, collectionsLoading() { return this.$store.state.collectionsLoading } }, mounted() { this.loadJobs(); this.loadCollections(); this.$store.commit('setLoading', false); }, methods: { loadJobs() { this.$store.dispatch('loadJobs'); loadCollections() { this.$store.dispatch('loadCollections'); } } } Loading vospace-ui-frontend/src/store.js +19 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ export default new Vuex.Store({ jobs: [], jobsLoading: true, lastJobsCheckTime: null, collections: [], collectionsLoading: true, user: 'anonymous', nodesToDelete: [], selectedUndeletableNodes: [], Loading Loading @@ -95,6 +97,15 @@ export default new Vuex.Store({ setJobsLoading(state, loading) { state.jobsLoading = loading; }, setCollections(state, collections) { updateArray(state.collections, collections); }, addCollections(state, collection) { state.collections.push(collection); }, setCollectionsLoading(state, loading) { state.collectionsLoading = loading; }, setUsername(state, username) { state.user = username; }, Loading Loading @@ -229,6 +240,14 @@ export default new Vuex.Store({ state.lastJobsCheckTime = new Date().getTime(); }); }, loadCollections({ commit }) { commit('setCollectionsLoading', true); client.loadCollections() .then(collections => { commit('setCollections', collections); }); commit('setCollectionsLoading', false); }, loadUserInfo({ commit }) { client.getUserInfo() .then(res => commit('setUsername', res.username)); Loading Loading
vospace-ui-frontend/src/api/mock/data/collections.json 0 → 100644 +9 −0 Original line number Diff line number Diff line [{ "id": "1", "title": "My collection 1" }, { "id": "2", "title": "My collection 2" } ]
vospace-ui-frontend/src/api/mock/index.js +4 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ import folder1 from './data/nodes/folder1'; import folder2 from './data/nodes/folder2'; import job from './data/job'; import jobs from './data/jobs'; import collections from './data/collections'; import user from './data/user'; import sharing from './data/sharing'; Loading Loading @@ -49,6 +50,9 @@ export default { loadJobs() { return fetch(jobs, false); }, loadCollections() { return fetch(collections, false); }, getUserInfo() { return fetch(user, false); }, Loading
vospace-ui-frontend/src/api/server/index.js +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ export default { } }, false, true); }, loadNodeCollections() { loadCollections() { let url = BASE_API_URL + 'collections'; return apiRequest({ method: 'GET', Loading
vospace-ui-frontend/src/components/Collections.vue +12 −15 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ <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"> <div v-if="collections.length > 0" class="mb-3"> <table class="table b-table table-striped table-hover"> <thead> <tr> Loading @@ -19,20 +19,17 @@ </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 v-for="collection in collections" :key="collection.id"> <td>{{collection.id}}</td> <td>{{collection.title}}</td> </tr> </tbody> </table> </div> <div v-if="jobs.length === 0"> No jobs <div v-if="collections.length === 0"> No collections </div> <div id="jobs-loading" v-if="jobsLoading" class="loading"> <div id="collections-loading" v-if="collectionsLoading" class="loading"> <div class="spinner-wrapper"> <b-spinner variant="primary" style="width: 3rem; height: 3rem;" label="Loading"></b-spinner> </div> Loading @@ -52,16 +49,16 @@ export default { CreateCollectionModal }, computed: { jobs() { return this.$store.state.jobs }, jobsLoading() { return this.$store.state.jobsLoading } collections() { return this.$store.state.collections }, collectionsLoading() { return this.$store.state.collectionsLoading } }, mounted() { this.loadJobs(); this.loadCollections(); this.$store.commit('setLoading', false); }, methods: { loadJobs() { this.$store.dispatch('loadJobs'); loadCollections() { this.$store.dispatch('loadCollections'); } } } Loading
vospace-ui-frontend/src/store.js +19 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ export default new Vuex.Store({ jobs: [], jobsLoading: true, lastJobsCheckTime: null, collections: [], collectionsLoading: true, user: 'anonymous', nodesToDelete: [], selectedUndeletableNodes: [], Loading Loading @@ -95,6 +97,15 @@ export default new Vuex.Store({ setJobsLoading(state, loading) { state.jobsLoading = loading; }, setCollections(state, collections) { updateArray(state.collections, collections); }, addCollections(state, collection) { state.collections.push(collection); }, setCollectionsLoading(state, loading) { state.collectionsLoading = loading; }, setUsername(state, username) { state.user = username; }, Loading Loading @@ -229,6 +240,14 @@ export default new Vuex.Store({ state.lastJobsCheckTime = new Date().getTime(); }); }, loadCollections({ commit }) { commit('setCollectionsLoading', true); client.loadCollections() .then(collections => { commit('setCollections', collections); }); commit('setCollectionsLoading', false); }, loadUserInfo({ commit }) { client.getUserInfo() .then(res => commit('setUsername', res.username)); Loading