@social-mail/social-mail-client 1.2.182 → 1.2.183

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.2.182",
3
+ "version": "1.2.183",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,6 +32,12 @@ export default class AdminCommands extends CommonCommands {
32
32
  openPage: () => import("../../common/pages/mailboxes/MailboxListPage")
33
33
  });
34
34
 
35
+ static config = Command.create({
36
+ route: "/admin/config",
37
+ routeOrder: 100,
38
+ openPage: () => import("../pages/config/ConfigPage")
39
+ });
40
+
35
41
  static editRelay = Command.create({
36
42
  openPage: () => import("../pages/relays/edit/EditRelayPage")
37
43
  });
@@ -76,6 +76,11 @@ export default class AdminDrawer extends Drawer {
76
76
  label="Web Sites"
77
77
  commandLink={CommonCommands.openWebSiteList.displayRoute({})}
78
78
  />
79
+ <MenuItem
80
+ icon="fas fa-gear"
81
+ label="Config"
82
+ commandLink={AdminCommands.config.displayRoute({})}
83
+ />
79
84
  <MenuItem
80
85
  icon="fas fa-hard-drive"
81
86
  label="Repair"
@@ -1,5 +1,77 @@
1
+ import InjectProperty from "@web-atoms/core/dist/core/InjectProperty";
1
2
  import { ContentPage } from "@web-atoms/web-controls/dist/mobile-app/MobileApp";
3
+ import EntityService from "../../../services/EntityService";
4
+ import XNode from "@web-atoms/core/dist/core/XNode";
5
+ import AtomRepeater from "@web-atoms/web-controls/dist/basic/AtomRepeater";
6
+ import DropDown from "@web-atoms/web-controls/dist/basic/DropDown";
7
+ import Bind from "@web-atoms/core/dist/core/Bind";
8
+ import { Configuration, IConfiguration } from "../../../model/model";
9
+ import Form from "@web-atoms/web-controls/dist/basic/Form";
10
+ import FormField from "@web-atoms/web-controls/dist/basic/FormField";
11
+ import MonacoService from "../../../code-editor/MonacoService";
12
+ import { SaveIconTextButton } from "../../../common/controls/buttons/IconButton";
13
+ import Action from "@web-atoms/core/dist/view-model/Action";
2
14
 
3
15
  export default class ConfigPage extends ContentPage {
4
-
16
+
17
+ @InjectProperty
18
+ entityService: EntityService;
19
+
20
+ selectedConfig: IConfiguration = null;
21
+ monacoService: MonacoService;
22
+
23
+ get code() {
24
+ return this.monacoService.editor.getModel().getValue();
25
+ }
26
+ set code(v) {
27
+ if (!v) {
28
+ return;
29
+ }
30
+ this.monacoService?.setCodeModel(this, v, "https://a/a.json");
31
+ }
32
+
33
+
34
+ async init() {
35
+
36
+ this.renderer = <div
37
+ data-display="grid"
38
+ data-align-items="stretch"
39
+ data-justify-items="stretch"
40
+ code={Bind.oneWay(() => this.selectedConfig.configValue)}>
41
+ <iframe
42
+ data-border="none"
43
+ data-padding="auto"
44
+ />
45
+ </div>;
46
+
47
+ const iframe = this.element.querySelector("iframe");
48
+
49
+ const items = await this.entityService.query(Configuration).toArray();
50
+ this.selectedConfig = items.find((x) => x.name === "UIPackageConfig");
51
+
52
+ this.monacoService = await MonacoService.createEditor(this, iframe);
53
+
54
+ this.code = this.selectedConfig.configValue;
55
+ this.headerRenderer = () => <div data-layout="header-row">
56
+ <DropDown
57
+ items={items}
58
+ selectedItem={Bind.twoWaysImmediate(() => this.selectedConfig)}
59
+ labelPath={(item) => item.name}
60
+ />
61
+ </div>;
62
+
63
+ this.footerRenderer = () => <div data-layout="command-row">
64
+ <SaveIconTextButton
65
+ data-click-event="save-config"
66
+ />
67
+ </div>;
68
+ }
69
+
70
+ @Action({
71
+ onEvent: "save-config",
72
+ success: "Config saved successfully."
73
+ })
74
+ async save() {
75
+ await this.entityService.save(this.selectedConfig);
76
+ }
5
77
  }