refactor: Update Woodpecker CI config and StorageHierarchy component

This commit is contained in:
garionion 2025-03-02 11:47:10 +01:00
parent 6400eb9513
commit d652903734
2 changed files with 29 additions and 25 deletions

View file

@ -1,14 +1,15 @@
pipeline:
variables:
- &golang_image 'golang:1.24'
steps:
backend-lint:
image: golang:1.21
group: lint
image: *golang_image
commands:
- go vet ./...
- go fmt ./...
frontend-lint:
image: node:20
group: lint
commands:
- cd web
- npm ci
@ -20,18 +21,19 @@ pipeline:
- cd web
- npm ci
- npm run build
when:
status: [success]
depends_on:
- frontend-lint
backend-build:
image: golang:1.21
image: *golang_image
commands:
- go mod download
- go generate ./...
# Build with embedded frontend
- go build -o inventory -ldflags="-s -w" .
when:
status: [success]
depends_on:
- frontend-build
- backend-lint
# Create artifacts
artifacts:
@ -40,8 +42,8 @@ pipeline:
- mkdir -p artifacts
- cp inventory artifacts/
- tar -czvf artifacts/inventory.tar.gz inventory
when:
status: [success]
depends_on:
- backend-build
# Optional step for creating a Docker image
docker-build:
@ -52,7 +54,9 @@ pipeline:
- latest
- ${DRONE_TAG##v}
dockerfile: Dockerfile
depends_on:
- backend-lint
- frontend-lint
when:
branch: main
event: [push, tag]
status: [success]

View file

@ -7,7 +7,7 @@
<v-select
v-model="selectedStorageId"
:items="storageSpaces"
item-title="location"
item-title="name"
item-value="id"
label="Select Storage Space"
density="compact"
@ -16,7 +16,7 @@
style="max-width: 300px"
></v-select>
</v-card-title>
<v-card-text>
<v-alert
v-if="error"
@ -26,20 +26,20 @@
>
{{ error }}
</v-alert>
<div v-if="loading" class="d-flex justify-center align-center my-4">
<v-progress-circular indeterminate color="primary"></v-progress-circular>
</div>
<template v-else>
<v-expansion-panels v-if="selectedStorage">
<storage-box
:storage="selectedStorage"
<storage-box
:storage="selectedStorage"
:objects="objectsInStorage"
:nested-storages="nestedStorages"
/>
</v-expansion-panels>
<v-alert v-else type="info" variant="tonal">
Please select a storage space to view its contents
</v-alert>
@ -92,13 +92,13 @@ const StorageBox = defineComponent({
const objectsInCurrentStorage = computed(() => {
return props.objects.filter(obj => obj.storagespaceId === props.storage.id);
});
const childStorages = computed(() => {
return props.nestedStorages.filter(storage =>
return props.nestedStorages.filter(storage =>
storage.parent && storage.parent.valid && storage.parent.int64 === props.storage.id
);
});
return { objectsInCurrentStorage, childStorages };
},
template: `
@ -136,7 +136,7 @@ const StorageBox = defineComponent({
No objects in this storage
</v-alert>
</div>
<div v-if="childStorages.length > 0" class="mt-4">
<h3 class="text-subtitle-1 mb-2">Nested storage spaces:</h3>
<v-expansion-panels>
@ -186,7 +186,7 @@ watch(selectedStorageId, async (newId) => {
async function fetchStorageData(storageId: number): Promise<void> {
loading.value = true;
error.value = null;
try {
await storageStore.fetchStorageHierarchy(storageId);
} catch (err: any) {
@ -207,7 +207,7 @@ watch(() => storageStore.storageSpaces, (newSpaces) => {
onMounted(async () => {
loading.value = true;
error.value = null;
try {
await storageStore.fetchStorageSpaces();
if (storageSpaces.value.length > 0) {