Skip to content

Commit b058649

Browse files
Merge branch 'main' into bc/eln-button
2 parents 58be50f + 3ef27ff commit b058649

File tree

6 files changed

+101
-12
lines changed

6 files changed

+101
-12
lines changed

webapp/src/components/CollectionRelationshipVisualization.vue

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
<template>
22
<label class="mr-2">Relationships</label>
3-
<div>
3+
<div style="position: relative">
4+
<div
5+
v-if="isLoading"
6+
class="position-absolute w-100 h-100 top-0 start-0 d-flex justify-content-center align-items-center"
7+
style="background-color: rgba(255, 255, 255, 0.7); z-index: 100"
8+
>
9+
<div class="card p-3 shadow-sm">
10+
<div class="text-center">
11+
<font-awesome-icon
12+
:icon="['fa', 'sync']"
13+
class="fa-2x text-primary mb-2"
14+
:spin="true"
15+
aria-label="loading"
16+
/>
17+
<p class="mb-0 fw-medium">Loading graph...</p>
18+
</div>
19+
</div>
20+
</div>
421
<ItemGraph
522
:graph-data="graphData"
623
style="height: 200px; width: 100%; border: 1px solid transparent; border-radius: 5px"
@@ -29,9 +46,12 @@ export default {
2946
graphData() {
3047
return this.$store.state.itemGraphData;
3148
},
49+
isLoading() {
50+
return this.$store.state.itemGraphIsLoading;
51+
},
3252
},
33-
async mounted() {
34-
await getItemGraph({ item_id: null, collection_id: this.collection_id });
53+
mounted() {
54+
getItemGraph({ item_id: null, collection_id: this.collection_id });
3555
},
3656
};
3757
</script>

webapp/src/components/ItemRelationshipVisualization.vue

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
<template>
22
<label class="pr-2"><font-awesome-icon icon="project-diagram" /> Relationships</label>
3-
<div>
3+
<div style="position: relative">
4+
<div
5+
v-if="isLoading"
6+
class="position-absolute w-100 h-100 top-0 start-0 d-flex justify-content-center align-items-center"
7+
style="background-color: rgba(255, 255, 255, 0.7); z-index: 100"
8+
>
9+
<div class="card p-3 shadow-sm">
10+
<div class="text-center">
11+
<font-awesome-icon
12+
:icon="['fa', 'sync']"
13+
class="fa-2x text-primary mb-2"
14+
:spin="true"
15+
aria-label="loading"
16+
/>
17+
<p class="mb-0 fw-medium">Loading graph...</p>
18+
</div>
19+
</div>
20+
</div>
421
<ItemGraph
522
:graph-data="graphData"
623
style="height: 200px; width: 100%; border: 1px solid transparent; border-radius: 5px"
@@ -26,9 +43,12 @@ export default {
2643
graphData() {
2744
return this.$store.state.itemGraphData;
2845
},
46+
isLoading() {
47+
return this.$store.state.itemGraphIsLoading;
48+
},
2949
},
30-
async mounted() {
31-
await getItemGraph({ item_id: this.item_id });
50+
mounted() {
51+
getItemGraph({ item_id: this.item_id });
3252
},
3353
};
3454
</script>

webapp/src/components/RelationshipVisualization.vue

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,24 @@
4747
<span class="contents-blocktitle" @click="openEditPageInNewTab(child)">{{ child }}</span>
4848
</li>
4949
</ul>
50-
<div v-show="activeTab == 'graph'">
50+
<div v-show="activeTab == 'graph'" style="position: relative">
51+
<div
52+
v-if="isLoading"
53+
class="position-absolute w-100 h-100 top-0 start-0 d-flex justify-content-center align-items-center"
54+
style="background-color: rgba(255, 255, 255, 0.7); z-index: 100"
55+
>
56+
<div class="card p-3 shadow-sm">
57+
<div class="text-center">
58+
<font-awesome-icon
59+
:icon="['fa', 'sync']"
60+
class="fa-2x text-primary mb-2"
61+
:spin="true"
62+
aria-label="loading"
63+
/>
64+
<p class="mb-0 fw-medium">Loading graph...</p>
65+
</div>
66+
</div>
67+
</div>
5168
<ItemGraph :graph-data="graphData" style="height: 400px" />
5269
</div>
5370
<!-- <div class="alert alert-info" role="alert" v-show="activeTab == 'graph'">
@@ -85,9 +102,12 @@ export default {
85102
graphData() {
86103
return this.$store.state.itemGraphData;
87104
},
105+
isLoading() {
106+
return this.$store.state.itemGraphIsLoading;
107+
},
88108
},
89-
async mounted() {
90-
await getItemGraph({ item_id: this.item_id });
109+
mounted() {
110+
getItemGraph({ item_id: this.item_id });
91111
},
92112
methods: {
93113
openEditPageInNewTab(item_id) {

webapp/src/server_fetch_utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,12 +784,15 @@ export async function getItemGraph({ item_id = null, collection_id = null } = {}
784784
if (collection_id != null) {
785785
url = url + "?collection_id=" + collection_id;
786786
}
787+
store.commit("setItemGraphIsLoading", true);
787788
return fetch_get(url)
788789
.then(function (response_json) {
789790
store.commit("setItemGraph", { nodes: response_json.nodes, edges: response_json.edges });
791+
store.commit("setItemGraphIsLoading", false);
790792
return response_json;
791793
})
792794
.catch((error) => {
795+
store.commit("setItemGraphIsLoading", false);
793796
DialogService.error({
794797
title: "Graph Retrieval Failed",
795798
message: `Error retrieving item graph from API: ${error}`,

webapp/src/store/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default createStore({
2424
remoteDirectoryTree: {},
2525
remoteDirectoryTreeSecondsSinceLastUpdate: null,
2626
itemGraphData: null,
27+
itemGraphIsLoading: false,
2728
remoteDirectoryTreeIsLoading: false,
2829
fileSelectModalIsOpen: false,
2930
currentUserDisplayName: null,
@@ -336,6 +337,9 @@ export default createStore({
336337
setItemGraph(state, payload) {
337338
state.itemGraphData = payload;
338339
},
340+
setItemGraphIsLoading(state, isLoading) {
341+
state.itemGraphIsLoading = isLoading;
342+
},
339343
setBlocksInfos(state, blocksInfos) {
340344
blocksInfos.forEach((info) => {
341345
state.blocksInfos[info.id] = info;

webapp/src/views/ItemGraphPage.vue

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
<template>
22
<Navbar />
3-
<ItemGraph :graph-data="graphData" />
3+
<div style="position: relative; min-height: 400px">
4+
<div
5+
v-if="isLoading"
6+
class="position-absolute w-100 h-100 top-0 start-0 d-flex justify-content-center align-items-center"
7+
style="background-color: rgba(255, 255, 255, 0.7); z-index: 100"
8+
>
9+
<div class="card p-3 shadow-sm">
10+
<div class="text-center">
11+
<font-awesome-icon
12+
:icon="['fa', 'sync']"
13+
class="fa-2x text-primary mb-2"
14+
:spin="true"
15+
aria-label="loading"
16+
/>
17+
<p class="mb-0 fw-medium">Loading graph...</p>
18+
</div>
19+
</div>
20+
</div>
21+
<ItemGraph :graph-data="graphData" />
22+
</div>
423
</template>
524

625
<script>
@@ -22,9 +41,12 @@ export default {
2241
graphData() {
2342
return this.$store.state.itemGraphData;
2443
},
44+
isLoading() {
45+
return this.$store.state.itemGraphIsLoading;
46+
},
2547
},
26-
async mounted() {
27-
await getItemGraph();
48+
mounted() {
49+
getItemGraph();
2850
},
2951
};
3052
</script>

0 commit comments

Comments
 (0)