-
Notifications
You must be signed in to change notification settings - Fork 385
/
BucketDetailsDialog.vue
158 lines (132 loc) · 4.5 KB
/
BucketDetailsDialog.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// Copyright (C) 2023 Storj Labs, Inc.
// See LICENSE for copying information.
<template>
<v-dialog
v-model="model"
width="auto"
min-width="320px"
max-width="460px"
transition="fade-transition"
>
<v-card rounded="xlg">
<v-card-item class="pa-5 pl-7">
<template #prepend>
<v-sheet
class="border-sm d-flex justify-center align-center"
width="40"
height="40"
rounded="lg"
>
<icon-bucket />
</v-sheet>
</template>
<v-card-title class="font-weight-bold">
Bucket Details
</v-card-title>
<template #append>
<v-btn
icon="$close"
variant="text"
size="small"
color="default"
@click="model = false"
/>
</template>
</v-card-item>
<v-divider />
<v-card-item class="pl-7">
<template #prepend>
<img class="d-block" src="@poc/assets/icon-bookmark-circle.svg" alt="bookmark">
</template>
<h4>Name</h4>
<p>{{ bucket.name }}</p>
</v-card-item>
<v-card-item class="pl-7">
<template #prepend>
<img class="d-block" src="@poc/assets/icon-file-circle.svg" alt="file">
</template>
<h4>Objects</h4>
<p>{{ bucket.objectCount.toLocaleString() }}</p>
</v-card-item>
<v-card-item class="pl-7">
<template #prepend>
<img class="d-block" src="@poc/assets/icon-globe-circle.svg" alt="globe">
</template>
<h4>Segments</h4>
<p>{{ bucket.segmentCount.toLocaleString() }}</p>
</v-card-item>
<v-card-item class="pl-7">
<template #prepend>
<img class="d-block" src="@poc/assets/icon-calendar-circle.svg" alt="calendar">
</template>
<h4>Date Created</h4>
<p>{{ bucket.since.toUTCString() }}</p>
</v-card-item>
<v-card-item class="mb-4 pl-7">
<template #prepend>
<img class="d-block" src="@poc/assets/icon-clock-circle.svg" alt="clock">
</template>
<h4>Last Updated</h4>
<p>{{ bucket.before.toUTCString() }}</p>
</v-card-item>
<v-divider />
<v-card-actions class="pa-7">
<v-row>
<v-col>
<v-btn color="primary" variant="flat" block @click="model = false">Close</v-btn>
</v-col>
</v-row>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { useRouter } from 'vue-router';
import {
VDialog,
VCard,
VCardItem,
VCardTitle,
VDivider,
VCardActions,
VRow,
VCol,
VBtn,
VSheet,
} from 'vuetify/components';
import IconBucket from '../icons/IconBucket.vue';
import { useLoading } from '@/composables/useLoading';
import { Bucket } from '@/types/buckets';
import { useBucketsStore } from '@/store/modules/bucketsStore';
import { useProjectsStore } from '@/store/modules/projectsStore';
const isLoading = useLoading();
const bucketsStore = useBucketsStore();
const projectsStore = useProjectsStore();
const router = useRouter();
const emit = defineEmits<{
(event: 'update:modelValue', value: boolean): void,
}>();
const props = defineProps<{
modelValue: boolean,
bucketName: string,
}>();
const model = computed<boolean>({
get: () => props.modelValue,
set: value => emit('update:modelValue', value),
});
function redirectToBucketsPage(): void {
router.push(`/projects/${projectsStore.state.selectedProject.urlId}/buckets`);
}
const bucket = computed((): Bucket => {
if (!projectsStore.state.selectedProject.id) return new Bucket();
const data = bucketsStore.state.page.buckets.find(
(bucket: Bucket) => bucket.name === props.bucketName,
);
if (!data) {
redirectToBucketsPage();
return new Bucket();
}
return data;
});
</script>