Skip to content

Commit 4ed7b94

Browse files
committed
feat: add SparkleIcon component and integrate hasUI property in plugin configuration
1 parent faa3ee9 commit 4ed7b94

File tree

10 files changed

+30
-1
lines changed

10 files changed

+30
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<svg viewBox="0 0 1024 1024">
3+
<path
4+
d="M844.757608 374.443217L894.339657 255.518157l118.925061-49.582049a15.968454 15.968454 0 0 0 0-28.583533L894.339657 127.770526 844.757608 8.845466a15.968454 15.968454 0 0 0-28.583532 0L766.592026 127.770526l-118.92506 49.582049a15.968454 15.968454 0 0 0 0 28.583533L766.592026 255.518157l49.58205 118.92506a15.968454 15.968454 0 0 0 28.583532 0z m-28.583532 273.140404L766.592026 766.508681l-118.92506 49.582049a15.968454 15.968454 0 0 0 0 28.583533L766.592026 894.256312l49.58205 118.92506a15.968454 15.968454 0 0 0 28.583532 0L894.339657 894.256312l118.925061-49.582049a15.968454 15.968454 0 0 0 0-28.583533L894.339657 766.508681l-49.582049-118.92506a15.968454 15.968454 0 0 0-28.583532 0z"
5+
opacity=".4"
6+
v-bind="$attrs"
7+
></path>
8+
<path
9+
d="M766.592026 510.294839a32.056671 32.056671 0 0 0-17.645141-28.603493l-224.696107-112.55764-112.338073-225.095318c-10.858549-21.697137-46.288556-21.697137-57.127144 0l-112.338073 225.095318L17.751382 481.691346a31.936908 31.936908 0 0 0 0 57.226946l224.696106 112.557639 112.338073 225.095319a31.936908 31.936908 0 0 0 57.127144 0l112.338073-225.095319L748.946885 538.958213a32.076632 32.076632 0 0 0 17.645141-28.663374z"
10+
v-bind="$attrs"
11+
></path>
12+
</svg>
13+
</template>

frontend/src/components/Icon/icons.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const icons = [
5454
'grant',
5555
'preview',
5656
'rollback',
57+
'sparkle',
5758
] as const
5859

5960
export default icons

frontend/src/lang/locale/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ export default {
516516
path: 'Save Path',
517517
type: 'Type',
518518
menus: 'Menus',
519+
hasUI: 'Has user interface',
519520
context: 'Context',
520521
configuration: ' Configuration',
521522
menuKey: 'Menu Title',

frontend/src/lang/locale/fa.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ export default {
516516
path: 'مسیر ذخیره',
517517
type: 'نوع',
518518
menus: 'منوها',
519+
hasUI: 'دارای رابط کاربری است',
519520
context: 'متن',
520521
configuration: 'پیکربندی',
521522
menuKey: 'عنوان منو',

frontend/src/lang/locale/ru.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ export default {
516516
path: 'Путь сохранения',
517517
type: 'Тип',
518518
menus: 'Меню',
519+
hasUI: 'Есть пользовательский интерфейс',
519520
context: 'Контекст',
520521
configuration: 'Конфигурация',
521522
menuKey: 'Название меню',

frontend/src/lang/locale/zh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ export default {
515515
path: '保存路径',
516516
type: '类型',
517517
menus: '菜单',
518+
hasUI: '是否具有用户界面',
518519
context: '上下文',
519520
configuration: '配置',
520521
menuKey: '菜单名称',

frontend/src/stores/plugins.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const usePluginsStore = defineStore('plugins', () => {
8383
list && (pluginHub.value = JSON.parse(list))
8484

8585
for (let i = 0; i < plugins.value.length; i++) {
86-
const { id, triggers, path, context } = plugins.value[i]
86+
const { id, triggers, path, context, hasUI } = plugins.value[i]
8787
const code = await ignoredError(Readfile, path)
8888
if (code) {
8989
PluginsCache[id] = { plugin: plugins.value[i], code }
@@ -101,6 +101,10 @@ export const usePluginsStore = defineStore('plugins', () => {
101101
scheduledtasks: {},
102102
}
103103
}
104+
105+
if (hasUI === undefined) {
106+
plugins.value[i].hasUI = false
107+
}
104108
}
105109
}
106110

frontend/src/types/app.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export interface Plugin {
111111
url: string
112112
path: string
113113
triggers: PluginTrigger[]
114+
hasUI: boolean
114115
menus: Record<string, string>
115116
context: {
116117
profiles: Recordable

frontend/src/views/PluginsView/components/PluginForm.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const plugin = ref<Plugin>({
3333
status: 0,
3434
path: `data/plugins/plugin-${pluginID}.js`,
3535
triggers: [PluginTrigger.OnManual],
36+
hasUI: false,
3637
menus: {},
3738
context: {
3839
profiles: {},
@@ -202,6 +203,10 @@ if (props.isUpdate) {
202203
</Button>
203204
</Divider>
204205
<div v-show="showMore">
206+
<div class="form-item">
207+
<div class="name">{{ t('plugin.hasUI') }}</div>
208+
<Switch v-model="plugin.hasUI" />
209+
</div>
205210
<div class="form-item" :class="{ 'flex-start': Object.keys(plugin.menus).length !== 0 }">
206211
<div class="name">{{ t('plugin.menus') }}</div>
207212
<KeyValueEditor

frontend/src/views/PluginsView/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ const onSortUpdate = debounce(pluginsStore.savePlugins, 1000)
410410
v-if="!p.disabled && (!p.install || p.installed)"
411411
@click="handleOnRun(p)"
412412
:loading="p.running"
413+
:icon="p.hasUI ? 'sparkle' : undefined"
413414
type="primary"
414415
size="small"
415416
auto-size

0 commit comments

Comments
 (0)