Skip to content

Commit d13b799

Browse files
kamalqureshiraheeliftikhar5
authored andcommitted
Update App meta data
1 parent 79b5e83 commit d13b799

File tree

5 files changed

+58
-8
lines changed

5 files changed

+58
-8
lines changed

client/packages/lowcoder/src/comps/comps/preLoadComp/actionConfigs.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {
55
renameComponentAction,
66
deleteComponentAction,
77
resizeComponentAction,
8-
configureComponentAction,
9-
changeLayoutAction,
8+
configureAppMetaAction,
109
addEventHandlerAction,
1110
applyStyleAction,
1211
nestComponentAction,
@@ -27,9 +26,9 @@ export const actionCategories: ActionCategory[] = [
2726
]
2827
},
2928
{
30-
key: 'component-configuration',
31-
label: 'Component Configuration',
32-
actions: [configureComponentAction]
29+
key: 'app-configuration',
30+
label: 'App Configuration',
31+
actions: [configureAppMetaAction]
3332
},
3433
{
3534
key: 'layout',

client/packages/lowcoder/src/comps/comps/preLoadComp/actionInputSection.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ import { BaseSection, Dropdown } from "lowcoder-design";
1616
import { EditorContext } from "comps/editorState";
1717
import { message } from "antd";
1818
import { CustomDropdown } from "./styled";
19-
import { generateComponentActionItems, getComponentCategories, getEditorComponentInfo, getLayoutItemsOrder } from "./utils";
19+
import {
20+
generateComponentActionItems,
21+
getComponentCategories,
22+
getEditorComponentInfo,
23+
getLayoutItemsOrder
24+
} from "./utils";
2025
import { actionRegistry, getAllActionItems } from "./actionConfigs";
2126

2227
export function ActionInputSection() {
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { message } from "antd";
2+
import { ActionConfig, ActionExecuteParams } from "../types";
3+
4+
export const configureAppMetaAction: ActionConfig = {
5+
key: 'configure-app-meta',
6+
label: 'Configure app meta data',
7+
category: 'app-configuration',
8+
requiresInput: false,
9+
execute: async (params: ActionExecuteParams) => {
10+
const { editorState } = params;
11+
const appSettingsComp = editorState.getAppSettingsComp();
12+
13+
try {
14+
// TODO: Get config data from the user
15+
let configData = {
16+
title: "Test Title",
17+
description: "Test Description",
18+
category: "Test Category"
19+
};
20+
21+
if (configData.title && appSettingsComp?.children?.title) {
22+
appSettingsComp.children.title.dispatchChangeValueAction(configData.title);
23+
}
24+
25+
if (configData.description && appSettingsComp?.children?.description) {
26+
appSettingsComp.children.description.dispatchChangeValueAction(configData.description);
27+
}
28+
29+
if (configData.category && appSettingsComp?.children?.category) {
30+
appSettingsComp.children.category.dispatchChangeValueAction(configData.category);
31+
}
32+
33+
// Display error message if no valid configuration data is provided
34+
const updatedFields = [];
35+
if (configData.title) updatedFields.push('title');
36+
if (configData.description) updatedFields.push('description');
37+
if (configData.category) updatedFields.push('category');
38+
39+
!updatedFields.length && message.info('No valid configuration data provided');
40+
41+
} catch (error) {
42+
console.error('Error updating app settings:', error);
43+
message.error('Failed to update app configuration');
44+
}
45+
}
46+
};

client/packages/lowcoder/src/comps/comps/preLoadComp/actions/componentConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ export const configureComponentAction: ActionConfig = {
6262
message.error('Invalid configuration format');
6363
}
6464
}
65-
};
65+
};

client/packages/lowcoder/src/comps/comps/preLoadComp/actions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
export * from './componentManagement';
33

44
// Component Configuration Actions
5-
export { configureComponentAction } from './componentConfiguration';
5+
export * from './appConfiguration';
66

77
// Layout Actions
88
export { changeLayoutAction, updateDynamicLayoutAction } from './componentLayout';

0 commit comments

Comments
 (0)