feat(node): Implements node group selection functionality
- Introduces the Group entity and groupRepository - Adds a new database utility function, getDatabase, to centrally retrieve database instances - Removes the loading state and skeleton screen logic from nodeList to simplify the page structure - Updates dependencies and adds the zod library for data validation
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import {ref, onMounted, computed} from 'vue'
|
||||
import {computed, onMounted, ref} from 'vue'
|
||||
import {invoke} from '@tauri-apps/api/core'
|
||||
import Database from '@tauri-apps/plugin-sql'
|
||||
import {Group, groupRepository} from "@/entities/group.ts";
|
||||
|
||||
defineProps<{
|
||||
groupId: string
|
||||
@@ -10,6 +11,13 @@ defineProps<{
|
||||
const db = ref<any>(null)
|
||||
const db_ready = ref(false)
|
||||
|
||||
const allGroups = ref<Group[]>([])
|
||||
|
||||
|
||||
const loadGroups = async () => {
|
||||
allGroups.value = await groupRepository.findAll()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
db.value = await Database.load('sqlite:spary.db')
|
||||
db_ready.value = true
|
||||
@@ -64,6 +72,8 @@ async function add_node(nodeAlias: string, nodeArguments: string | null) {
|
||||
isAdding.value = false
|
||||
}
|
||||
}
|
||||
|
||||
loadGroups()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -74,7 +84,13 @@ async function add_node(nodeAlias: string, nodeArguments: string | null) {
|
||||
v-model="nodeAlias"
|
||||
label="Node alias"
|
||||
></v-text-field>
|
||||
<v-select></v-select>
|
||||
<v-select
|
||||
label="Group"
|
||||
:items="allGroups"
|
||||
item-title="name"
|
||||
item-value="id"
|
||||
variant="solo"
|
||||
></v-select>
|
||||
|
||||
<v-textarea
|
||||
v-model="nodeArguments"
|
||||
|
||||
Reference in New Issue
Block a user