@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
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2017 - 2020 by ChartIQ, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
import React, { useEffect, useState } from "react";
|
|
6
|
+
import { SmartDesktopDesignerActions } from "../../actions/smartDesktopDesignerActions";
|
|
7
|
+
import { useDispatch, useSelector } from "../../store";
|
|
8
|
+
import { FinsembleSelect } from "../common/FinsembleSelect";
|
|
9
|
+
import { Tooltip } from "../common/Tooltip";
|
|
10
|
+
import RelativePortal from "react-relative-portal";
|
|
11
|
+
import { FinsembleIcon } from "../common/FinsembleIcon";
|
|
12
|
+
export const AppEditAccess = (props) => {
|
|
13
|
+
const dispatch = useDispatch();
|
|
14
|
+
const apps = useSelector((state) => state.smartDesktopDesigner.apps);
|
|
15
|
+
const [rules, setRules] = useState(props.rules);
|
|
16
|
+
const [scrolling, setScrolling] = useState(false);
|
|
17
|
+
let timeout = null;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const handleScroll = () => {
|
|
20
|
+
setScrolling(true);
|
|
21
|
+
clearTimeout(timeout);
|
|
22
|
+
timeout = setTimeout(() => {
|
|
23
|
+
setScrolling(false);
|
|
24
|
+
}, 50);
|
|
25
|
+
};
|
|
26
|
+
window.addEventListener("scroll", handleScroll, { passive: true, capture: true });
|
|
27
|
+
return () => window.removeEventListener("scroll", handleScroll);
|
|
28
|
+
}, []);
|
|
29
|
+
const filteredApps = apps
|
|
30
|
+
.filter((app) => !app.manifest?.component?.temporary && app.name !== props.appName)
|
|
31
|
+
.sort((a, b) => {
|
|
32
|
+
if (a.name > b.name) {
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
else if (b.name > a.name) {
|
|
36
|
+
return -1;
|
|
37
|
+
}
|
|
38
|
+
return 0;
|
|
39
|
+
});
|
|
40
|
+
const currentApp = apps.find((app) => app.manifest?.component?.temporary || app.name === props.appName);
|
|
41
|
+
const [inboundAuthorizedApps, setInboundAuthorizedApps] = useState([]);
|
|
42
|
+
const [outboundAuthorizedApps, setOutboundAuthorizedApps] = useState([]);
|
|
43
|
+
const [advancedExpanded, setAdvancedExpanded] = useState(false);
|
|
44
|
+
function doSetRules(newRules) {
|
|
45
|
+
setRules(newRules);
|
|
46
|
+
props.onChange(newRules);
|
|
47
|
+
}
|
|
48
|
+
function updateBlockingApp(config) {
|
|
49
|
+
props.updateApp(config.appId, config).then(() => {
|
|
50
|
+
dispatch(SmartDesktopDesignerActions.update_app(config));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function getOptions() {
|
|
54
|
+
return filteredApps.map((app) => {
|
|
55
|
+
const isInboundAuthorized = inboundAuthorizedApps.includes(app.name);
|
|
56
|
+
return (React.createElement("div", { className: ["app-edit-access-item", !isInboundAuthorized ? "app-edit-access-blocked" : ""].join(" "), key: app.name },
|
|
57
|
+
React.createElement("span", { className: "app-edit-access-item-name" }, app.name),
|
|
58
|
+
!isInboundAuthorized && (React.createElement(RelativePortal, { className: ["tooltip-portal", scrolling || !advancedExpanded ? "is-scrolling" : ""].join(" "), component: "div", left: -13, top: 0 },
|
|
59
|
+
React.createElement(Tooltip, { type: "lock", onClick: () => {
|
|
60
|
+
updateBlockingApp({
|
|
61
|
+
...app,
|
|
62
|
+
manifest: {
|
|
63
|
+
...app.manifest,
|
|
64
|
+
interop: {
|
|
65
|
+
...app.manifest?.interop,
|
|
66
|
+
selectConnect: [
|
|
67
|
+
...(app.manifest?.interop?.selectConnect || []),
|
|
68
|
+
{
|
|
69
|
+
authorize: [{ name: props.appName || "" }],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
} }, "This app is blocking access. Click to allow access")))));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (currentApp) {
|
|
80
|
+
filteredApps.forEach((targetApp) => {
|
|
81
|
+
if (targetApp.name === props.appName) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
props
|
|
85
|
+
.isInboundInteropAuthorized({
|
|
86
|
+
...currentApp,
|
|
87
|
+
name: props.appName,
|
|
88
|
+
manifest: {
|
|
89
|
+
interop: {
|
|
90
|
+
selectConnect: rules,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
}, targetApp)
|
|
94
|
+
.then((inboundAuthorized) => {
|
|
95
|
+
if (inboundAuthorized && !inboundAuthorizedApps.includes(targetApp.name)) {
|
|
96
|
+
setInboundAuthorizedApps([...inboundAuthorizedApps, targetApp.name]);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
props
|
|
100
|
+
.isOutboundInteropAuthorized({
|
|
101
|
+
...currentApp,
|
|
102
|
+
name: props.appName,
|
|
103
|
+
manifest: {
|
|
104
|
+
interop: {
|
|
105
|
+
selectConnect: rules,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
}, targetApp)
|
|
109
|
+
.then((outboundAuthorized) => {
|
|
110
|
+
if (outboundAuthorized && !outboundAuthorizedApps.includes(targetApp.name)) {
|
|
111
|
+
setOutboundAuthorizedApps([...outboundAuthorizedApps, targetApp.name]);
|
|
112
|
+
}
|
|
113
|
+
else if (!outboundAuthorized && outboundAuthorizedApps.includes(targetApp.name)) {
|
|
114
|
+
const outboundAuthorizedAppsCopy = outboundAuthorizedApps.slice(0);
|
|
115
|
+
outboundAuthorizedAppsCopy.splice(outboundAuthorizedAppsCopy.indexOf(targetApp.name), 1);
|
|
116
|
+
setOutboundAuthorizedApps(outboundAuthorizedAppsCopy);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return (React.createElement(React.Fragment, null, filteredApps.length > 0 && (React.createElement("div", { className: "app-edit-field" },
|
|
123
|
+
React.createElement("div", { className: ["app-edit-advanced", advancedExpanded ? "is-expanded" : ""].join(" ") },
|
|
124
|
+
React.createElement("h2", { onClick: () => {
|
|
125
|
+
setAdvancedExpanded(!advancedExpanded);
|
|
126
|
+
} },
|
|
127
|
+
React.createElement(FinsembleIcon, { className: "expand-icon", icon: "chevron-right" }),
|
|
128
|
+
" Advanced settings"),
|
|
129
|
+
React.createElement("div", { className: "app-edit-advanced-content" },
|
|
130
|
+
React.createElement("div", { className: "app-edit-access" },
|
|
131
|
+
React.createElement("h3", null, "Configure access"),
|
|
132
|
+
React.createElement("p", null, "Use the controls below to decide which apps this app will be able to share information with. By default, your app is able to share with all other apps."),
|
|
133
|
+
React.createElement("p", null,
|
|
134
|
+
React.createElement(FinsembleIcon, { icon: "check-square" }),
|
|
135
|
+
"Choose which apps to authorize"),
|
|
136
|
+
React.createElement(FinsembleSelect, { options: filteredApps.map((app) => app.name), optionComponents: getOptions(), selected: filteredApps
|
|
137
|
+
.filter((app) => outboundAuthorizedApps.includes(app.name))
|
|
138
|
+
.map((app) => app.name), updateCallback: (selected) => {
|
|
139
|
+
filteredApps.forEach((app) => {
|
|
140
|
+
const isSelected = selected.find((name) => name === app.name);
|
|
141
|
+
if (!isSelected) {
|
|
142
|
+
doSetRules(rules.filter((rule) => rule.authorize?.some((auth) => auth.name !== app.name)));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
doSetRules([
|
|
146
|
+
...rules,
|
|
147
|
+
{
|
|
148
|
+
authorize: [{ name: app.name }],
|
|
149
|
+
},
|
|
150
|
+
]);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}, showSearch: true }))))))));
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=AppEditAccess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppEditAccess.js","sourceRoot":"","sources":["../../../src/components/smartDesktopDesigner/AppEditAccess.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,2BAA2B,EAAE,MA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AAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gCAC5B,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;gCAE9D,IAAI,CAAC,UAAU,EAAE;oCAChB,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iCAC3F;qCAAM;oCACN,UAAU,CAAC;wCACV,GAAG,KAAK;wCACR;4CACC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;yCAC/B;qCACD,CAAC,CAAC;iCACH;4BACF,CAAC,CAAC,CAAC;wBACJ,CAAC,EACD,UAAU,EAAE,IAAI,GACE,CACd,CACD,CACD,CACD,CACN,CACC,CACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\r\n * Copyright 2017 - 2020 by ChartIQ, Inc.\r\n * All rights reserved.\r\n */\r\n\r\nimport React, { useEffect, useState } from \"react\";\r\nimport { AppDefinition } from \"services/Interop/types\";\r\nimport { SmartDesktopDesignerActions } from \"../../actions/smartDesktopDesignerActions\";\r\nimport { RootState } from \"../../reducers/rootReducer\";\r\nimport { useDispatch, useSelector } from \"../../store\";\r\nimport { ApplicationRule } from \"../../types/smartDesktopDesignerTypes\";\r\nimport { FinsembleSelect } from \"../common/FinsembleSelect\";\r\nimport { Tooltip } from \"../common/Tooltip\";\r\nimport RelativePortal from \"react-relative-portal\";\r\nimport { FinsembleIcon } from \"../common/FinsembleIcon\";\r\n\r\nexport type AppEditAccessProps = {\r\n\tappName: string;\r\n\trules: ApplicationRule[];\r\n\tonChange: (data: ApplicationRule[]) => any;\r\n\tupdateApp: typeof FSBL.Clients.SmartDesktopClient.prototype.updateApp;\r\n\tisInboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isInboundInteropAuthorized;\r\n\tisOutboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isOutboundInteropAuthorized;\r\n};\r\n\r\nexport const AppEditAccess = (props: AppEditAccessProps) => {\r\n\tconst dispatch = useDispatch();\r\n\r\n\tconst apps = useSelector((state: RootState) => state.smartDesktopDesigner.apps);\r\n\r\n\tconst [rules, setRules] = useState(props.rules);\r\n\r\n\tconst [scrolling, setScrolling] = useState(false);\r\n\tlet timeout: any = null;\r\n\r\n\tuseEffect(() => {\r\n\t\tconst handleScroll = () => {\r\n\t\t\tsetScrolling(true);\r\n\t\t\tclearTimeout(timeout);\r\n\r\n\t\t\ttimeout = setTimeout(() => {\r\n\t\t\t\tsetScrolling(false);\r\n\t\t\t}, 50);\r\n\t\t};\r\n\r\n\t\twindow.addEventListener(\"scroll\", handleScroll, { passive: true, capture: true });\r\n\r\n\t\treturn () => window.removeEventListener(\"scroll\", handleScroll);\r\n\t}, []);\r\n\r\n\tconst filteredApps = apps\r\n\t\t.filter((app) => !app.manifest?.component?.temporary && app.name !== props.appName)\r\n\t\t.sort((a, b) => {\r\n\t\t\tif (a.name > b.name) {\r\n\t\t\t\treturn 1;\r\n\t\t\t} else if (b.name > a.name) {\r\n\t\t\t\treturn -1;\r\n\t\t\t}\r\n\r\n\t\t\treturn 0;\r\n\t\t});\r\n\r\n\tconst currentApp = apps.find((app) => app.manifest?.component?.temporary || app.name === props.appName);\r\n\r\n\tconst [inboundAuthorizedApps, setInboundAuthorizedApps] = useState<string[]>([]);\r\n\tconst [outboundAuthorizedApps, setOutboundAuthorizedApps] = useState<string[]>([]);\r\n\tconst [advancedExpanded, setAdvancedExpanded] = useState(false);\r\n\r\n\tfunction doSetRules(newRules: ApplicationRule[]) {\r\n\t\tsetRules(newRules);\r\n\r\n\t\tprops.onChange(newRules);\r\n\t}\r\n\r\n\tfunction updateBlockingApp(config: AppDefinition) {\r\n\t\tprops.updateApp(config.appId, config).then(() => {\r\n\t\t\tdispatch(SmartDesktopDesignerActions.update_app(config));\r\n\t\t});\r\n\t}\r\n\r\n\tfunction getOptions() {\r\n\t\treturn filteredApps.map((app) => {\r\n\t\t\tconst isInboundAuthorized = inboundAuthorizedApps.includes(app.name);\r\n\r\n\t\t\treturn (\r\n\t\t\t\t<div\r\n\t\t\t\t\tclassName={[\"app-edit-access-item\", !isInboundAuthorized ? \"app-edit-access-blocked\" : \"\"].join(\" \")}\r\n\t\t\t\t\tkey={app.name}\r\n\t\t\t\t>\r\n\t\t\t\t\t<span className=\"app-edit-access-item-name\">{app.name}</span>\r\n\t\t\t\t\t{!isInboundAuthorized && (\r\n\t\t\t\t\t\t<RelativePortal\r\n\t\t\t\t\t\t\tclassName={[\"tooltip-portal\", scrolling || !advancedExpanded ? \"is-scrolling\" : \"\"].join(\" \")}\r\n\t\t\t\t\t\t\tcomponent=\"div\"\r\n\t\t\t\t\t\t\tleft={-13}\r\n\t\t\t\t\t\t\ttop={0}\r\n\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t<Tooltip\r\n\t\t\t\t\t\t\t\ttype=\"lock\"\r\n\t\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\t\tupdateBlockingApp({\r\n\t\t\t\t\t\t\t\t\t\t...app,\r\n\t\t\t\t\t\t\t\t\t\tmanifest: {\r\n\t\t\t\t\t\t\t\t\t\t\t...app.manifest,\r\n\t\t\t\t\t\t\t\t\t\t\tinterop: {\r\n\t\t\t\t\t\t\t\t\t\t\t\t...app.manifest?.interop,\r\n\t\t\t\t\t\t\t\t\t\t\t\tselectConnect: [\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t...(app.manifest?.interop?.selectConnect || []),\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tauthorize: [{ name: props.appName || \"\" }],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t\t],\r\n\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t},\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\t\tThis app is blocking access. Click to allow access\r\n\t\t\t\t\t\t\t</Tooltip>\r\n\t\t\t\t\t\t</RelativePortal>\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\tuseEffect(() => {\r\n\t\tif (currentApp) {\r\n\t\t\tfilteredApps.forEach((targetApp) => {\r\n\t\t\t\tif (targetApp.name === props.appName) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tprops\r\n\t\t\t\t\t.isInboundInteropAuthorized(\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t...currentApp,\r\n\t\t\t\t\t\t\tname: props.appName,\r\n\t\t\t\t\t\t\tmanifest: {\r\n\t\t\t\t\t\t\t\tinterop: {\r\n\t\t\t\t\t\t\t\t\tselectConnect: rules,\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},\r\n\t\t\t\t\t\ttargetApp\r\n\t\t\t\t\t)\r\n\t\t\t\t\t.then((inboundAuthorized) => {\r\n\t\t\t\t\t\tif (inboundAuthorized && !inboundAuthorizedApps.includes(targetApp.name)) {\r\n\t\t\t\t\t\t\tsetInboundAuthorizedApps([...inboundAuthorizedApps, targetApp.name]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\tprops\r\n\t\t\t\t\t.isOutboundInteropAuthorized(\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t...currentApp,\r\n\t\t\t\t\t\t\tname: props.appName,\r\n\t\t\t\t\t\t\tmanifest: {\r\n\t\t\t\t\t\t\t\tinterop: {\r\n\t\t\t\t\t\t\t\t\tselectConnect: rules,\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},\r\n\t\t\t\t\t\ttargetApp\r\n\t\t\t\t\t)\r\n\t\t\t\t\t.then((outboundAuthorized) => {\r\n\t\t\t\t\t\tif (outboundAuthorized && !outboundAuthorizedApps.includes(targetApp.name)) {\r\n\t\t\t\t\t\t\tsetOutboundAuthorizedApps([...outboundAuthorizedApps, targetApp.name]);\r\n\t\t\t\t\t\t} else if (!outboundAuthorized && outboundAuthorizedApps.includes(targetApp.name)) {\r\n\t\t\t\t\t\t\tconst outboundAuthorizedAppsCopy = outboundAuthorizedApps.slice(0);\r\n\t\t\t\t\t\t\toutboundAuthorizedAppsCopy.splice(outboundAuthorizedAppsCopy.indexOf(targetApp.name), 1);\r\n\t\t\t\t\t\t\tsetOutboundAuthorizedApps(outboundAuthorizedAppsCopy);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t{filteredApps.length > 0 && (\r\n\t\t\t\t<div className=\"app-edit-field\">\r\n\t\t\t\t\t<div className={[\"app-edit-advanced\", advancedExpanded ? \"is-expanded\" : \"\"].join(\" \")}>\r\n\t\t\t\t\t\t<h2\r\n\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\tsetAdvancedExpanded(!advancedExpanded);\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<FinsembleIcon className=\"expand-icon\" icon=\"chevron-right\"></FinsembleIcon> Advanced settings\r\n\t\t\t\t\t\t</h2>\r\n\r\n\t\t\t\t\t\t<div className=\"app-edit-advanced-content\">\r\n\t\t\t\t\t\t\t<div className=\"app-edit-access\">\r\n\t\t\t\t\t\t\t\t<h3>Configure access</h3>\r\n\t\t\t\t\t\t\t\t<p>\r\n\t\t\t\t\t\t\t\t\tUse the controls below to decide which apps this app will be able to share information with. By\r\n\t\t\t\t\t\t\t\t\tdefault, your app is able to share with all other apps.\r\n\t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t\t<p>\r\n\t\t\t\t\t\t\t\t\t<FinsembleIcon icon=\"check-square\"></FinsembleIcon>\r\n\t\t\t\t\t\t\t\t\tChoose which apps to authorize\r\n\t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t\t<FinsembleSelect\r\n\t\t\t\t\t\t\t\t\toptions={filteredApps.map((app) => app.name)}\r\n\t\t\t\t\t\t\t\t\toptionComponents={getOptions()}\r\n\t\t\t\t\t\t\t\t\tselected={filteredApps\r\n\t\t\t\t\t\t\t\t\t\t.filter((app) => outboundAuthorizedApps.includes(app.name))\r\n\t\t\t\t\t\t\t\t\t\t.map((app) => app.name)}\r\n\t\t\t\t\t\t\t\t\tupdateCallback={(selected) => {\r\n\t\t\t\t\t\t\t\t\t\tfilteredApps.forEach((app) => {\r\n\t\t\t\t\t\t\t\t\t\t\tconst isSelected = selected.find((name) => name === app.name);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tif (!isSelected) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tdoSetRules(rules.filter((rule) => rule.authorize?.some((auth) => auth.name !== app.name)));\r\n\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\tdoSetRules([\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t...rules,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tauthorize: [{ name: app.name }],\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t\t]);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\tshowSearch={true}\r\n\t\t\t\t\t\t\t\t></FinsembleSelect>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t)}\r\n\t\t</>\r\n\t);\r\n};\r\n"]}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/// <reference types="react" />
|
|
6
6
|
import "../common/css/application-edit-page.css";
|
|
7
|
+
import { ApplicationRule } from "../../types/smartDesktopDesignerTypes";
|
|
7
8
|
export declare type AppEditPageProps = {
|
|
8
9
|
startingDisplayName: string;
|
|
9
10
|
isSetupWizard: boolean;
|
|
@@ -14,10 +15,14 @@ export declare type AppEditPageProps = {
|
|
|
14
15
|
startingDescription: string;
|
|
15
16
|
startingWidth: number;
|
|
16
17
|
startingHeight: number;
|
|
18
|
+
startingRules: ApplicationRule[];
|
|
17
19
|
validateURL: (s: string) => boolean;
|
|
18
20
|
removeApplicationFn: () => void;
|
|
19
21
|
cancelFn: () => void;
|
|
20
22
|
submitFn: (data: SubmittedDataProps) => void;
|
|
23
|
+
isInboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isInboundInteropAuthorized;
|
|
24
|
+
isOutboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isOutboundInteropAuthorized;
|
|
25
|
+
updateApp: typeof FSBL.Clients.SmartDesktopClient.prototype.updateApp;
|
|
21
26
|
};
|
|
22
27
|
export declare type SubmittedDataProps = {
|
|
23
28
|
name: string;
|
|
@@ -27,5 +32,6 @@ export declare type SubmittedDataProps = {
|
|
|
27
32
|
description: string;
|
|
28
33
|
width: number;
|
|
29
34
|
height: number;
|
|
35
|
+
rules: ApplicationRule[];
|
|
30
36
|
};
|
|
31
|
-
export declare const AppEditPage: ({ startingDisplayName, isSetupWizard, isEditMode, startingAppType, startingWindowURL, startingNativePath, startingDescription, startingWidth, startingHeight, validateURL, removeApplicationFn, cancelFn, submitFn, }: AppEditPageProps) => JSX.Element;
|
|
37
|
+
export declare const AppEditPage: ({ startingDisplayName, isSetupWizard, isEditMode, startingAppType, startingWindowURL, startingNativePath, startingDescription, startingWidth, startingHeight, startingRules, validateURL, removeApplicationFn, cancelFn, submitFn, isInboundInteropAuthorized, isOutboundInteropAuthorized, updateApp, }: AppEditPageProps) => JSX.Element;
|
|
@@ -7,11 +7,12 @@ import { FileInput } from "../common/FileInput";
|
|
|
7
7
|
import { Button } from "../common/Button";
|
|
8
8
|
import { validateFilename, VALID_APP_EXTENSIONS } from "../common/file_helpers";
|
|
9
9
|
import "../common/css/application-edit-page.css";
|
|
10
|
+
import { AppEditAccess } from "./AppEditAccess";
|
|
10
11
|
const DEFAULT_WINDOW_WIDTH = 1280;
|
|
11
12
|
const DEFAULT_WINDOW_HEIGHT = 600;
|
|
12
13
|
const MINIMUM_WINDOW_WIDTH = 0;
|
|
13
14
|
const MINIMUM_WINDOW_HEIGHT = 0;
|
|
14
|
-
export const AppEditPage = ({ startingDisplayName = "", isSetupWizard = false, isEditMode = true, startingAppType = "web", startingWindowURL = "", startingNativePath = "", startingDescription = "", startingWidth = DEFAULT_WINDOW_WIDTH, startingHeight = DEFAULT_WINDOW_HEIGHT, validateURL, removeApplicationFn = () => { }, cancelFn = () => { }, submitFn, }) => {
|
|
15
|
+
export const AppEditPage = ({ startingDisplayName = "", isSetupWizard = false, isEditMode = true, startingAppType = "web", startingWindowURL = "", startingNativePath = "", startingDescription = "", startingWidth = DEFAULT_WINDOW_WIDTH, startingHeight = DEFAULT_WINDOW_HEIGHT, startingRules = [], validateURL, removeApplicationFn = () => { }, cancelFn = () => { }, submitFn, isInboundInteropAuthorized, isOutboundInteropAuthorized, updateApp, }) => {
|
|
15
16
|
const [displayName, setDisplayName] = useState(startingDisplayName);
|
|
16
17
|
const [currentAppType, setCurrentAppType] = useState(startingAppType);
|
|
17
18
|
const [windowURL, setWindowURL] = useState(startingWindowURL);
|
|
@@ -19,6 +20,7 @@ export const AppEditPage = ({ startingDisplayName = "", isSetupWizard = false, i
|
|
|
19
20
|
const [componentDescription, setComponentDescription] = useState(startingDescription);
|
|
20
21
|
const [windowWidth, setWindowWidth] = useState(startingWidth || DEFAULT_WINDOW_WIDTH);
|
|
21
22
|
const [windowHeight, setWindowHeight] = useState(startingHeight || DEFAULT_WINDOW_HEIGHT);
|
|
23
|
+
const [rules, setRules] = useState(startingRules || []);
|
|
22
24
|
const isWindowURLValid = validateURL(windowURL);
|
|
23
25
|
const isHeightValid = !(typeof windowHeight !== "number" || windowHeight < MINIMUM_WINDOW_HEIGHT);
|
|
24
26
|
const isWidthValid = !(typeof windowWidth !== "number" || windowWidth < MINIMUM_WINDOW_WIDTH);
|
|
@@ -41,6 +43,7 @@ export const AppEditPage = ({ startingDisplayName = "", isSetupWizard = false, i
|
|
|
41
43
|
width: windowWidth,
|
|
42
44
|
height: windowHeight,
|
|
43
45
|
description: componentDescription,
|
|
46
|
+
rules,
|
|
44
47
|
});
|
|
45
48
|
};
|
|
46
49
|
const submitOnEnter = (e) => {
|
|
@@ -101,6 +104,7 @@ export const AppEditPage = ({ startingDisplayName = "", isSetupWizard = false, i
|
|
|
101
104
|
setWindowHeight(parseInt(e.target.value, 10) || "");
|
|
102
105
|
} }),
|
|
103
106
|
React.createElement("span", { className: "unit" }, "px")))),
|
|
107
|
+
React.createElement(AppEditAccess, { appName: displayName, rules: startingRules, onChange: (newRules) => setRules(newRules), isInboundInteropAuthorized: isInboundInteropAuthorized, isOutboundInteropAuthorized: isOutboundInteropAuthorized, updateApp: updateApp }),
|
|
104
108
|
React.createElement("div", { className: "app-edit-actions" },
|
|
105
109
|
React.createElement("div", null, isEditMode && (React.createElement(Button, { fashion: "danger", text: "Remove app", onClick: (e) => {
|
|
106
110
|
removeApplicationFn();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppEditPage.js","sourceRoot":"","sources":["../../../src/components/smartDesktopDesigner/AppEditPage.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OA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Q,GAAI;gBAC3D,oBAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAI,CACpF,CACD,CACJ,CACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\r\n * Copyright 2017 - 2020 by ChartIQ, Inc.\r\n * All rights reserved.\r\n */\r\n\r\nimport React, { ChangeEvent, useState } from \"react\";\r\nimport { FileInput } from \"../common/FileInput\";\r\nimport { Button } from \"../common/Button\";\r\nimport { validateFilename, VALID_APP_EXTENSIONS } from \"../common/file_helpers\";\r\nimport \"../common/css/application-edit-page.css\";\r\n\r\nconst DEFAULT_WINDOW_WIDTH = 1280;\r\nconst DEFAULT_WINDOW_HEIGHT = 600;\r\nconst MINIMUM_WINDOW_WIDTH = 0;\r\nconst MINIMUM_WINDOW_HEIGHT = 0;\r\n\r\nexport type AppEditPageProps = {\r\n\tstartingDisplayName: string;\r\n\tisSetupWizard: boolean;\r\n\tisEditMode: boolean;\r\n\tstartingAppType: string;\r\n\tstartingWindowURL: string;\r\n\tstartingNativePath: string;\r\n\tstartingDescription: string;\r\n\tstartingWidth: number;\r\n\tstartingHeight: number;\r\n\tvalidateURL: (s: string) => boolean;\r\n\tremoveApplicationFn: () => void;\r\n\tcancelFn: () => void;\r\n\tsubmitFn: (data: SubmittedDataProps) => void;\r\n};\r\n\r\nexport type SubmittedDataProps = {\r\n\tname: string;\r\n\turl: string;\r\n\tpath: string;\r\n\tappType: string;\r\n\tdescription: string;\r\n\twidth: number;\r\n\theight: number;\r\n};\r\n\r\nexport const AppEditPage = ({\r\n\tstartingDisplayName = \"\",\r\n\tisSetupWizard = false,\r\n\tisEditMode = true,\r\n\tstartingAppType = \"web\",\r\n\tstartingWindowURL = \"\",\r\n\tstartingNativePath = \"\",\r\n\tstartingDescription = \"\",\r\n\tstartingWidth = DEFAULT_WINDOW_WIDTH,\r\n\tstartingHeight = DEFAULT_WINDOW_HEIGHT,\r\n\tvalidateURL,\r\n\tremoveApplicationFn = () => {},\r\n\tcancelFn = () => {},\r\n\tsubmitFn,\r\n}: AppEditPageProps) => {\r\n\tconst [displayName, setDisplayName] = useState(startingDisplayName);\r\n\tconst [currentAppType, setCurrentAppType] = useState(startingAppType);\r\n\tconst [windowURL, setWindowURL] = useState(startingWindowURL);\r\n\tconst [nativePath, setNativePath] = useState(startingNativePath);\r\n\tconst [componentDescription, setComponentDescription] = useState(startingDescription);\r\n\tconst [windowWidth, setWindowWidth] = useState<number | string>(startingWidth || DEFAULT_WINDOW_WIDTH);\r\n\tconst [windowHeight, setWindowHeight] = useState<number | string>(startingHeight || DEFAULT_WINDOW_HEIGHT);\r\n\r\n\tconst isWindowURLValid = validateURL(windowURL);\r\n\tconst isHeightValid = !(typeof windowHeight !== \"number\" || windowHeight < MINIMUM_WINDOW_HEIGHT);\r\n\tconst isWidthValid = !(typeof windowWidth !== \"number\" || windowWidth < MINIMUM_WINDOW_WIDTH);\r\n\r\n\tconst disableSubmit =\r\n\t\t(currentAppType === \"web\" && (!isWindowURLValid || windowURL.length === 0)) ||\r\n\t\t(currentAppType === \"native\" &&\r\n\t\t\t(!nativePath || nativePath.length === 0 || validateFilename(VALID_APP_EXTENSIONS, nativePath))) ||\r\n\t\tdisplayName === undefined ||\r\n\t\tdisplayName === \"\" ||\r\n\t\t!isWidthValid ||\r\n\t\t!isHeightValid;\r\n\r\n\tconst clickSubmit = () => {\r\n\t\t// Shouldn't be possible to get in a state where windowWith/windowHeight aren't numbers,\r\n\t\t// but let's check anyway\r\n\t\tif (!(typeof windowWidth === \"number\" && typeof windowHeight === \"number\")) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tsubmitFn({\r\n\t\t\tname: displayName,\r\n\t\t\turl: windowURL,\r\n\t\t\tpath: nativePath,\r\n\t\t\tappType: currentAppType,\r\n\t\t\twidth: windowWidth,\r\n\t\t\theight: windowHeight,\r\n\t\t\tdescription: componentDescription,\r\n\t\t});\r\n\t};\r\n\r\n\t// TODO: This isn't ideal, but when we try to use the form/type=submit interaction, it acts like we pressed the back button, rather than the submit button\r\n\tconst submitOnEnter = (e: React.KeyboardEvent<HTMLInputElement>) => {\r\n\t\tif (e.key !== \"Enter\") {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\te.preventDefault();\r\n\t\tif (!disableSubmit) {\r\n\t\t\tclickSubmit();\r\n\t\t}\r\n\t};\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t<div className=\"app-edit-field\">\r\n\t\t\t\t<label htmlFor=\"app-name\">Name</label>\r\n\t\t\t\t<input\r\n\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\tid=\"app-name\"\r\n\t\t\t\t\tvalue={displayName}\r\n\t\t\t\t\tplaceholder=\"Untitled Application\"\r\n\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\tsetDisplayName(e.target.value);\r\n\t\t\t\t\t}}\r\n\t\t\t\t/>\r\n\t\t\t</div>\r\n\r\n\t\t\t{isSetupWizard !== true && (\r\n\t\t\t\t<div className=\"app-edit-field\">\r\n\t\t\t\t\t<label>App type</label>\r\n\r\n\t\t\t\t\t<div className=\"app-edit-type-field\">\r\n\t\t\t\t\t\t<div className=\"app-type-container\">\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\ttype=\"radio\"\r\n\t\t\t\t\t\t\t\tname=\"app-type\"\r\n\t\t\t\t\t\t\t\tid=\"app-type-web\"\r\n\t\t\t\t\t\t\t\tvalue=\"web\"\r\n\t\t\t\t\t\t\t\tchecked={currentAppType == \"web\"}\r\n\t\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\t\t\t\tsetCurrentAppType(e.target.value);\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\t<label htmlFor=\"app-type-web\">Web</label>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div className=\"app-type-container\">\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\ttype=\"radio\"\r\n\t\t\t\t\t\t\t\tname=\"app-type\"\r\n\t\t\t\t\t\t\t\tid=\"app-type-native\"\r\n\t\t\t\t\t\t\t\tvalue=\"native\"\r\n\t\t\t\t\t\t\t\tchecked={currentAppType == \"native\"}\r\n\t\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\t\tonChange={(e: ChangeEvent<HTMLInputElement>) => {\r\n\t\t\t\t\t\t\t\t\tsetCurrentAppType(e.target.value);\r\n\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t/>\r\n\r\n\t\t\t\t\t\t\t<label htmlFor=\"app-type-native\">Native</label>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t)}\r\n\r\n\t\t\t<div className=\"app-edit-field\">\r\n\t\t\t\t{currentAppType === \"web\" ? (\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t\t<label htmlFor=\"app-url\">Web URL</label>\r\n\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\t\t\tid=\"app-url\"\r\n\t\t\t\t\t\t\tplaceholder=\"https://...\"\r\n\t\t\t\t\t\t\tvalue={windowURL}\r\n\t\t\t\t\t\t\taria-invalid={!isWindowURLValid}\r\n\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\t\t\tsetWindowURL(e.target.value);\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t</>\r\n\t\t\t\t) : (\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t\t<label>File Path</label>\r\n\t\t\t\t\t\t<div className=\"app-file-input\">\r\n\t\t\t\t\t\t\t<FileInput\r\n\t\t\t\t\t\t\t\tacceptTypes={VALID_APP_EXTENSIONS}\r\n\t\t\t\t\t\t\t\tshouldUpload={false}\r\n\t\t\t\t\t\t\t\tvalue={nativePath}\r\n\t\t\t\t\t\t\t\tonSetValue={(value: string) => {\r\n\t\t\t\t\t\t\t\t\tsetNativePath(value);\r\n\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t></FileInput>\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\r\n\t\t\t<div className=\"app-edit-field description\">\r\n\t\t\t\t<label htmlFor=\"app-description\">Description</label>\r\n\t\t\t\t<textarea\r\n\t\t\t\t\tid=\"app-description\"\r\n\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\tsetComponentDescription(e.target.value);\r\n\t\t\t\t\t}}\r\n\t\t\t\t\tvalue={componentDescription}\r\n\t\t\t\t></textarea>\r\n\t\t\t</div>\r\n\r\n\t\t\t<div className=\"app-edit-field\">\r\n\t\t\t\t<label htmlFor=\"app-size\">Default window size</label>\r\n\t\t\t\t<fieldset className=\"app-size-fieldset\">\r\n\t\t\t\t\t<div className=\"app-size-field\">\r\n\t\t\t\t\t\t<label htmlFor=\"app-width\">Width</label>\r\n\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\tclassName=\"app-size-input\"\r\n\t\t\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\t\t\tid=\"app-width\"\r\n\t\t\t\t\t\t\tvalue={windowWidth}\r\n\t\t\t\t\t\t\taria-invalid={!isWidthValid}\r\n\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\t\t\tsetWindowWidth(parseInt(e.target.value, 10) || \"\");\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<span className=\"unit\">px</span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div className=\"app-size-field\">\r\n\t\t\t\t\t\t<label htmlFor=\"app-height\">Height</label>\r\n\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\tclassName=\"app-size-input\"\r\n\t\t\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\t\t\tid=\"app-height\"\r\n\t\t\t\t\t\t\tvalue={windowHeight}\r\n\t\t\t\t\t\t\taria-invalid={!isHeightValid}\r\n\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\t\t\tsetWindowHeight(parseInt(e.target.value, 10) || \"\");\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<span className=\"unit\">px</span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</fieldset>\r\n\t\t\t</div>\r\n\r\n\t\t\t<div className=\"app-edit-actions\">\r\n\t\t\t\t<div>\r\n\t\t\t\t\t{isEditMode && (\r\n\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\tfashion=\"danger\"\r\n\t\t\t\t\t\t\ttext=\"Remove app\"\r\n\t\t\t\t\t\t\tonClick={(e) => {\r\n\t\t\t\t\t\t\t\tremoveApplicationFn();\r\n\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t)}\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div className=\"app-actions-right-wrapper\">\r\n\t\t\t\t\t<Button fashion=\"ghost\" text=\"Cancel\" onClick={cancelFn} />\r\n\t\t\t\t\t<Button fashion=\"secondary\" text=\"Save\" disabled={disableSubmit} onClick={clickSubmit} />\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":"AppEditPage.js","sourceRoot":"","sources":["../../../src/components/smartDesktopDesigner/AppEditPage.tsx"],"names":[],"mappings":"AAA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AC1C,0BAA0B,EAAE,0BAA0B,EACtD,2BAA2B,EAAE,2BAA2B,EACxD,SAAS,EAAE,SAAS,GACJ;QAEjB,6BAAK,SAAS,EAAC,kBAAkB;YAChC,iCACE,UAAU,IAAI,CACd,oBAAC,MAAM,IACN,OAAO,EAAC,QAAQ,EAChB,IAAI,EAAC,YAAY,EACjB,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oBACd,mBAAmB,EAAE,CAAC;oBACtB,CAAC,CAAC,cAAc,EAAE,CAAC;gBACpB,CAAC,GACA,CACF,CACI;YAEN,6BAAK,SAAS,EAAC,2BAA2B;gBACzC,oBAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,QAAQ,GAAI;gBAC3D,oBAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAI,CACpF,CACD,CACJ,CACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\r\n * Copyright 2017 - 2020 by ChartIQ, Inc.\r\n * All rights reserved.\r\n */\r\n\r\nimport React, { ChangeEvent, useState } from \"react\";\r\nimport { FileInput } from \"../common/FileInput\";\r\nimport { Button } from \"../common/Button\";\r\nimport { validateFilename, VALID_APP_EXTENSIONS } from \"../common/file_helpers\";\r\nimport \"../common/css/application-edit-page.css\";\r\nimport { AppEditAccess } from \"./AppEditAccess\";\r\nimport { ApplicationRule } from \"../../types/smartDesktopDesignerTypes\";\r\n\r\nconst DEFAULT_WINDOW_WIDTH = 1280;\r\nconst DEFAULT_WINDOW_HEIGHT = 600;\r\nconst MINIMUM_WINDOW_WIDTH = 0;\r\nconst MINIMUM_WINDOW_HEIGHT = 0;\r\n\r\nexport type AppEditPageProps = {\r\n\tstartingDisplayName: string;\r\n\tisSetupWizard: boolean;\r\n\tisEditMode: boolean;\r\n\tstartingAppType: string;\r\n\tstartingWindowURL: string;\r\n\tstartingNativePath: string;\r\n\tstartingDescription: string;\r\n\tstartingWidth: number;\r\n\tstartingHeight: number;\r\n\tstartingRules: ApplicationRule[];\r\n\tvalidateURL: (s: string) => boolean;\r\n\tremoveApplicationFn: () => void;\r\n\tcancelFn: () => void;\r\n\tsubmitFn: (data: SubmittedDataProps) => void;\r\n\tisInboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isInboundInteropAuthorized;\r\n\tisOutboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isOutboundInteropAuthorized;\r\n\tupdateApp: typeof FSBL.Clients.SmartDesktopClient.prototype.updateApp;\r\n};\r\n\r\nexport type SubmittedDataProps = {\r\n\tname: string;\r\n\turl: string;\r\n\tpath: string;\r\n\tappType: string;\r\n\tdescription: string;\r\n\twidth: number;\r\n\theight: number;\r\n\trules: ApplicationRule[];\r\n};\r\n\r\nexport const AppEditPage = ({\r\n\tstartingDisplayName = \"\",\r\n\tisSetupWizard = false,\r\n\tisEditMode = true,\r\n\tstartingAppType = \"web\",\r\n\tstartingWindowURL = \"\",\r\n\tstartingNativePath = \"\",\r\n\tstartingDescription = \"\",\r\n\tstartingWidth = DEFAULT_WINDOW_WIDTH,\r\n\tstartingHeight = DEFAULT_WINDOW_HEIGHT,\r\n\tstartingRules = [],\r\n\tvalidateURL,\r\n\tremoveApplicationFn = () => {},\r\n\tcancelFn = () => {},\r\n\tsubmitFn,\r\n\tisInboundInteropAuthorized,\r\n\tisOutboundInteropAuthorized,\r\n\tupdateApp,\r\n}: AppEditPageProps) => {\r\n\tconst [displayName, setDisplayName] = useState(startingDisplayName);\r\n\tconst [currentAppType, setCurrentAppType] = useState(startingAppType);\r\n\tconst [windowURL, setWindowURL] = useState(startingWindowURL);\r\n\tconst [nativePath, setNativePath] = useState(startingNativePath);\r\n\tconst [componentDescription, setComponentDescription] = useState(startingDescription);\r\n\tconst [windowWidth, setWindowWidth] = useState<number | string>(startingWidth || DEFAULT_WINDOW_WIDTH);\r\n\tconst [windowHeight, setWindowHeight] = useState<number | string>(startingHeight || DEFAULT_WINDOW_HEIGHT);\r\n\tconst [rules, setRules] = useState(startingRules || []);\r\n\r\n\tconst isWindowURLValid = validateURL(windowURL);\r\n\tconst isHeightValid = !(typeof windowHeight !== \"number\" || windowHeight < MINIMUM_WINDOW_HEIGHT);\r\n\tconst isWidthValid = !(typeof windowWidth !== \"number\" || windowWidth < MINIMUM_WINDOW_WIDTH);\r\n\r\n\tconst disableSubmit =\r\n\t\t(currentAppType === \"web\" && (!isWindowURLValid || windowURL.length === 0)) ||\r\n\t\t(currentAppType === \"native\" &&\r\n\t\t\t(!nativePath || nativePath.length === 0 || validateFilename(VALID_APP_EXTENSIONS, nativePath))) ||\r\n\t\tdisplayName === undefined ||\r\n\t\tdisplayName === \"\" ||\r\n\t\t!isWidthValid ||\r\n\t\t!isHeightValid;\r\n\r\n\tconst clickSubmit = () => {\r\n\t\t// Shouldn't be possible to get in a state where windowWith/windowHeight aren't numbers,\r\n\t\t// but let's check anyway\r\n\t\tif (!(typeof windowWidth === \"number\" && typeof windowHeight === \"number\")) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tsubmitFn({\r\n\t\t\tname: displayName,\r\n\t\t\turl: windowURL,\r\n\t\t\tpath: nativePath,\r\n\t\t\tappType: currentAppType,\r\n\t\t\twidth: windowWidth,\r\n\t\t\theight: windowHeight,\r\n\t\t\tdescription: componentDescription,\r\n\t\t\trules,\r\n\t\t});\r\n\t};\r\n\r\n\t// TODO: This isn't ideal, but when we try to use the form/type=submit interaction, it acts like we pressed the back button, rather than the submit button\r\n\tconst submitOnEnter = (e: React.KeyboardEvent<HTMLInputElement>) => {\r\n\t\tif (e.key !== \"Enter\") {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\te.preventDefault();\r\n\t\tif (!disableSubmit) {\r\n\t\t\tclickSubmit();\r\n\t\t}\r\n\t};\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t<div className=\"app-edit-field\">\r\n\t\t\t\t<label htmlFor=\"app-name\">Name</label>\r\n\t\t\t\t<input\r\n\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\tid=\"app-name\"\r\n\t\t\t\t\tvalue={displayName}\r\n\t\t\t\t\tplaceholder=\"Untitled Application\"\r\n\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\tsetDisplayName(e.target.value);\r\n\t\t\t\t\t}}\r\n\t\t\t\t/>\r\n\t\t\t</div>\r\n\r\n\t\t\t{isSetupWizard !== true && (\r\n\t\t\t\t<div className=\"app-edit-field\">\r\n\t\t\t\t\t<label>App type</label>\r\n\r\n\t\t\t\t\t<div className=\"app-edit-type-field\">\r\n\t\t\t\t\t\t<div className=\"app-type-container\">\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\ttype=\"radio\"\r\n\t\t\t\t\t\t\t\tname=\"app-type\"\r\n\t\t\t\t\t\t\t\tid=\"app-type-web\"\r\n\t\t\t\t\t\t\t\tvalue=\"web\"\r\n\t\t\t\t\t\t\t\tchecked={currentAppType == \"web\"}\r\n\t\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\t\t\t\tsetCurrentAppType(e.target.value);\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\t<label htmlFor=\"app-type-web\">Web</label>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div className=\"app-type-container\">\r\n\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\ttype=\"radio\"\r\n\t\t\t\t\t\t\t\tname=\"app-type\"\r\n\t\t\t\t\t\t\t\tid=\"app-type-native\"\r\n\t\t\t\t\t\t\t\tvalue=\"native\"\r\n\t\t\t\t\t\t\t\tchecked={currentAppType == \"native\"}\r\n\t\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\t\tonChange={(e: ChangeEvent<HTMLInputElement>) => {\r\n\t\t\t\t\t\t\t\t\tsetCurrentAppType(e.target.value);\r\n\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t/>\r\n\r\n\t\t\t\t\t\t\t<label htmlFor=\"app-type-native\">Native</label>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t)}\r\n\r\n\t\t\t<div className=\"app-edit-field\">\r\n\t\t\t\t{currentAppType === \"web\" ? (\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t\t<label htmlFor=\"app-url\">Web URL</label>\r\n\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\t\t\tid=\"app-url\"\r\n\t\t\t\t\t\t\tplaceholder=\"https://...\"\r\n\t\t\t\t\t\t\tvalue={windowURL}\r\n\t\t\t\t\t\t\taria-invalid={!isWindowURLValid}\r\n\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\t\t\tsetWindowURL(e.target.value);\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t</>\r\n\t\t\t\t) : (\r\n\t\t\t\t\t<>\r\n\t\t\t\t\t\t<label>File Path</label>\r\n\t\t\t\t\t\t<div className=\"app-file-input\">\r\n\t\t\t\t\t\t\t<FileInput\r\n\t\t\t\t\t\t\t\tacceptTypes={VALID_APP_EXTENSIONS}\r\n\t\t\t\t\t\t\t\tshouldUpload={false}\r\n\t\t\t\t\t\t\t\tvalue={nativePath}\r\n\t\t\t\t\t\t\t\tonSetValue={(value: string) => {\r\n\t\t\t\t\t\t\t\t\tsetNativePath(value);\r\n\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t></FileInput>\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\r\n\t\t\t<div className=\"app-edit-field description\">\r\n\t\t\t\t<label htmlFor=\"app-description\">Description</label>\r\n\t\t\t\t<textarea\r\n\t\t\t\t\tid=\"app-description\"\r\n\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\tsetComponentDescription(e.target.value);\r\n\t\t\t\t\t}}\r\n\t\t\t\t\tvalue={componentDescription}\r\n\t\t\t\t></textarea>\r\n\t\t\t</div>\r\n\r\n\t\t\t<div className=\"app-edit-field\">\r\n\t\t\t\t<label htmlFor=\"app-size\">Default window size</label>\r\n\t\t\t\t<fieldset className=\"app-size-fieldset\">\r\n\t\t\t\t\t<div className=\"app-size-field\">\r\n\t\t\t\t\t\t<label htmlFor=\"app-width\">Width</label>\r\n\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\tclassName=\"app-size-input\"\r\n\t\t\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\t\t\tid=\"app-width\"\r\n\t\t\t\t\t\t\tvalue={windowWidth}\r\n\t\t\t\t\t\t\taria-invalid={!isWidthValid}\r\n\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\t\t\tsetWindowWidth(parseInt(e.target.value, 10) || \"\");\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<span className=\"unit\">px</span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div className=\"app-size-field\">\r\n\t\t\t\t\t\t<label htmlFor=\"app-height\">Height</label>\r\n\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\tclassName=\"app-size-input\"\r\n\t\t\t\t\t\t\ttype=\"text\"\r\n\t\t\t\t\t\t\tid=\"app-height\"\r\n\t\t\t\t\t\t\tvalue={windowHeight}\r\n\t\t\t\t\t\t\taria-invalid={!isHeightValid}\r\n\t\t\t\t\t\t\tonKeyDown={submitOnEnter}\r\n\t\t\t\t\t\t\tonChange={(e) => {\r\n\t\t\t\t\t\t\t\tsetWindowHeight(parseInt(e.target.value, 10) || \"\");\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<span className=\"unit\">px</span>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</fieldset>\r\n\t\t\t</div>\r\n\r\n\t\t\t<AppEditAccess\r\n\t\t\t\tappName={displayName}\r\n\t\t\t\trules={startingRules}\r\n\t\t\t\tonChange={(newRules) => setRules(newRules)}\r\n\t\t\t\tisInboundInteropAuthorized={isInboundInteropAuthorized}\r\n\t\t\t\tisOutboundInteropAuthorized={isOutboundInteropAuthorized}\r\n\t\t\t\tupdateApp={updateApp}\r\n\t\t\t></AppEditAccess>\r\n\r\n\t\t\t<div className=\"app-edit-actions\">\r\n\t\t\t\t<div>\r\n\t\t\t\t\t{isEditMode && (\r\n\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\tfashion=\"danger\"\r\n\t\t\t\t\t\t\ttext=\"Remove app\"\r\n\t\t\t\t\t\t\tonClick={(e) => {\r\n\t\t\t\t\t\t\t\tremoveApplicationFn();\r\n\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t/>\r\n\t\t\t\t\t)}\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div className=\"app-actions-right-wrapper\">\r\n\t\t\t\t\t<Button fashion=\"ghost\" text=\"Cancel\" onClick={cancelFn} />\r\n\t\t\t\t\t<Button fashion=\"secondary\" text=\"Save\" disabled={disableSubmit} onClick={clickSubmit} />\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</>\r\n\t);\r\n};\r\n"]}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
/// <reference types="finsemble-core" />
|
|
6
6
|
/// <reference types="react" />
|
|
7
7
|
import * as Types from "../../types/smartDesktopDesignerTypes";
|
|
8
|
-
|
|
8
|
+
import { AppDefinition } from "services/Interop/types";
|
|
9
|
+
export declare function appConfigToAppData(appConfig: AppDefinition): Types.ApplicationSaveData;
|
|
9
10
|
export declare enum ApplicationCloseReason {
|
|
10
11
|
SUCCESS = 0,
|
|
11
12
|
CANCEL = 1,
|
|
@@ -20,5 +21,7 @@ export declare type ApplicationProps = {
|
|
|
20
21
|
getAppConfigTemplate: typeof FSBL.Clients.SmartDesktopClient.prototype.getAppConfigTemplate;
|
|
21
22
|
onClose: (reason: ApplicationCloseReason) => void;
|
|
22
23
|
setCurrentAppID: (id: string | null) => void;
|
|
24
|
+
isInboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isInboundInteropAuthorized;
|
|
25
|
+
isOutboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isOutboundInteropAuthorized;
|
|
23
26
|
};
|
|
24
27
|
export declare const Application: (props: ApplicationProps) => JSX.Element;
|
|
@@ -16,12 +16,13 @@ import { ApplicationSetupType } from "../../types/smartDesktopDesignerTypes";
|
|
|
16
16
|
import { launchTutorialLink } from "./common/fsbl_functions";
|
|
17
17
|
export function appConfigToAppData(appConfig) {
|
|
18
18
|
return {
|
|
19
|
-
name: appConfig.name || appConfig?.component?.displayName,
|
|
20
|
-
description: appConfig.description,
|
|
21
|
-
url: appConfig.manifest?.window
|
|
22
|
-
path: appConfig.manifest?.window
|
|
23
|
-
width: appConfig.manifest?.window
|
|
24
|
-
height: appConfig.manifest?.window
|
|
19
|
+
name: appConfig.name || appConfig.manifest?.component?.displayName,
|
|
20
|
+
description: appConfig.description || "",
|
|
21
|
+
url: appConfig.manifest?.window?.url,
|
|
22
|
+
path: appConfig.manifest?.window?.path,
|
|
23
|
+
width: appConfig.manifest?.window?.width,
|
|
24
|
+
height: appConfig.manifest?.window?.height,
|
|
25
|
+
rules: appConfig.manifest?.interop?.selectConnect,
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
export var ApplicationCloseReason;
|
|
@@ -45,7 +46,9 @@ export const Application = (props) => {
|
|
|
45
46
|
name: undefined,
|
|
46
47
|
manifest: {
|
|
47
48
|
...response.config.manifest,
|
|
48
|
-
|
|
49
|
+
component: {
|
|
50
|
+
temporary: true,
|
|
51
|
+
},
|
|
49
52
|
},
|
|
50
53
|
};
|
|
51
54
|
props.addApp(currentAppID, config).then(() => {
|
|
@@ -71,13 +74,19 @@ export const Application = (props) => {
|
|
|
71
74
|
window: {
|
|
72
75
|
...currentAppConfig.manifest?.window,
|
|
73
76
|
},
|
|
77
|
+
component: {
|
|
78
|
+
temporary: undefined,
|
|
79
|
+
},
|
|
80
|
+
interop: {
|
|
81
|
+
...currentAppConfig.manifest?.interop,
|
|
82
|
+
},
|
|
74
83
|
},
|
|
75
84
|
name: data.name,
|
|
76
85
|
description: data.description,
|
|
77
86
|
appId: currentAppID,
|
|
78
87
|
appName: data.name,
|
|
79
88
|
};
|
|
80
|
-
delete appConfig.manifest.temporary;
|
|
89
|
+
delete appConfig.manifest.component.temporary;
|
|
81
90
|
if (data.appType == "native") {
|
|
82
91
|
appConfig.manifest.window.windowType = "assimilation";
|
|
83
92
|
appConfig.manifest.window.path = data.path;
|
|
@@ -90,6 +99,7 @@ export const Application = (props) => {
|
|
|
90
99
|
}
|
|
91
100
|
appConfig.manifest.window.width = data.width;
|
|
92
101
|
appConfig.manifest.window.height = data.height;
|
|
102
|
+
appConfig.manifest.interop.selectConnect = data.rules;
|
|
93
103
|
props.deleteApp(currentAppID).then(({ err }) => {
|
|
94
104
|
if (err) {
|
|
95
105
|
alert(err);
|
|
@@ -154,7 +164,7 @@ export const Application = (props) => {
|
|
|
154
164
|
},
|
|
155
165
|
onClickBackButton,
|
|
156
166
|
onSaveData,
|
|
157
|
-
} })) : (React.createElement(ApplicationSetup, { id: currentAppID, data: appConfigToAppData(currentAppConfig), apps: props.apps, backFunction: () => {
|
|
167
|
+
}, isInboundInteropAuthorized: props.isInboundInteropAuthorized, isOutboundInteropAuthorized: props.isOutboundInteropAuthorized, updateApp: props.updateApp })) : (React.createElement(ApplicationSetup, { id: currentAppID, data: appConfigToAppData(currentAppConfig), apps: props.apps, backFunction: () => {
|
|
158
168
|
setCurrentSetupType(null);
|
|
159
169
|
}, ...{
|
|
160
170
|
setCurrentSetupType,
|
|
@@ -169,6 +179,6 @@ export const Application = (props) => {
|
|
|
169
179
|
},
|
|
170
180
|
onClickBackButton,
|
|
171
181
|
onSaveData,
|
|
172
|
-
} }))));
|
|
182
|
+
}, isInboundInteropAuthorized: props.isInboundInteropAuthorized, isOutboundInteropAuthorized: props.isOutboundInteropAuthorized, updateApp: props.updateApp }))));
|
|
173
183
|
};
|
|
174
184
|
//# sourceMappingURL=Application.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.js","sourceRoot":"","sources":["../../../src/components/smartDesktopDesigner/Application.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,UAAU,kBAAkB,CAAC,SAAc;IAChD,OAAO;QACN,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,SAAS,EAAE,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B,qBAAqB,EAAE,CAAC,EAAiB,EAAE,EAAE;gBAC5C,IAAI,EAAE,KAAK,KAAK,EAAE;oBACjB,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;iBAC1C;qBAAM;oBACN,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;iBAC9C;YACF,CAAC;YACD,iBAAiB;YACjB,UAAU;SACV,GACkB,CACpB,CACC,CACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\r\n * Copyright 2017 - 2020 by ChartIQ, Inc.\r\n * All rights reserved.\r\n */\r\n\r\nimport React from \"react\";\r\nimport { useSelector, useDispatch } from \"../../store\";\r\nimport { View } from \"./View\";\r\nimport { Header } from \"../common/Header\";\r\nimport { Content } from \"./Content\";\r\nimport { ApplicationEdit } from \"./ApplicationEdit\";\r\nimport { ApplicationSetup } from \"./ApplicationSetup\";\r\n\r\nimport * as Types from \"../../types/smartDesktopDesignerTypes\";\r\n\r\nimport { ButtonTile } from \"../common/ButtonTile\";\r\nimport { CircularLoadingSpinner } from \"../common/LoadingSpinner\";\r\nimport { SmartDesktopDesignerActions } from \"../../actions/smartDesktopDesignerActions\";\r\nimport { ApplicationSetupType } from \"../../types/smartDesktopDesignerTypes\";\r\nimport { RootState } from \"../../reducers/rootReducer\";\r\nimport { launchTutorialLink } from \"./common/fsbl_functions\";\r\n\r\nexport function appConfigToAppData(appConfig: any): Types.ApplicationSaveData {\r\n\treturn {\r\n\t\tname: appConfig.name || appConfig?.component?.displayName,\r\n\t\tdescription: appConfig.description,\r\n\t\turl: appConfig.manifest?.window.url,\r\n\t\tpath: appConfig.manifest?.window.path,\r\n\t\twidth: appConfig.manifest?.window.width,\r\n\t\theight: appConfig.manifest?.window.height,\r\n\t};\r\n}\r\n\r\nexport enum ApplicationCloseReason {\r\n\tSUCCESS,\r\n\tCANCEL,\r\n\tNEW,\r\n}\r\n\r\nexport type ApplicationProps = {\r\n\tid: string;\r\n\tapps: AppDConfig[];\r\n\taddApp: typeof FSBL.Clients.SmartDesktopClient.prototype.addApp;\r\n\tupdateApp: typeof FSBL.Clients.SmartDesktopClient.prototype.updateApp;\r\n\tdeleteApp: typeof FSBL.Clients.SmartDesktopClient.prototype.deleteApp;\r\n\tgetAppConfigTemplate: typeof FSBL.Clients.SmartDesktopClient.prototype.getAppConfigTemplate;\r\n\tonClose: (reason: ApplicationCloseReason) => void;\r\n\tsetCurrentAppID: (id: string | null) => void;\r\n};\r\n\r\nexport const Application = (props: ApplicationProps) => {\r\n\tconst dispatch = useDispatch();\r\n\r\n\tconst currentAppID = props.id;\r\n\r\n\tconst currentAppConfig = useSelector((state: RootState) =>\r\n\t\tstate.smartDesktopDesigner.apps.find((app: AppDConfig) => app.appId === currentAppID)\r\n\t);\r\n\r\n\tconst currentSetupType = useSelector((state: RootState) => state.smartDesktopDesigner.currentAppSetupType);\r\n\r\n\tconst isGettingStarted = useSelector((state: RootState) => state.smartDesktopDesigner.isGettingStarted);\r\n\r\n\tif (!currentAppConfig) {\r\n\t\tprops.getAppConfigTemplate().then((response) => {\r\n\t\t\tprops.deleteApp(currentAppID).then(({ err }: { err: string }) => {\r\n\t\t\t\tconst config = {\r\n\t\t\t\t\t...response.config,\r\n\t\t\t\t\tappId: currentAppID,\r\n\t\t\t\t\tname: undefined,\r\n\t\t\t\t\tmanifest: {\r\n\t\t\t\t\t\t...response.config.manifest,\r\n\t\t\t\t\t\ttemporary: true,\r\n\t\t\t\t\t},\r\n\t\t\t\t};\r\n\r\n\t\t\t\tprops.addApp(currentAppID, config).then(() => {\r\n\t\t\t\t\tdispatch(SmartDesktopDesignerActions.update_app(config));\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\treturn (\r\n\t\t\t<>\r\n\t\t\t\t<div style={{ overflow: \"hidden\" }}>\r\n\t\t\t\t\t<div style={{ marginTop: \"43vh\" }}>\r\n\t\t\t\t\t\t<CircularLoadingSpinner />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</>\r\n\t\t);\r\n\t}\r\n\r\n\tconst isEditMode =\r\n\t\tcurrentSetupType === ApplicationSetupType.APP_EDIT_ADVANCED ||\r\n\t\tcurrentSetupType === ApplicationSetupType.APP_EDIT_SIMPLE;\r\n\r\n\tconst onSaveData = (data: Types.ApplicationSaveData) =>\r\n\t\tnew Promise<any>((resolve, reject) => {\r\n\t\t\tif (!currentAppID) {\r\n\t\t\t\treturn reject(new Error(\"no app ID specified\"));\r\n\t\t\t}\r\n\r\n\t\t\tconst appConfig = {\r\n\t\t\t\t...currentAppConfig,\r\n\t\t\t\tmanifest: {\r\n\t\t\t\t\t...currentAppConfig.manifest,\r\n\t\t\t\t\twindow: {\r\n\t\t\t\t\t\t...currentAppConfig.manifest?.window,\r\n\t\t\t\t\t},\r\n\t\t\t\t},\r\n\t\t\t\tname: data.name,\r\n\t\t\t\tdescription: data.description,\r\n\t\t\t\tappId: currentAppID,\r\n\t\t\t\tappName: data.name,\r\n\t\t\t};\r\n\t\t\tdelete appConfig.manifest.temporary;\r\n\r\n\t\t\tif (data.appType == \"native\") {\r\n\t\t\t\tappConfig.manifest.window.windowType = \"assimilation\";\r\n\t\t\t\tappConfig.manifest.window.path = data.path;\r\n\t\t\t\tdelete appConfig.manifest.window.url;\r\n\t\t\t} else {\r\n\t\t\t\tdelete appConfig.manifest.window.windowType;\r\n\t\t\t\tdelete appConfig.manifest.window.path;\r\n\t\t\t\tappConfig.manifest.window.url = data.url;\r\n\t\t\t}\r\n\r\n\t\t\tappConfig.manifest.window.width = data.width;\r\n\t\t\tappConfig.manifest.window.height = data.height;\r\n\r\n\t\t\t// Always remove and replace component\r\n\t\t\tprops.deleteApp(currentAppID).then(({ err }: { err: string }) => {\r\n\t\t\t\tif (err) {\r\n\t\t\t\t\t// @todo : add error handling. Maybe react-toast-notify?\r\n\t\t\t\t\talert(err);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tprops\r\n\t\t\t\t\t.addApp(currentAppID, appConfig)\r\n\t\t\t\t\t.then((response) => {\r\n\t\t\t\t\t\tresolve(response);\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.catch((e) => {\r\n\t\t\t\t\t\treject(e);\r\n\t\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n\r\n\tconst onClickBackButton = () => {\r\n\t\tif (!isEditMode) {\r\n\t\t\tif (currentSetupType === null) {\r\n\t\t\t\tprops.onClose(ApplicationCloseReason.CANCEL);\r\n\t\t\t} else {\r\n\t\t\t\tdispatch(SmartDesktopDesignerActions.set_current_app_setup_type(null));\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tprops.onClose(ApplicationCloseReason.CANCEL);\r\n\t\t}\r\n\t};\r\n\r\n\tconst setCurrentSetupType = (type: ApplicationSetupType | null) => {\r\n\t\tdispatch(SmartDesktopDesignerActions.set_current_app_setup_type(type));\r\n\t};\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t{currentSetupType === null ? (\r\n\t\t\t\t<div className=\"setup-type-container\">\r\n\t\t\t\t\t<View>\r\n\t\t\t\t\t\t<Header\r\n\t\t\t\t\t\t\thelpFunction={() => {\r\n\t\t\t\t\t\t\t\tlaunchTutorialLink(\"adding-applications\");\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\tbackFunction={() => {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.CANCEL);\r\n\r\n\t\t\t\t\t\t\t\tif (isGettingStarted) {\r\n\t\t\t\t\t\t\t\t\tdispatch(SmartDesktopDesignerActions.change_view(\"getting-started\"));\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>\r\n\t\t\t\t\t\t\tAdd an app\r\n\t\t\t\t\t\t</Header>\r\n\r\n\t\t\t\t\t\t<Content>\r\n\t\t\t\t\t\t\t<h2 className=\"setup-type-heading\">Choose a method to add an app</h2>\r\n\t\t\t\t\t\t\t<div className=\"tile-type-buttons\">\r\n\t\t\t\t\t\t\t\t<ButtonTile\r\n\t\t\t\t\t\t\t\t\tclassName=\"icon-wizard\"\r\n\t\t\t\t\t\t\t\t\ticon=\"magic\"\r\n\t\t\t\t\t\t\t\t\ttext=\"App wizard\"\r\n\t\t\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\t\t\tdispatch(\r\n\t\t\t\t\t\t\t\t\t\t\tSmartDesktopDesignerActions.set_current_app_setup_type(ApplicationSetupType.APP_ADD_SIMPLE)\r\n\t\t\t\t\t\t\t\t\t\t);\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<ButtonTile\r\n\t\t\t\t\t\t\t\t\tclassName=\"icon-manual\"\r\n\t\t\t\t\t\t\t\t\ticon=\"tools\"\r\n\t\t\t\t\t\t\t\t\ttext=\"Manual setup (advanced)\"\r\n\t\t\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\t\t\tdispatch(\r\n\t\t\t\t\t\t\t\t\t\t\tSmartDesktopDesignerActions.set_current_app_setup_type(ApplicationSetupType.APP_ADD_ADVANCED)\r\n\t\t\t\t\t\t\t\t\t\t);\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</div>\r\n\t\t\t\t\t\t</Content>\r\n\t\t\t\t\t</View>\r\n\t\t\t\t</div>\r\n\t\t\t) : currentSetupType === ApplicationSetupType.APP_EDIT_ADVANCED ||\r\n\t\t\t currentSetupType === ApplicationSetupType.APP_ADD_ADVANCED ? (\r\n\t\t\t\t<ApplicationEdit\r\n\t\t\t\t\tid={currentAppID}\r\n\t\t\t\t\tdata={appConfigToAppData(currentAppConfig) as Types.ApplicationSaveData}\r\n\t\t\t\t\tapps={props.apps}\r\n\t\t\t\t\tisSetupWizard={false}\r\n\t\t\t\t\t{...{\r\n\t\t\t\t\t\tcurrentSetupType,\r\n\t\t\t\t\t\tisEditMode,\r\n\t\t\t\t\t\tsetCurrentSetupType,\r\n\t\t\t\t\t\tremoveAppID: props.deleteApp,\r\n\t\t\t\t\t\tsetCurrentComponentID: (id: string | null) => {\r\n\t\t\t\t\t\t\tif (id === \"new\") {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.NEW);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.SUCCESS);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tonClickBackButton,\r\n\t\t\t\t\t\tonSaveData,\r\n\t\t\t\t\t}}\r\n\t\t\t\t></ApplicationEdit>\r\n\t\t\t) : (\r\n\t\t\t\t// else \"application setup wizard\"\r\n\t\t\t\t<ApplicationSetup\r\n\t\t\t\t\tid={currentAppID}\r\n\t\t\t\t\tdata={appConfigToAppData(currentAppConfig) as Types.ApplicationSaveData}\r\n\t\t\t\t\tapps={props.apps}\r\n\t\t\t\t\tbackFunction={() => {\r\n\t\t\t\t\t\tsetCurrentSetupType(null);\r\n\t\t\t\t\t}}\r\n\t\t\t\t\t{...{\r\n\t\t\t\t\t\tsetCurrentSetupType,\r\n\t\t\t\t\t\tremoveAppID: props.deleteApp,\r\n\t\t\t\t\t\tsetCurrentComponentID: (id: string | null) => {\r\n\t\t\t\t\t\t\tif (id === \"new\") {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.NEW);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.SUCCESS);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tonClickBackButton,\r\n\t\t\t\t\t\tonSaveData,\r\n\t\t\t\t\t}}\r\n\t\t\t\t></ApplicationSetup>\r\n\t\t\t)}\r\n\t\t</>\r\n\t);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"Application.js","sourceRoot":"","sources":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BAAqB,EAAE,CAAC,EAAiB,EAAE,EAAE;gBAC5C,IAAI,EAAE,KAAK,KAAK,EAAE;oBACjB,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;iBAC1C;qBAAM;oBACN,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;iBAC9C;YACF,CAAC;YACD,iBAAiB;YACjB,UAAU;SACV,EACD,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAC5D,2BAA2B,EAAE,KAAK,CAAC,2BAA2B,EAC9D,SAAS,EAAE,KAAK,CAAC,SAAS,GACP,CACpB,CACC,CACH,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\r\n * Copyright 2017 - 2020 by ChartIQ, Inc.\r\n * All rights reserved.\r\n */\r\n\r\nimport React from \"react\";\r\nimport { useSelector, useDispatch } from \"../../store\";\r\nimport { View } from \"./View\";\r\nimport { Header } from \"../common/Header\";\r\nimport { Content } from \"./Content\";\r\nimport { ApplicationEdit } from \"./ApplicationEdit\";\r\nimport { ApplicationSetup } from \"./ApplicationSetup\";\r\n\r\nimport * as Types from \"../../types/smartDesktopDesignerTypes\";\r\n\r\nimport { ButtonTile } from \"../common/ButtonTile\";\r\nimport { CircularLoadingSpinner } from \"../common/LoadingSpinner\";\r\nimport { SmartDesktopDesignerActions } from \"../../actions/smartDesktopDesignerActions\";\r\nimport { ApplicationSetupType } from \"../../types/smartDesktopDesignerTypes\";\r\nimport { RootState } from \"../../reducers/rootReducer\";\r\nimport { launchTutorialLink } from \"./common/fsbl_functions\";\r\nimport { AppDefinition } from \"services/Interop/types\";\r\n\r\nexport function appConfigToAppData(appConfig: AppDefinition): Types.ApplicationSaveData {\r\n\treturn {\r\n\t\tname: appConfig.name || appConfig.manifest?.component?.displayName,\r\n\t\tdescription: appConfig.description || \"\",\r\n\t\turl: appConfig.manifest?.window?.url,\r\n\t\tpath: appConfig.manifest?.window?.path,\r\n\t\twidth: appConfig.manifest?.window?.width,\r\n\t\theight: appConfig.manifest?.window?.height,\r\n\t\trules: appConfig.manifest?.interop?.selectConnect,\r\n\t};\r\n}\r\n\r\nexport enum ApplicationCloseReason {\r\n\tSUCCESS,\r\n\tCANCEL,\r\n\tNEW,\r\n}\r\n\r\nexport type ApplicationProps = {\r\n\tid: string;\r\n\tapps: AppDConfig[];\r\n\taddApp: typeof FSBL.Clients.SmartDesktopClient.prototype.addApp;\r\n\tupdateApp: typeof FSBL.Clients.SmartDesktopClient.prototype.updateApp;\r\n\tdeleteApp: typeof FSBL.Clients.SmartDesktopClient.prototype.deleteApp;\r\n\tgetAppConfigTemplate: typeof FSBL.Clients.SmartDesktopClient.prototype.getAppConfigTemplate;\r\n\tonClose: (reason: ApplicationCloseReason) => void;\r\n\tsetCurrentAppID: (id: string | null) => void;\r\n\tisInboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isInboundInteropAuthorized;\r\n\tisOutboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isOutboundInteropAuthorized;\r\n};\r\n\r\nexport const Application = (props: ApplicationProps) => {\r\n\tconst dispatch = useDispatch();\r\n\r\n\tconst currentAppID = props.id;\r\n\r\n\tconst currentAppConfig = useSelector((state: RootState) =>\r\n\t\tstate.smartDesktopDesigner.apps.find((app: AppDConfig) => app.appId === currentAppID)\r\n\t);\r\n\r\n\tconst currentSetupType = useSelector((state: RootState) => state.smartDesktopDesigner.currentAppSetupType);\r\n\r\n\tconst isGettingStarted = useSelector((state: RootState) => state.smartDesktopDesigner.isGettingStarted);\r\n\r\n\tif (!currentAppConfig) {\r\n\t\tprops.getAppConfigTemplate().then((response) => {\r\n\t\t\tprops.deleteApp(currentAppID).then(({ err }: { err: string }) => {\r\n\t\t\t\tconst config: AppDefinition = {\r\n\t\t\t\t\t...response.config,\r\n\t\t\t\t\tappId: currentAppID,\r\n\t\t\t\t\tname: undefined,\r\n\t\t\t\t\tmanifest: {\r\n\t\t\t\t\t\t...response.config.manifest,\r\n\t\t\t\t\t\tcomponent: {\r\n\t\t\t\t\t\t\ttemporary: true,\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t},\r\n\t\t\t\t};\r\n\r\n\t\t\t\tprops.addApp(currentAppID, config).then(() => {\r\n\t\t\t\t\tdispatch(SmartDesktopDesignerActions.update_app(config));\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\treturn (\r\n\t\t\t<>\r\n\t\t\t\t<div style={{ overflow: \"hidden\" }}>\r\n\t\t\t\t\t<div style={{ marginTop: \"43vh\" }}>\r\n\t\t\t\t\t\t<CircularLoadingSpinner />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</>\r\n\t\t);\r\n\t}\r\n\r\n\tconst isEditMode =\r\n\t\tcurrentSetupType === ApplicationSetupType.APP_EDIT_ADVANCED ||\r\n\t\tcurrentSetupType === ApplicationSetupType.APP_EDIT_SIMPLE;\r\n\r\n\tconst onSaveData = (data: Types.ApplicationSaveData) =>\r\n\t\tnew Promise<any>((resolve, reject) => {\r\n\t\t\tif (!currentAppID) {\r\n\t\t\t\treturn reject(new Error(\"no app ID specified\"));\r\n\t\t\t}\r\n\r\n\t\t\tconst appConfig = {\r\n\t\t\t\t...currentAppConfig,\r\n\t\t\t\tmanifest: {\r\n\t\t\t\t\t...currentAppConfig.manifest,\r\n\t\t\t\t\twindow: {\r\n\t\t\t\t\t\t...currentAppConfig.manifest?.window,\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomponent: {\r\n\t\t\t\t\t\ttemporary: undefined,\r\n\t\t\t\t\t},\r\n\t\t\t\t\tinterop: {\r\n\t\t\t\t\t\t...currentAppConfig.manifest?.interop,\r\n\t\t\t\t\t},\r\n\t\t\t\t},\r\n\t\t\t\tname: data.name,\r\n\t\t\t\tdescription: data.description,\r\n\t\t\t\tappId: currentAppID,\r\n\t\t\t\tappName: data.name,\r\n\t\t\t};\r\n\t\t\tdelete appConfig.manifest.component.temporary;\r\n\r\n\t\t\tif (data.appType == \"native\") {\r\n\t\t\t\tappConfig.manifest.window.windowType = \"assimilation\";\r\n\t\t\t\tappConfig.manifest.window.path = data.path;\r\n\t\t\t\tdelete appConfig.manifest.window.url;\r\n\t\t\t} else {\r\n\t\t\t\tdelete appConfig.manifest.window.windowType;\r\n\t\t\t\tdelete appConfig.manifest.window.path;\r\n\t\t\t\tappConfig.manifest.window.url = data.url;\r\n\t\t\t}\r\n\r\n\t\t\tappConfig.manifest.window.width = data.width;\r\n\t\t\tappConfig.manifest.window.height = data.height;\r\n\t\t\tappConfig.manifest.interop.selectConnect = data.rules;\r\n\r\n\t\t\t// Always remove and replace component\r\n\t\t\tprops.deleteApp(currentAppID).then(({ err }: { err: string }) => {\r\n\t\t\t\tif (err) {\r\n\t\t\t\t\t// @todo : add error handling. Maybe react-toast-notify?\r\n\t\t\t\t\talert(err);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tprops\r\n\t\t\t\t\t.addApp(currentAppID, appConfig)\r\n\t\t\t\t\t.then((response) => {\r\n\t\t\t\t\t\tresolve(response);\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.catch((e) => {\r\n\t\t\t\t\t\treject(e);\r\n\t\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n\r\n\tconst onClickBackButton = () => {\r\n\t\tif (!isEditMode) {\r\n\t\t\tif (currentSetupType === null) {\r\n\t\t\t\tprops.onClose(ApplicationCloseReason.CANCEL);\r\n\t\t\t} else {\r\n\t\t\t\tdispatch(SmartDesktopDesignerActions.set_current_app_setup_type(null));\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tprops.onClose(ApplicationCloseReason.CANCEL);\r\n\t\t}\r\n\t};\r\n\r\n\tconst setCurrentSetupType = (type: ApplicationSetupType | null) => {\r\n\t\tdispatch(SmartDesktopDesignerActions.set_current_app_setup_type(type));\r\n\t};\r\n\r\n\treturn (\r\n\t\t<>\r\n\t\t\t{currentSetupType === null ? (\r\n\t\t\t\t<div className=\"setup-type-container\">\r\n\t\t\t\t\t<View>\r\n\t\t\t\t\t\t<Header\r\n\t\t\t\t\t\t\thelpFunction={() => {\r\n\t\t\t\t\t\t\t\tlaunchTutorialLink(\"adding-applications\");\r\n\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\tbackFunction={() => {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.CANCEL);\r\n\r\n\t\t\t\t\t\t\t\tif (isGettingStarted) {\r\n\t\t\t\t\t\t\t\t\tdispatch(SmartDesktopDesignerActions.change_view(\"getting-started\"));\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>\r\n\t\t\t\t\t\t\tAdd an app\r\n\t\t\t\t\t\t</Header>\r\n\r\n\t\t\t\t\t\t<Content>\r\n\t\t\t\t\t\t\t<h2 className=\"setup-type-heading\">Choose a method to add an app</h2>\r\n\t\t\t\t\t\t\t<div className=\"tile-type-buttons\">\r\n\t\t\t\t\t\t\t\t<ButtonTile\r\n\t\t\t\t\t\t\t\t\tclassName=\"icon-wizard\"\r\n\t\t\t\t\t\t\t\t\ticon=\"magic\"\r\n\t\t\t\t\t\t\t\t\ttext=\"App wizard\"\r\n\t\t\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\t\t\tdispatch(\r\n\t\t\t\t\t\t\t\t\t\t\tSmartDesktopDesignerActions.set_current_app_setup_type(ApplicationSetupType.APP_ADD_SIMPLE)\r\n\t\t\t\t\t\t\t\t\t\t);\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<ButtonTile\r\n\t\t\t\t\t\t\t\t\tclassName=\"icon-manual\"\r\n\t\t\t\t\t\t\t\t\ticon=\"tools\"\r\n\t\t\t\t\t\t\t\t\ttext=\"Manual setup (advanced)\"\r\n\t\t\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\t\t\tdispatch(\r\n\t\t\t\t\t\t\t\t\t\t\tSmartDesktopDesignerActions.set_current_app_setup_type(ApplicationSetupType.APP_ADD_ADVANCED)\r\n\t\t\t\t\t\t\t\t\t\t);\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</div>\r\n\t\t\t\t\t\t</Content>\r\n\t\t\t\t\t</View>\r\n\t\t\t\t</div>\r\n\t\t\t) : currentSetupType === ApplicationSetupType.APP_EDIT_ADVANCED ||\r\n\t\t\t currentSetupType === ApplicationSetupType.APP_ADD_ADVANCED ? (\r\n\t\t\t\t<ApplicationEdit\r\n\t\t\t\t\tid={currentAppID}\r\n\t\t\t\t\tdata={appConfigToAppData(currentAppConfig) as Types.ApplicationSaveData}\r\n\t\t\t\t\tapps={props.apps}\r\n\t\t\t\t\tisSetupWizard={false}\r\n\t\t\t\t\t{...{\r\n\t\t\t\t\t\tcurrentSetupType,\r\n\t\t\t\t\t\tisEditMode,\r\n\t\t\t\t\t\tsetCurrentSetupType,\r\n\t\t\t\t\t\tremoveAppID: props.deleteApp,\r\n\t\t\t\t\t\tsetCurrentComponentID: (id: string | null) => {\r\n\t\t\t\t\t\t\tif (id === \"new\") {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.NEW);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.SUCCESS);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tonClickBackButton,\r\n\t\t\t\t\t\tonSaveData,\r\n\t\t\t\t\t}}\r\n\t\t\t\t\tisInboundInteropAuthorized={props.isInboundInteropAuthorized}\r\n\t\t\t\t\tisOutboundInteropAuthorized={props.isOutboundInteropAuthorized}\r\n\t\t\t\t\tupdateApp={props.updateApp}\r\n\t\t\t\t></ApplicationEdit>\r\n\t\t\t) : (\r\n\t\t\t\t// else \"application setup wizard\"\r\n\t\t\t\t<ApplicationSetup\r\n\t\t\t\t\tid={currentAppID}\r\n\t\t\t\t\tdata={appConfigToAppData(currentAppConfig) as Types.ApplicationSaveData}\r\n\t\t\t\t\tapps={props.apps}\r\n\t\t\t\t\tbackFunction={() => {\r\n\t\t\t\t\t\tsetCurrentSetupType(null);\r\n\t\t\t\t\t}}\r\n\t\t\t\t\t{...{\r\n\t\t\t\t\t\tsetCurrentSetupType,\r\n\t\t\t\t\t\tremoveAppID: props.deleteApp,\r\n\t\t\t\t\t\tsetCurrentComponentID: (id: string | null) => {\r\n\t\t\t\t\t\t\tif (id === \"new\") {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.NEW);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tprops.onClose(ApplicationCloseReason.SUCCESS);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tonClickBackButton,\r\n\t\t\t\t\t\tonSaveData,\r\n\t\t\t\t\t}}\r\n\t\t\t\t\tisInboundInteropAuthorized={props.isInboundInteropAuthorized}\r\n\t\t\t\t\tisOutboundInteropAuthorized={props.isOutboundInteropAuthorized}\r\n\t\t\t\t\tupdateApp={props.updateApp}\r\n\t\t\t\t></ApplicationSetup>\r\n\t\t\t)}\r\n\t\t</>\r\n\t);\r\n};\r\n"]}
|
|
@@ -15,5 +15,8 @@ export declare type ApplicationEditProps = {
|
|
|
15
15
|
onSaveData: (data: ApplicationSaveData) => Promise<any>;
|
|
16
16
|
apps: object[];
|
|
17
17
|
data: ApplicationSaveData;
|
|
18
|
+
isInboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isInboundInteropAuthorized;
|
|
19
|
+
isOutboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isOutboundInteropAuthorized;
|
|
20
|
+
updateApp: typeof FSBL.Clients.SmartDesktopClient.prototype.updateApp;
|
|
18
21
|
};
|
|
19
22
|
export declare const ApplicationEdit: (props: ApplicationEditProps) => JSX.Element;
|
|
@@ -38,7 +38,7 @@ export const ApplicationEdit = (props) => {
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
}) }, props.isEditMode ? "Edit App" : "Add an app")),
|
|
41
|
-
React.createElement(Content, null, !setupComplete ? (React.createElement(AppEditPage, { startingDisplayName: displayName, isSetupWizard: props.isSetupWizard, isEditMode: props.isEditMode, startingAppType: currentAppType, startingWindowURL: windowURL, startingNativePath: nativePath, startingDescription: props?.data?.description || "", validateURL: (url) => FSBL.Clients.SmartDesktopClient.checkValidURL(url), startingWidth: props.data.width || 0, startingHeight: props.data.height || 0, removeApplicationFn: () => {
|
|
41
|
+
React.createElement(Content, null, !setupComplete ? (React.createElement(AppEditPage, { startingDisplayName: displayName, isSetupWizard: props.isSetupWizard, isEditMode: props.isEditMode, startingAppType: currentAppType, startingWindowURL: windowURL, startingNativePath: nativePath, startingDescription: props?.data?.description || "", validateURL: (url) => FSBL.Clients.SmartDesktopClient.checkValidURL(url), startingWidth: props.data.width || 0, startingHeight: props.data.height || 0, startingRules: props.data.rules || [], removeApplicationFn: () => {
|
|
42
42
|
props.removeAppID(props.id);
|
|
43
43
|
props.setCurrentComponentID("");
|
|
44
44
|
}, cancelFn: () => {
|
|
@@ -58,7 +58,7 @@ export const ApplicationEdit = (props) => {
|
|
|
58
58
|
props?.setCurrentComponentID?.("");
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
-
} })) : (React.createElement("div", { className: "app-edit-success" },
|
|
61
|
+
}, isInboundInteropAuthorized: props.isInboundInteropAuthorized, isOutboundInteropAuthorized: props.isOutboundInteropAuthorized, updateApp: props.updateApp })) : (React.createElement("div", { className: "app-edit-success" },
|
|
62
62
|
React.createElement("h2", null, "Your application is added"),
|
|
63
63
|
React.createElement("div", { className: "app-edit-success-content" },
|
|
64
64
|
React.createElement("div", { className: "app-trial-wrapper" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationEdit.js","sourceRoot":"","sources":["../../../src/components/smartDesktopD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,IACN,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,yBAAyB,EAC9B,OAAO,EAAE,GAAG,EAAE;4CACb,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;wCACpC,CAAC,GACA;oCACF,oBAAC,MAAM,IACN,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,GAAG,EAAE;4CACb,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC;wCACjC,CAAC,GACA,CACG,CACD,CACD,CACN,CACQ,CACA,CACL,CACF,CACA,CACF,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\r\n * Copyright 2017 - 2020 by ChartIQ, Inc.\r\n * All rights reserved.\r\n */\r\n\r\nimport React, { useState } from \"react\";\r\nimport { View } from \"./View\";\r\nimport { Header } from \"../common/Header\";\r\nimport { Content } from \"./Content\";\r\nimport { Button } from \"../common/Button\";\r\nimport { AppEditPage, SubmittedDataProps } from \"./AppEditPage\";\r\nimport { generateDefaultConfig } from \"./sdd_helpers\";\r\nimport { ApplicationSaveData } from \"../../types/smartDesktopDesignerTypes\";\r\nimport { launchTutorialLink } from \"./common/fsbl_functions\";\r\n\r\nexport type ApplicationEditProps = {\r\n\tid: string;\r\n\tisEditMode: boolean;\r\n\tisSetupWizard: boolean;\r\n\tonClickBackButton?: (e: React.MouseEvent<HTMLElement>) => void;\r\n\tsetCurrentComponentID: (id: string | null) => void;\r\n\tremoveAppID: (id: string) => void;\r\n\tremoveComponentID?: (id: string) => void;\r\n\tonSaveData: (data: ApplicationSaveData) => Promise<any>;\r\n\tapps: object[];\r\n\tdata: ApplicationSaveData;\r\n};\r\n\r\nexport const ApplicationEdit = (props: ApplicationEditProps) => {\r\n\tconst [setupComplete, setSetupComplete] = useState(false);\r\n\tconst { displayName, windowURL, nativePath, currentAppType } = generateDefaultConfig(props.data);\r\n\r\n\treturn (\r\n\t\t<div className=\"app-edit\">\r\n\t\t\t<View>\r\n\t\t\t\t<div>\r\n\t\t\t\t\t<form onSubmit={(e) => e.preventDefault()}>\r\n\t\t\t\t\t\t<fieldset className=\"app-edit-fieldset\">\r\n\t\t\t\t\t\t\t<legend>\r\n\t\t\t\t\t\t\t\t<Header\r\n\t\t\t\t\t\t\t\t\thelpFunction={\r\n\t\t\t\t\t\t\t\t\t\tprops.isEditMode\r\n\t\t\t\t\t\t\t\t\t\t\t? () => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tlaunchTutorialLink(\"editing-applications\");\r\n\t\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t\t\t: () => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tlaunchTutorialLink(\"adding-applications\");\r\n\t\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t// Only display the back button during setup. Once setup is complete, hide the back button.\r\n\t\t\t\t\t\t\t\t\t\t...(setupComplete\r\n\t\t\t\t\t\t\t\t\t\t\t? {}\r\n\t\t\t\t\t\t\t\t\t\t\t: {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackFunction: (e: React.MouseEvent<HTMLButtonElement>) => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetSetupComplete(false);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (!props.isEditMode) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tprops.removeAppID(props.id);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (typeof props.onClickBackButton === \"function\") {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// we're a child of of ApplicationSetup\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn props.onClickBackButton(e);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t })\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\t{props.isEditMode ? \"Edit App\" : \"Add an app\"}\r\n\t\t\t\t\t\t\t\t</Header>\r\n\t\t\t\t\t\t\t</legend>\r\n\r\n\t\t\t\t\t\t\t<Content>\r\n\t\t\t\t\t\t\t\t{!setupComplete ? (\r\n\t\t\t\t\t\t\t\t\t<AppEditPage\r\n\t\t\t\t\t\t\t\t\t\tstartingDisplayName={displayName}\r\n\t\t\t\t\t\t\t\t\t\tisSetupWizard={props.isSetupWizard}\r\n\t\t\t\t\t\t\t\t\t\tisEditMode={props.isEditMode}\r\n\t\t\t\t\t\t\t\t\t\tstartingAppType={currentAppType}\r\n\t\t\t\t\t\t\t\t\t\tstartingWindowURL={windowURL}\r\n\t\t\t\t\t\t\t\t\t\tstartingNativePath={nativePath}\r\n\t\t\t\t\t\t\t\t\t\tstartingDescription={props?.data?.description || \"\"}\r\n\t\t\t\t\t\t\t\t\t\tvalidateURL={(url: string) => FSBL.Clients.SmartDesktopClient.checkValidURL(url)}\r\n\t\t\t\t\t\t\t\t\t\tstartingWidth={props.data.width || 0}\r\n\t\t\t\t\t\t\t\t\t\tstartingHeight={props.data.height || 0}\r\n\t\t\t\t\t\t\t\t\t\tremoveApplicationFn={() => {\r\n\t\t\t\t\t\t\t\t\t\t\tprops.removeAppID(props.id);\r\n\t\t\t\t\t\t\t\t\t\t\tprops.setCurrentComponentID(\"\");\r\n\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\tcancelFn={() => {\r\n\t\t\t\t\t\t\t\t\t\t\tif (!props.isEditMode) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tprops.removeAppID(props.id);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tprops.setCurrentComponentID(null);\r\n\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\tsubmitFn={(data: SubmittedDataProps) => {\r\n\t\t\t\t\t\t\t\t\t\t\tprops\r\n\t\t\t\t\t\t\t\t\t\t\t\t?.onSaveData?.({\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t...data,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttags: props.data.tags,\r\n\t\t\t\t\t\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t\t\t\t\t\t.then(() => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetSetupComplete(true);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (props?.isEditMode) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tprops?.setCurrentComponentID?.(\"\");\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t}}\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\t<div className=\"app-edit-success\">\r\n\t\t\t\t\t\t\t\t\t\t<h2>Your application is added</h2>\r\n\r\n\t\t\t\t\t\t\t\t\t\t<div className=\"app-edit-success-content\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div className=\"app-trial-wrapper\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<p>Want to test it out?</p>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfashion=\"primary\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext=\"See it Now\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={(e: React.MouseEvent<HTMLButtonElement>) => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFSBL.Clients.LauncherClient.spawn(props.id, {}, (err: any, response: any) => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (err) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFSBL.Clients.Logger.error(\"ApplicationEdit spawn error:\", err);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFSBL.Clients.Logger.log(\"ApplicationEdit spawn response:\", response);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<p>Your application is now available to be launched in the toolbar under “Apps”.</p>\r\n\t\t\t\t\t\t\t\t\t\t\t<div className=\"app-edit-success-actions\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfashion=\"secondary\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext=\"Add Another Application\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tprops.setCurrentComponentID(\"new\");\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfashion=\"secondary\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext=\"Return to List\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tprops.setCurrentComponentID(\"\");\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t)}\r\n\t\t\t\t\t\t\t</Content>\r\n\t\t\t\t\t\t</fieldset>\r\n\t\t\t\t\t</form>\r\n\t\t\t\t</div>\r\n\t\t\t</View>\r\n\t\t</div>\r\n\t);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"ApplicationEdit.js","sourceRoot":"","sources":["../../../src/components/smartDesktopDesigner/ApplicationEdit.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAsB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAkB7D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC9D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEjG,OAAO,CACN,6BAAK,SAAS,EAAC,UAAU;QACxB,oBAAC,IAAI;YACJ;gBACC,8BAAM,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE;oBACxC,kCAAU,SAAS,EAAC,mBAAmB;wBACtC;4BACC,oBAAC,MAAM,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AAc,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,GAAQ,EAAE,QAAa,EAAE,EAAE;gDAC3E,IAAI,GAAG,EAAE;oDACR,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;iDAC/D;qDAAM;oDACN,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,iCAAiC,EAAE,QAAQ,CAAC,CAAC;iDACrE;4CACF,CAAC,CAAC,CAAC;4CACH,CAAC,CAAC,cAAc,EAAE,CAAC;wCACpB,CAAC,GACA,CACG;gCACN,yHAAoF;gCACpF,6BAAK,SAAS,EAAC,0BAA0B;oCACxC,oBAAC,MAAM,IACN,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,yBAAyB,EAC9B,OAAO,EAAE,GAAG,EAAE;4CACb,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;wCACpC,CAAC,GACA;oCACF,oBAAC,MAAM,IACN,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,GAAG,EAAE;4CACb,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC;wCACjC,CAAC,GACA,CACG,CACD,CACD,CACN,CACQ,CACA,CACL,CACF,CACA,CACF,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\r\n * Copyright 2017 - 2020 by ChartIQ, Inc.\r\n * All rights reserved.\r\n */\r\n\r\nimport React, { useState } from \"react\";\r\nimport { View } from \"./View\";\r\nimport { Header } from \"../common/Header\";\r\nimport { Content } from \"./Content\";\r\nimport { Button } from \"../common/Button\";\r\nimport { AppEditPage, SubmittedDataProps } from \"./AppEditPage\";\r\nimport { generateDefaultConfig } from \"./sdd_helpers\";\r\nimport { ApplicationSaveData } from \"../../types/smartDesktopDesignerTypes\";\r\nimport { launchTutorialLink } from \"./common/fsbl_functions\";\r\n\r\nexport type ApplicationEditProps = {\r\n\tid: string;\r\n\tisEditMode: boolean;\r\n\tisSetupWizard: boolean;\r\n\tonClickBackButton?: (e: React.MouseEvent<HTMLElement>) => void;\r\n\tsetCurrentComponentID: (id: string | null) => void;\r\n\tremoveAppID: (id: string) => void;\r\n\tremoveComponentID?: (id: string) => void;\r\n\tonSaveData: (data: ApplicationSaveData) => Promise<any>;\r\n\tapps: object[];\r\n\tdata: ApplicationSaveData;\r\n\tisInboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isInboundInteropAuthorized;\r\n\tisOutboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isOutboundInteropAuthorized;\r\n\tupdateApp: typeof FSBL.Clients.SmartDesktopClient.prototype.updateApp;\r\n};\r\n\r\nexport const ApplicationEdit = (props: ApplicationEditProps) => {\r\n\tconst [setupComplete, setSetupComplete] = useState(false);\r\n\tconst { displayName, windowURL, nativePath, currentAppType } = generateDefaultConfig(props.data);\r\n\r\n\treturn (\r\n\t\t<div className=\"app-edit\">\r\n\t\t\t<View>\r\n\t\t\t\t<div>\r\n\t\t\t\t\t<form onSubmit={(e) => e.preventDefault()}>\r\n\t\t\t\t\t\t<fieldset className=\"app-edit-fieldset\">\r\n\t\t\t\t\t\t\t<legend>\r\n\t\t\t\t\t\t\t\t<Header\r\n\t\t\t\t\t\t\t\t\thelpFunction={\r\n\t\t\t\t\t\t\t\t\t\tprops.isEditMode\r\n\t\t\t\t\t\t\t\t\t\t\t? () => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tlaunchTutorialLink(\"editing-applications\");\r\n\t\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t\t\t: () => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tlaunchTutorialLink(\"adding-applications\");\r\n\t\t\t\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\t\t\t// Only display the back button during setup. Once setup is complete, hide the back button.\r\n\t\t\t\t\t\t\t\t\t\t...(setupComplete\r\n\t\t\t\t\t\t\t\t\t\t\t? {}\r\n\t\t\t\t\t\t\t\t\t\t\t: {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackFunction: (e: React.MouseEvent<HTMLButtonElement>) => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetSetupComplete(false);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (!props.isEditMode) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tprops.removeAppID(props.id);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (typeof props.onClickBackButton === \"function\") {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// we're a child of of ApplicationSetup\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn props.onClickBackButton(e);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t\t\t\t })\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\t{props.isEditMode ? \"Edit App\" : \"Add an app\"}\r\n\t\t\t\t\t\t\t\t</Header>\r\n\t\t\t\t\t\t\t</legend>\r\n\r\n\t\t\t\t\t\t\t<Content>\r\n\t\t\t\t\t\t\t\t{!setupComplete ? (\r\n\t\t\t\t\t\t\t\t\t<AppEditPage\r\n\t\t\t\t\t\t\t\t\t\tstartingDisplayName={displayName}\r\n\t\t\t\t\t\t\t\t\t\tisSetupWizard={props.isSetupWizard}\r\n\t\t\t\t\t\t\t\t\t\tisEditMode={props.isEditMode}\r\n\t\t\t\t\t\t\t\t\t\tstartingAppType={currentAppType}\r\n\t\t\t\t\t\t\t\t\t\tstartingWindowURL={windowURL}\r\n\t\t\t\t\t\t\t\t\t\tstartingNativePath={nativePath}\r\n\t\t\t\t\t\t\t\t\t\tstartingDescription={props?.data?.description || \"\"}\r\n\t\t\t\t\t\t\t\t\t\tvalidateURL={(url: string) => FSBL.Clients.SmartDesktopClient.checkValidURL(url)}\r\n\t\t\t\t\t\t\t\t\t\tstartingWidth={props.data.width || 0}\r\n\t\t\t\t\t\t\t\t\t\tstartingHeight={props.data.height || 0}\r\n\t\t\t\t\t\t\t\t\t\tstartingRules={props.data.rules || []}\r\n\t\t\t\t\t\t\t\t\t\tremoveApplicationFn={() => {\r\n\t\t\t\t\t\t\t\t\t\t\tprops.removeAppID(props.id);\r\n\t\t\t\t\t\t\t\t\t\t\tprops.setCurrentComponentID(\"\");\r\n\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\tcancelFn={() => {\r\n\t\t\t\t\t\t\t\t\t\t\tif (!props.isEditMode) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tprops.removeAppID(props.id);\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tprops.setCurrentComponentID(null);\r\n\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\tsubmitFn={(data: SubmittedDataProps) => {\r\n\t\t\t\t\t\t\t\t\t\t\tprops\r\n\t\t\t\t\t\t\t\t\t\t\t\t?.onSaveData?.({\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t...data,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttags: props.data.tags,\r\n\t\t\t\t\t\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t\t\t\t\t\t.then(() => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetSetupComplete(true);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (props?.isEditMode) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tprops?.setCurrentComponentID?.(\"\");\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\tisInboundInteropAuthorized={props.isInboundInteropAuthorized}\r\n\t\t\t\t\t\t\t\t\t\tisOutboundInteropAuthorized={props.isOutboundInteropAuthorized}\r\n\t\t\t\t\t\t\t\t\t\tupdateApp={props.updateApp}\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\t<div className=\"app-edit-success\">\r\n\t\t\t\t\t\t\t\t\t\t<h2>Your application is added</h2>\r\n\r\n\t\t\t\t\t\t\t\t\t\t<div className=\"app-edit-success-content\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div className=\"app-trial-wrapper\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<p>Want to test it out?</p>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfashion=\"primary\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext=\"See it Now\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={(e: React.MouseEvent<HTMLButtonElement>) => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFSBL.Clients.LauncherClient.spawn(props.id, {}, (err: any, response: any) => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (err) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFSBL.Clients.Logger.error(\"ApplicationEdit spawn error:\", err);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFSBL.Clients.Logger.log(\"ApplicationEdit spawn response:\", response);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\te.preventDefault();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t<p>Your application is now available to be launched in the toolbar under “Apps”.</p>\r\n\t\t\t\t\t\t\t\t\t\t\t<div className=\"app-edit-success-actions\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfashion=\"secondary\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext=\"Add Another Application\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tprops.setCurrentComponentID(\"new\");\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<Button\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tfashion=\"secondary\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttext=\"Return to List\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tprops.setCurrentComponentID(\"\");\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t)}\r\n\t\t\t\t\t\t\t</Content>\r\n\t\t\t\t\t\t</fieldset>\r\n\t\t\t\t\t</form>\r\n\t\t\t\t</div>\r\n\t\t\t</View>\r\n\t\t</div>\r\n\t);\r\n};\r\n"]}
|