@finsemble/finsemble-ui 6.1.3 → 6.2.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.
- package/package.json +20 -17
- package/react/actions/smartDesktopDesignerActions.d.ts +5 -4
- package/react/actions/smartDesktopDesignerActions.js.map +1 -1
- package/react/assets/css/defaultTheme.css +1 -1
- package/react/assets/css/notificationsCenter.css +1 -0
- package/react/assets/css/userPreferences.css +4 -2
- package/react/assets/css/windowTitleBar.css +1 -0
- package/react/assets/icons/check-square.svg +6 -0
- package/react/assets/icons/lock.svg +6 -0
- package/react/components/common/Button.d.ts +1 -0
- package/react/components/common/Button.js +2 -2
- package/react/components/common/Button.js.map +1 -1
- package/react/components/common/ButtonRow.d.ts +15 -0
- package/react/components/common/ButtonRow.js +32 -0
- package/react/components/common/ButtonRow.js.map +1 -0
- package/react/components/common/Checkbox.d.ts +8 -0
- package/react/components/common/Checkbox.js +22 -0
- package/react/components/common/Checkbox.js.map +1 -0
- package/react/components/common/FinsembleIcon.d.ts +1 -1
- package/react/components/common/FinsembleIcon.js +4 -0
- package/react/components/common/FinsembleIcon.js.map +1 -1
- package/react/components/common/FinsembleSelect.d.ts +3 -2
- package/react/components/common/FinsembleSelect.js +2 -2
- package/react/components/common/FinsembleSelect.js.map +1 -1
- package/react/components/common/Tooltip.d.ts +4 -3
- package/react/components/common/Tooltip.js +3 -3
- package/react/components/common/Tooltip.js.map +1 -1
- package/react/components/common/css/tooltip.css +10 -0
- package/react/components/common/helpers.js +12 -0
- package/react/components/common/helpers.js.map +1 -1
- package/react/components/common/stories/ButtonRow.stories.d.ts +14 -0
- package/react/components/common/stories/ButtonRow.stories.js +39 -0
- package/react/components/common/stories/ButtonRow.stories.js.map +1 -0
- package/react/components/common/stories/Checkbox.stories.d.ts +13 -0
- package/react/components/common/stories/Checkbox.stories.js +29 -0
- package/react/components/common/stories/Checkbox.stories.js.map +1 -0
- package/react/components/common/stories/DropdownButton.stories.d.ts +22 -0
- package/react/components/common/stories/DropdownButton.stories.js +29 -0
- package/react/components/common/stories/DropdownButton.stories.js.map +1 -0
- package/react/components/common/stories/FinsembleIcon.stories.js +2 -0
- package/react/components/common/stories/FinsembleIcon.stories.js.map +1 -1
- package/react/components/common/stories/FinsembleSelect.stories.d.ts +1 -1
- package/react/components/common/stories/Tooltip.stories.d.ts +1 -1
- package/react/components/{shared/addProtocolToValidURL.spec.d.ts → common/tests/ButtonRow.spec.d.ts} +0 -0
- package/react/components/common/tests/ButtonRow.spec.js +25 -0
- package/react/components/common/tests/ButtonRow.spec.js.map +1 -0
- package/react/components/common/tests/Checkbox.spec.d.ts +1 -0
- package/react/components/common/tests/Checkbox.spec.js +33 -0
- package/react/components/common/tests/Checkbox.spec.js.map +1 -0
- package/react/components/fdc3Resolver/ResolverDialog.css +1 -0
- package/react/components/fdc3Resolver/ResolverDialog.js +4 -5
- package/react/components/fdc3Resolver/ResolverDialog.js.map +1 -1
- package/react/components/fdc3Resolver/ResolverDialog.spec.js +1 -8
- package/react/components/fdc3Resolver/ResolverDialog.spec.js.map +1 -1
- package/react/components/fdc3Resolver/ResolverDialog.stories.js +45 -45
- package/react/components/fdc3Resolver/ResolverDialog.stories.js.map +1 -1
- package/react/components/notifications/components/drawer/DrawerHeader.js +6 -6
- package/react/components/notifications/components/drawer/DrawerHeader.js.map +1 -1
- package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js +32 -31
- package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js.map +1 -1
- package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js +4 -6
- package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js.map +1 -1
- package/react/components/notifications/components/views/ListView.js +1 -1
- package/react/components/notifications/components/views/ListView.js.map +1 -1
- package/react/components/notifications/components/views/NotificationDetailsView.js +3 -2
- package/react/components/notifications/components/views/NotificationDetailsView.js.map +1 -1
- package/react/components/notifications/constants.d.ts +13 -0
- package/react/components/notifications/constants.js.map +1 -1
- package/react/components/search/Highlight.js +13 -3
- package/react/components/search/Highlight.js.map +1 -1
- package/react/components/shared/DefaultDropdownButton.d.ts +1 -0
- package/react/components/shared/DefaultDropdownButton.js +14 -4
- package/react/components/shared/DefaultDropdownButton.js.map +1 -1
- package/react/components/shared/tests/DefaultDropdownButton.spec.d.ts +1 -0
- package/react/components/shared/tests/DefaultDropdownButton.spec.js +54 -0
- package/react/components/shared/tests/DefaultDropdownButton.spec.js.map +1 -0
- package/react/components/shared/tests/addProtocolToValidURL.spec.d.ts +1 -0
- package/react/components/shared/{addProtocolToValidURL.spec.js → tests/addProtocolToValidURL.spec.js} +1 -1
- package/react/components/shared/tests/addProtocolToValidURL.spec.js.map +1 -0
- package/react/components/smartDesktopDesigner/AppEditAccess.d.ts +15 -0
- package/react/components/smartDesktopDesigner/AppEditAccess.js +155 -0
- package/react/components/smartDesktopDesigner/AppEditAccess.js.map +1 -0
- package/react/components/smartDesktopDesigner/AppEditPage.d.ts +7 -1
- package/react/components/smartDesktopDesigner/AppEditPage.js +5 -1
- package/react/components/smartDesktopDesigner/AppEditPage.js.map +1 -1
- package/react/components/smartDesktopDesigner/Application.d.ts +4 -1
- package/react/components/smartDesktopDesigner/Application.js +20 -10
- package/react/components/smartDesktopDesigner/Application.js.map +1 -1
- package/react/components/smartDesktopDesigner/ApplicationEdit.d.ts +3 -0
- package/react/components/smartDesktopDesigner/ApplicationEdit.js +2 -2
- package/react/components/smartDesktopDesigner/ApplicationEdit.js.map +1 -1
- package/react/components/smartDesktopDesigner/ApplicationList.js +11 -1
- package/react/components/smartDesktopDesigner/ApplicationList.js.map +1 -1
- package/react/components/smartDesktopDesigner/ApplicationSetup.d.ts +6 -1
- package/react/components/smartDesktopDesigner/ApplicationSetup.js.map +1 -1
- package/react/components/smartDesktopDesigner/Applications.d.ts +2 -0
- package/react/components/smartDesktopDesigner/Applications.js +2 -2
- package/react/components/smartDesktopDesigner/Applications.js.map +1 -1
- package/react/components/smartDesktopDesigner/common/views.js +2 -0
- package/react/components/smartDesktopDesigner/common/views.js.map +1 -1
- package/react/components/smartDesktopDesigner/css/applications.css +38 -0
- package/react/components/smartDesktopDesigner/fixtures/applicationEditProps.js +18 -0
- package/react/components/smartDesktopDesigner/fixtures/applicationEditProps.js.map +1 -1
- package/react/components/smartDesktopDesigner/fixtures/applicationSetupProps.js +9 -0
- package/react/components/smartDesktopDesigner/fixtures/applicationSetupProps.js.map +1 -1
- package/react/components/smartDesktopDesigner/fixtures/applicationsProps.js +6 -2
- package/react/components/smartDesktopDesigner/fixtures/applicationsProps.js.map +1 -1
- package/react/components/smartDesktopDesigner/fixtures/apps.d.ts +71 -2
- package/react/components/smartDesktopDesigner/fixtures/apps.js +16 -5
- package/react/components/smartDesktopDesigner/fixtures/apps.js.map +1 -1
- package/react/components/smartDesktopDesigner/stories/AppEditPage.stories.d.ts +1 -1
- package/react/components/smartDesktopDesigner/stories/AppEditPage.stories.js +20 -0
- package/react/components/smartDesktopDesigner/stories/AppEditPage.stories.js.map +1 -1
- package/react/components/smartDesktopDesigner/stories/Applications.stories.js +2 -1
- package/react/components/smartDesktopDesigner/stories/Applications.stories.js.map +1 -1
- package/react/components/smartDesktopDesigner/tests/AppEditPage.spec.js +1 -0
- package/react/components/smartDesktopDesigner/tests/AppEditPage.spec.js.map +1 -1
- package/react/components/smartDesktopDesigner/tests/Applications.spec.d.ts +1 -1
- package/react/components/smartDesktopDesigner/tests/Applications.spec.js +84 -7
- package/react/components/smartDesktopDesigner/tests/Applications.spec.js.map +1 -1
- package/react/components/toolbar/advancedAppLauncher/components/Content.js +2 -3
- package/react/components/toolbar/advancedAppLauncher/components/Content.js.map +1 -1
- package/react/components/toolbar/advancedAppLauncher/components/FoldersList.js +1 -1
- package/react/components/toolbar/advancedAppLauncher/components/FoldersList.js.map +1 -1
- package/react/components/toolbar/dashbar/Dashbar.js +23 -11
- package/react/components/toolbar/dashbar/Dashbar.js.map +1 -1
- package/react/components/userPreferences/UserPreferences.js +8 -23
- package/react/components/userPreferences/UserPreferences.js.map +1 -1
- package/react/components/userPreferences/UserPreferencesBase.d.ts +3 -1
- package/react/components/userPreferences/UserPreferencesBase.js +5 -6
- package/react/components/userPreferences/UserPreferencesBase.js.map +1 -1
- package/react/components/userPreferences/UserPreferencesWrapper.d.ts +4 -0
- package/react/components/userPreferences/UserPreferencesWrapper.js +27 -0
- package/react/components/userPreferences/UserPreferencesWrapper.js.map +1 -0
- package/react/components/userPreferences/components/ContentSection.d.ts +18 -3
- package/react/components/userPreferences/components/ContentSection.js +4 -2
- package/react/components/userPreferences/components/ContentSection.js.map +1 -1
- package/react/components/userPreferences/components/LeftNav.d.ts +19 -4
- package/react/components/userPreferences/components/LeftNav.js +11 -10
- package/react/components/userPreferences/components/LeftNav.js.map +1 -1
- package/react/components/userPreferences/components/content/DashbarEditor.d.ts +20 -5
- package/react/components/userPreferences/components/content/DashbarEditor.js +11 -11
- package/react/components/userPreferences/components/content/DashbarEditor.js.map +1 -1
- package/react/components/userPreferences/components/content/DashbarEditorItem.d.ts +10 -0
- package/react/components/userPreferences/components/content/DashbarEditorItem.js +11 -0
- package/react/components/userPreferences/components/content/DashbarEditorItem.js.map +1 -0
- package/react/components/userPreferences/components/content/General.d.ts +10 -3
- package/react/components/userPreferences/components/content/General.js +2 -2
- package/react/components/userPreferences/components/content/General.js.map +1 -1
- package/react/components/userPreferences/components/content/Workspaces.js +39 -112
- package/react/components/userPreferences/components/content/Workspaces.js.map +1 -1
- package/react/components/userPreferences/components/content/notificationViews/NotificationsPreferencesHome.js +9 -11
- package/react/components/userPreferences/components/content/notificationViews/NotificationsPreferencesHome.js.map +1 -1
- package/react/components/userPreferences/components/content/notificationViews/NotificationsSourceTypes.d.ts +1 -1
- package/react/components/userPreferences/components/content/notificationViews/NotificationsSourceTypes.js +9 -7
- package/react/components/userPreferences/components/content/notificationViews/NotificationsSourceTypes.js.map +1 -1
- package/react/components/userPreferences/components/content/notificationViews/NotificationsSourcesPreferences.d.ts +3 -1
- package/react/components/userPreferences/components/content/notificationViews/NotificationsSourcesPreferences.js +13 -12
- package/react/components/userPreferences/components/content/notificationViews/NotificationsSourcesPreferences.js.map +1 -1
- package/react/components/userPreferences/components/general/ScheduledRestart.d.ts +24 -7
- package/react/components/userPreferences/components/general/ScheduledRestart.js +71 -22
- package/react/components/userPreferences/components/general/ScheduledRestart.js.map +1 -1
- package/react/components/userPreferences/components/workspaces/WorkspaceButton.d.ts +9 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceButton.js +5 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceButton.js.map +1 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceComponents.d.ts +6 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceComponents.js +8 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceComponents.js.map +1 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceItem.d.ts +45 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceItem.js +82 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceItem.js.map +1 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceItemList.d.ts +8 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceItemList.js +7 -0
- package/react/components/userPreferences/components/workspaces/WorkspaceItemList.js.map +1 -0
- package/react/components/userPreferences/index.d.ts +1 -1
- package/react/components/userPreferences/index.js +1 -1
- package/react/components/userPreferences/index.js.map +1 -1
- package/react/components/userPreferences/stores/UserPreferencesStore.d.ts +0 -1
- package/react/components/userPreferences/stores/UserPreferencesStore.js +4 -9
- package/react/components/userPreferences/stores/UserPreferencesStore.js.map +1 -1
- package/react/components/userPreferences/stories/DashbarEditor.stories.d.ts +2 -1
- package/react/components/userPreferences/stories/DashbarEditor.stories.js +35 -4
- package/react/components/userPreferences/stories/DashbarEditor.stories.js.map +1 -1
- package/react/components/userPreferences/stories/DashbarEditorItem.stories.d.ts +11 -0
- package/react/components/userPreferences/stories/DashbarEditorItem.stories.js +21 -0
- package/react/components/userPreferences/stories/DashbarEditorItem.stories.js.map +1 -0
- package/react/components/userPreferences/stories/General.stories.d.ts +9 -0
- package/react/components/userPreferences/stories/General.stories.js +16 -0
- package/react/components/userPreferences/stories/General.stories.js.map +1 -0
- package/react/components/userPreferences/stories/Notifications.stories.d.ts +9 -0
- package/react/components/userPreferences/stories/Notifications.stories.js +17 -0
- package/react/components/userPreferences/stories/Notifications.stories.js.map +1 -0
- package/react/components/userPreferences/stories/NotificationsSourceTypes.stories.d.ts +9 -0
- package/react/components/userPreferences/stories/NotificationsSourceTypes.stories.js +20 -0
- package/react/components/userPreferences/stories/NotificationsSourceTypes.stories.js.map +1 -0
- package/react/components/userPreferences/stories/NotificationsSources.stories.d.ts +12 -0
- package/react/components/userPreferences/stories/NotificationsSources.stories.js +28 -0
- package/react/components/userPreferences/stories/NotificationsSources.stories.js.map +1 -0
- package/react/components/userPreferences/stories/UserPreferences.stories.d.ts +8 -0
- package/react/components/userPreferences/stories/UserPreferences.stories.js +53 -0
- package/react/components/userPreferences/stories/UserPreferences.stories.js.map +1 -0
- package/react/components/userPreferences/stories/WorkspaceButton.stories.d.ts +15 -0
- package/react/components/userPreferences/stories/WorkspaceButton.stories.js +13 -0
- package/react/components/userPreferences/stories/WorkspaceButton.stories.js.map +1 -0
- package/react/components/userPreferences/stories/WorkspaceComponents.stories.d.ts +13 -0
- package/react/components/userPreferences/stories/WorkspaceComponents.stories.js +26 -0
- package/react/components/userPreferences/stories/WorkspaceComponents.stories.js.map +1 -0
- package/react/components/userPreferences/stories/WorkspaceItem.stories.d.ts +9 -0
- package/react/components/userPreferences/stories/WorkspaceItem.stories.js +30 -0
- package/react/components/userPreferences/stories/WorkspaceItem.stories.js.map +1 -0
- package/react/components/userPreferences/stories/WorkspaceItemList.stories.d.ts +10 -0
- package/react/components/userPreferences/stories/WorkspaceItemList.stories.js +57 -0
- package/react/components/userPreferences/stories/WorkspaceItemList.stories.js.map +1 -0
- package/react/components/userPreferences/stories/Workspaces.stories.d.ts +9 -0
- package/react/components/userPreferences/stories/Workspaces.stories.js +44 -0
- package/react/components/userPreferences/stories/Workspaces.stories.js.map +1 -0
- package/react/components/userPreferences/tests/ContentSection.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/ContentSection.spec.js +41 -0
- package/react/components/userPreferences/tests/ContentSection.spec.js.map +1 -0
- package/react/components/userPreferences/tests/DashbarEditor.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/DashbarEditor.spec.js +37 -0
- package/react/components/userPreferences/tests/DashbarEditor.spec.js.map +1 -0
- package/react/components/userPreferences/tests/DashbarEditorItem.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/DashbarEditorItem.spec.js +38 -0
- package/react/components/userPreferences/tests/DashbarEditorItem.spec.js.map +1 -0
- package/react/components/userPreferences/tests/General.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/General.spec.js +28 -0
- package/react/components/userPreferences/tests/General.spec.js.map +1 -0
- package/react/components/userPreferences/tests/LeftNav.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/LeftNav.spec.js +12 -0
- package/react/components/userPreferences/tests/LeftNav.spec.js.map +1 -0
- package/react/components/userPreferences/tests/NotificationSourceTypes.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/NotificationSourceTypes.spec.js +14 -0
- package/react/components/userPreferences/tests/NotificationSourceTypes.spec.js.map +1 -0
- package/react/components/userPreferences/tests/Notifications.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/Notifications.spec.js +17 -0
- package/react/components/userPreferences/tests/Notifications.spec.js.map +1 -0
- package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js +39 -0
- package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js.map +1 -0
- package/react/components/userPreferences/tests/NotificationsSourcesPreferences.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/NotificationsSourcesPreferences.spec.js +22 -0
- package/react/components/userPreferences/tests/NotificationsSourcesPreferences.spec.js.map +1 -0
- package/react/components/userPreferences/tests/ScheduledRestart.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/ScheduledRestart.spec.js +70 -0
- package/react/components/userPreferences/tests/ScheduledRestart.spec.js.map +1 -0
- package/react/components/userPreferences/tests/WorkspaceButton.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/WorkspaceButton.spec.js +24 -0
- package/react/components/userPreferences/tests/WorkspaceButton.spec.js.map +1 -0
- package/react/components/userPreferences/tests/WorkspaceComponents.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/WorkspaceComponents.spec.js +22 -0
- package/react/components/userPreferences/tests/WorkspaceComponents.spec.js.map +1 -0
- package/react/components/userPreferences/tests/WorkspaceItem.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/WorkspaceItem.spec.js +64 -0
- package/react/components/userPreferences/tests/WorkspaceItem.spec.js.map +1 -0
- package/react/components/userPreferences/tests/WorkspaceItemList.spec.d.ts +1 -0
- package/react/components/userPreferences/tests/WorkspaceItemList.spec.js +45 -0
- package/react/components/userPreferences/tests/WorkspaceItemList.spec.js.map +1 -0
- package/react/hooks/useNotifications.d.ts +4 -0
- package/react/hooks/useNotifications.js +47 -40
- package/react/hooks/useNotifications.js.map +1 -1
- package/react/hooks/usePubSub.js.map +1 -1
- package/react/hooks/useToolbar.js +71 -48
- package/react/hooks/useToolbar.js.map +1 -1
- package/react/reducers/rootReducer.d.ts +2 -2
- package/react/store.d.ts +4 -4
- package/react/types/dashbarTypes.d.ts +1 -1
- package/react/types/dashbarTypes.js.map +1 -1
- package/react/types/fdc3.d.ts +8 -22
- package/react/types/fdc3.js.map +1 -1
- package/react/types/smartDesktopDesignerTypes.d.ts +4 -1
- package/react/types/smartDesktopDesignerTypes.js.map +1 -1
- package/react/components/shared/addProtocolToValidURL.spec.js.map +0 -1
- package/react/components/userPreferences/components/Checkbox.d.ts +0 -4
- package/react/components/userPreferences/components/Checkbox.js +0 -27
- package/react/components/userPreferences/components/Checkbox.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Actions
|
|
3
|
-
import Checkbox from "
|
|
2
|
+
import { Actions } from "../../stores/UserPreferencesStore";
|
|
3
|
+
import { Checkbox } from "../../../common/Checkbox";
|
|
4
|
+
import DefaultDropdownButton from "../../../shared/DefaultDropdownButton";
|
|
4
5
|
const DEFAULT_RESTART = {
|
|
5
6
|
hour: 4,
|
|
6
|
-
minute:
|
|
7
|
+
minute: "00",
|
|
7
8
|
meridiem: "AM",
|
|
8
9
|
};
|
|
9
10
|
let HOURS = [];
|
|
@@ -52,7 +53,7 @@ export default class ScheduledRestart extends React.Component {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
setHour(e) {
|
|
55
|
-
let hour = Number(e
|
|
56
|
+
let hour = Number(e);
|
|
56
57
|
let { scheduledRestart } = this.state;
|
|
57
58
|
if (hour < 12 && scheduledRestart.meridiem === "PM") {
|
|
58
59
|
hour = hour + 12;
|
|
@@ -68,7 +69,7 @@ export default class ScheduledRestart extends React.Component {
|
|
|
68
69
|
Actions.setScheduledRestart(scheduledRestart);
|
|
69
70
|
}
|
|
70
71
|
setMinute(e) {
|
|
71
|
-
let minute = Number(e
|
|
72
|
+
let minute = Number(e);
|
|
72
73
|
let { scheduledRestart } = this.state;
|
|
73
74
|
scheduledRestart.minute = minute;
|
|
74
75
|
this.setState({ scheduledRestart });
|
|
@@ -77,16 +78,12 @@ export default class ScheduledRestart extends React.Component {
|
|
|
77
78
|
setMeridiem(e) {
|
|
78
79
|
let { scheduledRestart } = this.state;
|
|
79
80
|
let currentMeridiem = scheduledRestart.meridiem;
|
|
80
|
-
let meridiem = e
|
|
81
|
+
let meridiem = e;
|
|
81
82
|
scheduledRestart.meridiem = meridiem;
|
|
82
83
|
this.setState({
|
|
83
84
|
scheduledRestart,
|
|
84
85
|
}, () => {
|
|
85
|
-
this.setHour(
|
|
86
|
-
target: {
|
|
87
|
-
value: this.state.scheduledRestart.hour,
|
|
88
|
-
},
|
|
89
|
-
});
|
|
86
|
+
this.setHour(this.state.scheduledRestart.hour);
|
|
90
87
|
});
|
|
91
88
|
}
|
|
92
89
|
getDisplayHour() {
|
|
@@ -102,8 +99,8 @@ export default class ScheduledRestart extends React.Component {
|
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
componentDidMount() {
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
this.props.addListener({ field: "preferences" }, this.setPreferences);
|
|
103
|
+
this.props.getValue({ field: "preferences" }, (err, data) => {
|
|
107
104
|
if (data) {
|
|
108
105
|
let scheduledRestart = data["finsemble.scheduledRestart"];
|
|
109
106
|
let enabled = typeof scheduledRestart === "object";
|
|
@@ -118,7 +115,7 @@ export default class ScheduledRestart extends React.Component {
|
|
|
118
115
|
});
|
|
119
116
|
}
|
|
120
117
|
componentWillUnmount() {
|
|
121
|
-
|
|
118
|
+
this.props.removeListener({ field: "preferences" }, this.setPreferences);
|
|
122
119
|
}
|
|
123
120
|
render() {
|
|
124
121
|
const { scheduledRestart, enabled } = this.state;
|
|
@@ -126,17 +123,69 @@ export default class ScheduledRestart extends React.Component {
|
|
|
126
123
|
if (!enabled) {
|
|
127
124
|
wrapClasses = `${wrapClasses} disabled-restart`;
|
|
128
125
|
}
|
|
129
|
-
|
|
126
|
+
const hourOptions = HOURS.map((hour) => {
|
|
127
|
+
return {
|
|
128
|
+
optionLabel: hour,
|
|
129
|
+
optionValue: hour,
|
|
130
|
+
clickHandler: () => {
|
|
131
|
+
this.setHour(hour);
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
const minuteOptions = MINUTES.map((minute) => {
|
|
136
|
+
return {
|
|
137
|
+
optionLabel: minute,
|
|
138
|
+
optionValue: minute,
|
|
139
|
+
clickHandler: () => {
|
|
140
|
+
this.setMinute(minute);
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
return (React.createElement("div", { className: "complex-menu-content-row", style: { overflow: "visible" } },
|
|
130
145
|
React.createElement(Checkbox, { onClick: this.toggleEnabled, checked: this.state.enabled, label: "Restart daily" }),
|
|
131
|
-
React.createElement("div", { className: wrapClasses },
|
|
146
|
+
React.createElement("div", { className: wrapClasses, style: { display: "flex" } },
|
|
132
147
|
React.createElement("span", { className: "scheduled-restart-select-label" }, "Time:"),
|
|
133
|
-
React.createElement("
|
|
134
|
-
|
|
135
|
-
|
|
148
|
+
React.createElement("div", { className: "row-section", style: { width: "10px", marginRight: "40px" } },
|
|
149
|
+
React.createElement(DefaultDropdownButton, { classNames: "push-right", allowEmpty: false, caretLocation: "right", buttonOptions: hourOptions, defaultSelection: {
|
|
150
|
+
optionLabel: this.getDisplayHour(),
|
|
151
|
+
optionValue: this.getDisplayHour(),
|
|
152
|
+
clickHandler: () => {
|
|
153
|
+
this.setHour(this.getDisplayHour());
|
|
154
|
+
},
|
|
155
|
+
}, enabled: enabled })),
|
|
156
|
+
React.createElement("div", { className: "row-section", style: { marginLeft: 30, marginRight: 10, marginTop: 5 } }, "\u00A0:\u00A0"),
|
|
157
|
+
React.createElement("div", { style: { width: "10px", marginRight: "65px" } },
|
|
158
|
+
React.createElement(DefaultDropdownButton, { classNames: "push-right", allowEmpty: false, caretLocation: "right", buttonOptions: minuteOptions, defaultSelection: {
|
|
159
|
+
optionLabel: scheduledRestart.minute === 0 ? "00" : scheduledRestart.minute,
|
|
160
|
+
optionValue: scheduledRestart.minute,
|
|
161
|
+
clickHandler: () => {
|
|
162
|
+
this.setMinute(scheduledRestart.minute);
|
|
163
|
+
},
|
|
164
|
+
}, enabled: enabled })),
|
|
136
165
|
"\u00A0",
|
|
137
|
-
React.createElement("
|
|
138
|
-
React.createElement(
|
|
139
|
-
|
|
166
|
+
React.createElement("div", { className: "row-section", style: { width: "10px" } },
|
|
167
|
+
React.createElement(DefaultDropdownButton, { classNames: "push-right", allowEmpty: false, caretLocation: "right", buttonOptions: [
|
|
168
|
+
{
|
|
169
|
+
optionLabel: "AM",
|
|
170
|
+
optionValue: "AM",
|
|
171
|
+
clickHandler: () => {
|
|
172
|
+
this.setMeridiem("AM");
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
optionLabel: "PM",
|
|
177
|
+
optionValue: "PM",
|
|
178
|
+
clickHandler: () => {
|
|
179
|
+
this.setMeridiem("PM");
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
], defaultSelection: {
|
|
183
|
+
optionLabel: scheduledRestart.meridiem,
|
|
184
|
+
optionValue: scheduledRestart.meridiem,
|
|
185
|
+
clickHandler: () => {
|
|
186
|
+
this.setHour(scheduledRestart.meridiem);
|
|
187
|
+
},
|
|
188
|
+
}, enabled: enabled })))));
|
|
140
189
|
}
|
|
141
190
|
}
|
|
142
191
|
//# sourceMappingURL=ScheduledRestart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScheduledRestart.js","sourceRoot":"","sources":["../../../../../src/components/userPreferences/components/general/ScheduledRestart.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,MAAM,eAAe,GAAG;IACvB,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,IAAI;CACd,CAAC;AAGF,IAAI,KAAK,GAAG,EAAE,CAAC;AACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;IAC5B,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACd;AAOD,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACnC,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,KAAK,CAAC,SAAS;IAC5D,YAAY,KAAK;QAChB,KAAK,CAAC,KA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,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CACvB,gCAAQ,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,IACzB,IAAI,CACG,CACT,CAAC,CACM;;gBAGT,gCAAQ,QAAQ,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,IAClF,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAC3B,gCAAQ,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,IAC3B,MAAM,CACC,CACT,CAAC,CACM;;gBAGT,gCAAQ,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,gBAAgB,CAAC,QAAQ;oBACvF,gCAAQ,KAAK,EAAE,IAAI,SAAa;oBAChC,gCAAQ,KAAK,EAAE,IAAI,SAAa,CACxB,CACJ,CACD,CACN,CAAC;IACH,CAAC;CACD","sourcesContent":["import React from \"react\";\r\nimport { Actions, UserPreferencesStore } from \"../../stores/UserPreferencesStore\";\r\nimport Checkbox from \"../Checkbox\";\r\n\r\nconst DEFAULT_RESTART = {\r\n\thour: 4,\r\n\tminute: 0,\r\n\tmeridiem: \"AM\",\r\n};\r\n\r\n// Create an array 1-12.\r\nlet HOURS = [];\r\nfor (var i = 1; i < 13; i++) {\r\n\tHOURS.push(i);\r\n}\r\n\r\n// FOR TESTING\r\n// let MINUTES = [];\r\n// for (var i = 1; i <= 60; i++){\r\n// MINUTES.push(i);\r\n// }\r\nconst MINUTES = [\"00\", 15, 30, 45];\r\nexport default class ScheduledRestart extends React.Component {\r\n\tconstructor(props) {\r\n\t\tsuper(props);\r\n\t\tthis.state = {\r\n\t\t\tscheduledRestart: DEFAULT_RESTART,\r\n\t\t\tenabled: false,\r\n\t\t};\r\n\t\tthis.setPreferences = this.setPreferences.bind(this);\r\n\t\tthis.toggleEnabled = this.toggleEnabled.bind(this);\r\n\t\tthis.setHour = this.setHour.bind(this);\r\n\t\tthis.setMinute = this.setMinute.bind(this);\r\n\t\tthis.setMeridiem = this.setMeridiem.bind(this);\r\n\t\tthis.getDisplayHour = this.getDisplayHour.bind(this);\r\n\t}\r\n\r\n\t/**\r\n\t * Invoked when any preference is changed on the userPreferencesStore.\r\n\t * @param {obj} err\r\n\t * @param {data} data\r\n\t */\r\n\tsetPreferences(err, data) {\r\n\t\tif (!data && !data.value) return;\r\n\t\tlet scheduledRestart = data.value[\"finsemble.scheduledRestart\"];\r\n\t\t// If scheduledRestart is falsy, set \"enabled\" to false. I probably could've done !scheduledRestart. Oh well.\r\n\t\tlet enabled = typeof scheduledRestart === \"object\";\r\n\t\tif (enabled) {\r\n\t\t\t// This is purely for display. I found that military time forced a scroll bar onto the dropdown that looked bad.\r\n\t\t\tscheduledRestart.meridiem = scheduledRestart.hour > 11 ? \"PM\" : \"AM\";\r\n\t\t} else {\r\n\t\t\tscheduledRestart = DEFAULT_RESTART;\r\n\t\t}\r\n\t\tthis.setState({ scheduledRestart, enabled });\r\n\t}\r\n\r\n\t/**\r\n\t * Toggle the enabled state of the select boxes.\r\n\t */\r\n\ttoggleEnabled() {\r\n\t\tlet { enabled, scheduledRestart } = this.state;\r\n\t\tenabled = !enabled;\r\n\t\t// If the select boxes are no longer enabled, reset the scheduled restart time and call a method on the Actions object.\r\n\t\t// That function will set scheduledRestart to null via the preferences API. But we want our display to look nice, hence the bit where we reset it to the default value.\r\n\t\tif (!enabled) {\r\n\t\t\tscheduledRestart = DEFAULT_RESTART;\r\n\t\t\tthis.setState({ enabled, scheduledRestart });\r\n\t\t\tActions.disableScheduledRestart();\r\n\t\t} else {\r\n\t\t\tthis.setState({ enabled });\r\n\t\t\tActions.setScheduledRestart(scheduledRestart);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * This method will transform 8 PM into 20:00. It also handles when the user changes the meridiem.\r\n\t * e.g., 8PM (20) => 8AM (8).\r\n\t * Set the minute, then set the 'finsemble.scheduledRestart' preference via the method on the Actions object.\r\n\t * @param {event} e\r\n\t */\r\n\tsetHour(e) {\r\n\t\tlet hour = Number(e.target.value);\r\n\t\tlet { scheduledRestart } = this.state;\r\n\t\tif (hour < 12 && scheduledRestart.meridiem === \"PM\") {\r\n\t\t\thour = hour + 12;\r\n\t\t} else if (hour > 12 && scheduledRestart.meridiem === \"AM\") {\r\n\t\t\thour = hour - 12;\r\n\t\t} else if (scheduledRestart.meridiem === \"AM\" && hour === 12) {\r\n\t\t\thour = 0;\r\n\t\t}\r\n\r\n\t\tscheduledRestart.hour = hour;\r\n\t\tthis.setState({ scheduledRestart });\r\n\t\tActions.setScheduledRestart(scheduledRestart);\r\n\t}\r\n\r\n\t/**\r\n\t * Set the minute, then set the 'finsemble.scheduledRestart' preference via the method on the Actions object.\r\n\t * @param {event} e\r\n\t */\r\n\tsetMinute(e) {\r\n\t\tlet minute = Number(e.target.value);\r\n\t\tlet { scheduledRestart } = this.state;\r\n\t\tscheduledRestart.minute = minute;\r\n\r\n\t\tthis.setState({ scheduledRestart });\r\n\t\tActions.setScheduledRestart(scheduledRestart);\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the meridiem for the time (AM or PM). Afterwards, this calls setHour to handle any necessary conversions to military time.\r\n\t * @param {event} e\r\n\t */\r\n\tsetMeridiem(e) {\r\n\t\tlet { scheduledRestart } = this.state;\r\n\t\tlet currentMeridiem = scheduledRestart.meridiem;\r\n\r\n\t\tlet meridiem = e.target.value;\r\n\t\tscheduledRestart.meridiem = meridiem;\r\n\t\tthis.setState(\r\n\t\t\t{\r\n\t\t\t\tscheduledRestart,\r\n\t\t\t},\r\n\t\t\t() => {\r\n\t\t\t\tthis.setHour({\r\n\t\t\t\t\ttarget: {\r\n\t\t\t\t\t\tvalue: this.state.scheduledRestart.hour,\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n\r\n\tgetDisplayHour() {\r\n\t\tlet { scheduledRestart } = this.state;\r\n\t\tif (scheduledRestart.meridiem === \"AM\" && scheduledRestart.hour === 0) {\r\n\t\t\treturn 12;\r\n\t\t} else if (scheduledRestart.meridiem === \"PM\" && scheduledRestart.hour > 12) {\r\n\t\t\treturn scheduledRestart.hour - 12;\r\n\t\t} else {\r\n\t\t\treturn scheduledRestart.hour;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Add listener on the store. When the preferences field changes, we change our local state.\r\n\t * Also, get the initial state from the store.\r\n\t */\r\n\tcomponentDidMount() {\r\n\t\tUserPreferencesStore.addListener({ field: \"preferences\" }, this.setPreferences);\r\n\t\tUserPreferencesStore.getValue({ field: \"preferences\" }, (err, data) => {\r\n\t\t\tif (data) {\r\n\t\t\t\tlet scheduledRestart = data[\"finsemble.scheduledRestart\"];\r\n\t\t\t\tlet enabled = typeof scheduledRestart === \"object\";\r\n\t\t\t\tif (enabled) {\r\n\t\t\t\t\tscheduledRestart.meridiem = scheduledRestart.hour > 11 ? \"PM\" : \"AM\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tscheduledRestart = DEFAULT_RESTART;\r\n\t\t\t\t}\r\n\t\t\t\tthis.setState({ scheduledRestart, enabled });\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tcomponentWillUnmount() {\r\n\t\tUserPreferencesStore.removeListener({ field: \"preferences\" }, this.setPreferences);\r\n\t}\r\n\r\n\trender() {\r\n\t\tconst { scheduledRestart, enabled } = this.state;\r\n\t\tlet wrapClasses = \"scheduled-restart\";\r\n\t\tif (!enabled) {\r\n\t\t\twrapClasses = `${wrapClasses} disabled-restart`;\r\n\t\t}\r\n\t\treturn (\r\n\t\t\t<div className=\"complex-menu-content-row\">\r\n\t\t\t\t<Checkbox onClick={this.toggleEnabled} checked={this.state.enabled} label=\"Restart daily\" />\r\n\t\t\t\t<div className={wrapClasses}>\r\n\t\t\t\t\t<span className=\"scheduled-restart-select-label\">Time:</span>\r\n\t\t\t\t\t{/* HOURS */}\r\n\t\t\t\t\t<select disabled={!enabled} onChange={this.setHour} value={this.getDisplayHour()}>\r\n\t\t\t\t\t\t{HOURS.map((hour, i) => (\r\n\t\t\t\t\t\t\t<option key={i} value={hour}>\r\n\t\t\t\t\t\t\t\t{hour}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t))}\r\n\t\t\t\t\t</select>\r\n\t\t\t\t\t : \r\n\t\t\t\t\t{/* MINUTES */}\r\n\t\t\t\t\t<select disabled={!enabled} value={scheduledRestart.minute} onChange={this.setMinute}>\r\n\t\t\t\t\t\t{MINUTES.map((minute, i) => (\r\n\t\t\t\t\t\t\t<option key={i} value={minute}>\r\n\t\t\t\t\t\t\t\t{minute}\r\n\t\t\t\t\t\t\t</option>\r\n\t\t\t\t\t\t))}\r\n\t\t\t\t\t</select>\r\n\t\t\t\t\t \r\n\t\t\t\t\t{/* MERIDIEM */}\r\n\t\t\t\t\t<select disabled={!enabled} onChange={this.setMeridiem} value={scheduledRestart.meridiem}>\r\n\t\t\t\t\t\t<option value={\"AM\"}>AM</option>\r\n\t\t\t\t\t\t<option value={\"PM\"}>PM</option>\r\n\t\t\t\t\t</select>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t);\r\n\t}\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ScheduledRestart.js","sourceRoot":"","sources":["../../../../../src/components/userPreferences/components/general/ScheduledRestart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAwB,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,qBAAqB,MAAM,uCAAuC,CAAC;AAE1E,MAAM,eAAe,GAAG;IACvB,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;CACd,CAAC;AAGF,IAAI,KAAK,GAAkB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CAAC,QAAQ;4BACtC,YAAY,EAAE,GAAG,EAAE;gCAClB,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;4BACzC,CAAC;yBACD,EACD,OAAO,EAAE,OAAO,GACf,CACG,CACD,CACD,CACN,CAAC;IACH,CAAC;CACD","sourcesContent":["import React from \"react\";\r\nimport { Actions, UserPreferencesStore } from \"../../stores/UserPreferencesStore\";\r\nimport { Checkbox } from \"../../../common/Checkbox\";\r\nimport DefaultDropdownButton from \"../../../shared/DefaultDropdownButton\";\r\n\r\nconst DEFAULT_RESTART = {\r\n\thour: 4,\r\n\tminute: \"00\",\r\n\tmeridiem: \"AM\",\r\n};\r\n\r\n// Create an array 1-12.\r\nlet HOURS: Array<number> = [];\r\nfor (var i = 1; i < 13; i++) {\r\n\tHOURS.push(i);\r\n}\r\n\r\n// FOR TESTING\r\n// let MINUTES = [];\r\n// for (var i = 1; i <= 60; i++){\r\n// MINUTES.push(i);\r\n// }\r\nconst MINUTES = [\"00\", 15, 30, 45];\r\n\r\ntype ScheduledRestartProps = {\r\n\taddListener: Function;\r\n\tremoveListener: Function;\r\n\tgetValue: Function;\r\n};\r\n\r\ntype ScheduledRestartState = {\r\n\tscheduledRestart: { hour: number; minute: string | number; meridiem: string };\r\n\tenabled: boolean;\r\n};\r\n\r\nexport default class ScheduledRestart extends React.Component<ScheduledRestartProps, ScheduledRestartState> {\r\n\tconstructor(props: ScheduledRestartProps) {\r\n\t\tsuper(props);\r\n\t\tthis.state = {\r\n\t\t\tscheduledRestart: DEFAULT_RESTART,\r\n\t\t\tenabled: false,\r\n\t\t};\r\n\t\tthis.setPreferences = this.setPreferences.bind(this);\r\n\t\tthis.toggleEnabled = this.toggleEnabled.bind(this);\r\n\t\tthis.setHour = this.setHour.bind(this);\r\n\t\tthis.setMinute = this.setMinute.bind(this);\r\n\t\tthis.setMeridiem = this.setMeridiem.bind(this);\r\n\t\tthis.getDisplayHour = this.getDisplayHour.bind(this);\r\n\t}\r\n\r\n\t/**\r\n\t * Invoked when any preference is changed on the userPreferencesStore.\r\n\t * @param {obj} err\r\n\t * @param {data} data\r\n\t */\r\n\tsetPreferences(err: any, data: any) {\r\n\t\tif (!data && !data.value) return;\r\n\t\tlet scheduledRestart = data.value[\"finsemble.scheduledRestart\"];\r\n\t\t// If scheduledRestart is falsy, set \"enabled\" to false. I probably could've done !scheduledRestart. Oh well.\r\n\t\tlet enabled = typeof scheduledRestart === \"object\";\r\n\t\tif (enabled) {\r\n\t\t\t// This is purely for display. I found that military time forced a scroll bar onto the dropdown that looked bad.\r\n\t\t\tscheduledRestart.meridiem = scheduledRestart.hour > 11 ? \"PM\" : \"AM\";\r\n\t\t} else {\r\n\t\t\tscheduledRestart = DEFAULT_RESTART;\r\n\t\t}\r\n\t\tthis.setState({ scheduledRestart, enabled });\r\n\t}\r\n\r\n\t/**\r\n\t * Toggle the enabled state of the select boxes.\r\n\t */\r\n\ttoggleEnabled() {\r\n\t\tlet { enabled, scheduledRestart }: any = this.state;\r\n\t\tenabled = !enabled;\r\n\t\t// If the select boxes are no longer enabled, reset the scheduled restart time and call a method on the Actions object.\r\n\t\t// That function will set scheduledRestart to null via the preferences API. But we want our display to look nice, hence the bit where we reset it to the default value.\r\n\t\tif (!enabled) {\r\n\t\t\tscheduledRestart = DEFAULT_RESTART;\r\n\t\t\tthis.setState({ enabled, scheduledRestart });\r\n\t\t\tActions.disableScheduledRestart();\r\n\t\t} else {\r\n\t\t\tthis.setState({ enabled });\r\n\t\t\tActions.setScheduledRestart(scheduledRestart);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * This method will transform 8 PM into 20:00. It also handles when the user changes the meridiem.\r\n\t * e.g., 8PM (20) => 8AM (8).\r\n\t * Set the minute, then set the 'finsemble.scheduledRestart' preference via the method on the Actions object.\r\n\t * @param {event} e\r\n\t */\r\n\tsetHour(e: any) {\r\n\t\tlet hour = Number(e);\r\n\t\tlet { scheduledRestart }: any = this.state;\r\n\t\tif (hour < 12 && scheduledRestart.meridiem === \"PM\") {\r\n\t\t\thour = hour + 12;\r\n\t\t} else if (hour > 12 && scheduledRestart.meridiem === \"AM\") {\r\n\t\t\thour = hour - 12;\r\n\t\t} else if (scheduledRestart.meridiem === \"AM\" && hour === 12) {\r\n\t\t\thour = 0;\r\n\t\t}\r\n\r\n\t\tscheduledRestart.hour = hour;\r\n\t\tthis.setState({ scheduledRestart });\r\n\t\tActions.setScheduledRestart(scheduledRestart);\r\n\t}\r\n\r\n\t/**\r\n\t * Set the minute, then set the 'finsemble.scheduledRestart' preference via the method on the Actions object.\r\n\t * @param {event} e\r\n\t */\r\n\tsetMinute(e: any) {\r\n\t\tlet minute = Number(e);\r\n\t\tlet { scheduledRestart }: any = this.state;\r\n\t\tscheduledRestart.minute = minute;\r\n\r\n\t\tthis.setState({ scheduledRestart });\r\n\t\tActions.setScheduledRestart(scheduledRestart);\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the meridiem for the time (AM or PM). Afterwards, this calls setHour to handle any necessary conversions to military time.\r\n\t * @param {event} e\r\n\t */\r\n\tsetMeridiem(e: any) {\r\n\t\tlet { scheduledRestart }: any = this.state;\r\n\t\tlet currentMeridiem: string = scheduledRestart.meridiem;\r\n\t\tlet meridiem = e;\r\n\t\tscheduledRestart.meridiem = meridiem;\r\n\t\tthis.setState(\r\n\t\t\t{\r\n\t\t\t\tscheduledRestart,\r\n\t\t\t},\r\n\t\t\t() => {\r\n\t\t\t\tthis.setHour(this.state.scheduledRestart.hour);\r\n\t\t\t}\r\n\t\t);\r\n\t}\r\n\r\n\tgetDisplayHour() {\r\n\t\tlet { scheduledRestart }: any = this.state;\r\n\t\tif (scheduledRestart.meridiem === \"AM\" && scheduledRestart.hour === 0) {\r\n\t\t\treturn 12;\r\n\t\t} else if (scheduledRestart.meridiem === \"PM\" && scheduledRestart.hour > 12) {\r\n\t\t\treturn scheduledRestart.hour - 12;\r\n\t\t} else {\r\n\t\t\treturn scheduledRestart.hour;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Add listener on the store. When the preferences field changes, we change our local state.\r\n\t * Also, get the initial state from the store.\r\n\t */\r\n\tcomponentDidMount() {\r\n\t\tthis.props.addListener({ field: \"preferences\" }, this.setPreferences);\r\n\t\tthis.props.getValue({ field: \"preferences\" }, (err: any, data: any) => {\r\n\t\t\tif (data) {\r\n\t\t\t\tlet scheduledRestart = data[\"finsemble.scheduledRestart\"];\r\n\t\t\t\tlet enabled = typeof scheduledRestart === \"object\";\r\n\t\t\t\tif (enabled) {\r\n\t\t\t\t\tscheduledRestart.meridiem = scheduledRestart.hour > 11 ? \"PM\" : \"AM\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tscheduledRestart = DEFAULT_RESTART;\r\n\t\t\t\t}\r\n\t\t\t\tthis.setState({ scheduledRestart, enabled });\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\tcomponentWillUnmount() {\r\n\t\tthis.props.removeListener({ field: \"preferences\" }, this.setPreferences);\r\n\t}\r\n\r\n\trender() {\r\n\t\tconst { scheduledRestart, enabled }: any = this.state;\r\n\t\tlet wrapClasses = \"scheduled-restart\";\r\n\t\tif (!enabled) {\r\n\t\t\twrapClasses = `${wrapClasses} disabled-restart`;\r\n\t\t}\r\n\t\tconst hourOptions: Array<any> = HOURS.map((hour: number) => {\r\n\t\t\treturn {\r\n\t\t\t\toptionLabel: hour,\r\n\t\t\t\toptionValue: hour,\r\n\t\t\t\tclickHandler: () => {\r\n\t\t\t\t\tthis.setHour(hour);\r\n\t\t\t\t},\r\n\t\t\t};\r\n\t\t});\r\n\t\tconst minuteOptions: Array<any> = MINUTES.map((minute) => {\r\n\t\t\treturn {\r\n\t\t\t\toptionLabel: minute,\r\n\t\t\t\toptionValue: minute,\r\n\t\t\t\tclickHandler: () => {\r\n\t\t\t\t\tthis.setMinute(minute);\r\n\t\t\t\t},\r\n\t\t\t};\r\n\t\t});\r\n\t\treturn (\r\n\t\t\t<div className=\"complex-menu-content-row\" style={{ overflow: \"visible\" }}>\r\n\t\t\t\t<Checkbox onClick={this.toggleEnabled} checked={this.state.enabled} label=\"Restart daily\" />\r\n\t\t\t\t<div className={wrapClasses} style={{ display: \"flex\" }}>\r\n\t\t\t\t\t<span className=\"scheduled-restart-select-label\">Time:</span>\r\n\t\t\t\t\t{/* HOURS */}\r\n\t\t\t\t\t<div className=\"row-section\" style={{ width: \"10px\", marginRight: \"40px\" }}>\r\n\t\t\t\t\t\t<DefaultDropdownButton\r\n\t\t\t\t\t\t\tclassNames={\"push-right\"}\r\n\t\t\t\t\t\t\tallowEmpty={false}\r\n\t\t\t\t\t\t\tcaretLocation={\"right\"}\r\n\t\t\t\t\t\t\tbuttonOptions={hourOptions}\r\n\t\t\t\t\t\t\tdefaultSelection={{\r\n\t\t\t\t\t\t\t\toptionLabel: this.getDisplayHour(),\r\n\t\t\t\t\t\t\t\toptionValue: this.getDisplayHour(),\r\n\t\t\t\t\t\t\t\tclickHandler: () => {\r\n\t\t\t\t\t\t\t\t\tthis.setHour(this.getDisplayHour());\r\n\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\tenabled={enabled}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div className=\"row-section\" style={{ marginLeft: 30, marginRight: 10, marginTop: 5 }}>\r\n\t\t\t\t\t\t : \r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t{/* MINUTES */}\r\n\t\t\t\t\t<div style={{ width: \"10px\", marginRight: \"65px\" }}>\r\n\t\t\t\t\t\t<DefaultDropdownButton\r\n\t\t\t\t\t\t\tclassNames={\"push-right\"}\r\n\t\t\t\t\t\t\tallowEmpty={false}\r\n\t\t\t\t\t\t\tcaretLocation={\"right\"}\r\n\t\t\t\t\t\t\tbuttonOptions={minuteOptions}\r\n\t\t\t\t\t\t\tdefaultSelection={{\r\n\t\t\t\t\t\t\t\toptionLabel: scheduledRestart.minute === 0 ? \"00\" : scheduledRestart.minute,\r\n\t\t\t\t\t\t\t\toptionValue: scheduledRestart.minute,\r\n\t\t\t\t\t\t\t\tclickHandler: () => {\r\n\t\t\t\t\t\t\t\t\tthis.setMinute(scheduledRestart.minute);\r\n\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\tenabled={enabled}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t \r\n\t\t\t\t\t{/* MERIDIEM */}\r\n\t\t\t\t\t<div className=\"row-section\" style={{ width: \"10px\" }}>\r\n\t\t\t\t\t\t<DefaultDropdownButton\r\n\t\t\t\t\t\t\tclassNames={\"push-right\"}\r\n\t\t\t\t\t\t\tallowEmpty={false}\r\n\t\t\t\t\t\t\tcaretLocation={\"right\"}\r\n\t\t\t\t\t\t\tbuttonOptions={[\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\toptionLabel: \"AM\",\r\n\t\t\t\t\t\t\t\t\toptionValue: \"AM\",\r\n\t\t\t\t\t\t\t\t\tclickHandler: () => {\r\n\t\t\t\t\t\t\t\t\t\tthis.setMeridiem(\"AM\");\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\toptionLabel: \"PM\",\r\n\t\t\t\t\t\t\t\t\toptionValue: \"PM\",\r\n\t\t\t\t\t\t\t\t\tclickHandler: () => {\r\n\t\t\t\t\t\t\t\t\t\tthis.setMeridiem(\"PM\");\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t]}\r\n\t\t\t\t\t\t\tdefaultSelection={{\r\n\t\t\t\t\t\t\t\toptionLabel: scheduledRestart.meridiem,\r\n\t\t\t\t\t\t\t\toptionValue: scheduledRestart.meridiem,\r\n\t\t\t\t\t\t\t\tclickHandler: () => {\r\n\t\t\t\t\t\t\t\t\tthis.setHour(scheduledRestart.meridiem);\r\n\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\tenabled={enabled}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t);\r\n\t}\r\n}\r\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type WorkspaceButtonProps = {
|
|
3
|
+
title?: string;
|
|
4
|
+
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
|
5
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
6
|
+
type?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const WorkspaceButton: ({ title, onMouseDown, onClick, type }: WorkspaceButtonProps) => JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export const WorkspaceButton = ({ title, onMouseDown, onClick, type }) => (React.createElement("div", { title: title, className: "action-button workspace-action-button", onMouseDown: onMouseDown, onClick: onClick },
|
|
3
|
+
React.createElement("i", { className: `workspace-action-button-icon ${type === "import" ? "ff-import" : "ff-export"}` }),
|
|
4
|
+
React.createElement("div", { className: "workspace-action-button-label" }, type === "import" ? "Import" : "Export")));
|
|
5
|
+
//# sourceMappingURL=WorkspaceButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceButton.js","sourceRoot":"","sources":["../../../../../src/components/userPreferences/components/workspaces/WorkspaceButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAwB,EAAE,EAAE,CAAC,CAC/F,6BAAK,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,uCAAuC,EAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO;IAC9G,2BAAG,SAAS,EAAE,gCAAgC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,EAAE,GAAM;IACnG,6BAAK,SAAS,EAAC,+BAA+B,IAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAO,CACzF,CACN,CAAC","sourcesContent":["import React from \"react\";\r\n\r\ntype WorkspaceButtonProps = {\r\n\ttitle?: string;\r\n\tonMouseDown?: React.MouseEventHandler<HTMLDivElement>;\r\n\tonClick?: React.MouseEventHandler<HTMLDivElement>;\r\n\ttype?: string;\r\n};\r\nexport const WorkspaceButton = ({ title, onMouseDown, onClick, type }: WorkspaceButtonProps) => (\r\n\t<div title={title} className=\"action-button workspace-action-button\" onMouseDown={onMouseDown} onClick={onClick}>\r\n\t\t<i className={`workspace-action-button-icon ${type === \"import\" ? \"ff-import\" : \"ff-export\"}`}></i>\r\n\t\t<div className=\"workspace-action-button-label\">{type === \"import\" ? \"Import\" : \"Export\"}</div>\r\n\t</div>\r\n);\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const WorkspaceComponents = (props) => (React.createElement("div", { className: "workspace-component-list" },
|
|
3
|
+
props.focusedWorkspaceComponentList &&
|
|
4
|
+
props.focusedWorkspaceComponentList?.length > 0 &&
|
|
5
|
+
props.focusedWorkspaceComponentList?.map((cmp, i) => (React.createElement("div", { key: i, className: "workspace-component" }, cmp))),
|
|
6
|
+
props.focusedWorkspaceComponentList?.length === 0 && React.createElement("span", { className: "no-components" }, "No components.")));
|
|
7
|
+
export default WorkspaceComponents;
|
|
8
|
+
//# sourceMappingURL=WorkspaceComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceComponents.js","sourceRoot":"","sources":["../../../../../src/components/userPreferences/components/workspaces/WorkspaceComponents.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,mBAAmB,GAAG,CAAC,KAA+B,EAAE,EAAE,CAAC,CAChE,6BAAK,SAAS,EAAC,0BAA0B;IACvC,KAAK,CAAC,6BAA6B;QACnC,KAAK,CAAC,6BAA6B,EAAE,MAAM,GAAG,CAAC;QAC/C,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CACpD,6BAAK,GAAG,EAAE,CAAC,EAAE,SAAS,EAAC,qBAAqB,IAC1C,GAAG,CACC,CACN,CAAC;IAEF,KAAK,CAAC,6BAA6B,EAAE,MAAM,KAAK,CAAC,IAAI,8BAAM,SAAS,EAAC,eAAe,qBAAsB,CACtG,CACN,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import React from \"react\";\r\n\r\ntype WorkspaceComponentsProps = {\r\n\tfocusedWorkspaceComponentList?: Array<any>;\r\n};\r\n\r\nconst WorkspaceComponents = (props: WorkspaceComponentsProps) => (\r\n\t<div className=\"workspace-component-list\">\r\n\t\t{props.focusedWorkspaceComponentList &&\r\n\t\t\tprops.focusedWorkspaceComponentList?.length > 0 &&\r\n\t\t\tprops.focusedWorkspaceComponentList?.map((cmp, i) => (\r\n\t\t\t\t<div key={i} className=\"workspace-component\">\r\n\t\t\t\t\t{cmp}\r\n\t\t\t\t</div>\r\n\t\t\t))}\r\n\r\n\t\t{props.focusedWorkspaceComponentList?.length === 0 && <span className=\"no-components\">No components.</span>}\r\n\t</div>\r\n);\r\n\r\nexport default WorkspaceComponents;\r\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { MouseEventHandler } from "react";
|
|
2
|
+
declare type WorkspaceEditorProps = {
|
|
3
|
+
cancelHandler?: Function;
|
|
4
|
+
saveHandler?: Function;
|
|
5
|
+
value?: string;
|
|
6
|
+
};
|
|
7
|
+
declare type WorkspaceEditorState = {
|
|
8
|
+
value: string;
|
|
9
|
+
finished: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare class WorkspaceEditor extends React.Component<WorkspaceEditorProps, WorkspaceEditorState> {
|
|
12
|
+
constructor(props: WorkspaceEditorProps);
|
|
13
|
+
onKeyDown(e: any): void;
|
|
14
|
+
onChange(e: any): void;
|
|
15
|
+
onFocus(e: any): void;
|
|
16
|
+
onBlur(): void;
|
|
17
|
+
render(): JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
export declare type WorkspaceItemProps = {
|
|
20
|
+
workspace: {
|
|
21
|
+
name?: string;
|
|
22
|
+
components?: Array<String>;
|
|
23
|
+
};
|
|
24
|
+
workspaceToLoadOnStart?: any;
|
|
25
|
+
focusedWorkspace?: string;
|
|
26
|
+
i?: number;
|
|
27
|
+
editing?: boolean;
|
|
28
|
+
adding?: boolean;
|
|
29
|
+
key?: number;
|
|
30
|
+
renameWorkspace?: Function;
|
|
31
|
+
addWorkspace?: Function;
|
|
32
|
+
cancelEdit?: Function;
|
|
33
|
+
setFocusedWorkspace?: Function;
|
|
34
|
+
renameTooltip?: string;
|
|
35
|
+
renameButtonClasses?: string;
|
|
36
|
+
handleButtonClicks?: MouseEventHandler<HTMLDivElement>;
|
|
37
|
+
allowRename?: boolean;
|
|
38
|
+
startEditingWorkspace?: (e: MouseEventHandler<HTMLDivElement>, name: string) => void;
|
|
39
|
+
deleteTooltip?: string;
|
|
40
|
+
deleteButtonClasses?: string;
|
|
41
|
+
allowDelete?: boolean;
|
|
42
|
+
deleteWorkspace?: (name: string) => void;
|
|
43
|
+
};
|
|
44
|
+
declare const WorkspaceItem: (props: WorkspaceItemProps) => JSX.Element;
|
|
45
|
+
export default WorkspaceItem;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FinsembleDraggable } from "../../../legacyControls/FinsembleDraggable";
|
|
3
|
+
export class WorkspaceEditor extends React.Component {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
super(props);
|
|
6
|
+
this.state = {
|
|
7
|
+
value: props.value || "",
|
|
8
|
+
finished: false,
|
|
9
|
+
};
|
|
10
|
+
this.onKeyDown = this.onKeyDown.bind(this);
|
|
11
|
+
this.onChange = this.onChange.bind(this);
|
|
12
|
+
this.onBlur = this.onBlur.bind(this);
|
|
13
|
+
this.onFocus = this.onFocus.bind(this);
|
|
14
|
+
}
|
|
15
|
+
onKeyDown(e) {
|
|
16
|
+
if (e.key === "Escape") {
|
|
17
|
+
this.setState({ finished: true }, () => {
|
|
18
|
+
this.props.cancelHandler?.();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
else if (e.key === "Enter") {
|
|
22
|
+
const finish = (val) => {
|
|
23
|
+
this.props.saveHandler?.(val);
|
|
24
|
+
};
|
|
25
|
+
this.setState({ finished: true }, finish.bind(this, e.target.value));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
onChange(e) {
|
|
29
|
+
this.setState({
|
|
30
|
+
value: e.target.value,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
onFocus(e) {
|
|
34
|
+
e.target.select();
|
|
35
|
+
}
|
|
36
|
+
onBlur() {
|
|
37
|
+
const finish = (val) => {
|
|
38
|
+
this.props.saveHandler?.(val);
|
|
39
|
+
};
|
|
40
|
+
this.setState({ finished: true }, finish.bind(this, this.state.value));
|
|
41
|
+
}
|
|
42
|
+
render() {
|
|
43
|
+
return (React.createElement("input", { onFocus: this.onFocus, onBlur: this.onBlur, autoFocus: true, value: this.state.value, className: "workspace-editor", onChange: this.onChange, onKeyDown: this.onKeyDown }));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const WorkspaceItem = (props) => {
|
|
47
|
+
let baseClass = "workspace-item";
|
|
48
|
+
let classNames = baseClass;
|
|
49
|
+
if (FSBL.Clients.WorkspaceClient.activeWorkspace?.name === props.workspace.name) {
|
|
50
|
+
classNames = `${classNames} active-workspace`;
|
|
51
|
+
}
|
|
52
|
+
if (props.workspaceToLoadOnStart === props.workspace.name) {
|
|
53
|
+
classNames = `${classNames} auto-start-workspace-item`;
|
|
54
|
+
}
|
|
55
|
+
if (props.focusedWorkspace === props.workspace.name) {
|
|
56
|
+
classNames = `${classNames} focused-workspace-item`;
|
|
57
|
+
if (props.i === 0) {
|
|
58
|
+
classNames = `${classNames} no-top-border`;
|
|
59
|
+
}
|
|
60
|
+
if (props.editing || props.adding) {
|
|
61
|
+
classNames = `${classNames} workspace-item-editing`;
|
|
62
|
+
return (React.createElement("div", { key: props.i, className: classNames },
|
|
63
|
+
React.createElement(WorkspaceEditor, { value: props.workspace.name || "", saveHandler: props.editing ? props.renameWorkspace : props.addWorkspace, cancelHandler: props.cancelEdit })));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return (React.createElement(FinsembleDraggable, { onClick: () => {
|
|
67
|
+
props.setFocusedWorkspace?.(props.workspace.name);
|
|
68
|
+
}, wrapperClass: classNames, draggableId: props.workspace.name || "", index: props.i || 0 },
|
|
69
|
+
React.createElement("div", { className: "ff-adp-hamburger" }),
|
|
70
|
+
React.createElement("div", { className: "workspace-name", title: props.workspace.name }, props.workspace.name),
|
|
71
|
+
React.createElement("div", { className: "individual-workspace-actions" }, props.workspace.name !== FSBL.Clients.WorkspaceClient.activeWorkspace?.name && (React.createElement(React.Fragment, null,
|
|
72
|
+
React.createElement("div", { title: props.renameTooltip, className: props.renameButtonClasses, onMouseDown: props.handleButtonClicks, onClick: (e) => {
|
|
73
|
+
props.allowRename && props.startEditingWorkspace?.(e, props.workspace.name || "");
|
|
74
|
+
} },
|
|
75
|
+
React.createElement("i", { className: "ff-adp-edit" })),
|
|
76
|
+
React.createElement("div", { title: props.deleteTooltip, className: props.deleteButtonClasses, onMouseDown: props.handleButtonClicks, onClick: () => {
|
|
77
|
+
props.allowDelete && props.deleteWorkspace?.(props.workspace.name || "");
|
|
78
|
+
} },
|
|
79
|
+
React.createElement("i", { className: "ff-adp-trash-outline" })))))));
|
|
80
|
+
};
|
|
81
|
+
export default WorkspaceItem;
|
|
82
|
+
//# sourceMappingURL=WorkspaceItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceItem.js","sourceRoot":"","sources":["../../../../../src/components/userPreferences/components/workspaces/WorkspaceItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAahF,MAAM,OAAO,eAAgB,SAAQ,KAAK,CAAC,SAAqD;IAC/F,YAAY,KAA2B;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACZ,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;YACxB,QAAQ,EAAE,KAAK;SACf,CAAC;QACF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,SAAS,CAAC,CAAM;QACf,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE;YACvB,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE;gBACtC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC;YAC9B,CAAC,CAAC,CAAC;SACH;aAAM,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YAC7B,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE;gBAC9B,IAAI,CAAC,KAAK,CAAC,WAAW,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gBAAgB,EAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,IACzD,KAAK,CAAC,SAAS,CAAC,IAAI,CAChB;QACN,6BAAK,SAAS,EAAC,8BAA8B,IAC3C,KAAK,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,eAAe,EAAE,IAAI,IAAI,CAC/E;YACC,6BACC,KAAK,EAAE,KAAK,CAAC,aAAa,EAC1B,SAAS,EAAE,KAAK,CAAC,mBAAmB,EACpC,WAAW,EAAE,KAAK,CAAC,kBAAkB,EACrC,OAAO,EAAE,CAAC,CAAM,EAAE,EAAE;oBACnB,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;gBACnF,CAAC;gBAED,2BAAG,SAAS,EAAC,aAAa,GAAK,CAC1B;YACN,6BACC,KAAK,EAAE,KAAK,CAAC,aAAa,EAC1B,SAAS,EAAE,KAAK,CAAC,mBAAmB,EACpC,WAAW,EAAE,KAAK,CAAC,kBAAkB,EACrC,OAAO,EAAE,GAAG,EAAE;oBACb,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;gBAC1E,CAAC;gBAED,2BAAG,SAAS,EAAC,sBAAsB,GAAK,CACnC,CACJ,CACH,CACI,CACc,CACrB,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import React, { MouseEventHandler } from \"react\";\r\nimport { FinsembleDraggable } from \"../../../legacyControls/FinsembleDraggable\";\r\n\r\ntype WorkspaceEditorProps = {\r\n\tcancelHandler?: Function;\r\n\tsaveHandler?: Function;\r\n\tvalue?: string;\r\n};\r\n\r\ntype WorkspaceEditorState = {\r\n\tvalue: string;\r\n\tfinished: boolean;\r\n};\r\n\r\nexport class WorkspaceEditor extends React.Component<WorkspaceEditorProps, WorkspaceEditorState> {\r\n\tconstructor(props: WorkspaceEditorProps) {\r\n\t\tsuper(props);\r\n\t\tthis.state = {\r\n\t\t\tvalue: props.value || \"\",\r\n\t\t\tfinished: false,\r\n\t\t};\r\n\t\tthis.onKeyDown = this.onKeyDown.bind(this);\r\n\t\tthis.onChange = this.onChange.bind(this);\r\n\t\tthis.onBlur = this.onBlur.bind(this);\r\n\t\tthis.onFocus = this.onFocus.bind(this);\r\n\t}\r\n\r\n\tonKeyDown(e: any) {\r\n\t\tif (e.key === \"Escape\") {\r\n\t\t\tthis.setState({ finished: true }, () => {\r\n\t\t\t\tthis.props.cancelHandler?.();\r\n\t\t\t});\r\n\t\t} else if (e.key === \"Enter\") {\r\n\t\t\tconst finish = (val: string) => {\r\n\t\t\t\tthis.props.saveHandler?.(val);\r\n\t\t\t};\r\n\t\t\t// binding so we don't lose the event inside of react's crazy callback structure\r\n\t\t\tthis.setState({ finished: true }, finish.bind(this, e.target.value));\r\n\t\t}\r\n\t}\r\n\r\n\tonChange(e: any) {\r\n\t\tthis.setState({\r\n\t\t\tvalue: e.target.value,\r\n\t\t});\r\n\t}\r\n\r\n\tonFocus(e: any) {\r\n\t\te.target.select();\r\n\t}\r\n\r\n\tonBlur() {\r\n\t\t// console.log(\"ON BLUR\", performance.now());\r\n\t\tconst finish = (val: string) => {\r\n\t\t\tthis.props.saveHandler?.(val);\r\n\t\t};\r\n\t\t// binding so we don't lose the event inside of react's crazy callback structure. Finished is set so that the component doesn't call the saveHandler again on unMount\r\n\t\tthis.setState({ finished: true }, finish.bind(this, this.state.value));\r\n\t}\r\n\r\n\trender() {\r\n\t\treturn (\r\n\t\t\t<input\r\n\t\t\t\tonFocus={this.onFocus}\r\n\t\t\t\tonBlur={this.onBlur}\r\n\t\t\t\tautoFocus={true}\r\n\t\t\t\tvalue={this.state.value}\r\n\t\t\t\tclassName=\"workspace-editor\"\r\n\t\t\t\tonChange={this.onChange}\r\n\t\t\t\tonKeyDown={this.onKeyDown}\r\n\t\t\t/>\r\n\t\t);\r\n\t}\r\n}\r\n\r\nexport type WorkspaceItemProps = {\r\n\tworkspace: { name?: string; components?: Array<String> };\r\n\tworkspaceToLoadOnStart?: any;\r\n\tfocusedWorkspace?: string;\r\n\ti?: number;\r\n\tediting?: boolean;\r\n\tadding?: boolean;\r\n\tkey?: number;\r\n\trenameWorkspace?: Function;\r\n\taddWorkspace?: Function;\r\n\tcancelEdit?: Function;\r\n\tsetFocusedWorkspace?: Function;\r\n\trenameTooltip?: string;\r\n\trenameButtonClasses?: string;\r\n\thandleButtonClicks?: MouseEventHandler<HTMLDivElement>;\r\n\tallowRename?: boolean;\r\n\tstartEditingWorkspace?: (e: MouseEventHandler<HTMLDivElement>, name: string) => void;\r\n\tdeleteTooltip?: string;\r\n\tdeleteButtonClasses?: string;\r\n\tallowDelete?: boolean;\r\n\tdeleteWorkspace?: (name: string) => void;\r\n};\r\nconst WorkspaceItem = (props: WorkspaceItemProps) => {\r\n\tlet baseClass = \"workspace-item\";\r\n\tlet classNames = baseClass;\r\n\tif (FSBL.Clients.WorkspaceClient.activeWorkspace?.name === props.workspace.name) {\r\n\t\tclassNames = `${classNames} active-workspace`;\r\n\t}\r\n\r\n\tif (props.workspaceToLoadOnStart === props.workspace.name) {\r\n\t\tclassNames = `${classNames} auto-start-workspace-item`;\r\n\t}\r\n\r\n\tif (props.focusedWorkspace === props.workspace.name) {\r\n\t\tclassNames = `${classNames} focused-workspace-item`;\r\n\t\tif (props.i === 0) {\r\n\t\t\tclassNames = `${classNames} no-top-border`;\r\n\t\t}\r\n\t\tif (props.editing || props.adding) {\r\n\t\t\tclassNames = `${classNames} workspace-item-editing`;\r\n\t\t\treturn (\r\n\t\t\t\t<div key={props.i} className={classNames}>\r\n\t\t\t\t\t<WorkspaceEditor\r\n\t\t\t\t\t\tvalue={props.workspace.name || \"\"}\r\n\t\t\t\t\t\tsaveHandler={props.editing ? props.renameWorkspace : props.addWorkspace}\r\n\t\t\t\t\t\tcancelHandler={props.cancelEdit}\r\n\t\t\t\t\t/>\r\n\t\t\t\t</div>\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\treturn (\r\n\t\t<FinsembleDraggable\r\n\t\t\tonClick={() => {\r\n\t\t\t\tprops.setFocusedWorkspace?.(props.workspace.name);\r\n\t\t\t}}\r\n\t\t\twrapperClass={classNames}\r\n\t\t\tdraggableId={props.workspace.name || \"\"}\r\n\t\t\tindex={props.i || 0}\r\n\t\t>\r\n\t\t\t<div className=\"ff-adp-hamburger\"></div>\r\n\t\t\t<div className=\"workspace-name\" title={props.workspace.name}>\r\n\t\t\t\t{props.workspace.name}\r\n\t\t\t</div>\r\n\t\t\t<div className=\"individual-workspace-actions\">\r\n\t\t\t\t{props.workspace.name !== FSBL.Clients.WorkspaceClient.activeWorkspace?.name && (\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t\t<div\r\n\t\t\t\t\t\t\ttitle={props.renameTooltip}\r\n\t\t\t\t\t\t\tclassName={props.renameButtonClasses}\r\n\t\t\t\t\t\t\tonMouseDown={props.handleButtonClicks}\r\n\t\t\t\t\t\t\tonClick={(e: any) => {\r\n\t\t\t\t\t\t\t\tprops.allowRename && props.startEditingWorkspace?.(e, props.workspace.name || \"\");\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t<i className=\"ff-adp-edit\"></i>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div\r\n\t\t\t\t\t\t\ttitle={props.deleteTooltip}\r\n\t\t\t\t\t\t\tclassName={props.deleteButtonClasses}\r\n\t\t\t\t\t\t\tonMouseDown={props.handleButtonClicks}\r\n\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\tprops.allowDelete && props.deleteWorkspace?.(props.workspace.name || \"\");\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t<i className=\"ff-adp-trash-outline\"></i>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</>\r\n\t\t\t\t)}\r\n\t\t\t</div>\r\n\t\t</FinsembleDraggable>\r\n\t);\r\n};\r\n\r\nexport default WorkspaceItem;\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type WorkspaceItemListProps = {
|
|
3
|
+
onDragEnd?: Function;
|
|
4
|
+
workspaceList?: Array<object>;
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
};
|
|
7
|
+
declare const WorkspaceItemList: ({ onDragEnd, workspaceList, ...rest }: WorkspaceItemListProps) => JSX.Element;
|
|
8
|
+
export default WorkspaceItemList;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import WorkspaceItem from "./WorkspaceItem";
|
|
3
|
+
import { FinsembleDnDContext } from "../../../legacyControls/FinsembleDnDContext";
|
|
4
|
+
const WorkspaceItemList = ({ onDragEnd, workspaceList, ...rest }) => (React.createElement("div", { className: "workspace-list" },
|
|
5
|
+
React.createElement(FinsembleDnDContext, { onDragEnd: onDragEnd }, workspaceList?.map((workspace, i) => (React.createElement(WorkspaceItem, { workspace: workspace, key: i, i: i, ...rest }))))));
|
|
6
|
+
export default WorkspaceItemList;
|
|
7
|
+
//# sourceMappingURL=WorkspaceItemList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceItemList.js","sourceRoot":"","sources":["../../../../../src/components/userPreferences/components/workspaces/WorkspaceItemList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAQlF,MAAM,iBAAiB,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,EAA0B,EAAE,EAAE,CAAC,CAC5F,6BAAK,SAAS,EAAC,gBAAgB;IAC9B,oBAAC,mBAAmB,IAAC,SAAS,EAAE,SAAS,IACvC,aAAa,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC,CACrC,oBAAC,aAAa,IAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAM,IAAI,GAAI,CAC/D,CAAC,CACmB,CACjB,CACN,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import React from \"react\";\r\nimport WorkspaceItem from \"./WorkspaceItem\";\r\nimport { FinsembleDnDContext } from \"../../../legacyControls/FinsembleDnDContext\";\r\n\r\nexport type WorkspaceItemListProps = {\r\n\tonDragEnd?: Function;\r\n\tworkspaceList?: Array<object>;\r\n\t[x: string]: any;\r\n};\r\n\r\nconst WorkspaceItemList = ({ onDragEnd, workspaceList, ...rest }: WorkspaceItemListProps) => (\r\n\t<div className=\"workspace-list\">\r\n\t\t<FinsembleDnDContext onDragEnd={onDragEnd}>\r\n\t\t\t{workspaceList?.map((workspace, i) => (\r\n\t\t\t\t<WorkspaceItem workspace={workspace} key={i} i={i} {...rest} />\r\n\t\t\t))}\r\n\t\t</FinsembleDnDContext>\r\n\t</div>\r\n);\r\n\r\nexport default WorkspaceItemList;\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/userPreferences/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/userPreferences/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { UserPreferences } from \"./UserPreferencesWrapper\";\r\nexport { General } from \"./UserPreferences\";\r\nexport { Workspaces } from \"./UserPreferences\";\r\nexport { DashbarEditor } from \"./UserPreferences\";\r\nexport { Notifications } from \"./UserPreferences\";\r\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
let UserPreferencesStore
|
|
1
|
+
let UserPreferencesStore;
|
|
2
|
+
let WorkspaceManagementMenuStore;
|
|
2
3
|
let updateConstants;
|
|
3
4
|
const Actions = {
|
|
4
5
|
initialize: function () {
|
|
@@ -87,13 +88,7 @@ async function createLocalStore(done) {
|
|
|
87
88
|
FSBL.Clients.Logger.error("Error fetching user preferences data: ", preferencesErr);
|
|
88
89
|
}
|
|
89
90
|
UserPreferencesStore = preferencesStore;
|
|
90
|
-
|
|
91
|
-
if (dashbarErr) {
|
|
92
|
-
FSBL.Clients.Logger.error("Error fetching dashbar data: ", dashbarErr);
|
|
93
|
-
}
|
|
94
|
-
DashbarStore = dashbarStore;
|
|
95
|
-
done();
|
|
96
|
-
});
|
|
91
|
+
done();
|
|
97
92
|
});
|
|
98
93
|
}
|
|
99
94
|
function initialize(WorkspaceMngMenuStore, cb) {
|
|
@@ -103,5 +98,5 @@ function initialize(WorkspaceMngMenuStore, cb) {
|
|
|
103
98
|
cb(UserPreferencesStore);
|
|
104
99
|
});
|
|
105
100
|
}
|
|
106
|
-
export { WorkspaceManagementMenuStore, initialize, UserPreferencesStore, Actions
|
|
101
|
+
export { WorkspaceManagementMenuStore, initialize, UserPreferencesStore, Actions };
|
|
107
102
|
//# sourceMappingURL=UserPreferencesStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserPreferencesStore.js","sourceRoot":"","sources":["../../../../src/components/userPreferences/stores/UserPreferencesStore.jsx"],"names":[],"mappings":"AAAA,IAAI,oBAAoB,
|
|
1
|
+
{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,CAAC;QACrB,EAAE,CAAC,oBAAoB,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,4BAA4B,EAAE,UAAU,EAAE,oBAAoB,EAAE,OAAO,EAAE,CAAC","sourcesContent":["let UserPreferencesStore;\r\nlet WorkspaceManagementMenuStore;\r\n\r\nlet updateConstants;\r\n\r\nconst Actions = {\r\n\tinitialize: function () {\r\n\t\tFSBL.Clients.WorkspaceClient.getWorkspaceActions((err, constants) => {\r\n\t\t\tupdateConstants = constants;\r\n\t\t});\r\n\r\n\t\tFSBL.Clients.ConfigClient.getPreferences((err, data) => {\r\n\t\t\tUserPreferencesStore.setValue({ field: \"preferences\", value: data });\r\n\t\t});\r\n\r\n\t\t// Gets the workspace list and sets the value in the store.\r\n\t\tFSBL.Clients.WorkspaceClient.getWorkspaces((err, workspaces) => {\r\n\t\t\tUserPreferencesStore.setValue({\r\n\t\t\t\tfield: \"WorkspaceList\",\r\n\t\t\t\tvalue: workspaces,\r\n\t\t\t});\r\n\t\t});\r\n\r\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.\r\n\t\tFSBL.Clients.WorkspaceClient.getActiveWorkspace((err, activeWorkspace) => {\r\n\t\t\tUserPreferencesStore.setValue({\r\n\t\t\t\tfield: \"activeWorkspace\",\r\n\t\t\t\tvalue: activeWorkspace,\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\t/**\r\n\t\t * We listen here for any workspace updates, and pass them to the store.\r\n\t\t * **NOTE**: You may notice that the signature of this callback is different from the previous ones. In this case we receive a `response`, instead of `workspaces` or `activeWorkspace`. This is because this callback is for a `RouterClient` message. The functions above are callbacks to `WorkspaceClient` API calls.\r\n\t\t */\r\n\t\tFSBL.Clients.RouterClient.subscribe(\"Finsemble.WorkspaceService.update\", (err, response) => {\r\n\t\t\tif (response.data && response.data.activeWorkspace) {\r\n\t\t\t\tUserPreferencesStore.setValue({\r\n\t\t\t\t\tfield: \"activeWorkspace\",\r\n\t\t\t\t\tvalue: response.data.activeWorkspace,\r\n\t\t\t\t});\r\n\r\n\t\t\t\tif (updateConstants) {\r\n\t\t\t\t\tswitch (response.data.reason) {\r\n\t\t\t\t\t\tcase updateConstants.GET_ACTIVE_WORKSPACE:\r\n\t\t\t\t\t\tcase updateConstants.NEW_WORKSPACE:\r\n\t\t\t\t\t\tcase updateConstants.IMPORT:\r\n\t\t\t\t\t\tcase updateConstants.SAVE:\r\n\t\t\t\t\t\tcase updateConstants.SAVE_AS:\r\n\t\t\t\t\t\tcase updateConstants.REMOVE:\r\n\t\t\t\t\t\tcase updateConstants.SWITCH_TO:\r\n\t\t\t\t\t\tcase updateConstants.SET_WORKSPACE_ORDER:\r\n\t\t\t\t\t\tcase updateConstants.ADD_WINDOW:\r\n\t\t\t\t\t\tcase updateConstants.REMOVE_WINDOW:\r\n\t\t\t\t\t\tcase updateConstants.RENAME:\r\n\t\t\t\t\t\t\tActions.getWorkspaces();\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t},\r\n\tgetWorkspaces(cb = Function.prototype) {\r\n\t\t// Gets the workspace list and sets the value in the store.\r\n\t\tFSBL.Clients.WorkspaceClient.getWorkspaces((err, workspaces) => {\r\n\t\t\tUserPreferencesStore.setValue({\r\n\t\t\t\tfield: \"WorkspaceList\",\r\n\t\t\t\tvalue: workspaces,\r\n\t\t\t});\r\n\t\t\tcb();\r\n\t\t});\r\n\t},\r\n\texportWorkspace: function () {\r\n\t\tvar workspaceName; // ************* needs to be set to selected workspace **********************\r\n\t\tFSBL.Clients.WorkspaceClient.getWorkspaceDefinition(workspaceName, (err, workspaceDefinition) => {\r\n\t\t\tvar newTemplateDefinition = FSBL.Clients.WorkspaceClient.convertWorkspaceDefinitionToTemplate(\r\n\t\t\t\t\"templateX\",\r\n\t\t\t\tworkspaceDefinition\r\n\t\t\t);\r\n\t\t\tFSBL.Clients.WorkspaceClient.saveWorkspaceTemplateToConfigFile(newTemplateDefinition);\r\n\t\t});\r\n\t},\r\n\timportTemplate: function () {\r\n\t\tvar newTemplateJSONDefinition; // ************* needs to be initialized from file input **********************\r\n\t\tFSBL.Clients.WorkspaceClient.addWorkspaceTemplateDefinition(newTemplateJSONDefinition, { force: true }, () => {});\r\n\t},\r\n\t/**\r\n\t * By making the value of `finsemble.scheduledRestart` falsy, the application will remove any existing restart timers.\r\n\t */\r\n\tdisableScheduledRestart: () => {\r\n\t\tFSBL.Clients.ConfigClient.setPreference({\r\n\t\t\tfield: \"finsemble.scheduledRestart\",\r\n\t\t\tvalue: false,\r\n\t\t});\r\n\t},\r\n\t/** Finsemble listens for this piece of config. When it changes, it will schedule a daily restart at that time. */\r\n\tsetScheduledRestart: (val) => {\r\n\t\tFSBL.Clients.ConfigClient.setPreference({\r\n\t\t\tfield: \"finsemble.scheduledRestart\",\r\n\t\t\tvalue: val,\r\n\t\t});\r\n\t},\r\n};\r\n\r\nasync function createLocalStore(done) {\r\n\t// While the order of these two functions is unimportant, they cannot be done in series as we don't want\r\n\t// to call the callback until both stores have been initiated. This keeps the initialization function\r\n\t// executing until both stores either have values, or fail to initialize.\r\n\tFSBL.Clients.DistributedStoreClient.createStore(\r\n\t\t{ store: \"Finsemble-UserPreferences-Local-Store\" },\r\n\t\t(preferencesErr, preferencesStore) => {\r\n\t\t\tif (preferencesErr) {\r\n\t\t\t\tFSBL.Clients.Logger.error(\"Error fetching user preferences data: \", preferencesErr);\r\n\t\t\t}\r\n\t\t\tUserPreferencesStore = preferencesStore;\r\n\t\t\tdone();\r\n\t\t}\r\n\t);\r\n}\r\n\r\n/**\r\n * Initializes the store for the User Preferences Menu.\r\n *\r\n * @param {any} cb\r\n */\r\nfunction initialize(WorkspaceMngMenuStore, cb) {\r\n\tWorkspaceManagementMenuStore = WorkspaceMngMenuStore;\r\n\tcreateLocalStore(() => {\r\n\t\tActions.initialize();\r\n\t\tcb(UserPreferencesStore);\r\n\t});\r\n}\r\n\r\nexport { WorkspaceManagementMenuStore, initialize, UserPreferencesStore, Actions };\r\n"]}
|
|
@@ -6,4 +6,5 @@ declare const _default: {
|
|
|
6
6
|
component: typeof DashbarEditor;
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const WithoutDashbarItems: Story<import("@storybook/react/types-6-0").Args>;
|
|
10
|
+
export declare const WithDashbarItems: Story<import("@storybook/react/types-6-0").Args>;
|
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import DashbarEditor from "../components/content/DashbarEditor";
|
|
3
3
|
import "../../../assets/css/finsemble.css";
|
|
4
|
+
import { FinsembleProvider, createStore } from "../../FinsembleProvider";
|
|
5
|
+
import { initFSBL } from "../../common/helpers";
|
|
4
6
|
export default {
|
|
5
|
-
title: "User Preferences/Dashbar Editor",
|
|
7
|
+
title: "User Preferences/DashbarEditor/Dashbar Editor Content",
|
|
6
8
|
component: DashbarEditor,
|
|
7
9
|
};
|
|
8
|
-
const Template = (args) =>
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const Template = (args) => {
|
|
11
|
+
initFSBL(window);
|
|
12
|
+
return (React.createElement(FinsembleProvider, { store: createStore() },
|
|
13
|
+
React.createElement(DashbarEditor, { ...args })));
|
|
14
|
+
};
|
|
15
|
+
export const WithoutDashbarItems = Template.bind({});
|
|
16
|
+
export const WithDashbarItems = Template.bind({});
|
|
17
|
+
WithDashbarItems.args = {
|
|
18
|
+
availableItems: [
|
|
19
|
+
{
|
|
20
|
+
id: 1,
|
|
21
|
+
enabled: true,
|
|
22
|
+
title: "EURUSD",
|
|
23
|
+
url: "https://dashbar.finsemble.com/index.html?symbol=EURUSD",
|
|
24
|
+
width: 350,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 2,
|
|
28
|
+
enabled: true,
|
|
29
|
+
title: "EURGBP",
|
|
30
|
+
url: "https://dashbar.finsemble.com/index.html?symbol=EURGBP",
|
|
31
|
+
width: 350,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 3,
|
|
35
|
+
enabled: true,
|
|
36
|
+
title: "EURCHF",
|
|
37
|
+
url: "https://dashbar.finsemble.com/index.html?symbol=EURCHF",
|
|
38
|
+
width: 350,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
11
42
|
//# sourceMappingURL=DashbarEditor.stories.js.map
|