@finsemble/finsemble-ui 7.2.0 → 7.3.0

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.
Files changed (126) hide show
  1. package/package.json +14 -14
  2. package/react/assets/css/button.css +34 -6
  3. package/react/assets/css/contextMenu.css +118 -0
  4. package/react/assets/css/notificationsCenter.css +3 -214
  5. package/react/assets/css/userPreferences.css +2 -2
  6. package/react/components/common/Checkbox.d.ts +3 -2
  7. package/react/components/common/Checkbox.js +5 -21
  8. package/react/components/common/Checkbox.js.map +1 -1
  9. package/react/components/common/ContextMenu.d.ts +13 -0
  10. package/react/components/common/ContextMenu.js +69 -0
  11. package/react/components/common/ContextMenu.js.map +1 -0
  12. package/react/components/common/DropdownButton.d.ts +0 -4
  13. package/react/components/common/DropdownButton.js +39 -10
  14. package/react/components/common/DropdownButton.js.map +1 -1
  15. package/react/components/common/css/FinsembleToggle.css +0 -1
  16. package/react/components/common/css/application-edit-page.css +3 -4
  17. package/react/components/common/css/checkbox.css +60 -21
  18. package/react/components/common/css/icon.css +2 -2
  19. package/react/components/common/css/toggle.css +4 -1
  20. package/react/components/common/helpers.js +9 -0
  21. package/react/components/common/helpers.js.map +1 -1
  22. package/react/components/common/stories/ContextMenu.stories.d.ts +38 -0
  23. package/react/components/common/stories/ContextMenu.stories.js +70 -0
  24. package/react/components/common/stories/ContextMenu.stories.js.map +1 -0
  25. package/react/components/common/stories/DropdownButton.stories.d.ts +3 -3
  26. package/react/components/common/stories/DropdownButton.stories.js +11 -10
  27. package/react/components/common/stories/DropdownButton.stories.js.map +1 -1
  28. package/react/components/common/tests/Checkbox.spec.js +10 -12
  29. package/react/components/common/tests/Checkbox.spec.js.map +1 -1
  30. package/react/components/common/tests/ContextMenu.spec.d.ts +1 -0
  31. package/react/components/common/tests/ContextMenu.spec.js +108 -0
  32. package/react/components/common/tests/ContextMenu.spec.js.map +1 -0
  33. package/react/components/common/tests/DropdownButton.spec.d.ts +1 -0
  34. package/react/components/common/tests/DropdownButton.spec.js +32 -0
  35. package/react/components/common/tests/DropdownButton.spec.js.map +1 -0
  36. package/react/components/fdc3Resolver/ResolverDialog.js +5 -1
  37. package/react/components/fdc3Resolver/ResolverDialog.js.map +1 -1
  38. package/react/components/notifications/components/drawer/DrawerHeader.js +3 -3
  39. package/react/components/notifications/components/drawer/DrawerHeader.js.map +1 -1
  40. package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js +1 -0
  41. package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js.map +1 -1
  42. package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js +2 -0
  43. package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js.map +1 -1
  44. package/react/components/notifications/components/shared/IconButton.js +2 -1
  45. package/react/components/notifications/components/shared/IconButton.js.map +1 -1
  46. package/react/components/notifications/components/shared/NotificationCardShell.d.ts +2 -0
  47. package/react/components/notifications/components/shared/NotificationCardShell.js +55 -49
  48. package/react/components/notifications/components/shared/NotificationCardShell.js.map +1 -1
  49. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js +2 -3
  50. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js.map +1 -1
  51. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.d.ts +4 -0
  52. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js +92 -13
  53. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js.map +1 -1
  54. package/react/components/notifications/components/views/ListView.js +5 -9
  55. package/react/components/notifications/components/views/ListView.js.map +1 -1
  56. package/react/components/notifications/css/notification-card.css +165 -0
  57. package/react/components/notifications/stories/NotificationCardShell.stories.d.ts +14 -0
  58. package/react/components/notifications/stories/NotificationCardShell.stories.js +108 -0
  59. package/react/components/notifications/stories/NotificationCardShell.stories.js.map +1 -0
  60. package/react/components/notifications/tests/NotificationCardShell.spec.d.ts +1 -0
  61. package/react/components/notifications/tests/NotificationCardShell.spec.js +91 -0
  62. package/react/components/notifications/tests/NotificationCardShell.spec.js.map +1 -0
  63. package/react/components/notifications/types.d.ts +4 -2
  64. package/react/components/notifications/types.js.map +1 -1
  65. package/react/components/sdd/AddApp.d.ts +3 -3
  66. package/react/components/sdd/AddApp.js +29 -21
  67. package/react/components/sdd/AddApp.js.map +1 -1
  68. package/react/components/sdd/AppEditPage.js +1 -8
  69. package/react/components/sdd/AppEditPage.js.map +1 -1
  70. package/react/components/sdd/Appearance.css +2 -1
  71. package/react/components/sdd/Applications.js +7 -7
  72. package/react/components/sdd/Applications.js.map +1 -1
  73. package/react/components/sdd/Navigation.js +2 -4
  74. package/react/components/sdd/Navigation.js.map +1 -1
  75. package/react/components/sdd/common/views.js +1 -14
  76. package/react/components/sdd/common/views.js.map +1 -1
  77. package/react/components/sdd/css/addApp.css +64 -1
  78. package/react/components/sdd/css/nav.css +50 -29
  79. package/react/components/sdd/fixtures/views.js +1 -14
  80. package/react/components/sdd/fixtures/views.js.map +1 -1
  81. package/react/components/sdd/tests/AddApp.spec.js +2 -2
  82. package/react/components/sdd/tests/AddApp.spec.js.map +1 -1
  83. package/react/components/sdd/tests/AppEditPage.spec.js +5 -8
  84. package/react/components/sdd/tests/AppEditPage.spec.js.map +1 -1
  85. package/react/components/sdd/tests/Export.spec.js +11 -11
  86. package/react/components/sdd/tests/Export.spec.js.map +1 -1
  87. package/react/components/sdd/tests/ExportZip.spec.js +3 -3
  88. package/react/components/sdd/tests/ExportZip.spec.js.map +1 -1
  89. package/react/components/sdd/tests/Navigation.spec.js +3 -2
  90. package/react/components/sdd/tests/Navigation.spec.js.map +1 -1
  91. package/react/components/sdd/tests/SmartDesktopDesigner.spec.js +1 -2
  92. package/react/components/sdd/tests/SmartDesktopDesigner.spec.js.map +1 -1
  93. package/react/components/toolbar/dashbar/Dashbar.js +18 -14
  94. package/react/components/toolbar/dashbar/Dashbar.js.map +1 -1
  95. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.d.ts +9 -1
  96. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js +35 -1
  97. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js.map +1 -1
  98. package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js +1 -1
  99. package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js.map +1 -1
  100. package/react/components/userPreferences/components/content/Workspaces.d.ts +3 -1
  101. package/react/components/userPreferences/components/content/Workspaces.js +20 -3
  102. package/react/components/userPreferences/components/content/Workspaces.js.map +1 -1
  103. package/react/components/userPreferences/components/workspaces/WorkspaceItem.d.ts +1 -0
  104. package/react/components/userPreferences/components/workspaces/WorkspaceItem.js +3 -2
  105. package/react/components/userPreferences/components/workspaces/WorkspaceItem.js.map +1 -1
  106. package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js +12 -9
  107. package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js.map +1 -1
  108. package/react/components/userPreferences/tests/UserPreferencesBase.spec.js +2 -0
  109. package/react/components/userPreferences/tests/UserPreferencesBase.spec.js.map +1 -1
  110. package/react/components/windowTitleBar/WindowTitleBarShell.d.ts +99 -26
  111. package/react/components/windowTitleBar/WindowTitleBarShell.js +206 -138
  112. package/react/components/windowTitleBar/WindowTitleBarShell.js.map +1 -1
  113. package/react/components/windowTitleBar/components/left/LinkerButton.js +30 -21
  114. package/react/components/windowTitleBar/components/left/LinkerButton.js.map +1 -1
  115. package/react/hooks/useNotifications.js +8 -7
  116. package/react/hooks/useNotifications.js.map +1 -1
  117. package/react/tsconfig.tsbuildinfo +1 -1
  118. package/react/components/notifications/components/shared/OverflowMenu.d.ts +0 -16
  119. package/react/components/notifications/components/shared/OverflowMenu.js +0 -114
  120. package/react/components/notifications/components/shared/OverflowMenu.js.map +0 -1
  121. package/react/components/sdd/GettingStarted.d.ts +0 -8
  122. package/react/components/sdd/GettingStarted.js +0 -25
  123. package/react/components/sdd/GettingStarted.js.map +0 -1
  124. package/react/components/sdd/stories/GettingStarted.stories.d.ts +0 -11
  125. package/react/components/sdd/stories/GettingStarted.stories.js +0 -18
  126. package/react/components/sdd/stories/GettingStarted.stories.js.map +0 -1
@@ -8,6 +8,9 @@ import { MenuItem } from "../../../menu/MenuItem";
8
8
  import { Actions as WorkspaceManagementMenuActions } from "../stores/workspaceManagementMenuStore";
9
9
  import { FavoriteMaker } from "../../../favorites/FavoriteMaker";
10
10
  import { useFavorites } from "../../../../hooks/useFavorites";
11
+ const WORKSPACE_PREFERENCES = {
12
+ PERMANENT_WORKSPACES: "finsemble.servicesConfig.workspace.permanentWorkspaces",
13
+ };
11
14
  const RemoveWorkspace = (props) => {
12
15
  const { workspace } = props;
13
16
  const { isFavorited, removeFavorite } = useFavorites();
@@ -30,6 +33,10 @@ export default class Workspace extends React.Component {
30
33
  constructor(props) {
31
34
  super(props);
32
35
  this.bindCorrectContext();
36
+ this.state = {
37
+ permanentWorkspaces: [],
38
+ };
39
+ this.addListeners();
33
40
  }
34
41
  /**
35
42
  * This is necessary to make sure that the `this` inside of the callback is correct.
@@ -38,6 +45,8 @@ export default class Workspace extends React.Component {
38
45
  */
39
46
  bindCorrectContext() {
40
47
  this.onClick = this.onClick.bind(this);
48
+ this.addListeners = this.addListeners.bind(this);
49
+ this.setPermanentWorkspaces = this.setPermanentWorkspaces.bind(this);
41
50
  }
42
51
  /**
43
52
  * When the main body of the component is clicked, we fire off the mainAction. By default this is to switch workspaces.
@@ -49,6 +58,31 @@ export default class Workspace extends React.Component {
49
58
  name: this.props.workspace.name,
50
59
  });
51
60
  }
61
+ setPermanentWorkspaces(err, config) {
62
+ FSBL.Clients.Logger.system.log("Workspaces new permanentWorkspaces config", config);
63
+ const { permanentWorkspaces } = config.value.workspace;
64
+ if (permanentWorkspaces && Array.isArray(permanentWorkspaces)) {
65
+ this.setState({
66
+ permanentWorkspaces: permanentWorkspaces,
67
+ });
68
+ }
69
+ }
70
+ addListeners() {
71
+ FSBL.Clients.ConfigClient.addListener({ field: "finsemble.servicesConfig" }, this.setPermanentWorkspaces);
72
+ }
73
+ componentDidMount() {
74
+ // load preferences values from config and set component state on mount
75
+ FSBL.Clients.ConfigClient.getValue(WORKSPACE_PREFERENCES.PERMANENT_WORKSPACES, (err, value) => {
76
+ if (err) {
77
+ FSBL.Clients.Logger.system.error("render.getValues error", err);
78
+ }
79
+ if (value)
80
+ this.setState({ permanentWorkspaces: value });
81
+ });
82
+ }
83
+ componentWillUnmount() {
84
+ FSBL.Clients.ConfigClient.removeListener({ field: "finsemble.servicesConfig" }, this.setPermanentWorkspaces);
85
+ }
52
86
  /**
53
87
  * Render method.
54
88
  *
@@ -66,7 +100,7 @@ export default class Workspace extends React.Component {
66
100
  !showSpinner && dragHandle && dragHandle.iconClass && React.createElement("span", { className: dragHandle.iconClass }),
67
101
  React.createElement("span", { className: "workspace-name", title: workspace.name }, workspace.name),
68
102
  React.createElement("div", { className: "menu-item-row-push-right" },
69
- !isActiveWorkspace && !workspace.permanent && React.createElement(RemoveWorkspace, { workspace: workspace }),
103
+ !isActiveWorkspace && !workspace.permanent && !this.state.permanentWorkspaces.includes(workspace.name) && (React.createElement(RemoveWorkspace, { workspace: workspace })),
70
104
  React.createElement(FavoriteMaker, { id: workspace.name, name: workspace.name, category: "Workspace", className: "menu-item-icon" })))));
71
105
  }
72
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Workspace.js","sourceRoot":"","sources":["../../../../../src/components/toolbar/workspaceManagementMenu/components/Workspace.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAW9D,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IACv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qB,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAEvF,wCAAwC;QAExC,MAAM,WAAW,GAAG,qBAAqB,IAAI,iBAAiB,CAAC;QAE/D,IAAI,OAAO,GAAG,iBAAiB,CAAC,CAAC,CAAC,2CAA2C,CAAC,CAAC,CAAC,0BAA0B,CAAC;QAE3G,OAAO,CACN,oBAAC,QAAQ,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO;YAClD,6BAAK,SAAS,EAAC,eAAe;gBAC5B,WAAW,IAAI,8BAAM,SAAS,EAAC,aAAa,iBAAkB;gBAC9D,CAAC,WAAW,IAAI,UAAU,IAAI,UAAU,CAAC,SAAS,IAAI,8BAAM,SAAS,EAAE,UAAU,CAAC,SAAS,GAAS;gBACrG,8BAAM,SAAS,EAAC,gBAAgB,EAAC,KAAK,EAAE,SAAS,CAAC,IAAI,IACpD,SAAS,CAAC,IAAI,CACT;gBACP,6BAAK,SAAS,EAAC,0BAA0B;oBACvC,CAAC,iBAAiB,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,oBAAC,eAAe,IAAC,SAAS,EAAE,SAAS,GAAI;oBACxF,oBAAC,aAAa,IACb,EAAE,EAAE,SAAS,CAAC,IAAI,EAClB,IAAI,EAAE,SAAS,CAAC,IAAI,EACpB,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAC,gBAAgB,GACzB,CACG,CACD,CACI,CACX,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright 2017 by ChartIQ, Inc.\n * All rights reserved.\n * This is a single workspace. When clicked, it requests that the app switch to the clicked workspace.\n */\n\nimport React from \"react\";\nimport { MenuItem } from \"../../../menu/MenuItem\";\nimport { Actions as WorkspaceManagementMenuActions } from \"../stores/workspaceManagementMenuStore\";\nimport { FavoriteMaker } from \"../../../favorites/FavoriteMaker\";\nimport { useFavorites } from \"../../../../hooks/useFavorites\";\nimport { Workspace as WorkspaceType } from \"@finsemble/finsemble-api/types/services/workspace/types\";\n\ntype WorkspaceActionType = WorkspaceType & {\n\tpermanent?: boolean;\n};\n\ninterface RemoveWorkspaceProps {\n\tworkspace: WorkspaceActionType;\n}\n\nconst RemoveWorkspace = (props: RemoveWorkspaceProps) => {\n\tconst { workspace } = props;\n\tconst { isFavorited, removeFavorite } = useFavorites();\n\tconst actuallyRemoveWorkspace = (e: React.MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\t// Trigger the remove. This will throw a dialog. It will return a boolean\n\t\t// for whether it was or was not deleted.\n\t\t// If the thing was deleted, remove it from favorites.\n\t\tWorkspaceManagementMenuActions.removeWorkspace(workspace, (wasDeleted) => {\n\t\t\tif (wasDeleted && isFavorited(workspace.name)) {\n\t\t\t\tremoveFavorite(workspace.name);\n\t\t\t}\n\t\t});\n\t};\n\n\treturn (\n\t\t<span role=\"button\" tabIndex={0} onClick={actuallyRemoveWorkspace} className=\"menu-item-icon\">\n\t\t\t<i className=\"ff-adp-trash-outline\" title=\"Delete\"></i>\n\t\t</span>\n\t);\n};\n\ninterface IProps {\n\tisSwitchingWorkspaces: boolean;\n\tisActiveWorkspace: boolean;\n\tdragHandle: { iconClass: string };\n\tworkspace: WorkspaceActionType;\n\tmainAction: (data: { name: string }) => void;\n}\n\nexport default class Workspace extends React.Component<IProps> {\n\tconstructor(props: IProps) {\n\t\tsuper(props);\n\t\tthis.bindCorrectContext();\n\t}\n\n\t/**\n\t * This is necessary to make sure that the `this` inside of the callback is correct.\n\t *\n\t * @memberof Workspace\n\t */\n\tbindCorrectContext() {\n\t\tthis.onClick = this.onClick.bind(this);\n\t}\n\n\t/**\n\t * When the main body of the component is clicked, we fire off the mainAction. By default this is to switch workspaces.\n\t *\n\t * @memberof Workspace\n\t */\n\tonClick() {\n\t\tthis.props.mainAction({\n\t\t\tname: this.props.workspace.name,\n\t\t});\n\t}\n\n\t/**\n\t * Render method.\n\t *\n\t * @returns\n\t * @memberof Workspace\n\t */\n\trender() {\n\t\tconst { isSwitchingWorkspaces, workspace, isActiveWorkspace, dragHandle } = this.props;\n\n\t\t// Actions are remove and pin workspace.\n\n\t\tconst showSpinner = isSwitchingWorkspaces && isActiveWorkspace;\n\n\t\tlet classes = isActiveWorkspace ? \"menu-item active-workspace workspace-name\" : \"menu-item workspace-name\";\n\n\t\treturn (\n\t\t\t<MenuItem onClick={this.onClick} className={classes}>\n\t\t\t\t<div className=\"menu-item-row\">\n\t\t\t\t\t{showSpinner && <span className=\"fsbl-loader\">Loading...</span>}\n\t\t\t\t\t{!showSpinner && dragHandle && dragHandle.iconClass && <span className={dragHandle.iconClass}></span>}\n\t\t\t\t\t<span className=\"workspace-name\" title={workspace.name}>\n\t\t\t\t\t\t{workspace.name}\n\t\t\t\t\t</span>\n\t\t\t\t\t<div className=\"menu-item-row-push-right\">\n\t\t\t\t\t\t{!isActiveWorkspace && !workspace.permanent && <RemoveWorkspace workspace={workspace} />}\n\t\t\t\t\t\t<FavoriteMaker\n\t\t\t\t\t\t\tid={workspace.name}\n\t\t\t\t\t\t\tname={workspace.name}\n\t\t\t\t\t\t\tcategory={\"Workspace\"}\n\t\t\t\t\t\t\tclassName=\"menu-item-icon\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</MenuItem>\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"Workspace.js","sourceRoot":"","sources":["../../../../../src/components/toolbar/workspaceManagementMenu/components/Workspace.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAI9D,MA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AAC,gBAAgB,GACzB,CACG,CACD,CACI,CACX,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright 2017 by ChartIQ, Inc.\n * All rights reserved.\n * This is a single workspace. When clicked, it requests that the app switch to the clicked workspace.\n */\n\nimport React from \"react\";\nimport { MenuItem } from \"../../../menu/MenuItem\";\nimport { Actions as WorkspaceManagementMenuActions } from \"../stores/workspaceManagementMenuStore\";\nimport { FavoriteMaker } from \"../../../favorites/FavoriteMaker\";\nimport { useFavorites } from \"../../../../hooks/useFavorites\";\nimport { Workspace as WorkspaceType } from \"@finsemble/finsemble-api/types/services/workspace/types\";\nimport { StandardError } from \"@finsemble/finsemble-api\";\n\nconst WORKSPACE_PREFERENCES = {\n\tPERMANENT_WORKSPACES: \"finsemble.servicesConfig.workspace.permanentWorkspaces\",\n};\n\ntype WorkspaceActionType = WorkspaceType & {\n\tpermanent?: boolean;\n};\n\ninterface RemoveWorkspaceProps {\n\tworkspace: WorkspaceActionType;\n}\n\nconst RemoveWorkspace = (props: RemoveWorkspaceProps) => {\n\tconst { workspace } = props;\n\tconst { isFavorited, removeFavorite } = useFavorites();\n\tconst actuallyRemoveWorkspace = (e: React.MouseEvent) => {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\t// Trigger the remove. This will throw a dialog. It will return a boolean\n\t\t// for whether it was or was not deleted.\n\t\t// If the thing was deleted, remove it from favorites.\n\t\tWorkspaceManagementMenuActions.removeWorkspace(workspace, (wasDeleted) => {\n\t\t\tif (wasDeleted && isFavorited(workspace.name)) {\n\t\t\t\tremoveFavorite(workspace.name);\n\t\t\t}\n\t\t});\n\t};\n\n\treturn (\n\t\t<span role=\"button\" tabIndex={0} onClick={actuallyRemoveWorkspace} className=\"menu-item-icon\">\n\t\t\t<i className=\"ff-adp-trash-outline\" title=\"Delete\"></i>\n\t\t</span>\n\t);\n};\n\ninterface IState {\n\tpermanentWorkspaces: string[];\n}\n\ninterface IProps {\n\tisSwitchingWorkspaces: boolean;\n\tisActiveWorkspace: boolean;\n\tdragHandle: { iconClass: string };\n\tworkspace: WorkspaceActionType;\n\tmainAction: (data: { name: string }) => void;\n}\n\nexport default class Workspace extends React.Component<IProps, IState> {\n\tconstructor(props: IProps) {\n\t\tsuper(props);\n\t\tthis.bindCorrectContext();\n\t\tthis.state = {\n\t\t\tpermanentWorkspaces: [],\n\t\t};\n\t\tthis.addListeners();\n\t}\n\n\t/**\n\t * This is necessary to make sure that the `this` inside of the callback is correct.\n\t *\n\t * @memberof Workspace\n\t */\n\tbindCorrectContext() {\n\t\tthis.onClick = this.onClick.bind(this);\n\t\tthis.addListeners = this.addListeners.bind(this);\n\t\tthis.setPermanentWorkspaces = this.setPermanentWorkspaces.bind(this);\n\t}\n\n\t/**\n\t * When the main body of the component is clicked, we fire off the mainAction. By default this is to switch workspaces.\n\t *\n\t * @memberof Workspace\n\t */\n\tonClick() {\n\t\tthis.props.mainAction({\n\t\t\tname: this.props.workspace.name,\n\t\t});\n\t}\n\n\tsetPermanentWorkspaces(err: StandardError, config: any) {\n\t\tFSBL.Clients.Logger.system.log(\"Workspaces new permanentWorkspaces config\", config);\n\t\tconst { permanentWorkspaces } = config.value.workspace;\n\t\tif (permanentWorkspaces && Array.isArray(permanentWorkspaces)) {\n\t\t\tthis.setState({\n\t\t\t\tpermanentWorkspaces: permanentWorkspaces,\n\t\t\t});\n\t\t}\n\t}\n\n\taddListeners() {\n\t\tFSBL.Clients.ConfigClient.addListener({ field: \"finsemble.servicesConfig\" }, this.setPermanentWorkspaces);\n\t}\n\n\tcomponentDidMount() {\n\t\t// load preferences values from config and set component state on mount\n\t\tFSBL.Clients.ConfigClient.getValue(WORKSPACE_PREFERENCES.PERMANENT_WORKSPACES, (err, value) => {\n\t\t\tif (err) {\n\t\t\t\tFSBL.Clients.Logger.system.error(\"render.getValues error\", err);\n\t\t\t}\n\t\t\tif (value) this.setState({ permanentWorkspaces: value });\n\t\t});\n\t}\n\n\tcomponentWillUnmount() {\n\t\tFSBL.Clients.ConfigClient.removeListener({ field: \"finsemble.servicesConfig\" }, this.setPermanentWorkspaces);\n\t}\n\n\t/**\n\t * Render method.\n\t *\n\t * @returns\n\t * @memberof Workspace\n\t */\n\trender() {\n\t\tconst { isSwitchingWorkspaces, workspace, isActiveWorkspace, dragHandle } = this.props;\n\n\t\t// Actions are remove and pin workspace.\n\n\t\tconst showSpinner = isSwitchingWorkspaces && isActiveWorkspace;\n\n\t\tlet classes = isActiveWorkspace ? \"menu-item active-workspace workspace-name\" : \"menu-item workspace-name\";\n\n\t\treturn (\n\t\t\t<MenuItem onClick={this.onClick} className={classes}>\n\t\t\t\t<div className=\"menu-item-row\">\n\t\t\t\t\t{showSpinner && <span className=\"fsbl-loader\">Loading...</span>}\n\t\t\t\t\t{!showSpinner && dragHandle && dragHandle.iconClass && <span className={dragHandle.iconClass}></span>}\n\t\t\t\t\t<span className=\"workspace-name\" title={workspace.name}>\n\t\t\t\t\t\t{workspace.name}\n\t\t\t\t\t</span>\n\t\t\t\t\t<div className=\"menu-item-row-push-right\">\n\t\t\t\t\t\t{!isActiveWorkspace && !workspace.permanent && !this.state.permanentWorkspaces.includes(workspace.name) && (\n\t\t\t\t\t\t\t<RemoveWorkspace workspace={workspace} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<FavoriteMaker\n\t\t\t\t\t\t\tid={workspace.name}\n\t\t\t\t\t\t\tname={workspace.name}\n\t\t\t\t\t\t\tcategory={\"Workspace\"}\n\t\t\t\t\t\t\tclassName=\"menu-item-icon\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</MenuItem>\n\t\t);\n\t}\n}\n"]}
@@ -47,7 +47,7 @@ function addListeners(done) {
47
47
  const Actions = {
48
48
  autoSave: (callback) => {
49
49
  var _a;
50
- const activeName = (_a = FSBL.Clients.WorkspaceClient.activeWorkspace) === null || _a === void 0 ? void 0 : _a.name;
50
+ const activeName = ((_a = FSBL.Clients.WorkspaceClient.activeWorkspace) === null || _a === void 0 ? void 0 : _a.name) || "";
51
51
  if (!PROMPT_ON_DIRTY_WORKSPACE) {
52
52
  FSBL.Clients.WorkspaceClient.saveAs({
53
53
  name: activeName,
@@ -1 +1 @@
1
- {"version":3,"file":"workspaceManagementMenuStore.js","sourceRoot":"","sources":["../../../../../src/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAkBhD,yGAAyG;AACzG,MAAM,wBAAwB,GAAG,QAAQ,CAAC;AAC1C,MAAM,QAAQ,GAAG,UAAU,CAAC;AAE5B,IAAI,yBAAkC,CAAC;AACvC,IAAI,uBAAgC,CAAC;AAErC,MAAM,iBAAiB,GAAG;IACzB,8BAA8B,EAAE,+DAA+D;IAC/F,uBAAuB,EAAE,0DAA0D;IACnF,0BAA0B,EAAE,mEAAmE,EAAE,yDAAyD;CAC1J,CAAC;AAEF,IAAI,wBAAoC,CAAC;AACzC,IAAI,WAAgB,CAAC;AACrB,IAAI,MAAW,CAAC;AAChB,IAAI,8BAA0C,CAAC;AAE/C,8BAA8B;AAC9B,MAAM,WAAW,GAAG;IACnB,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE,GAAG;IACd,aAAa,EAAE,EAAE;IACjB,0BAA0B,EAAE,KAAK;IACjC;;;;;;;OAOG;IACH,qBAAqB,EAAE,KAAK;IAC5B,eAAe,EAAE,KAAK;CACtB,CAAC;AAEF,SAAS,YAAY,CAAC,IAAgB;IACrC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;QAC9E,4FAA4F;QAC5F,IAAI,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,KAAK,IAAI;YAAE,yBAAyB,GAAG,KAAK,CAAC;I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,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;IAED,yBAAyB,CAAC,EAAY;QACrC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;IACjE,CAAC;CACD;AACD,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;AAExC,OAAO,EACN,YAAY,EACZ,8BAA8B,IAAI,WAAW,EAC7C,UAAU,EACV,wBAAwB,IAAI,KAAK,EACjC,OAAO,EACP,QAAQ,GACR,CAAC","sourcesContent":["/*!\n * Copyright 2017 by ChartIQ, Inc.\n * All rights reserved.\n * The workspace management menu may be the most complicated component that we have (other than the toolbar). It isn't because workspace management is particularly difficult, it's because there is a lot of user question and answer going on. We don't want to overwrite data without explicit consent, and so the calls get involved. To simplify the code, we are using the `async` library. If you are unfamiliar with this library, see this link: https://caolan.github.io/async/docs.html\n */\nimport async from \"async\";\nimport { Util } from \"@finsemble/finsemble-api\";\nimport StoreModel from \"@finsemble/finsemble-api/types/clients/StoreModel\";\nimport { StandardCallback, StandardError } from \"@finsemble/finsemble-api/types/types\";\nimport { Workspace as WorkspaceType } from \"@finsemble/finsemble-api/types/services/workspace/types\";\nimport { types } from \"@finsemble/finsemble-api\";\n\ntype StandardErrorCallback = types.StandardErrorCallback;\n\ntype UserInputResponseType = {\n\tchoice: string;\n\tvalue?: string;\n};\ntype SaveWorkspaceWaterfallParams = {\n\tworkspaceExists: boolean;\n\tworkspaceName: string;\n\ttemplate: any;\n};\n\n// When a user cancels the save workspace dialog, we throw an error, which short-circuits the async call.\nconst SAVE_DIALOG_CANCEL_ERROR = \"Cancel\";\nconst NEGATIVE = \"Negative\";\n\nlet PROMPT_ON_DIRTY_WORKSPACE: boolean;\nlet DISCARD_UNSAVED_CHANGES: boolean;\n\nconst WORKSPACE_CONFIGS = {\n\tPROMPT_USER_ON_DIRTY_WORKSPACE: \"finsemble.servicesConfig.workspace.promptUserOnDirtyWorkspace\",\n\tDISCARD_UNSAVED_CHANGES: \"finsemble.servicesConfig.workspace.discardUnsavedChanges\",\n\tDEPRECATED_PROMPT_ON_DIRTY: \"finsemble.preferences.workspaceService.promptUserOnDirtyWorkspace\", // DEPRECATED - retrieving it for backwards compatibility\n};\n\nlet WorkspaceManagementStore: StoreModel;\nlet StoreClient: any;\nlet Logger: any;\nlet WorkspaceManagementGlobalStore: StoreModel;\n\n// Initial data for the store.\nconst defaultData = {\n\tactiveWorkspace: {},\n\tmenuWidth: 285,\n\tWorkspaceList: [],\n\tnewWorkspaceDialogIsActive: false,\n\t/**\n\t * State around whether the workspace is currently in the process of switching.\n\t *\n\t * For simplicity, we're storing this in the local store for now, but this precludes\n\t * other components from signaling that the workspace is changing. A consequence,\n\t * for example, is that if you switch workspaces uses a pin on the toolbar instead\n\t * of the workspace management menu, the spinner doesn't show up.\n\t */\n\tisSwitchingWorkspaces: false,\n\tisPromptingUser: false,\n};\n\nfunction addListeners(done: () => void) {\n\tFSBL.Clients.RouterClient.addListener(\"Application.restart\", (err, response) => {\n\t\t// when the user calls a \"Reset\" function, Finsemble shouldn't show a save workspace dialog.\n\t\tif (response.data && response.data.forceRestart === true) PROMPT_ON_DIRTY_WORKSPACE = false;\n\t});\n\tdone();\n}\n\nconst Actions = {\n\tautoSave: (callback: StandardCallback) => {\n\t\tconst activeName = FSBL.Clients.WorkspaceClient.activeWorkspace?.name;\n\t\tif (!PROMPT_ON_DIRTY_WORKSPACE) {\n\t\t\tFSBL.Clients.WorkspaceClient.saveAs(\n\t\t\t\t{\n\t\t\t\t\tname: activeName,\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t(err: StandardError) => {\n\t\t\t\t\tcallback(err);\n\t\t\t\t}\n\t\t\t);\n\t\t} else {\n\t\t\tcallback(null);\n\t\t}\n\t},\n\tcompleteInitialize: () => {\n\t\tFSBL.Clients.ConfigClient.addListener(\n\t\t\t{ field: WORKSPACE_CONFIGS.PROMPT_USER_ON_DIRTY_WORKSPACE },\n\t\t\t(err, config) => {\n\t\t\t\tLogger.system.log(\"WorkspaceManagementStore new promptUserOnDirtyWorkspace config\", config);\n\t\t\t\tPROMPT_ON_DIRTY_WORKSPACE = !!config.value;\n\t\t\t}\n\t\t);\n\n\t\tFSBL.Clients.ConfigClient.addListener({ field: WORKSPACE_CONFIGS.DISCARD_UNSAVED_CHANGES }, (err, config) => {\n\t\t\tLogger.system.log(\"WorkspaceManagementStore new discardUnsavedChanges config\", config);\n\t\t\tDISCARD_UNSAVED_CHANGES = !!config.value;\n\t\t});\n\n\t\t// Gets the workspace list and sets the value in the store.\n\t\tFSBL.Clients.WorkspaceClient.getWorkspaces((err: StandardError, workspaces: WorkspaceType[]) => {\n\t\t\tLogger.system.debug(\"WorkspaceManagementStore init getWorkspaces\", workspaces);\n\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\tfield: \"WorkspaceList\",\n\t\t\t\tvalue: workspaces,\n\t\t\t});\n\t\t});\n\n\t\t// Get the activeWorkspace and set the value. I could have iterated through the workspaces above and found the active one, but this seems simpler.\n\t\tFSBL.Clients.WorkspaceClient.getActiveWorkspace(\n\t\t\t(err: StandardError, activeWorkspace: { data: WorkspaceType } | undefined) => {\n\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore init getActiveWorkspace\", activeWorkspace);\n\t\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\t\tfield: \"activeWorkspace\",\n\t\t\t\t\tvalue: activeWorkspace,\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\n\t\t/**\n\t\t * We listen here for any workspace updates, and pass them to the store.\n\t\t * **NOTE**: You may notice that the signature of this callback is different from the previous ones. In this case,\n\t\t * we receive a `response`, instead of `workspaces` or `activeWorkspace`. This is because this callback is for\n\t\t * a `RouterClient` message. The functions above are callbacks to `WorkspaceClient` API calls.\n\t\t */\n\t\tFSBL.Clients.RouterClient.subscribe(\"Finsemble.WorkspaceService.update\", (err, response) => {\n\t\t\tif (response.data && response.data.activeWorkspace) {\n\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore init update\", response.data);\n\t\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\t\tfield: \"activeWorkspace\",\n\t\t\t\t\tvalue: response.data.activeWorkspace,\n\t\t\t\t});\n\t\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\t\tfield: \"WorkspaceList\",\n\t\t\t\t\tvalue: response.data.workspacesConfig,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tWorkspaceManagementGlobalStore.getValue({ field: \"owner\" }, (err: StandardError, data?: string) => {\n\t\t\tif (data !== finsembleWindow.name) return;\n\t\t\tWorkspaceManagementGlobalStore.Dispatcher.register((action) => {\n\t\t\t\tswitch (action.actionType) {\n\t\t\t\t\tcase \"switchToWorkspace\":\n\t\t\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore switchToWorkspace\", action.data);\n\t\t\t\t\t\tActions.switchToWorkspace(action.data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"reorderWorkspace\":\n\t\t\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore reorderWorkspace\", action.data);\n\t\t\t\t\t\tActions.reorderWorkspaceList(action.data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"removeWorkspace\":\n\t\t\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore removeWorkspace\", action.data);\n\t\t\t\t\t\tActions.removeWorkspace(\n\t\t\t\t\t\t\taction.data as {\n\t\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\t\thideModalOnClose: boolean;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"renameWorkspace\":\n\t\t\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore renameWorkspace\", action.data);\n\t\t\t\t\t\tActions.renameWorkspace(action.data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// Nothing to do here\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t},\n\n\t/*********************************************************************************************\n\t *\n\t *\t\t\t\t\t\t\t\tGETTERS/SETTERS\n\t *\n\t *********************************************************************************************/\n\tgetActiveWorkspace: () => WorkspaceManagementStore.getValue(\"activeWorkspace\") as WorkspaceType,\n\n\t// Get the name of the workspace that is currently being edited\n\tgetWorkspaceBeingEdited: () => WorkspaceManagementStore.getValue(\"workspaceBeingEdited\") as string,\n\n\tgetWorkspaceList: () => WorkspaceManagementStore.getValue(\"WorkspaceList\") as WorkspaceType[],\n\n\tgetIsSwitchingWorkspaces: () => WorkspaceManagementStore.getValue(\"isSwitchingWorkspaces\") as boolean,\n\n\tsetIsSwitchingWorkspaces: (val: boolean) =>\n\t\tWorkspaceManagementStore.setValue({\n\t\t\tfield: \"isSwitchingWorkspaces\",\n\t\t\tvalue: val,\n\t\t}),\n\n\tgetIsPromptingUser: () => WorkspaceManagementStore.getValue(\"isPromptingUser\") as boolean,\n\n\tsetIsPromptingUser: (val: boolean) =>\n\t\tWorkspaceManagementStore.setValue({\n\t\t\tfield: \"isPromptingUser\",\n\t\t\tvalue: val,\n\t\t}),\n\n\t/*********************************************************************************************\n\t *\n\t *\t\t\t\t\t\t\t\tMain Workspace Actions\n\t *\n\t *********************************************************************************************/\n\n\t/**\n\t * Handles the complete workflow for creating a new workspace.\n\t * We make sure the user doesn't lose any unsaved work, ask them to name it, make sure that workspace doesn't already exist, then actually save the new workspace. After that, we fire off a notification to let them know that everything was a great success.\n\t */\n\tnewWorkspace: function () {\n\t\tlet newWorkspaceName: string;\n\t\tLogger.system.log(\"New workspace - start.\");\n\t\tconst newWorkspaceDialogIsActive = WorkspaceManagementStore.getValue(\"newWorkspaceDialogIsActive\");\n\n\t\ttype createItParams = {\n\t\t\tworkspaceName: string;\n\t\t};\n\t\t// Creates the new workspace.\n\t\tconst createIt = (params: createItParams, cb?: StandardCallback) => {\n\t\t\tLogger.system.log(\"createIt\", params);\n\t\t\tconst { workspaceName } = params;\n\t\t\tFSBL.Clients.WorkspaceClient.createWorkspace(workspaceName, {}, (err, response) => {\n\t\t\t\tLogger.system.log(\"createIt createNewWorkspace response\", workspaceName, response);\n\t\t\t\tnewWorkspaceName = response.workspaceName;\n\t\t\t\tif (cb) {\n\t\t\t\t\tcb(null, newWorkspaceName);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tif (!newWorkspaceDialogIsActive) {\n\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\tfield: \"newWorkspaceDialogIsActive\",\n\t\t\t\tvalue: true,\n\t\t\t});\n\t\t}\n\n\t\tActions.blurWindow();\n\t\tlet tasks: Function[] = [\n\t\t\tActions.autoSave,\n\t\t\tActions.spawnWorkspaceInputField,\n\t\t\tActions.validateWorkspaceInput,\n\t\t\tActions.checkIfWorkspaceAlreadyExists,\n\t\t\tActions.askIfUserWantsNewWorkspace,\n\t\t\tcreateIt,\n\t\t];\n\t\tif (PROMPT_ON_DIRTY_WORKSPACE) {\n\t\t\ttasks = ([Actions.askIfUserWantsToSave, Actions.handleSaveDialogResponse] as Function[]).concat(tasks);\n\t\t}\n\t\tasync.waterfall(tasks, Actions.onAsyncComplete);\n\t},\n\n\t/**\n\t * Handles the workflow for removing a workspace.\n\t * As long as you are not deleting the workspace that is active, it will pop up a confirm dialog,\n\t * and if the user says \"yes\", it will delete the workspace.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tremoveWorkspace: (data: { name: string; hideModalOnClose?: boolean }, cb = (val: any) => {}) => {\n\t\tconst workspaceName = data.name;\n\n\t\tconst dialogParams = {\n\t\t\ttitle: \"Delete this workspace?\",\n\t\t\tquestion: `Are you sure you want to delete the workspace \"${workspaceName}\"?`,\n\t\t\tshowNegativeButton: false,\n\t\t\taffirmativeResponseLabel: \"Delete\",\n\t\t\thideModalOnClose: data.hideModalOnClose,\n\t\t};\n\n\t\t/**\n\t\t * Invoked when the user interacts with the dialog.\n\t\t */\n\t\tfunction onUserInput(err: StandardError, response: UserInputResponseType) {\n\t\t\tif (response.choice === \"affirmative\") {\n\t\t\t\tcb(true);\n\t\t\t\tFSBL.Clients.WorkspaceClient.remove({\n\t\t\t\t\tname: workspaceName,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tcb(false);\n\t\t\t}\n\t\t}\n\t\tActions.spawnDialog(\"yesNo\", dialogParams, onUserInput);\n\t},\n\t/**\n\t * The `activeWorkspace` is simply a copy of something we brought out of storage. This function copies the `activeWorkspace` to back to storage.\n\t */\n\tsaveWorkspace: (cb?: StandardErrorCallback) => {\n\t\tconst activeWorkspace = WorkspaceManagementStore.getValue(\"activeWorkspace\");\n\t\tFSBL.Clients.WorkspaceClient.saveAs(\n\t\t\t{\n\t\t\t\tforce: true,\n\t\t\t\tname: activeWorkspace.name,\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tcb?.(null);\n\t\t\t}\n\t\t);\n\t},\n\treorderWorkspaceList: ({ oldIndex, newIndex }: { oldIndex: number; newIndex: number }) => {\n\t\tlet workspaces: WorkspaceType[] = WorkspaceManagementStore.getValue<WorkspaceType[]>({\n\t\t\tfield: \"WorkspaceList\",\n\t\t});\n\t\tconst workspaceToMove = workspaces[oldIndex];\n\t\tworkspaces.splice(oldIndex, 1);\n\t\tworkspaces.splice(newIndex, 0, workspaceToMove);\n\t\tconst workspacesWithExpectedStructure = workspaces.map((WSName) => {\n\t\t\treturn {\n\t\t\t\tname: WSName,\n\t\t\t};\n\t\t});\n\t\tFSBL.Clients.WorkspaceClient.setWorkspaces(\n\t\t\t{\n\t\t\t\tworkspaces: workspacesWithExpectedStructure,\n\t\t\t},\n\t\t\t() => {}\n\t\t);\n\t\tWorkspaceManagementStore.setValue({\n\t\t\tfield: \"WorkspaceList\",\n\t\t\tvalue: workspaces,\n\t\t});\n\t},\n\trenameWorkspace: ({ oldName, newName }: { oldName: string; newName: string }) => {\n\t\t// Note: This does no checking of the workspace before renaming. If you call this function, and `newName` is an existing\n\t\t// workspace name, the existing workspace will get stomped. Currently, the UI prevents renaming to existing names.\n\t\tFSBL.Clients.WorkspaceClient.rename({\n\t\t\toldName: oldName,\n\t\t\tnewName: newName,\n\t\t\tremoveOldWorkspace: true,\n\t\t\toverwriteExisting: true,\n\t\t});\n\t},\n\n\tshowPreferences: () => {\n\t\tFSBL.Clients.LauncherClient.showWindow(\n\t\t\t{\n\t\t\t\tcomponentType: \"UserPreferences\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tmonitor: \"mine\",\n\t\t\t\tleft: \"center\",\n\t\t\t\ttop: \"center\",\n\t\t\t}\n\t\t);\n\t},\n\n\t/**\n\t * Ask the user for a name, make sure it doesn't already exist, then save.\n\t */\n\tsaveWorkspaceAs: () => {\n\t\tfunction saveIt(workspaceName: string, callback: StandardErrorCallback) {\n\t\t\tFSBL.Clients.WorkspaceClient.saveAs(\n\t\t\t\t{\n\t\t\t\t\tname: workspaceName,\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t(err: StandardError, response: any) => {\n\t\t\t\t\tcallback(err, response);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tLogger.system.log(\"SaveWorkspaceAs clicked.\");\n\n\t\tasync.waterfall(\n\t\t\t[\n\t\t\t\tActions.autoSave,\n\t\t\t\tActions.spawnSaveAsDialog,\n\t\t\t\tActions.validateWorkspaceInput,\n\t\t\t\tActions.checkIfWorkspaceAlreadyExists,\n\t\t\t\tActions.askAboutOverwrite,\n\t\t\t\tsaveIt,\n\t\t\t],\n\t\t\tActions.onAsyncComplete\n\t\t);\n\t},\n\n\t/**\n\t * Asks the user if they'd like to save their data, then loads the requested workspace.\n\t */\n\tswitchToWorkspace: async function ({ name }: { name: string }) {\n\t\t// if a workspace prompt is outstanding for a previous switch, immediately return to lock out user from doing another switch (until responding to prompt);\n\t\t// note this prompting flag is cleared in Actions.onAsyncComplete when the previous switch completes (after user responds to the prompt)\n\t\tconst prompting = Actions.getIsPromptingUser();\n\t\tLogger.system.log(\"workspaceManagementMenuStore: switchToWorkspace\", prompting ? \"prompting\" : \"not-prompting\");\n\t\tif (prompting) return;\n\n\t\tActions.setIsSwitchingWorkspaces(true);\n\t\tActions.blurWindow();\n\t\tconst activeWorkspace = WorkspaceManagementStore.getValue(\"activeWorkspace\");\n\n\t\t/**\n\t\t * Actually perform the switch. Happens after we ask the user what they want.\n\t\t *\n\t\t */\n\t\tconst switchWorkspace = (callback = () => {}) => {\n\t\t\tFSBL.Clients.WorkspaceClient.switchTo(\n\t\t\t\t{\n\t\t\t\t\tname: name,\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tActions.setIsSwitchingWorkspaces(false);\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t);\n\t\t};\n\n\t\t/**\n\t\t * Make sure the user is sure\n\t\t */\n\t\tconst askAboutReload = (callback: () => void) => {\n\t\t\tActions.spawnDialog(\n\t\t\t\t\"yesNo\",\n\t\t\t\t{\n\t\t\t\t\tmonitor: \"primary\",\n\t\t\t\t\ttitle: \"Save your workspace?\",\n\t\t\t\t\tquestion: `\\\"${activeWorkspace.name}\\\" has unsaved changes. Would you like to save?`,\n\t\t\t\t\taffirmativeResponseLabel: \"Save\",\n\t\t\t\t\tnegativeResponseLabel: \"Don't Save\",\n\t\t\t\t},\n\t\t\t\tcallback\n\t\t\t);\n\t\t};\n\n\t\t/**\n\t\t * If the workspace is dirty, we need to do more than if it's clean.\n\t\t */\n\t\tif (await FSBL.Clients.WorkspaceClient.isWorkspaceDirty()) {\n\t\t\tlet tasks: Function[] = [];\n\n\t\t\tActions.setIsPromptingUser(true);\n\t\t\tlet firstMethod: Function = Actions.autoSave,\n\t\t\t\tsecondMethod = null;\n\n\t\t\tif (PROMPT_ON_DIRTY_WORKSPACE === true) {\n\t\t\t\t// We want to ask the user to save. But if they're trying to reload the workspace,\n\t\t\t\t// the message needs to be different. The first if block just switches that method.\n\t\t\t\tfirstMethod = Actions.askIfUserWantsToSave;\n\t\t\t\tif (name === FSBL.Clients.WorkspaceClient.activeWorkspace?.name) {\n\t\t\t\t\tfirstMethod = askAboutReload;\n\t\t\t\t}\n\n\t\t\t\t// If we are not autosaving, we need to process the dialog input.\n\t\t\t\tsecondMethod = Actions.handleSaveDialogResponse;\n\t\t\t}\n\n\t\t\tif (!DISCARD_UNSAVED_CHANGES) {\n\t\t\t\ttasks = [firstMethod];\n\t\t\t}\n\n\t\t\tif (secondMethod) {\n\t\t\t\ttasks.push(secondMethod);\n\t\t\t}\n\n\t\t\t// Switch is the last thing we do.\n\t\t\ttasks.push(switchWorkspace);\n\n\t\t\tasync.waterfall(tasks, Actions.onAsyncComplete);\n\t\t} else {\n\t\t\tswitchWorkspace();\n\t\t}\n\t},\n\n\t/*********************************************************************************************\n\t *\n\t *\t\t\t\t\t\t\t\tWorkspace Management Helpers\n\t *\n\t *********************************************************************************************/\n\n\t/**\n\t * General handler for `async.series` and `async.waterfall`\n\t */\n\tonAsyncComplete(err?: Error | null) {\n\t\tLogger.system.debug(\"workspaceManagementMenuStore: onAsyncComplete\");\n\t\tWorkspaceManagementStore.setValue({\n\t\t\tfield: \"newWorkspaceDialogIsActive\",\n\t\t\tvalue: false,\n\t\t});\n\t\tconst errMessage = err?.message;\n\t\tif (errMessage && errMessage !== NEGATIVE && errMessage !== SAVE_DIALOG_CANCEL_ERROR) {\n\t\t\t// handle error.\n\t\t\tLogger.system.error(err);\n\t\t}\n\n\t\t// Unlock the UI.\n\t\tActions.setIsSwitchingWorkspaces(false);\n\t\tActions.setIsPromptingUser(false);\n\t},\n\n\t/**\n\t * Helper for spawning dialogs. Keeps the internals of other functions squeaky clean.\n\t *\n\t * @param {string} type \"yesNo\" or \"singleInput\"\n\t * @param {object} data Optional params for the dialog call.\n\t * @param {function} responseCallback invoked when the user interacts with the dialog.\n\t */\n\tspawnDialog(type: \"yesNo\" | \"singleInput\", data: any, responseCallback: StandardErrorCallback) {\n\t\tLogger.system.debug(\"spawnDialog\", type, data);\n\t\tif (type === \"singleInput\") {\n\t\t\tdata.showCancelButton = true;\n\t\t}\n\t\tFSBL.Clients.DialogManager.open(type, data, responseCallback);\n\t},\n\n\tspawnSaveAsDialog: (cb: StandardCallback) => {\n\t\tconst onUserInput = (err: StandardError, response: UserInputResponseType) => {\n\t\t\tLogger.system.log(\"SpawnSaveAsDialog onUserInput\", response);\n\t\t\tlet callbackError: Error | null = null;\n\t\t\tif (typeof err === \"string\") {\n\t\t\t\t// Error objects cause async to invoke the final callback in async.waterfall.\n\t\t\t\tcallbackError = new Error(err);\n\t\t\t}\n\t\t\tif (cb) {\n\t\t\t\tcb(callbackError || err, response);\n\t\t\t}\n\t\t};\n\n\t\tconst dialogParams = {\n\t\t\ttitle: \"Enter a name for your new workspace.\",\n\t\t\tinputLabel: \"Enter a name for your new workspace.\",\n\t\t\taffirmativeResponseLabel: \"Confirm\",\n\t\t\tshowCancelButton: false,\n\t\t\tshowNegativeButton: false,\n\t\t};\n\n\t\tActions.spawnDialog(\"singleInput\", dialogParams, onUserInput);\n\t},\n\n\t/**\n\t * Spawns an input field asking what the user would like to name their new workspace.\n\t */\n\tspawnWorkspaceInputField: (cb: StandardCallback) => {\n\t\t// Spawns the dialog with the input field and accepts a callback to be invoked after the user acts.\n\t\tLogger.system.log(\"SpawnWorkspaceInput - start\");\n\t\tconst onUserInput = (err: StandardError, response: UserInputResponseType) => {\n\t\t\tLogger.system.log(\"SpawnWorkspaceInput onUserInput\", response);\n\t\t\tlet callbackError: Error | null = null;\n\t\t\tif (typeof err === \"string\") {\n\t\t\t\t// Error objects cause async to invoke the final callback in async.waterfall.\n\t\t\t\tcallbackError = new Error(err);\n\t\t\t}\n\t\t\tif (cb) {\n\t\t\t\tcb(callbackError || err, response);\n\t\t\t}\n\t\t};\n\n\t\tconst dialogParams = {\n\t\t\ttitle: \"Enter a name for your new workspace.\",\n\t\t\tinputLabel: \"Enter a name for your new workspace.\",\n\t\t\taffirmativeResponseLabel: \"Confirm\",\n\t\t\tshowCancelButton: false,\n\t\t\tshowNegativeButton: false,\n\t\t};\n\n\t\tActions.spawnDialog(\"singleInput\", dialogParams, onUserInput);\n\t},\n\n\t/**\n\t * Asks the user if they'd like to save their workspace if it's different from what's in storage. If the workspace is clean, we just invoke the callback.\n\t */\n\taskIfUserWantsToSave: async function (callback: StandardCallback) {\n\t\tconst activeWorkspace: WorkspaceType = WorkspaceManagementStore.getValue(\"activeWorkspace\");\n\n\t\tif (await FSBL.Clients.WorkspaceClient.isWorkspaceDirty()) {\n\t\t\tLogger.system.log(\"NewWorkspace.spawnDialog start.\");\n\t\t\tconst dialogParams = {\n\t\t\t\tmonitor: \"primary\",\n\t\t\t\ttitle: \"Save your workspace?\",\n\t\t\t\tquestion: `\\\"${activeWorkspace.name}\\\" has unsaved changes. Would you like to save?`,\n\t\t\t\taffirmativeResponseLabel: \"Save\",\n\t\t\t\tnegativeResponseLabel: \"Don't Save\",\n\t\t\t};\n\t\t\tconst waitForUserInput = () =>\n\t\t\t\tnew Promise((resolve) => {\n\t\t\t\t\tconst onUserInput = (err: StandardError, response: UserInputResponseType) => {\n\t\t\t\t\t\tLogger.system.log(\"Spawn Dialog callback.\");\n\t\t\t\t\t\tif (callback) callback(null, response);\n\t\t\t\t\t\tresolve(response);\n\t\t\t\t\t};\n\t\t\t\t\tActions.spawnDialog(\"yesNo\", dialogParams, onUserInput);\n\t\t\t\t});\n\t\t\treturn await waitForUserInput();\n\t\t} else {\n\t\t\t// In this case the workspace is not dirty, so we don't need to save.\n\t\t\tif (callback) callback(null, { choice: \"negative\" });\n\t\t\treturn { choice: \"negative\" };\n\t\t}\n\t},\n\n\t/**\n\t * Handles the response from the dialog asking if the user wants to save their workspace.\n\t *\n\t * @param {any} response\n\t * @param {any} callback\n\t */\n\thandleSaveDialogResponse(response: UserInputResponseType, callback: StandardErrorCallback) {\n\t\tif (response.choice === \"affirmative\") {\n\t\t\t// User wants to save, so call the client API.\n\t\t\tActions.saveWorkspace(callback);\n\t\t} else if (response.choice === \"negative\") {\n\t\t\t// Doesn't want to save.\n\t\t\tcallback(null);\n\t\t} else {\n\t\t\t// choice === cancel\n\t\t\tcallback(new Error(SAVE_DIALOG_CANCEL_ERROR));\n\t\t}\n\t},\n\t/**\n\t * Makes sure the user has input a valid workspace name.\n\t */\n\tvalidateWorkspaceInput(response: UserInputResponseType, callback: StandardErrorCallback) {\n\t\tLogger.system.log(\"spawnWorkspaceInput\", response);\n\t\t// If user wants to proceed but gave an invalid name, tell them that they messed up, then die.\n\t\tif (response.choice !== \"cancel\" && (!response.value || response.value === \"\")) {\n\t\t\tlet dialogParams = {\n\t\t\t\ttitle: \"Invalid Workspace Name\",\n\t\t\t\tquestion: \"Workspace names must contain letters or numbers. Please try again.\",\n\t\t\t\taffirmativeResponseLabel: \"OK\",\n\t\t\t\tshowNegativeButton: false,\n\t\t\t\tshowCancelButton: false,\n\t\t\t};\n\t\t\tActions.spawnDialog(\"yesNo\", dialogParams, () => {});\n\t\t\treturn callback(new Error(\"Invalid workspace name.\"));\n\t\t} else if (response.choice === \"cancel\") {\n\t\t\treturn callback(new Error(SAVE_DIALOG_CANCEL_ERROR));\n\t\t}\n\t\tcallback(null, response);\n\t},\n\n\taskAboutOverwrite(params: SaveWorkspaceWaterfallParams, callback: StandardErrorCallback) {\n\t\tconst { workspaceExists, workspaceName } = params;\n\t\tconst dialogParams = {\n\t\t\ttitle: \"Overwrite Workspace?\",\n\t\t\tquestion: `This will overwrite the saved data for \"${workspaceName}\". Would you like to proceed?`,\n\t\t\taffirmativeResponseLabel: \"Overwrite\",\n\t\t\tshowNegativeButton: false,\n\t\t};\n\t\tconst onUserInput = (err: StandardError, response: UserInputResponseType) => {\n\t\t\tif (response.choice === \"affirmative\") {\n\t\t\t\tcallback(null, workspaceName);\n\t\t\t} else {\n\t\t\t\tcallback(new Error(NEGATIVE));\n\t\t\t}\n\t\t};\n\t\tif (workspaceExists) {\n\t\t\tActions.spawnDialog(\"yesNo\", dialogParams, onUserInput);\n\t\t} else {\n\t\t\tcallback(null, workspaceName);\n\t\t}\n\t},\n\taskIfUserWantsNewWorkspace(params: SaveWorkspaceWaterfallParams, callback: StandardErrorCallback) {\n\t\tlet { workspaceExists, workspaceName, template } = params;\n\n\t\tlet dialogParams = {\n\t\t\ttitle: \"New workspace\",\n\t\t\tquestion: `The workspace \"${workspaceName}\" already exists. A new workspace with a modified name will be created.`,\n\t\t\taffirmativeResponseLabel: \"OK\",\n\t\t\tshowNegativeButton: false,\n\t\t};\n\n\t\tfunction onUserInput(err: StandardError, response: UserInputResponseType) {\n\t\t\tif (response.choice === \"affirmative\") {\n\t\t\t\tcallback(null, { workspaceName, template });\n\t\t\t} else {\n\t\t\t\tcallback(new Error(NEGATIVE));\n\t\t\t}\n\t\t}\n\t\tif (workspaceExists) {\n\t\t\tActions.spawnDialog(\"yesNo\", dialogParams, onUserInput);\n\t\t} else {\n\t\t\tcallback(null, { workspaceName, template });\n\t\t}\n\t},\n\n\t/**\n\t * Checks if the workspace exists. If it does, it asks the user if they're comfortable overwriting that data.\n\t */\n\tcheckIfWorkspaceAlreadyExists(response: any, callback: StandardErrorCallback) {\n\t\tconst workspaceName = response.value;\n\t\tconst camelCaseWorkspaceName = Util.camelCase(workspaceName);\n\t\t// Do any of the workspaces have the same name that the user is trying to input.\n\t\tconst workspaceExists = FSBL.Clients.WorkspaceClient.workspaces.some(\n\t\t\t(workspace) => Util.camelCase(workspace) === camelCaseWorkspaceName\n\t\t);\n\t\tcallback(null, {\n\t\t\tworkspaceExists,\n\t\t\tworkspaceName,\n\t\t\ttemplate: response.template,\n\t\t});\n\t},\n\t/*********************************************************************************************\n\t *\n\t *\t\t\t\t\t\t\t\tMisc functionality\n\t *\n\t *********************************************************************************************/\n\t/**\n\t * Un-focuses from the menu.\n\t */\n\tblurWindow: function () {\n\t\tfinsembleWindow.blur();\n\t},\n};\n\nfunction createLocalStore(done: () => void) {\n\tStoreClient.createStore(\n\t\t{ store: \"Finsemble-WorkspaceMenu-Local-Store\", values: defaultData },\n\t\t(err: StandardError, store: StoreModel) => {\n\t\t\tWorkspaceManagementStore = store;\n\t\t\tdone();\n\t\t}\n\t);\n}\n\nfunction createGlobalStore(done: () => void) {\n\tStoreClient.createStore(\n\t\t{\n\t\t\tstore: \"Finsemble-WorkspaceMenu-Global-Store\",\n\t\t\tglobal: true,\n\t\t\tvalues: { owner: finsembleWindow.name },\n\t\t},\n\t\t(err: StandardError, store: StoreModel) => {\n\t\t\tWorkspaceManagementGlobalStore = store;\n\t\t\tdone();\n\t\t}\n\t);\n}\n\nfunction getPreferences(done: () => void) {\n\t(async () => {\n\t\tconst { err: preferencesErr, data: preferencesValues } = await FSBL.Clients.ConfigClient.getPreferences();\n\t\tif (preferencesErr) {\n\t\t\tLogger.system.error(\"workspaceManagementMenuStore.getPreferences - getPreferences\", preferencesErr);\n\t\t}\n\t\tlet promptUserOnDirtyWorkspaceFromPreferences;\n\t\tlet discardUnsavedChangesFromPreferences;\n\t\tif (preferencesValues) {\n\t\t\tpromptUserOnDirtyWorkspaceFromPreferences = preferencesValues[WORKSPACE_CONFIGS.PROMPT_USER_ON_DIRTY_WORKSPACE];\n\t\t\tdiscardUnsavedChangesFromPreferences = preferencesValues[WORKSPACE_CONFIGS.DISCARD_UNSAVED_CHANGES];\n\t\t}\n\n\t\t// if we don't have a preference as a boolean value (i.e. null or undefined)\n\t\t// fetch the config to apply\n\t\tif (typeof promptUserOnDirtyWorkspaceFromPreferences !== \"boolean\") {\n\t\t\tconst { err: configErr, data: configValues } = await FSBL.Clients.ConfigClient.getValues([\n\t\t\t\tWORKSPACE_CONFIGS.DEPRECATED_PROMPT_ON_DIRTY,\n\t\t\t\tWORKSPACE_CONFIGS.PROMPT_USER_ON_DIRTY_WORKSPACE,\n\t\t\t]);\n\n\t\t\tif (configErr) {\n\t\t\t\tLogger.system.error(\n\t\t\t\t\t\"workspaceManagementMenuStore.getPreferences - getValues - promptUserOnDirtyWorkspace\",\n\t\t\t\t\tconfigErr\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (configValues) {\n\t\t\t\t// deprecated (if present) > config (fallback) > default\n\t\t\t\tPROMPT_ON_DIRTY_WORKSPACE =\n\t\t\t\t\tconfigValues[WORKSPACE_CONFIGS.DEPRECATED_PROMPT_ON_DIRTY] ??\n\t\t\t\t\tconfigValues[WORKSPACE_CONFIGS.PROMPT_USER_ON_DIRTY_WORKSPACE] ??\n\t\t\t\t\ttrue;\n\t\t\t} else {\n\t\t\t\t// we shouldn't get to this - but in case we do we apply the default.\n\t\t\t\tPROMPT_ON_DIRTY_WORKSPACE = true;\n\t\t\t}\n\t\t} else {\n\t\t\tPROMPT_ON_DIRTY_WORKSPACE = promptUserOnDirtyWorkspaceFromPreferences;\n\t\t}\n\n\t\t// if we don't have a preference as a boolean value (i.e. null or undefined)\n\t\t// fetch the config to apply\n\t\tif (typeof discardUnsavedChangesFromPreferences !== \"boolean\") {\n\t\t\tconst { err: configErr, data: configValue } = await FSBL.Clients.ConfigClient.getValue(\n\t\t\t\tWORKSPACE_CONFIGS.DISCARD_UNSAVED_CHANGES\n\t\t\t);\n\n\t\t\tif (configErr) {\n\t\t\t\tLogger.system.error(\n\t\t\t\t\t\"workspaceManagementMenuStore.getPreferences - getValues - discardUnsavedworkspaceChanges\",\n\t\t\t\t\tconfigErr\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (configValue) {\n\t\t\t\t// config (fallback) > default\n\t\t\t\tDISCARD_UNSAVED_CHANGES = configValue[WORKSPACE_CONFIGS.DISCARD_UNSAVED_CHANGES] ?? false;\n\t\t\t} else {\n\t\t\t\t// we shouldn't get to this - but in case we do we assume user does not want to discard unsaved changes\n\t\t\t\t// by default.\n\t\t\t\tDISCARD_UNSAVED_CHANGES = false;\n\t\t\t}\n\t\t} else {\n\t\t\tDISCARD_UNSAVED_CHANGES = discardUnsavedChangesFromPreferences;\n\t\t}\n\n\t\tdone();\n\t})();\n}\n\n/**\n * Initializes the store for the Workspace Management Menu.\n */\nfunction initialize(cb: any) {\n\tStoreClient = FSBL.Clients.DistributedStoreClient;\n\t// eslint-disable-next-line prefer-destructuring\n\tLogger = FSBL.Clients.Logger;\n\tasync.parallel([createGlobalStore, createLocalStore, getPreferences, addListeners], () => {\n\t\tActions.completeInitialize();\n\t\tcb(WorkspaceManagementStore);\n\t});\n}\n\nlet getStore = () => WorkspaceManagementStore;\n\n/**\n * This is a quick little initialization manager that Terry hacked up.\n * Ultimately everything in this file should be rewritten in hooks/redux pattern.\n */\nclass StoreManager {\n\tinitialized: boolean;\n\n\tinitializing: boolean;\n\n\tcallbacks: Function[];\n\n\tstore: StoreModel | null;\n\n\tconstructor() {\n\t\tthis.initialized = false;\n\t\tthis.initializing = false;\n\t\tthis.callbacks = [];\n\t\tthis.store = null;\n\t}\n\n\tinitialize() {\n\t\tif (this.initializing) return;\n\t\tthis.initializing = true;\n\t\tinitialize((store: StoreModel) => {\n\t\t\tthis.initialized = true;\n\t\t\tthis.store = store;\n\t\t\tthis.callbacks.forEach((cb) => cb(store));\n\t\t});\n\t}\n\n\taddInitializedListener(cb: (store: StoreModel) => void) {\n\t\tif (this.initialized && this.store !== null) return cb(this.store);\n\t\tthis.callbacks.push(cb);\n\t}\n\n\tremoveInitializedListener(cb: Function) {\n\t\tthis.callbacks = this.callbacks.filter((entry) => entry !== cb);\n\t}\n}\nconst storeManager = new StoreManager();\n\nexport {\n\tstoreManager,\n\tWorkspaceManagementGlobalStore as GlobalStore,\n\tinitialize,\n\tWorkspaceManagementStore as Store,\n\tActions,\n\tgetStore,\n};\n"]}
1
+ {"version":3,"file":"workspaceManagementMenuStore.js","sourceRoot":"","sources":["../../../../../src/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAkBhD,yGAAyG;AACzG,MAAM,wBAAwB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AK,EACjC,OAAO,EACP,QAAQ,GACR,CAAC","sourcesContent":["/*!\n * Copyright 2017 by ChartIQ, Inc.\n * All rights reserved.\n * The workspace management menu may be the most complicated component that we have (other than the toolbar). It isn't because workspace management is particularly difficult, it's because there is a lot of user question and answer going on. We don't want to overwrite data without explicit consent, and so the calls get involved. To simplify the code, we are using the `async` library. If you are unfamiliar with this library, see this link: https://caolan.github.io/async/docs.html\n */\nimport async from \"async\";\nimport { Util } from \"@finsemble/finsemble-api\";\nimport StoreModel from \"@finsemble/finsemble-api/types/clients/StoreModel\";\nimport { StandardCallback, StandardError } from \"@finsemble/finsemble-api/types/types\";\nimport { Workspace as WorkspaceType } from \"@finsemble/finsemble-api/types/services/workspace/types\";\nimport { types } from \"@finsemble/finsemble-api\";\n\ntype StandardErrorCallback = types.StandardErrorCallback;\n\ntype UserInputResponseType = {\n\tchoice: string;\n\tvalue?: string;\n};\ntype SaveWorkspaceWaterfallParams = {\n\tworkspaceExists: boolean;\n\tworkspaceName: string;\n\ttemplate: any;\n};\n\n// When a user cancels the save workspace dialog, we throw an error, which short-circuits the async call.\nconst SAVE_DIALOG_CANCEL_ERROR = \"Cancel\";\nconst NEGATIVE = \"Negative\";\n\nlet PROMPT_ON_DIRTY_WORKSPACE: boolean;\nlet DISCARD_UNSAVED_CHANGES: boolean;\n\nconst WORKSPACE_CONFIGS = {\n\tPROMPT_USER_ON_DIRTY_WORKSPACE: \"finsemble.servicesConfig.workspace.promptUserOnDirtyWorkspace\",\n\tDISCARD_UNSAVED_CHANGES: \"finsemble.servicesConfig.workspace.discardUnsavedChanges\",\n\tDEPRECATED_PROMPT_ON_DIRTY: \"finsemble.preferences.workspaceService.promptUserOnDirtyWorkspace\", // DEPRECATED - retrieving it for backwards compatibility\n};\n\nlet WorkspaceManagementStore: StoreModel;\nlet StoreClient: any;\nlet Logger: any;\nlet WorkspaceManagementGlobalStore: StoreModel;\n\n// Initial data for the store.\nconst defaultData = {\n\tactiveWorkspace: {},\n\tmenuWidth: 285,\n\tWorkspaceList: [],\n\tnewWorkspaceDialogIsActive: false,\n\t/**\n\t * State around whether the workspace is currently in the process of switching.\n\t *\n\t * For simplicity, we're storing this in the local store for now, but this precludes\n\t * other components from signaling that the workspace is changing. A consequence,\n\t * for example, is that if you switch workspaces uses a pin on the toolbar instead\n\t * of the workspace management menu, the spinner doesn't show up.\n\t */\n\tisSwitchingWorkspaces: false,\n\tisPromptingUser: false,\n};\n\nfunction addListeners(done: () => void) {\n\tFSBL.Clients.RouterClient.addListener(\"Application.restart\", (err, response) => {\n\t\t// when the user calls a \"Reset\" function, Finsemble shouldn't show a save workspace dialog.\n\t\tif (response.data && response.data.forceRestart === true) PROMPT_ON_DIRTY_WORKSPACE = false;\n\t});\n\tdone();\n}\n\nconst Actions = {\n\tautoSave: (callback: StandardCallback) => {\n\t\tconst activeName = FSBL.Clients.WorkspaceClient.activeWorkspace?.name || \"\";\n\t\tif (!PROMPT_ON_DIRTY_WORKSPACE) {\n\t\t\tFSBL.Clients.WorkspaceClient.saveAs(\n\t\t\t\t{\n\t\t\t\t\tname: activeName,\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t(err: StandardError) => {\n\t\t\t\t\tcallback(err);\n\t\t\t\t}\n\t\t\t);\n\t\t} else {\n\t\t\tcallback(null);\n\t\t}\n\t},\n\tcompleteInitialize: () => {\n\t\tFSBL.Clients.ConfigClient.addListener(\n\t\t\t{ field: WORKSPACE_CONFIGS.PROMPT_USER_ON_DIRTY_WORKSPACE },\n\t\t\t(err, config) => {\n\t\t\t\tLogger.system.log(\"WorkspaceManagementStore new promptUserOnDirtyWorkspace config\", config);\n\t\t\t\tPROMPT_ON_DIRTY_WORKSPACE = !!config.value;\n\t\t\t}\n\t\t);\n\n\t\tFSBL.Clients.ConfigClient.addListener({ field: WORKSPACE_CONFIGS.DISCARD_UNSAVED_CHANGES }, (err, config) => {\n\t\t\tLogger.system.log(\"WorkspaceManagementStore new discardUnsavedChanges config\", config);\n\t\t\tDISCARD_UNSAVED_CHANGES = !!config.value;\n\t\t});\n\n\t\t// Gets the workspace list and sets the value in the store.\n\t\tFSBL.Clients.WorkspaceClient.getWorkspaces((err: StandardError, workspaces: WorkspaceType[]) => {\n\t\t\tLogger.system.debug(\"WorkspaceManagementStore init getWorkspaces\", workspaces);\n\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\tfield: \"WorkspaceList\",\n\t\t\t\tvalue: workspaces,\n\t\t\t});\n\t\t});\n\n\t\t// Get the activeWorkspace and set the value. I could have iterated through the workspaces above and found the active one, but this seems simpler.\n\t\tFSBL.Clients.WorkspaceClient.getActiveWorkspace(\n\t\t\t(err: StandardError, activeWorkspace: { data: WorkspaceType } | undefined) => {\n\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore init getActiveWorkspace\", activeWorkspace);\n\t\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\t\tfield: \"activeWorkspace\",\n\t\t\t\t\tvalue: activeWorkspace,\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\n\t\t/**\n\t\t * We listen here for any workspace updates, and pass them to the store.\n\t\t * **NOTE**: You may notice that the signature of this callback is different from the previous ones. In this case,\n\t\t * we receive a `response`, instead of `workspaces` or `activeWorkspace`. This is because this callback is for\n\t\t * a `RouterClient` message. The functions above are callbacks to `WorkspaceClient` API calls.\n\t\t */\n\t\tFSBL.Clients.RouterClient.subscribe(\"Finsemble.WorkspaceService.update\", (err, response) => {\n\t\t\tif (response.data && response.data.activeWorkspace) {\n\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore init update\", response.data);\n\t\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\t\tfield: \"activeWorkspace\",\n\t\t\t\t\tvalue: response.data.activeWorkspace,\n\t\t\t\t});\n\t\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\t\tfield: \"WorkspaceList\",\n\t\t\t\t\tvalue: response.data.workspacesConfig,\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tWorkspaceManagementGlobalStore.getValue({ field: \"owner\" }, (err: StandardError, data?: string) => {\n\t\t\tif (data !== finsembleWindow.name) return;\n\t\t\tWorkspaceManagementGlobalStore.Dispatcher.register((action) => {\n\t\t\t\tswitch (action.actionType) {\n\t\t\t\t\tcase \"switchToWorkspace\":\n\t\t\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore switchToWorkspace\", action.data);\n\t\t\t\t\t\tActions.switchToWorkspace(action.data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"reorderWorkspace\":\n\t\t\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore reorderWorkspace\", action.data);\n\t\t\t\t\t\tActions.reorderWorkspaceList(action.data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"removeWorkspace\":\n\t\t\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore removeWorkspace\", action.data);\n\t\t\t\t\t\tActions.removeWorkspace(\n\t\t\t\t\t\t\taction.data as {\n\t\t\t\t\t\t\t\tname: string;\n\t\t\t\t\t\t\t\thideModalOnClose: boolean;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"renameWorkspace\":\n\t\t\t\t\t\tLogger.system.debug(\"WorkspaceManagementStore renameWorkspace\", action.data);\n\t\t\t\t\t\tActions.renameWorkspace(action.data);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t// Nothing to do here\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t},\n\n\t/*********************************************************************************************\n\t *\n\t *\t\t\t\t\t\t\t\tGETTERS/SETTERS\n\t *\n\t *********************************************************************************************/\n\tgetActiveWorkspace: () => WorkspaceManagementStore.getValue(\"activeWorkspace\") as WorkspaceType,\n\n\t// Get the name of the workspace that is currently being edited\n\tgetWorkspaceBeingEdited: () => WorkspaceManagementStore.getValue(\"workspaceBeingEdited\") as string,\n\n\tgetWorkspaceList: () => WorkspaceManagementStore.getValue(\"WorkspaceList\") as WorkspaceType[],\n\n\tgetIsSwitchingWorkspaces: () => WorkspaceManagementStore.getValue(\"isSwitchingWorkspaces\") as boolean,\n\n\tsetIsSwitchingWorkspaces: (val: boolean) =>\n\t\tWorkspaceManagementStore.setValue({\n\t\t\tfield: \"isSwitchingWorkspaces\",\n\t\t\tvalue: val,\n\t\t}),\n\n\tgetIsPromptingUser: () => WorkspaceManagementStore.getValue(\"isPromptingUser\") as boolean,\n\n\tsetIsPromptingUser: (val: boolean) =>\n\t\tWorkspaceManagementStore.setValue({\n\t\t\tfield: \"isPromptingUser\",\n\t\t\tvalue: val,\n\t\t}),\n\n\t/*********************************************************************************************\n\t *\n\t *\t\t\t\t\t\t\t\tMain Workspace Actions\n\t *\n\t *********************************************************************************************/\n\n\t/**\n\t * Handles the complete workflow for creating a new workspace.\n\t * We make sure the user doesn't lose any unsaved work, ask them to name it, make sure that workspace doesn't already exist, then actually save the new workspace. After that, we fire off a notification to let them know that everything was a great success.\n\t */\n\tnewWorkspace: function () {\n\t\tlet newWorkspaceName: string;\n\t\tLogger.system.log(\"New workspace - start.\");\n\t\tconst newWorkspaceDialogIsActive = WorkspaceManagementStore.getValue(\"newWorkspaceDialogIsActive\");\n\n\t\ttype createItParams = {\n\t\t\tworkspaceName: string;\n\t\t};\n\t\t// Creates the new workspace.\n\t\tconst createIt = (params: createItParams, cb?: StandardCallback) => {\n\t\t\tLogger.system.log(\"createIt\", params);\n\t\t\tconst { workspaceName } = params;\n\t\t\tFSBL.Clients.WorkspaceClient.createWorkspace(workspaceName, {}, (err, response) => {\n\t\t\t\tLogger.system.log(\"createIt createNewWorkspace response\", workspaceName, response);\n\t\t\t\tnewWorkspaceName = response.workspaceName;\n\t\t\t\tif (cb) {\n\t\t\t\t\tcb(null, newWorkspaceName);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tif (!newWorkspaceDialogIsActive) {\n\t\t\tWorkspaceManagementStore.setValue({\n\t\t\t\tfield: \"newWorkspaceDialogIsActive\",\n\t\t\t\tvalue: true,\n\t\t\t});\n\t\t}\n\n\t\tActions.blurWindow();\n\t\tlet tasks: Function[] = [\n\t\t\tActions.autoSave,\n\t\t\tActions.spawnWorkspaceInputField,\n\t\t\tActions.validateWorkspaceInput,\n\t\t\tActions.checkIfWorkspaceAlreadyExists,\n\t\t\tActions.askIfUserWantsNewWorkspace,\n\t\t\tcreateIt,\n\t\t];\n\t\tif (PROMPT_ON_DIRTY_WORKSPACE) {\n\t\t\ttasks = ([Actions.askIfUserWantsToSave, Actions.handleSaveDialogResponse] as Function[]).concat(tasks);\n\t\t}\n\t\tasync.waterfall(tasks, Actions.onAsyncComplete);\n\t},\n\n\t/**\n\t * Handles the workflow for removing a workspace.\n\t * As long as you are not deleting the workspace that is active, it will pop up a confirm dialog,\n\t * and if the user says \"yes\", it will delete the workspace.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tremoveWorkspace: (data: { name: string; hideModalOnClose?: boolean }, cb = (val: any) => {}) => {\n\t\tconst workspaceName = data.name;\n\n\t\tconst dialogParams = {\n\t\t\ttitle: \"Delete this workspace?\",\n\t\t\tquestion: `Are you sure you want to delete the workspace \"${workspaceName}\"?`,\n\t\t\tshowNegativeButton: false,\n\t\t\taffirmativeResponseLabel: \"Delete\",\n\t\t\thideModalOnClose: data.hideModalOnClose,\n\t\t};\n\n\t\t/**\n\t\t * Invoked when the user interacts with the dialog.\n\t\t */\n\t\tfunction onUserInput(err: StandardError, response: UserInputResponseType) {\n\t\t\tif (response.choice === \"affirmative\") {\n\t\t\t\tcb(true);\n\t\t\t\tFSBL.Clients.WorkspaceClient.remove({\n\t\t\t\t\tname: workspaceName,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tcb(false);\n\t\t\t}\n\t\t}\n\t\tActions.spawnDialog(\"yesNo\", dialogParams, onUserInput);\n\t},\n\t/**\n\t * The `activeWorkspace` is simply a copy of something we brought out of storage. This function copies the `activeWorkspace` to back to storage.\n\t */\n\tsaveWorkspace: (cb?: StandardErrorCallback) => {\n\t\tconst activeWorkspace = WorkspaceManagementStore.getValue(\"activeWorkspace\");\n\t\tFSBL.Clients.WorkspaceClient.saveAs(\n\t\t\t{\n\t\t\t\tforce: true,\n\t\t\t\tname: activeWorkspace.name,\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tcb?.(null);\n\t\t\t}\n\t\t);\n\t},\n\treorderWorkspaceList: ({ oldIndex, newIndex }: { oldIndex: number; newIndex: number }) => {\n\t\tlet workspaces: WorkspaceType[] = WorkspaceManagementStore.getValue<WorkspaceType[]>({\n\t\t\tfield: \"WorkspaceList\",\n\t\t});\n\t\tconst workspaceToMove = workspaces[oldIndex];\n\t\tworkspaces.splice(oldIndex, 1);\n\t\tworkspaces.splice(newIndex, 0, workspaceToMove);\n\t\tconst workspacesWithExpectedStructure = workspaces.map((WSName) => {\n\t\t\treturn {\n\t\t\t\tname: WSName,\n\t\t\t};\n\t\t});\n\t\tFSBL.Clients.WorkspaceClient.setWorkspaces(\n\t\t\t{\n\t\t\t\tworkspaces: workspacesWithExpectedStructure,\n\t\t\t},\n\t\t\t() => {}\n\t\t);\n\t\tWorkspaceManagementStore.setValue({\n\t\t\tfield: \"WorkspaceList\",\n\t\t\tvalue: workspaces,\n\t\t});\n\t},\n\trenameWorkspace: ({ oldName, newName }: { oldName: string; newName: string }) => {\n\t\t// Note: This does no checking of the workspace before renaming. If you call this function, and `newName` is an existing\n\t\t// workspace name, the existing workspace will get stomped. Currently, the UI prevents renaming to existing names.\n\t\tFSBL.Clients.WorkspaceClient.rename({\n\t\t\toldName: oldName,\n\t\t\tnewName: newName,\n\t\t\tremoveOldWorkspace: true,\n\t\t\toverwriteExisting: true,\n\t\t});\n\t},\n\n\tshowPreferences: () => {\n\t\tFSBL.Clients.LauncherClient.showWindow(\n\t\t\t{\n\t\t\t\tcomponentType: \"UserPreferences\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tmonitor: \"mine\",\n\t\t\t\tleft: \"center\",\n\t\t\t\ttop: \"center\",\n\t\t\t}\n\t\t);\n\t},\n\n\t/**\n\t * Ask the user for a name, make sure it doesn't already exist, then save.\n\t */\n\tsaveWorkspaceAs: () => {\n\t\tfunction saveIt(workspaceName: string, callback: StandardErrorCallback) {\n\t\t\tFSBL.Clients.WorkspaceClient.saveAs(\n\t\t\t\t{\n\t\t\t\t\tname: workspaceName,\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t(err: StandardError, response: any) => {\n\t\t\t\t\tcallback(err, response);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tLogger.system.log(\"SaveWorkspaceAs clicked.\");\n\n\t\tasync.waterfall(\n\t\t\t[\n\t\t\t\tActions.autoSave,\n\t\t\t\tActions.spawnSaveAsDialog,\n\t\t\t\tActions.validateWorkspaceInput,\n\t\t\t\tActions.checkIfWorkspaceAlreadyExists,\n\t\t\t\tActions.askAboutOverwrite,\n\t\t\t\tsaveIt,\n\t\t\t],\n\t\t\tActions.onAsyncComplete\n\t\t);\n\t},\n\n\t/**\n\t * Asks the user if they'd like to save their data, then loads the requested workspace.\n\t */\n\tswitchToWorkspace: async function ({ name }: { name: string }) {\n\t\t// if a workspace prompt is outstanding for a previous switch, immediately return to lock out user from doing another switch (until responding to prompt);\n\t\t// note this prompting flag is cleared in Actions.onAsyncComplete when the previous switch completes (after user responds to the prompt)\n\t\tconst prompting = Actions.getIsPromptingUser();\n\t\tLogger.system.log(\"workspaceManagementMenuStore: switchToWorkspace\", prompting ? \"prompting\" : \"not-prompting\");\n\t\tif (prompting) return;\n\n\t\tActions.setIsSwitchingWorkspaces(true);\n\t\tActions.blurWindow();\n\t\tconst activeWorkspace = WorkspaceManagementStore.getValue(\"activeWorkspace\");\n\n\t\t/**\n\t\t * Actually perform the switch. Happens after we ask the user what they want.\n\t\t *\n\t\t */\n\t\tconst switchWorkspace = (callback = () => {}) => {\n\t\t\tFSBL.Clients.WorkspaceClient.switchTo(\n\t\t\t\t{\n\t\t\t\t\tname: name,\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tActions.setIsSwitchingWorkspaces(false);\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t);\n\t\t};\n\n\t\t/**\n\t\t * Make sure the user is sure\n\t\t */\n\t\tconst askAboutReload = (callback: () => void) => {\n\t\t\tActions.spawnDialog(\n\t\t\t\t\"yesNo\",\n\t\t\t\t{\n\t\t\t\t\tmonitor: \"primary\",\n\t\t\t\t\ttitle: \"Save your workspace?\",\n\t\t\t\t\tquestion: `\\\"${activeWorkspace.name}\\\" has unsaved changes. Would you like to save?`,\n\t\t\t\t\taffirmativeResponseLabel: \"Save\",\n\t\t\t\t\tnegativeResponseLabel: \"Don't Save\",\n\t\t\t\t},\n\t\t\t\tcallback\n\t\t\t);\n\t\t};\n\n\t\t/**\n\t\t * If the workspace is dirty, we need to do more than if it's clean.\n\t\t */\n\t\tif (await FSBL.Clients.WorkspaceClient.isWorkspaceDirty()) {\n\t\t\tlet tasks: Function[] = [];\n\n\t\t\tActions.setIsPromptingUser(true);\n\t\t\tlet firstMethod: Function = Actions.autoSave,\n\t\t\t\tsecondMethod = null;\n\n\t\t\tif (PROMPT_ON_DIRTY_WORKSPACE === true) {\n\t\t\t\t// We want to ask the user to save. But if they're trying to reload the workspace,\n\t\t\t\t// the message needs to be different. The first if block just switches that method.\n\t\t\t\tfirstMethod = Actions.askIfUserWantsToSave;\n\t\t\t\tif (name === FSBL.Clients.WorkspaceClient.activeWorkspace?.name) {\n\t\t\t\t\tfirstMethod = askAboutReload;\n\t\t\t\t}\n\n\t\t\t\t// If we are not autosaving, we need to process the dialog input.\n\t\t\t\tsecondMethod = Actions.handleSaveDialogResponse;\n\t\t\t}\n\n\t\t\tif (!DISCARD_UNSAVED_CHANGES) {\n\t\t\t\ttasks = [firstMethod];\n\t\t\t}\n\n\t\t\tif (secondMethod) {\n\t\t\t\ttasks.push(secondMethod);\n\t\t\t}\n\n\t\t\t// Switch is the last thing we do.\n\t\t\ttasks.push(switchWorkspace);\n\n\t\t\tasync.waterfall(tasks, Actions.onAsyncComplete);\n\t\t} else {\n\t\t\tswitchWorkspace();\n\t\t}\n\t},\n\n\t/*********************************************************************************************\n\t *\n\t *\t\t\t\t\t\t\t\tWorkspace Management Helpers\n\t *\n\t *********************************************************************************************/\n\n\t/**\n\t * General handler for `async.series` and `async.waterfall`\n\t */\n\tonAsyncComplete(err?: Error | null) {\n\t\tLogger.system.debug(\"workspaceManagementMenuStore: onAsyncComplete\");\n\t\tWorkspaceManagementStore.setValue({\n\t\t\tfield: \"newWorkspaceDialogIsActive\",\n\t\t\tvalue: false,\n\t\t});\n\t\tconst errMessage = err?.message;\n\t\tif (errMessage && errMessage !== NEGATIVE && errMessage !== SAVE_DIALOG_CANCEL_ERROR) {\n\t\t\t// handle error.\n\t\t\tLogger.system.error(err);\n\t\t}\n\n\t\t// Unlock the UI.\n\t\tActions.setIsSwitchingWorkspaces(false);\n\t\tActions.setIsPromptingUser(false);\n\t},\n\n\t/**\n\t * Helper for spawning dialogs. Keeps the internals of other functions squeaky clean.\n\t *\n\t * @param {string} type \"yesNo\" or \"singleInput\"\n\t * @param {object} data Optional params for the dialog call.\n\t * @param {function} responseCallback invoked when the user interacts with the dialog.\n\t */\n\tspawnDialog(type: \"yesNo\" | \"singleInput\", data: any, responseCallback: StandardErrorCallback) {\n\t\tLogger.system.debug(\"spawnDialog\", type, data);\n\t\tif (type === \"singleInput\") {\n\t\t\tdata.showCancelButton = true;\n\t\t}\n\t\tFSBL.Clients.DialogManager.open(type, data, responseCallback);\n\t},\n\n\tspawnSaveAsDialog: (cb: StandardCallback) => {\n\t\tconst onUserInput = (err: StandardError, response: UserInputResponseType) => {\n\t\t\tLogger.system.log(\"SpawnSaveAsDialog onUserInput\", response);\n\t\t\tlet callbackError: Error | null = null;\n\t\t\tif (typeof err === \"string\") {\n\t\t\t\t// Error objects cause async to invoke the final callback in async.waterfall.\n\t\t\t\tcallbackError = new Error(err);\n\t\t\t}\n\t\t\tif (cb) {\n\t\t\t\tcb(callbackError || err, response);\n\t\t\t}\n\t\t};\n\n\t\tconst dialogParams = {\n\t\t\ttitle: \"Enter a name for your new workspace.\",\n\t\t\tinputLabel: \"Enter a name for your new workspace.\",\n\t\t\taffirmativeResponseLabel: \"Confirm\",\n\t\t\tshowCancelButton: false,\n\t\t\tshowNegativeButton: false,\n\t\t};\n\n\t\tActions.spawnDialog(\"singleInput\", dialogParams, onUserInput);\n\t},\n\n\t/**\n\t * Spawns an input field asking what the user would like to name their new workspace.\n\t */\n\tspawnWorkspaceInputField: (cb: StandardCallback) => {\n\t\t// Spawns the dialog with the input field and accepts a callback to be invoked after the user acts.\n\t\tLogger.system.log(\"SpawnWorkspaceInput - start\");\n\t\tconst onUserInput = (err: StandardError, response: UserInputResponseType) => {\n\t\t\tLogger.system.log(\"SpawnWorkspaceInput onUserInput\", response);\n\t\t\tlet callbackError: Error | null = null;\n\t\t\tif (typeof err === \"string\") {\n\t\t\t\t// Error objects cause async to invoke the final callback in async.waterfall.\n\t\t\t\tcallbackError = new Error(err);\n\t\t\t}\n\t\t\tif (cb) {\n\t\t\t\tcb(callbackError || err, response);\n\t\t\t}\n\t\t};\n\n\t\tconst dialogParams = {\n\t\t\ttitle: \"Enter a name for your new workspace.\",\n\t\t\tinputLabel: \"Enter a name for your new workspace.\",\n\t\t\taffirmativeResponseLabel: \"Confirm\",\n\t\t\tshowCancelButton: false,\n\t\t\tshowNegativeButton: false,\n\t\t};\n\n\t\tActions.spawnDialog(\"singleInput\", dialogParams, onUserInput);\n\t},\n\n\t/**\n\t * Asks the user if they'd like to save their workspace if it's different from what's in storage. If the workspace is clean, we just invoke the callback.\n\t */\n\taskIfUserWantsToSave: async function (callback: StandardCallback) {\n\t\tconst activeWorkspace: WorkspaceType = WorkspaceManagementStore.getValue(\"activeWorkspace\");\n\n\t\tif (await FSBL.Clients.WorkspaceClient.isWorkspaceDirty()) {\n\t\t\tLogger.system.log(\"NewWorkspace.spawnDialog start.\");\n\t\t\tconst dialogParams = {\n\t\t\t\tmonitor: \"primary\",\n\t\t\t\ttitle: \"Save your workspace?\",\n\t\t\t\tquestion: `\\\"${activeWorkspace.name}\\\" has unsaved changes. Would you like to save?`,\n\t\t\t\taffirmativeResponseLabel: \"Save\",\n\t\t\t\tnegativeResponseLabel: \"Don't Save\",\n\t\t\t};\n\t\t\tconst waitForUserInput = () =>\n\t\t\t\tnew Promise((resolve) => {\n\t\t\t\t\tconst onUserInput = (err: StandardError, response: UserInputResponseType) => {\n\t\t\t\t\t\tLogger.system.log(\"Spawn Dialog callback.\");\n\t\t\t\t\t\tif (callback) callback(null, response);\n\t\t\t\t\t\tresolve(response);\n\t\t\t\t\t};\n\t\t\t\t\tActions.spawnDialog(\"yesNo\", dialogParams, onUserInput);\n\t\t\t\t});\n\t\t\treturn await waitForUserInput();\n\t\t} else {\n\t\t\t// In this case the workspace is not dirty, so we don't need to save.\n\t\t\tif (callback) callback(null, { choice: \"negative\" });\n\t\t\treturn { choice: \"negative\" };\n\t\t}\n\t},\n\n\t/**\n\t * Handles the response from the dialog asking if the user wants to save their workspace.\n\t *\n\t * @param {any} response\n\t * @param {any} callback\n\t */\n\thandleSaveDialogResponse(response: UserInputResponseType, callback: StandardErrorCallback) {\n\t\tif (response.choice === \"affirmative\") {\n\t\t\t// User wants to save, so call the client API.\n\t\t\tActions.saveWorkspace(callback);\n\t\t} else if (response.choice === \"negative\") {\n\t\t\t// Doesn't want to save.\n\t\t\tcallback(null);\n\t\t} else {\n\t\t\t// choice === cancel\n\t\t\tcallback(new Error(SAVE_DIALOG_CANCEL_ERROR));\n\t\t}\n\t},\n\t/**\n\t * Makes sure the user has input a valid workspace name.\n\t */\n\tvalidateWorkspaceInput(response: UserInputResponseType, callback: StandardErrorCallback) {\n\t\tLogger.system.log(\"spawnWorkspaceInput\", response);\n\t\t// If user wants to proceed but gave an invalid name, tell them that they messed up, then die.\n\t\tif (response.choice !== \"cancel\" && (!response.value || response.value === \"\")) {\n\t\t\tlet dialogParams = {\n\t\t\t\ttitle: \"Invalid Workspace Name\",\n\t\t\t\tquestion: \"Workspace names must contain letters or numbers. Please try again.\",\n\t\t\t\taffirmativeResponseLabel: \"OK\",\n\t\t\t\tshowNegativeButton: false,\n\t\t\t\tshowCancelButton: false,\n\t\t\t};\n\t\t\tActions.spawnDialog(\"yesNo\", dialogParams, () => {});\n\t\t\treturn callback(new Error(\"Invalid workspace name.\"));\n\t\t} else if (response.choice === \"cancel\") {\n\t\t\treturn callback(new Error(SAVE_DIALOG_CANCEL_ERROR));\n\t\t}\n\t\tcallback(null, response);\n\t},\n\n\taskAboutOverwrite(params: SaveWorkspaceWaterfallParams, callback: StandardErrorCallback) {\n\t\tconst { workspaceExists, workspaceName } = params;\n\t\tconst dialogParams = {\n\t\t\ttitle: \"Overwrite Workspace?\",\n\t\t\tquestion: `This will overwrite the saved data for \"${workspaceName}\". Would you like to proceed?`,\n\t\t\taffirmativeResponseLabel: \"Overwrite\",\n\t\t\tshowNegativeButton: false,\n\t\t};\n\t\tconst onUserInput = (err: StandardError, response: UserInputResponseType) => {\n\t\t\tif (response.choice === \"affirmative\") {\n\t\t\t\tcallback(null, workspaceName);\n\t\t\t} else {\n\t\t\t\tcallback(new Error(NEGATIVE));\n\t\t\t}\n\t\t};\n\t\tif (workspaceExists) {\n\t\t\tActions.spawnDialog(\"yesNo\", dialogParams, onUserInput);\n\t\t} else {\n\t\t\tcallback(null, workspaceName);\n\t\t}\n\t},\n\taskIfUserWantsNewWorkspace(params: SaveWorkspaceWaterfallParams, callback: StandardErrorCallback) {\n\t\tlet { workspaceExists, workspaceName, template } = params;\n\n\t\tlet dialogParams = {\n\t\t\ttitle: \"New workspace\",\n\t\t\tquestion: `The workspace \"${workspaceName}\" already exists. A new workspace with a modified name will be created.`,\n\t\t\taffirmativeResponseLabel: \"OK\",\n\t\t\tshowNegativeButton: false,\n\t\t};\n\n\t\tfunction onUserInput(err: StandardError, response: UserInputResponseType) {\n\t\t\tif (response.choice === \"affirmative\") {\n\t\t\t\tcallback(null, { workspaceName, template });\n\t\t\t} else {\n\t\t\t\tcallback(new Error(NEGATIVE));\n\t\t\t}\n\t\t}\n\t\tif (workspaceExists) {\n\t\t\tActions.spawnDialog(\"yesNo\", dialogParams, onUserInput);\n\t\t} else {\n\t\t\tcallback(null, { workspaceName, template });\n\t\t}\n\t},\n\n\t/**\n\t * Checks if the workspace exists. If it does, it asks the user if they're comfortable overwriting that data.\n\t */\n\tcheckIfWorkspaceAlreadyExists(response: any, callback: StandardErrorCallback) {\n\t\tconst workspaceName = response.value;\n\t\tconst camelCaseWorkspaceName = Util.camelCase(workspaceName);\n\t\t// Do any of the workspaces have the same name that the user is trying to input.\n\t\tconst workspaceExists = FSBL.Clients.WorkspaceClient.workspaces.some(\n\t\t\t(workspace) => Util.camelCase(workspace) === camelCaseWorkspaceName\n\t\t);\n\t\tcallback(null, {\n\t\t\tworkspaceExists,\n\t\t\tworkspaceName,\n\t\t\ttemplate: response.template,\n\t\t});\n\t},\n\t/*********************************************************************************************\n\t *\n\t *\t\t\t\t\t\t\t\tMisc functionality\n\t *\n\t *********************************************************************************************/\n\t/**\n\t * Un-focuses from the menu.\n\t */\n\tblurWindow: function () {\n\t\tfinsembleWindow.blur();\n\t},\n};\n\nfunction createLocalStore(done: () => void) {\n\tStoreClient.createStore(\n\t\t{ store: \"Finsemble-WorkspaceMenu-Local-Store\", values: defaultData },\n\t\t(err: StandardError, store: StoreModel) => {\n\t\t\tWorkspaceManagementStore = store;\n\t\t\tdone();\n\t\t}\n\t);\n}\n\nfunction createGlobalStore(done: () => void) {\n\tStoreClient.createStore(\n\t\t{\n\t\t\tstore: \"Finsemble-WorkspaceMenu-Global-Store\",\n\t\t\tglobal: true,\n\t\t\tvalues: { owner: finsembleWindow.name },\n\t\t},\n\t\t(err: StandardError, store: StoreModel) => {\n\t\t\tWorkspaceManagementGlobalStore = store;\n\t\t\tdone();\n\t\t}\n\t);\n}\n\nfunction getPreferences(done: () => void) {\n\t(async () => {\n\t\tconst { err: preferencesErr, data: preferencesValues } = await FSBL.Clients.ConfigClient.getPreferences();\n\t\tif (preferencesErr) {\n\t\t\tLogger.system.error(\"workspaceManagementMenuStore.getPreferences - getPreferences\", preferencesErr);\n\t\t}\n\t\tlet promptUserOnDirtyWorkspaceFromPreferences;\n\t\tlet discardUnsavedChangesFromPreferences;\n\t\tif (preferencesValues) {\n\t\t\tpromptUserOnDirtyWorkspaceFromPreferences = preferencesValues[WORKSPACE_CONFIGS.PROMPT_USER_ON_DIRTY_WORKSPACE];\n\t\t\tdiscardUnsavedChangesFromPreferences = preferencesValues[WORKSPACE_CONFIGS.DISCARD_UNSAVED_CHANGES];\n\t\t}\n\n\t\t// if we don't have a preference as a boolean value (i.e. null or undefined)\n\t\t// fetch the config to apply\n\t\tif (typeof promptUserOnDirtyWorkspaceFromPreferences !== \"boolean\") {\n\t\t\tconst { err: configErr, data: configValues } = await FSBL.Clients.ConfigClient.getValues([\n\t\t\t\tWORKSPACE_CONFIGS.DEPRECATED_PROMPT_ON_DIRTY,\n\t\t\t\tWORKSPACE_CONFIGS.PROMPT_USER_ON_DIRTY_WORKSPACE,\n\t\t\t]);\n\n\t\t\tif (configErr) {\n\t\t\t\tLogger.system.error(\n\t\t\t\t\t\"workspaceManagementMenuStore.getPreferences - getValues - promptUserOnDirtyWorkspace\",\n\t\t\t\t\tconfigErr\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (configValues) {\n\t\t\t\t// deprecated (if present) > config (fallback) > default\n\t\t\t\tPROMPT_ON_DIRTY_WORKSPACE =\n\t\t\t\t\tconfigValues[WORKSPACE_CONFIGS.DEPRECATED_PROMPT_ON_DIRTY] ??\n\t\t\t\t\tconfigValues[WORKSPACE_CONFIGS.PROMPT_USER_ON_DIRTY_WORKSPACE] ??\n\t\t\t\t\ttrue;\n\t\t\t} else {\n\t\t\t\t// we shouldn't get to this - but in case we do we apply the default.\n\t\t\t\tPROMPT_ON_DIRTY_WORKSPACE = true;\n\t\t\t}\n\t\t} else {\n\t\t\tPROMPT_ON_DIRTY_WORKSPACE = promptUserOnDirtyWorkspaceFromPreferences;\n\t\t}\n\n\t\t// if we don't have a preference as a boolean value (i.e. null or undefined)\n\t\t// fetch the config to apply\n\t\tif (typeof discardUnsavedChangesFromPreferences !== \"boolean\") {\n\t\t\tconst { err: configErr, data: configValue } = await FSBL.Clients.ConfigClient.getValue(\n\t\t\t\tWORKSPACE_CONFIGS.DISCARD_UNSAVED_CHANGES\n\t\t\t);\n\n\t\t\tif (configErr) {\n\t\t\t\tLogger.system.error(\n\t\t\t\t\t\"workspaceManagementMenuStore.getPreferences - getValues - discardUnsavedworkspaceChanges\",\n\t\t\t\t\tconfigErr\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (configValue) {\n\t\t\t\t// config (fallback) > default\n\t\t\t\tDISCARD_UNSAVED_CHANGES = configValue[WORKSPACE_CONFIGS.DISCARD_UNSAVED_CHANGES] ?? false;\n\t\t\t} else {\n\t\t\t\t// we shouldn't get to this - but in case we do we assume user does not want to discard unsaved changes\n\t\t\t\t// by default.\n\t\t\t\tDISCARD_UNSAVED_CHANGES = false;\n\t\t\t}\n\t\t} else {\n\t\t\tDISCARD_UNSAVED_CHANGES = discardUnsavedChangesFromPreferences;\n\t\t}\n\n\t\tdone();\n\t})();\n}\n\n/**\n * Initializes the store for the Workspace Management Menu.\n */\nfunction initialize(cb: any) {\n\tStoreClient = FSBL.Clients.DistributedStoreClient;\n\t// eslint-disable-next-line prefer-destructuring\n\tLogger = FSBL.Clients.Logger;\n\tasync.parallel([createGlobalStore, createLocalStore, getPreferences, addListeners], () => {\n\t\tActions.completeInitialize();\n\t\tcb(WorkspaceManagementStore);\n\t});\n}\n\nlet getStore = () => WorkspaceManagementStore;\n\n/**\n * This is a quick little initialization manager that Terry hacked up.\n * Ultimately everything in this file should be rewritten in hooks/redux pattern.\n */\nclass StoreManager {\n\tinitialized: boolean;\n\n\tinitializing: boolean;\n\n\tcallbacks: Function[];\n\n\tstore: StoreModel | null;\n\n\tconstructor() {\n\t\tthis.initialized = false;\n\t\tthis.initializing = false;\n\t\tthis.callbacks = [];\n\t\tthis.store = null;\n\t}\n\n\tinitialize() {\n\t\tif (this.initializing) return;\n\t\tthis.initializing = true;\n\t\tinitialize((store: StoreModel) => {\n\t\t\tthis.initialized = true;\n\t\t\tthis.store = store;\n\t\t\tthis.callbacks.forEach((cb) => cb(store));\n\t\t});\n\t}\n\n\taddInitializedListener(cb: (store: StoreModel) => void) {\n\t\tif (this.initialized && this.store !== null) return cb(this.store);\n\t\tthis.callbacks.push(cb);\n\t}\n\n\tremoveInitializedListener(cb: Function) {\n\t\tthis.callbacks = this.callbacks.filter((entry) => entry !== cb);\n\t}\n}\nconst storeManager = new StoreManager();\n\nexport {\n\tstoreManager,\n\tWorkspaceManagementGlobalStore as GlobalStore,\n\tinitialize,\n\tWorkspaceManagementStore as Store,\n\tActions,\n\tgetStore,\n};\n"]}
@@ -25,6 +25,7 @@ interface IState {
25
25
  focusedWorkspaceComponentList: string[];
26
26
  promptUserOnDirtyWorkspace: boolean;
27
27
  discardUnsavedChanges: boolean;
28
+ permanentWorkspaces: string[];
28
29
  }
29
30
  export default class Workspaces extends React.Component<IProps, IState> {
30
31
  addWorkspace?: () => void;
@@ -34,6 +35,7 @@ export default class Workspaces extends React.Component<IProps, IState> {
34
35
  setWorkspaceList(err: StandardError, data: {
35
36
  value: Workspace[];
36
37
  }): void;
38
+ setPermanentWorkspaces(err: StandardError, config: any): void;
37
39
  addListeners(): void;
38
40
  /**
39
41
  * Sets the windowOptions.alwaysOnTop to the value supplied. The preferences component should
@@ -57,7 +59,7 @@ export default class Workspaces extends React.Component<IProps, IState> {
57
59
  componentDidMount(): void;
58
60
  componentWillUnmount(): void;
59
61
  setPreference(field: string, value: any, cb?: Function): void;
60
- setWorkspaceToLoadOnStart(eventOrCb: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement> | (() => void)): void;
62
+ setWorkspaceToLoadOnStart(eventOrCb: React.ChangeEvent<HTMLInputElement> | (() => void)): void;
61
63
  openFileDialog(): void;
62
64
  /**
63
65
  * If the event is being listened to, when the preferences component is focused
@@ -8,6 +8,7 @@ import { WorkspaceButton } from "../workspaces/WorkspaceButton";
8
8
  import WorkspaceComponents from "../workspaces/WorkspaceComponents";
9
9
  import WorkspaceItemList from "../workspaces/WorkspaceItemList";
10
10
  const WORKSPACE_PREFERENCES = {
11
+ PERMANENT_WORKSPACES: "finsemble.servicesConfig.workspace.permanentWorkspaces",
11
12
  PROMPT_USER_ON_DIRTY_WORKSPACE: "finsemble.servicesConfig.workspace.promptUserOnDirtyWorkspace",
12
13
  DISCARD_UNSAVED_CHANGES: "finsemble.servicesConfig.workspace.discardUnsavedChanges",
13
14
  INITIAL_WORKSPACE_PREFERENCE: "finsemble.initialWorkspace",
@@ -29,6 +30,7 @@ export default class Workspaces extends React.Component {
29
30
  alwaysOnTop: (_b = finsembleWindow.windowOptions) === null || _b === void 0 ? void 0 : _b.alwaysOnTop,
30
31
  promptUserOnDirtyWorkspace: true,
31
32
  discardUnsavedChanges: false,
33
+ permanentWorkspaces: [],
32
34
  };
33
35
  this.bindCorrectContext();
34
36
  this.addListeners();
@@ -61,6 +63,7 @@ export default class Workspaces extends React.Component {
61
63
  this.setFocusedWorkspace = this.setFocusedWorkspace.bind(this);
62
64
  this.toggleDiscardUnsavedChanges = this.toggleDiscardUnsavedChanges.bind(this);
63
65
  this.togglePromptUserOnDirtyWorkspace = this.togglePromptUserOnDirtyWorkspace.bind(this);
66
+ this.setPermanentWorkspaces = this.setPermanentWorkspaces.bind(this);
64
67
  }
65
68
  setWorkspaceList(err, data) {
66
69
  if (!data)
@@ -69,10 +72,21 @@ export default class Workspaces extends React.Component {
69
72
  workspaceList: data.value,
70
73
  });
71
74
  }
75
+ setPermanentWorkspaces(err, config) {
76
+ FSBL.Clients.Logger.system.log("Workspaces new permanentWorkspaces config", config);
77
+ const { permanentWorkspaces } = config.value.workspace;
78
+ if (permanentWorkspaces && Array.isArray(permanentWorkspaces)) {
79
+ this.setState({
80
+ permanentWorkspaces: permanentWorkspaces,
81
+ });
82
+ }
83
+ }
72
84
  addListeners() {
73
85
  this.props.addListener({ field: "WorkspaceList" }, this.setWorkspaceList);
74
86
  this.props.addListener({ field: "preferences" }, this.setUIPreferencesState);
75
87
  FSBL.Clients.WorkspaceClient.addEventListener("save-complete", this.getFocusedWorkspaceComponentList);
88
+ // Configuration listeners to update the WSM
89
+ FSBL.Clients.ConfigClient.addListener({ field: "finsemble.servicesConfig" }, this.setPermanentWorkspaces);
76
90
  }
77
91
  /**
78
92
  * Sets the windowOptions.alwaysOnTop to the value supplied. The preferences component should
@@ -269,6 +283,7 @@ export default class Workspaces extends React.Component {
269
283
  WORKSPACE_PREFERENCES.PROMPT_USER_ON_DIRTY_WORKSPACE,
270
284
  WORKSPACE_PREFERENCES.DISCARD_UNSAVED_CHANGES,
271
285
  WORKSPACE_PREFERENCES.INITIAL_WORKSPACE_PREFERENCE,
286
+ WORKSPACE_PREFERENCES.PERMANENT_WORKSPACES,
272
287
  ], (err, values) => {
273
288
  var _a, _b;
274
289
  if (err) {
@@ -280,6 +295,7 @@ export default class Workspaces extends React.Component {
280
295
  focusedWorkspace: (_a = values[WORKSPACE_PREFERENCES.INITIAL_WORKSPACE_PREFERENCE]) !== null && _a !== void 0 ? _a : (_b = FSBL.Clients.WorkspaceClient.activeWorkspace) === null || _b === void 0 ? void 0 : _b.name,
281
296
  promptUserOnDirtyWorkspace: values[WORKSPACE_PREFERENCES.PROMPT_USER_ON_DIRTY_WORKSPACE],
282
297
  discardUnsavedChanges: values[WORKSPACE_PREFERENCES.DISCARD_UNSAVED_CHANGES],
298
+ permanentWorkspaces: values[WORKSPACE_PREFERENCES.PERMANENT_WORKSPACES],
283
299
  });
284
300
  }
285
301
  });
@@ -295,6 +311,7 @@ export default class Workspaces extends React.Component {
295
311
  }
296
312
  componentWillUnmount() {
297
313
  this.props.removeListener({ field: "preferences" }, this.setUIPreferencesState);
314
+ FSBL.Clients.ConfigClient.removeListener({ field: "finsemble.servicesConfig" }, this.setPermanentWorkspaces);
298
315
  }
299
316
  setPreference(field, value, cb) {
300
317
  FSBL.Clients.ConfigClient.setPreference({
@@ -422,7 +439,7 @@ export default class Workspaces extends React.Component {
422
439
  // default to false.
423
440
  let PROMPT_ON_SAVE = data === null ? false : data;
424
441
  if (!PROMPT_ON_SAVE) {
425
- let activeName = (_c = (_b = (_a = FSBL === null || FSBL === void 0 ? void 0 : FSBL.Clients) === null || _a === void 0 ? void 0 : _a.WorkspaceClient) === null || _b === void 0 ? void 0 : _b.activeWorkspace) === null || _c === void 0 ? void 0 : _c.name;
442
+ let activeName = ((_c = (_b = (_a = FSBL === null || FSBL === void 0 ? void 0 : FSBL.Clients) === null || _a === void 0 ? void 0 : _a.WorkspaceClient) === null || _b === void 0 ? void 0 : _b.activeWorkspace) === null || _c === void 0 ? void 0 : _c.name) || "";
426
443
  return FSBL.Clients.WorkspaceClient.saveAs({
427
444
  name: activeName,
428
445
  force: true,
@@ -499,7 +516,7 @@ export default class Workspaces extends React.Component {
499
516
  React.createElement("div", { className: "workspace-list-header-row" },
500
517
  React.createElement("div", { className: "content-section-header workspace-list-header" })),
501
518
  React.createElement("div", { className: "content-section-wrapper" },
502
- React.createElement(WorkspaceItemList, { onDragEnd: this.onDragEnd, workspaceList: this.state.workspaceList, allowDelete: allowDelete, deleteButtonClasses: deleteButtonClasses, deleteTooltip: deleteTooltip, workspaceToLoadOnStart: this.state.workspaceToLoadOnStart, focusedWorkspace: this.state.focusedWorkspace, editing: this.state.editing, adding: this.state.adding, renameWorkspace: this.renameWorkspace, addWorkspace: this.addWorkspace, cancelEdit: this.cancelEdit, setFocusedWorkspace: this.setFocusedWorkspace, renameTooltip: renameTooltip, renameButtonClasses: renameButtonClasses, allowRename: allowRename, handleButtonClicks: this.handleButtonClicks, startEditingWorkspace: this.startEditingWorkspace, deleteWorkspace: this.deleteWorkspace }),
519
+ React.createElement(WorkspaceItemList, { onDragEnd: this.onDragEnd, workspaceList: this.state.workspaceList, allowDelete: allowDelete, deleteButtonClasses: deleteButtonClasses, deleteTooltip: deleteTooltip, workspaceToLoadOnStart: this.state.workspaceToLoadOnStart, focusedWorkspace: this.state.focusedWorkspace, editing: this.state.editing, adding: this.state.adding, renameWorkspace: this.renameWorkspace, addWorkspace: this.addWorkspace, cancelEdit: this.cancelEdit, setFocusedWorkspace: this.setFocusedWorkspace, renameTooltip: renameTooltip, renameButtonClasses: renameButtonClasses, allowRename: allowRename, handleButtonClicks: this.handleButtonClicks, startEditingWorkspace: this.startEditingWorkspace, deleteWorkspace: this.deleteWorkspace, permanentWorkspaces: this.state.permanentWorkspaces }),
503
520
  React.createElement("div", { className: "workspace-extras" },
504
521
  React.createElement(WorkspaceComponents, { focusedWorkspaceComponentList: this.state.focusedWorkspaceComponentList }),
505
522
  React.createElement("div", { className: "workspace-action-buttons" },
@@ -508,7 +525,7 @@ export default class Workspaces extends React.Component {
508
525
  React.createElement(Checkbox, { disabled: !this.state.focusedWorkspace, onClick: this.setWorkspaceToLoadOnStart, checked: !!this.state.focusedWorkspace && this.state.focusedWorkspace === this.state.workspaceToLoadOnStart, label: "Load this workspace on startup" }),
509
526
  React.createElement(React.Fragment, null, "\u00A0"),
510
527
  React.createElement(Checkbox, { onClick: this.togglePromptUserOnDirtyWorkspace, checked: this.state.promptUserOnDirtyWorkspace, label: "Prompt user on dirty workspace" }),
511
- React.createElement("span", { className: "indent-15px" },
528
+ React.createElement("span", { className: "indent-5px" },
512
529
  React.createElement(Checkbox, { disabled: this.state.promptUserOnDirtyWorkspace, onClick: this.toggleDiscardUnsavedChanges, checked: this.state.discardUnsavedChanges, label: "Discard unsaved changes" })))));
513
530
  }
514
531
  }