refactor: Update Woodpecker CI config and StorageHierarchy component
This commit is contained in:
parent
6400eb9513
commit
020663cca9
2 changed files with 29 additions and 16 deletions
|
@ -1,6 +1,9 @@
|
||||||
pipeline:
|
variables:
|
||||||
|
- &golang_image 'golang:1.24'
|
||||||
|
|
||||||
|
steps:
|
||||||
backend-lint:
|
backend-lint:
|
||||||
image: golang:1.21
|
image: *golang_image
|
||||||
group: lint
|
group: lint
|
||||||
commands:
|
commands:
|
||||||
- go vet ./...
|
- go vet ./...
|
||||||
|
@ -20,16 +23,21 @@ pipeline:
|
||||||
- cd web
|
- cd web
|
||||||
- npm ci
|
- npm ci
|
||||||
- npm run build
|
- npm run build
|
||||||
|
depends_on:
|
||||||
|
- frontend-lint
|
||||||
when:
|
when:
|
||||||
status: [success]
|
status: [success]
|
||||||
|
|
||||||
backend-build:
|
backend-build:
|
||||||
image: golang:1.21
|
image: *golang_image
|
||||||
commands:
|
commands:
|
||||||
- go mod download
|
- go mod download
|
||||||
- go generate ./...
|
- go generate ./...
|
||||||
# Build with embedded frontend
|
# Build with embedded frontend
|
||||||
- go build -o inventory -ldflags="-s -w" .
|
- go build -o inventory -ldflags="-s -w" .
|
||||||
|
depends_on:
|
||||||
|
- frontend-build
|
||||||
|
- backend-lint
|
||||||
when:
|
when:
|
||||||
status: [success]
|
status: [success]
|
||||||
|
|
||||||
|
@ -40,6 +48,8 @@ pipeline:
|
||||||
- mkdir -p artifacts
|
- mkdir -p artifacts
|
||||||
- cp inventory artifacts/
|
- cp inventory artifacts/
|
||||||
- tar -czvf artifacts/inventory.tar.gz inventory
|
- tar -czvf artifacts/inventory.tar.gz inventory
|
||||||
|
depends_on:
|
||||||
|
- backend-build
|
||||||
when:
|
when:
|
||||||
status: [success]
|
status: [success]
|
||||||
|
|
||||||
|
@ -52,6 +62,9 @@ pipeline:
|
||||||
- latest
|
- latest
|
||||||
- ${DRONE_TAG##v}
|
- ${DRONE_TAG##v}
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
depends_on:
|
||||||
|
- backend-lint
|
||||||
|
- frontend-lint
|
||||||
when:
|
when:
|
||||||
branch: main
|
branch: main
|
||||||
event: [push, tag]
|
event: [push, tag]
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<v-select
|
<v-select
|
||||||
v-model="selectedStorageId"
|
v-model="selectedStorageId"
|
||||||
:items="storageSpaces"
|
:items="storageSpaces"
|
||||||
item-title="location"
|
item-title="name"
|
||||||
item-value="id"
|
item-value="id"
|
||||||
label="Select Storage Space"
|
label="Select Storage Space"
|
||||||
density="compact"
|
density="compact"
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
style="max-width: 300px"
|
style="max-width: 300px"
|
||||||
></v-select>
|
></v-select>
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
|
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<v-alert
|
<v-alert
|
||||||
v-if="error"
|
v-if="error"
|
||||||
|
@ -26,20 +26,20 @@
|
||||||
>
|
>
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</v-alert>
|
</v-alert>
|
||||||
|
|
||||||
<div v-if="loading" class="d-flex justify-center align-center my-4">
|
<div v-if="loading" class="d-flex justify-center align-center my-4">
|
||||||
<v-progress-circular indeterminate color="primary"></v-progress-circular>
|
<v-progress-circular indeterminate color="primary"></v-progress-circular>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<v-expansion-panels v-if="selectedStorage">
|
<v-expansion-panels v-if="selectedStorage">
|
||||||
<storage-box
|
<storage-box
|
||||||
:storage="selectedStorage"
|
:storage="selectedStorage"
|
||||||
:objects="objectsInStorage"
|
:objects="objectsInStorage"
|
||||||
:nested-storages="nestedStorages"
|
:nested-storages="nestedStorages"
|
||||||
/>
|
/>
|
||||||
</v-expansion-panels>
|
</v-expansion-panels>
|
||||||
|
|
||||||
<v-alert v-else type="info" variant="tonal">
|
<v-alert v-else type="info" variant="tonal">
|
||||||
Please select a storage space to view its contents
|
Please select a storage space to view its contents
|
||||||
</v-alert>
|
</v-alert>
|
||||||
|
@ -92,13 +92,13 @@ const StorageBox = defineComponent({
|
||||||
const objectsInCurrentStorage = computed(() => {
|
const objectsInCurrentStorage = computed(() => {
|
||||||
return props.objects.filter(obj => obj.storagespaceId === props.storage.id);
|
return props.objects.filter(obj => obj.storagespaceId === props.storage.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
const childStorages = computed(() => {
|
const childStorages = computed(() => {
|
||||||
return props.nestedStorages.filter(storage =>
|
return props.nestedStorages.filter(storage =>
|
||||||
storage.parent && storage.parent.valid && storage.parent.int64 === props.storage.id
|
storage.parent && storage.parent.valid && storage.parent.int64 === props.storage.id
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
return { objectsInCurrentStorage, childStorages };
|
return { objectsInCurrentStorage, childStorages };
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
|
@ -136,7 +136,7 @@ const StorageBox = defineComponent({
|
||||||
No objects in this storage
|
No objects in this storage
|
||||||
</v-alert>
|
</v-alert>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="childStorages.length > 0" class="mt-4">
|
<div v-if="childStorages.length > 0" class="mt-4">
|
||||||
<h3 class="text-subtitle-1 mb-2">Nested storage spaces:</h3>
|
<h3 class="text-subtitle-1 mb-2">Nested storage spaces:</h3>
|
||||||
<v-expansion-panels>
|
<v-expansion-panels>
|
||||||
|
@ -186,7 +186,7 @@ watch(selectedStorageId, async (newId) => {
|
||||||
async function fetchStorageData(storageId: number): Promise<void> {
|
async function fetchStorageData(storageId: number): Promise<void> {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
error.value = null;
|
error.value = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await storageStore.fetchStorageHierarchy(storageId);
|
await storageStore.fetchStorageHierarchy(storageId);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
@ -207,7 +207,7 @@ watch(() => storageStore.storageSpaces, (newSpaces) => {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
error.value = null;
|
error.value = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await storageStore.fetchStorageSpaces();
|
await storageStore.fetchStorageSpaces();
|
||||||
if (storageSpaces.value.length > 0) {
|
if (storageSpaces.value.length > 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue