diff --git a/plugins/config/client/components/forks.vue b/plugins/config/client/components/forks.vue new file mode 100644 index 00000000..22ceac0d --- /dev/null +++ b/plugins/config/client/components/forks.vue @@ -0,0 +1,114 @@ + + + + + {{ dialogFork + (local?.workspace ? ' (工作区)' : '') }} + + + + + + + {{ getFullPath(plugins.paths[id]) }} + + + + + + + + + + + 添加新配置 + + + + + + + diff --git a/plugins/config/client/components/index.vue b/plugins/config/client/components/index.vue index 08accda2..91bd3790 100644 --- a/plugins/config/client/components/index.vue +++ b/plugins/config/client/components/index.vue @@ -32,7 +32,7 @@ @closed="remove = null" > - 确定要移除{{ remove.children ? `分组 ${remove.alias}` : `插件 ${remove.name}` }} 吗?此操作不可撤销! + 确定要移除{{ remove.children ? `分组 ${remove.label || remove.path}` : `插件 ${remove.label || remove.name}` }} 吗?此操作不可撤销! 取消 @@ -62,7 +62,7 @@ import { computed, ref, watch } from 'vue' import { useRoute, useRouter } from 'vue-router' import { clone, message, send, store, useContext, Schema } from '@koishijs/client' -import { Tree, getFullName, addItem, hasCoreDeps, current, plugins, removeItem, select } from './utils' +import { Tree, getFullName, addItem, hasCoreDeps, current, plugins, removeItem, dialogSelect } from './utils' import GlobalSettings from './global.vue' import GroupSettings from './group.vue' import TreeView from './tree.vue' @@ -109,7 +109,7 @@ ctx.define('config.tree', current) ctx.action('config.tree.add-plugin', { disabled: ({ config }) => config.tree.path && !config.tree.children, - action: ({ config }) => select.value = config.tree, + action: ({ config }) => dialogSelect.value = config.tree, }) ctx.action('config.tree.add-group', { @@ -120,7 +120,7 @@ ctx.action('config.tree.add-group', { ctx.action('config.tree.rename', { disabled: ({ config }) => !config.tree.path, action: ({ config }) => { - input.value = config.tree.label || (config.tree.name === 'group' ? config.tree.alias : config.tree.name) + input.value = config.tree.label || (config.tree.name === 'group' ? config.tree.path : config.tree.name) rename.value = config.tree }, }) diff --git a/plugins/config/client/components/plugin.vue b/plugins/config/client/components/plugin.vue index abd560bf..b1c106d9 100644 --- a/plugins/config/client/components/plugin.vue +++ b/plugins/config/client/components/plugin.vue @@ -8,15 +8,8 @@ - - - - 此插件已在运行且不可重用,启用可能会导致非预期的问题。 - - - - + - + 此插件将会提供 {{ name }} 服务,但此服务已被其他插件实现。 @@ -47,6 +40,16 @@ + + + + 此插件已在运行且不可重用,启用可能会导致非预期的问题。 + + + 此插件存在多份配置,点击前往管理。 + + + @@ -94,7 +97,7 @@ import { activities, store, send } from '@koishijs/client' import { computed, provide, watch } from 'vue' -import { envMap, name, SettingsData, Tree } from './utils' +import { envMap, name, plugins, SettingsData, dialogFork, Tree } from './utils' import KModifier from './modifier.vue' const props = defineProps<{ @@ -109,6 +112,8 @@ const config = computed({ set: value => emit('update:modelValue', value), }) +const shortname = computed(() => name.value.replace(/(koishi-|^@koishijs\/)plugin-/, '')) + const env = computed(() => envMap.value[name.value]) const local = computed(() => store.packages[name.value]) const hint = computed(() => local.value.workspace ? '请检查插件源代码。' : '请联系插件作者并反馈此问题。') diff --git a/plugins/config/client/components/select.vue b/plugins/config/client/components/select.vue index a1ab7c83..46c15c6a 100644 --- a/plugins/config/client/components/select.vue +++ b/plugins/config/client/components/select.vue @@ -1,8 +1,8 @@ @@ -30,7 +30,7 @@ import { router, send, store, useI18nText } from '@koishijs/client' import { computed, inject, nextTick, ref, watch } from 'vue' import { PackageProvider } from '@koishijs/plugin-config' -import { select } from './utils' +import { dialogSelect } from './utils' const tt = useI18nText() @@ -44,14 +44,14 @@ const packages = computed(() => Object.values(store.packages).filter(({ name, sh })) function configure(shortname: string) { - const path = select.value.path + const path = dialogSelect.value.path const ident = Math.random().toString(36).slice(2, 8) - select.value = null + dialogSelect.value = null send('manager/unload', path, shortname + ':' + ident, {}) router.push('/plugins/' + ident) } -watch(select, async (value) => { +watch(dialogSelect, async (value) => { if (!value) return await nextTick() await input.value.focus() diff --git a/plugins/config/client/components/tree.vue b/plugins/config/client/components/tree.vue index 9138d8fa..f24d835f 100644 --- a/plugins/config/client/components/tree.vue +++ b/plugins/config/client/components/tree.vue @@ -28,7 +28,7 @@ {{ getLabel(node) }} - + @@ -38,9 +38,8 @@
此插件已在运行且不可重用,启用可能会导致非预期的问题。
此插件将会提供 {{ name }} 服务,但此服务已被其他插件实现。
此插件存在多份配置,点击前往管理。