fix: 修复自建插件保存丢失部署策略的bug

pull/409/head
xiaojunnuo 2025-05-16 23:50:18 +08:00
parent aebb07c5cc
commit 863e74dd2e
7 changed files with 25 additions and 15 deletions

View File

@ -91,6 +91,13 @@ export function createAxiosService({ logger }: { logger: Logger }) {
// 请求拦截 // 请求拦截
service.interceptors.request.use( service.interceptors.request.use(
(config: any) => { (config: any) => {
if (config.logParams == null) {
config.logParams = false;
}
if (config.logRes == null) {
config.logRes = false;
}
logger.info(`http request:${config.url}method:${config.method}`); logger.info(`http request:${config.url}method:${config.method}`);
if (config.logParams !== false && config.params) { if (config.logParams !== false && config.params) {
logger.info(`params:${JSON.stringify(config.params)}`); logger.info(`params:${JSON.stringify(config.params)}`);

View File

@ -84,7 +84,6 @@ provide("fn:ai.open", openChat);
</template> </template>
<template #footer> <template #footer>
<PageFooter></PageFooter> <PageFooter></PageFooter>
<MaxKBChat v-if="settingsStore.sysPublic.aiChatEnabled !== false" ref="chatBox" /> <MaxKBChat v-if="settingsStore.sysPublic.aiChatEnabled !== false" ref="chatBox" />
</template> </template>
</BasicLayout> </BasicLayout>

View File

@ -488,7 +488,7 @@ const idMainContent = ELEMENT_ID_MAIN_CONTENT;
</template> </template>
</LayoutContent> </LayoutContent>
<LayoutFooter v-if="footerEnable" class="hidden md:block" :fixed="footerFixed" :height="footerHeight" :show="!isFullContent" :width="footerWidth" :z-index="zIndex"> <LayoutFooter v-if="footerEnable" class="hidden md:block" :fixed="footerFixed" :height="footerHeight" :show="!isFullContent" :width="footerWidth" :z-index="zIndex + 2">
<slot name="footer"></slot> <slot name="footer"></slot>
</LayoutFooter> </LayoutFooter>
</div> </div>

View File

@ -23,7 +23,7 @@
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<template #footer> <template #footer>
<fs-button key="aiChat" type="primary" icon="ion:color-wand-outline" @click="taskModal.onAiChat">AI</fs-button> <fs-button v-if="settingsStore.sysPublic.aiChatEnabled !== false" key="aiChat" type="primary" icon="ion:color-wand-outline" @click="taskModal.onAiChat">AI</fs-button>
<fs-button key="cancel" icon="ion:close-circle-outline" @click="taskModal.onOk"></fs-button> <fs-button key="cancel" icon="ion:close-circle-outline" @click="taskModal.onOk"></fs-button>
<fs-button key="submit" icon="ion:checkmark-circle-outline" type="primary" @click="taskModal.onOk"></fs-button> <fs-button key="submit" icon="ion:checkmark-circle-outline" type="primary" @click="taskModal.onOk"></fs-button>
</template> </template>
@ -35,7 +35,7 @@ import { computed, inject, nextTick, Ref, ref, watch } from "vue";
import { RunHistory } from "../../type"; import { RunHistory } from "../../type";
import PiStatusShow from "/@/views/certd/pipeline/pipeline/component/status-show.vue"; import PiStatusShow from "/@/views/certd/pipeline/pipeline/component/status-show.vue";
import { usePreferences } from "/@/vben/preferences"; import { usePreferences } from "/@/vben/preferences";
import { useSettingStore } from "/@/store/settings/index";
export default { export default {
name: "PiTaskView", name: "PiTaskView",
components: { PiStatusShow }, components: { PiStatusShow },
@ -70,7 +70,7 @@ export default {
for (let log of logs) { for (let log of logs) {
logText += log + "\n"; logText += log + "\n";
} }
const maxLength = 5000; const maxLength = 2500;
if (logText.length > maxLength) { if (logText.length > maxLength) {
logText = logText.substring(logText.length - maxLength); logText = logText.substring(logText.length - maxLength);
} }
@ -172,6 +172,7 @@ export default {
taskModal.value.open = false; taskModal.value.open = false;
} }
const settingsStore = useSettingStore();
return { return {
detail, detail,
taskModal, taskModal,
@ -180,6 +181,7 @@ export default {
taskViewClose, taskViewClose,
tabPosition, tabPosition,
triggerRun, triggerRun,
settingsStore,
}; };
}, },
}; };

View File

@ -204,12 +204,14 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
form: { form: {
onSuccess(opts: any) { onSuccess(opts: any) {
router.push({ if (opts.res?.id) {
name: "SysPluginEdit", router.push({
query: { name: "SysPluginEdit",
id: opts.res.id, query: {
}, id: opts.res.id,
}); },
});
}
}, },
}, },
columns: { columns: {

View File

@ -44,9 +44,6 @@ export class PluginController extends CrudController<PluginService> {
async update(@Body(ALL) bean: any) { async update(@Body(ALL) bean: any) {
const res = await super.update(bean); const res = await super.update(bean);
// 更新插件配置
const info = await this.service.info(bean.id)
await this.service.registerPlugin(info)
return res return res
} }

View File

@ -350,12 +350,15 @@ export class PluginService extends BaseService<PluginEntity> {
async registerPlugin(plugin: PluginEntity) { async registerPlugin(plugin: PluginEntity) {
const metadata = plugin.metadata ? yaml.load(plugin.metadata) : {}; const metadata = plugin.metadata ? yaml.load(plugin.metadata) : {};
const extra = plugin.extra ? yaml.load(plugin.extra) : {};
const item = { const item = {
...plugin, ...plugin,
...metadata ...metadata,
...extra
}; };
delete item.metadata; delete item.metadata;
delete item.content; delete item.content;
delete item.extra;
if (item.author) { if (item.author) {
item.name = item.author + "/" + item.name; item.name = item.author + "/" + item.name;
} }