-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathManageIndex.vue
More file actions
78 lines (62 loc) · 3.08 KB
/
ManageIndex.vue
File metadata and controls
78 lines (62 loc) · 3.08 KB
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
<script setup lang="ts">
import { BAlert } from "bootstrap-vue";
import { computed } from "vue";
import type { TableField } from "@/components/Common/GTable.types";
import { DESCRIPTION_FIELD, NAME_FIELD, TEMPLATE_FIELD, TYPE_FIELD } from "@/components/ConfigTemplates/fields";
import { useInstanceTesting } from "@/components/ConfigTemplates/useConfigurationTesting";
import { useFiltering } from "@/components/ConfigTemplates/useInstanceFiltering";
import { useFileSourceInstancesStore } from "@/stores/fileSourceInstancesStore";
import GTable from "@/components/Common/GTable.vue";
import ManageIndexHeader from "@/components/ConfigTemplates/ManageIndexHeader.vue";
import FileSourceTypeSpan from "@/components/FileSources/FileSourceTypeSpan.vue";
import InstanceDropdown from "@/components/FileSources/Instances/InstanceDropdown.vue";
import TemplateSummarySpan from "@/components/FileSources/Templates/TemplateSummarySpan.vue";
import LoadingSpan from "@/components/LoadingSpan.vue";
const fileSourceInstancesStore = useFileSourceInstancesStore();
interface Props {
message?: string;
}
defineProps<Props>();
const fields: TableField[] = [NAME_FIELD, DESCRIPTION_FIELD, TYPE_FIELD, TEMPLATE_FIELD];
const allItems = computed(() => fileSourceInstancesStore.getInstances);
const { activeInstances } = useFiltering(allItems);
const loading = computed(() => fileSourceInstancesStore.loading);
fileSourceInstancesStore.fetchInstances();
function reload() {
fileSourceInstancesStore.fetchInstances();
}
const testInstanceUrl = "/api/file_source_instances/{uuid}/test";
const { ConfigurationTestSummaryModal, showTestResults, testResults, test, testingError } =
useInstanceTesting(testInstanceUrl);
</script>
<template>
<div>
<ConfigurationTestSummaryModal v-model="showTestResults" :error="testingError" :test-results="testResults" />
<ManageIndexHeader header="My Repositories" :message="message" create-route="/file_source_instances/create" />
<GTable
id="user-file-sources-index"
caption-top
fixed
hover
show-empty
striped
:fields="fields"
:items="activeInstances">
<template v-slot:empty>
<LoadingSpan v-if="loading" message="Loading your user's file source instances" />
<BAlert v-else id="no-file-source-instances" variant="info" show>
No file source instances found for your users, click the create button to configure a new one.
</BAlert>
</template>
<template v-slot:cell(name)="{ item }">
<InstanceDropdown :file-source="item" @entryRemoved="reload" @test="test(item)" />
</template>
<template v-slot:cell(type)="{ item }">
<FileSourceTypeSpan :type="item.type" />
</template>
<template v-slot:cell(template)="{ item }">
<TemplateSummarySpan :template-version="item.template_version ?? 0" :template-id="item.template_id" />
</template>
</GTable>
</div>
</template>