Skip to content

Commit c53388c

Browse files
Fixed the bug by added key triggered update and v-if (#383)
* Fixed the bug by added key triggered update and v-if * PipelineStorageView: use null instead of undefined for unloaded element => avoids error Co-authored-by: Georg Schwarz <[email protected]>
1 parent 0662582 commit c53388c

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

ui/src/storage/StorageItemView.vue

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<template>
22
<div>
3-
<div v-if="item !== null">
3+
<div v-if="item != null">
44
<v-card class="grey lighten-3">
55
<v-container fluid>
6-
<pre style="max-height: 400px; overflow:auto; text-align: left">{{
7-
item.data
8-
}}</pre>
6+
<pre
7+
v-if="item.data !== undefined"
8+
style="max-height: 400px; overflow:auto; text-align: left"
9+
>
10+
{{ item.data }}
11+
</pre>
12+
<pre
13+
v-else
14+
style="max-height: 400px; overflow:auto; text-align: left"
15+
>
16+
No Data
17+
</pre>
918
</v-container>
1019

1120
<v-divider />
@@ -45,8 +54,8 @@ import { StorageItem } from './storage-item';
4554
import { StorageRest } from './storageRest';
4655
4756
@Component({})
48-
export default class PipelineStorageOverview extends Vue {
49-
private item: StorageItem | undefined = undefined;
57+
export default class StorageItemView extends Vue {
58+
private item: StorageItem | null = null;
5059
5160
private clipUrl = clipboardCopy;
5261
@@ -58,11 +67,14 @@ export default class PipelineStorageOverview extends Vue {
5867
@Prop()
5968
private readonly itemId!: number;
6069
61-
private mounted(): void {
62-
this.storageRest
63-
.getStoredItem(this.pipelineId, this.itemId)
64-
.then(item => (this.item = item))
65-
.catch(error => console.error('Failed to fetch stored items', error));
70+
async mounted(): Promise<void> {
71+
try {
72+
this.item =
73+
(await this.storageRest.getStoredItem(this.pipelineId, this.itemId)) ||
74+
null;
75+
} catch (error) {
76+
console.error('Failed to fetch stored items', error);
77+
}
6678
}
6779
6880
private get storageItemUrl(): string {

0 commit comments

Comments
 (0)