Scope files jobs and plugins to request profile

This commit is contained in:
ekko
2026-05-24 09:25:52 +08:00
committed by ekko
parent 289a958684
commit 9708a6a521
23 changed files with 353 additions and 117 deletions
+10 -4
View File
@@ -1,17 +1,20 @@
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import { ref, computed, watch } from 'vue'
import { NButton, NSpin } from 'naive-ui'
import { useI18n } from 'vue-i18n'
import JobsPanel from '@/components/hermes/jobs/JobsPanel.vue'
import JobRunHistory from '@/components/hermes/jobs/JobRunHistory.vue'
import JobFormModal from '@/components/hermes/jobs/JobFormModal.vue'
import { useJobsStore } from '@/stores/hermes/jobs'
import { useProfilesStore } from '@/stores/hermes/profiles'
const { t } = useI18n()
const jobsStore = useJobsStore()
const profilesStore = useProfilesStore()
const showModal = ref(false)
const editingJob = ref<string | null>(null)
const selectedJobId = ref<string | null>(null)
const activeProfileName = computed(() => profilesStore.activeProfileName || 'default')
const jobNameMap = computed(() => {
const map: Record<string, string> = {}
@@ -22,9 +25,11 @@ const jobNameMap = computed(() => {
return map
})
onMounted(() => {
jobsStore.fetchJobs()
})
watch(activeProfileName, () => {
selectedJobId.value = null
jobsStore.jobs = []
void jobsStore.fetchJobs()
}, { immediate: true })
function openCreateModal() {
editingJob.value = null
@@ -80,6 +85,7 @@ function handleSelectJob(jobId: string | null) {
<JobRunHistory
:selected-job-id="selectedJobId"
:job-name-map="jobNameMap"
:profile-key="activeProfileName"
/>
</div>
</div>
@@ -1,11 +1,13 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { computed, ref, watch } from 'vue'
import { NAlert, NButton, NEmpty, NInput, NSelect, NSpin, NTag, useMessage } from 'naive-ui'
import { useI18n } from 'vue-i18n'
import { fetchPlugins, type HermesPluginInfo, type HermesPluginsMetadata } from '@/api/hermes/plugins'
import { useProfilesStore } from '@/stores/hermes/profiles'
const { t, te } = useI18n()
const message = useMessage()
const profilesStore = useProfilesStore()
const plugins = ref<HermesPluginInfo[]>([])
const warnings = ref<string[]>([])
@@ -111,7 +113,12 @@ async function copyCommand(plugin: HermesPluginInfo) {
message.success(t('plugins.commandCopied'))
}
onMounted(loadPlugins)
watch(() => profilesStore.activeProfileName || 'default', () => {
plugins.value = []
warnings.value = []
metadata.value = null
void loadPlugins()
}, { immediate: true })
</script>
<template>