fix: 修复变更面板类型不会更新的bug

pull/56/head
moonrailgun 3 years ago
parent 1cd533f8ce
commit e7eea31a46

@ -285,6 +285,7 @@ export async function modifyGroupPanel(
panelId: string, panelId: string,
options: { options: {
name: string; name: string;
type: number;
parentId?: string; parentId?: string;
provider?: string; provider?: string;
pluginPanelName?: string; pluginPanelName?: string;

@ -1,9 +1,9 @@
{ {
"label": "posthog", "label": "Posthog",
"name": "com.msgbyte.posthog", "name": "com.msgbyte.posthog",
"url": "/plugins/com.msgbyte.posthog/index.js", "url": "/plugins/com.msgbyte.posthog/index.js",
"version": "0.0.0", "version": "0.0.0",
"author": "moonrailgun", "author": "moonrailgun",
"description": "Posthog 数据统计", "description": "Posthog 数据统计",
"requireRestart": true "requireRestart": true
} }

@ -42,7 +42,7 @@ export const ModalModifyGroupPanel: React.FC<{
await modifyGroupPanel( await modifyGroupPanel(
props.groupId, props.groupId,
props.groupPanelId, props.groupPanelId,
_omit(buildDataFromValues(values), 'type') // 发送时不传type buildDataFromValues(values)
); );
showToasts(t('修改成功'), 'success'); showToasts(t('修改成功'), 'success');
typeof props.onSuccess === 'function' && props.onSuccess(); typeof props.onSuccess === 'function' && props.onSuccess();

@ -112,6 +112,7 @@ class GroupService extends TcService {
groupId: 'string', groupId: 'string',
panelId: 'string', panelId: 'string',
name: 'string', name: 'string',
type: 'number',
provider: { type: 'string', optional: true }, provider: { type: 'string', optional: true },
pluginPanelName: { type: 'string', optional: true }, pluginPanelName: { type: 'string', optional: true },
meta: { type: 'object', optional: true }, meta: { type: 'object', optional: true },
@ -640,12 +641,13 @@ class GroupService extends TcService {
groupId: string; groupId: string;
panelId: string; panelId: string;
name: string; name: string;
type: number;
provider?: string; provider?: string;
pluginPanelName?: string; pluginPanelName?: string;
meta?: object; meta?: object;
}> }>
) { ) {
const { groupId, panelId, name, provider, pluginPanelName, meta } = const { groupId, panelId, name, type, provider, pluginPanelName, meta } =
ctx.params; ctx.params;
const { t, userId } = ctx.meta; const { t, userId } = ctx.meta;
@ -666,6 +668,7 @@ class GroupService extends TcService {
{ {
$set: { $set: {
'panels.$[element].name': name, 'panels.$[element].name': name,
'panels.$[element].type': type,
'panels.$[element].provider': provider, 'panels.$[element].provider': provider,
'panels.$[element].pluginPanelName': pluginPanelName, 'panels.$[element].pluginPanelName': pluginPanelName,
'panels.$[element].meta': meta, 'panels.$[element].meta': meta,

Loading…
Cancel
Save