MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / getFrontendLayoutConfig

Function getFrontendLayoutConfig

panel/src/app/service/frontend_layout.ts:15–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13}
14
15export function getFrontendLayoutConfig(): string {
16 let layoutConfig: string = "";
17 if (storage.fileExists(LAYOUT_CONFIG_NAME)) {
18 layoutConfig = storage.readFile(LAYOUT_CONFIG_NAME);
19 }
20 if (layoutConfig) {
21 if (GlobalVariable.get("versionChange")) {
22 const latestLayoutConfig = getDefaultFrontendLayoutConfig();
23 const currentLayoutConfig = JSON.parse(layoutConfig) as IPageLayoutConfig[];
24 for (const page of latestLayoutConfig) {
25 if (!currentLayoutConfig.find((item) => item.page === page.page)) {
26 currentLayoutConfig.push(page);
27 }
28 }
29 GlobalVariable.set("versionChange", null);
30 setFrontendLayoutConfig(currentLayoutConfig);
31 return JSON.stringify(currentLayoutConfig);
32 }
33 return layoutConfig as string;
34 } else {
35 return JSON.stringify(getDefaultFrontendLayoutConfig());
36 }
37}
38
39export function setFrontendLayoutConfig(config: IPageLayoutConfig[]) {
40 storage.writeFile(LAYOUT_CONFIG_NAME, JSON.stringify(config, null, 2));

Callers 2

initVersionManagerFunction · 0.90
settings_router.tsFile · 0.90

Calls 7

setFrontendLayoutConfigFunction · 0.85
fileExistsMethod · 0.80
readFileMethod · 0.45
getMethod · 0.45
pushMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected