@finsemble/finsemble-ui 6.6.1 → 7.0.0-beta.3
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 +18 -32
- package/react/assets/css/button.css +1 -1
- package/react/assets/css/favorites.css +0 -47
- package/react/assets/css/finsemble.css +3 -0
- package/react/assets/css/linkerWindow.css +13 -1
- package/react/assets/css/menus.css +2 -2
- package/react/assets/css/notificationsCenter.css +32 -1
- package/react/assets/css/shared/common.css +40 -0
- package/react/assets/css/userPreferences.css +17 -12
- package/react/assets/css/windowTitleBar.css +7 -0
- package/react/assets/icons/server.svg +26 -0
- package/react/components/common/ButtonIcon.js +1 -1
- package/react/components/common/ButtonIcon.js.map +1 -1
- package/react/components/common/ButtonRow.js +2 -2
- package/react/components/common/ButtonRow.js.map +1 -1
- package/react/components/common/Checkbox.js +1 -1
- package/react/components/common/Checkbox.js.map +1 -1
- package/react/components/common/ColorPicker.js +16 -15
- package/react/components/common/ColorPicker.js.map +1 -1
- package/react/components/common/ErrorBoundary.d.ts +16 -0
- package/react/components/common/ErrorBoundary.js +22 -0
- package/react/components/common/ErrorBoundary.js.map +1 -0
- package/react/components/common/FinsembleIcon.d.ts +3 -2
- package/react/components/common/FinsembleIcon.js +10 -3
- package/react/components/common/FinsembleIcon.js.map +1 -1
- package/react/components/common/FinsembleLink.d.ts +6 -0
- package/react/components/common/FinsembleLink.js +12 -0
- package/react/components/common/FinsembleLink.js.map +1 -0
- package/react/components/common/FinsembleToggle.d.ts +1 -2
- package/react/components/common/FinsembleToggle.js +2 -6
- package/react/components/common/FinsembleToggle.js.map +1 -1
- package/react/components/common/FinsembleToggleButtonBar.d.ts +13 -0
- package/react/components/common/FinsembleToggleButtonBar.js +44 -0
- package/react/components/common/FinsembleToggleButtonBar.js.map +1 -0
- package/react/components/common/InputTable.d.ts +3 -3
- package/react/components/common/InputTable.js +13 -13
- package/react/components/common/InputTable.js.map +1 -1
- package/react/components/common/Tab.js +33 -5
- package/react/components/common/Tab.js.map +1 -1
- package/react/components/common/css/FinsembleToggle.css +22 -0
- package/react/components/common/css/application-edit-page.css +10 -2
- package/react/components/common/css/tab.css +8 -8
- package/react/components/common/css/time-select.css +1 -1
- package/react/components/common/css/toggle.css +2 -10
- package/react/components/common/helpers.js +6 -1
- package/react/components/common/helpers.js.map +1 -1
- package/react/components/common/stories/ColorPicker.stories.js +6 -11
- package/react/components/common/stories/ColorPicker.stories.js.map +1 -1
- package/react/components/common/stories/FinsembleToggle.stories.d.ts +1 -2
- package/react/components/common/stories/FinsembleToggle.stories.js +0 -7
- package/react/components/common/stories/FinsembleToggle.stories.js.map +1 -1
- package/react/components/common/stories/FinsembleToggleButtonBar.stories.d.ts +14 -0
- package/react/components/common/stories/FinsembleToggleButtonBar.stories.js +97 -0
- package/react/components/common/stories/FinsembleToggleButtonBar.stories.js.map +1 -0
- package/react/components/common/stories/InputTable.stories.d.ts +4 -3
- package/react/components/common/stories/InputTable.stories.js +18 -8
- package/react/components/common/stories/InputTable.stories.js.map +1 -1
- package/react/components/common/tests/ButtonRow.spec.js +5 -0
- package/react/components/common/tests/ButtonRow.spec.js.map +1 -1
- package/react/components/common/tests/FinsembleToggle.spec.js +1 -6
- package/react/components/common/tests/FinsembleToggle.spec.js.map +1 -1
- package/react/components/common/tests/FinsembleToggleButtonBar.spec.d.ts +1 -0
- package/react/components/common/tests/FinsembleToggleButtonBar.spec.js +40 -0
- package/react/components/common/tests/FinsembleToggleButtonBar.spec.js.map +1 -0
- package/react/components/common/tests/InputTable.spec.js +3 -3
- package/react/components/common/tests/InputTable.spec.js.map +1 -1
- package/react/components/favorites/FavoriteMaker.js +1 -1
- package/react/components/favorites/FavoriteMaker.js.map +1 -1
- package/react/components/fdc3Resolver/ResolverContainer.js +4 -7
- package/react/components/fdc3Resolver/ResolverContainer.js.map +1 -1
- package/react/components/icon/Icon.d.ts +1 -1
- package/react/components/icon/Icon.js +8 -1
- package/react/components/icon/Icon.js.map +1 -1
- package/react/components/legacyControls/FinsembleDnDContext.js +7 -7
- package/react/components/legacyControls/FinsembleDnDContext.js.map +1 -1
- package/react/components/linker/remoteRedux.js +1 -0
- package/react/components/linker/remoteRedux.js.map +1 -1
- package/react/components/menu/MenuItem.js +1 -1
- package/react/components/menu/MenuItem.js.map +1 -1
- package/react/components/menu/MenuPortal.js +12 -21
- package/react/components/menu/MenuPortal.js.map +1 -1
- package/react/components/menu/MenuToggle.js +1 -1
- package/react/components/menu/MenuToggle.js.map +1 -1
- package/react/components/menu/keyboardNavigation.d.ts +1 -22
- package/react/components/menu/keyboardNavigation.js +110 -160
- package/react/components/menu/keyboardNavigation.js.map +1 -1
- package/react/components/notifications/components/drawer/DrawerControls.js +39 -25
- package/react/components/notifications/components/drawer/DrawerControls.js.map +1 -1
- package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js +19 -6
- package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js.map +1 -1
- package/react/components/notifications/components/shared/CheckButton.js +19 -8
- package/react/components/notifications/components/shared/CheckButton.js.map +1 -1
- package/react/components/notifications/components/shared/NotificationCardShell.js +2 -1
- package/react/components/notifications/components/shared/NotificationCardShell.js.map +1 -1
- package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js +2 -1
- package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js.map +1 -1
- package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderShell.js +2 -1
- package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderShell.js.map +1 -1
- package/react/components/notifications/components/views/CardView.js +5 -3
- package/react/components/notifications/components/views/CardView.js.map +1 -1
- package/react/components/notifications/components/views/ListView.js +3 -1
- package/react/components/notifications/components/views/ListView.js.map +1 -1
- package/react/components/notifications/types.d.ts +3 -0
- package/react/components/notifications/types.js.map +1 -1
- package/react/components/processMonitor/ProcessMonitor.js +4 -1
- package/react/components/processMonitor/ProcessMonitor.js.map +1 -1
- package/react/components/processMonitor/components/ProcessStatistics.js +1 -3
- package/react/components/processMonitor/components/ProcessStatistics.js.map +1 -1
- package/react/components/processMonitor/helpers.js +4 -3
- package/react/components/processMonitor/helpers.js.map +1 -1
- package/react/components/processMonitor/helpers.spec.js +7 -3
- package/react/components/processMonitor/helpers.spec.js.map +1 -1
- package/react/components/sdd/AddApp.d.ts +4 -3
- package/react/components/sdd/AddApp.js +132 -30
- package/react/components/sdd/AddApp.js.map +1 -1
- package/react/components/sdd/AppEditAccess.d.ts +4 -3
- package/react/components/sdd/AppEditAccess.js.map +1 -1
- package/react/components/sdd/AppEditPage.d.ts +4 -3
- package/react/components/sdd/AppEditPage.js +141 -116
- package/react/components/sdd/AppEditPage.js.map +1 -1
- package/react/components/sdd/Appearance.d.ts +2 -1
- package/react/components/sdd/Appearance.js +15 -7
- package/react/components/sdd/Appearance.js.map +1 -1
- package/react/components/sdd/Application.d.ts +5 -4
- package/react/components/sdd/Application.js +61 -42
- package/react/components/sdd/Application.js.map +1 -1
- package/react/components/sdd/Applications.d.ts +12 -11
- package/react/components/sdd/Applications.js +23 -4
- package/react/components/sdd/Applications.js.map +1 -1
- package/react/components/sdd/Authentication.js +1 -6
- package/react/components/sdd/Authentication.js.map +1 -1
- package/react/components/sdd/AuthenticationProviderConfig.js +5 -3
- package/react/components/sdd/AuthenticationProviderConfig.js.map +1 -1
- package/react/components/sdd/EditPreload.d.ts +4 -3
- package/react/components/sdd/EditPreload.js +39 -22
- package/react/components/sdd/EditPreload.js.map +1 -1
- package/react/components/sdd/Export.d.ts +7 -6
- package/react/components/sdd/Export.js +3 -2
- package/react/components/sdd/Export.js.map +1 -1
- package/react/components/sdd/GettingStarted.js +3 -3
- package/react/components/sdd/GettingStarted.js.map +1 -1
- package/react/components/sdd/Navigation.js +28 -4
- package/react/components/sdd/Navigation.js.map +1 -1
- package/react/components/sdd/OptionalSettingsView.d.ts +6 -5
- package/react/components/sdd/OptionalSettingsView.js +2 -10
- package/react/components/sdd/OptionalSettingsView.js.map +1 -1
- package/react/components/sdd/ProjectErrors.js +1 -1
- package/react/components/sdd/ProjectErrors.js.map +1 -1
- package/react/components/sdd/Publish.js +2 -2
- package/react/components/sdd/Publish.js.map +1 -1
- package/react/components/sdd/SmartDesktopDesigner.d.ts +17 -16
- package/react/components/sdd/SmartDesktopDesigner.js +37 -34
- package/react/components/sdd/SmartDesktopDesigner.js.map +1 -1
- package/react/components/sdd/ThemePage.js +8 -5
- package/react/components/sdd/ThemePage.js.map +1 -1
- package/react/components/sdd/Themes.d.ts +2 -1
- package/react/components/sdd/Themes.js +2 -2
- package/react/components/sdd/Themes.js.map +1 -1
- package/react/components/sdd/Toolbar.d.ts +5 -4
- package/react/components/sdd/Toolbar.js +11 -9
- package/react/components/sdd/Toolbar.js.map +1 -1
- package/react/components/sdd/common/setPreloadDefaults.d.ts +1 -1
- package/react/components/sdd/common/setPreloadDefaults.js +5 -4
- package/react/components/sdd/common/setPreloadDefaults.js.map +1 -1
- package/react/components/sdd/common/views.js +7 -4
- package/react/components/sdd/common/views.js.map +1 -1
- package/react/components/sdd/css/addApp.css +52 -0
- package/react/components/sdd/css/applications.css +4 -24
- package/react/components/sdd/css/nav.css +3 -3
- package/react/components/sdd/fixtures/authenticationProps.js +15 -1
- package/react/components/sdd/fixtures/authenticationProps.js.map +1 -1
- package/react/components/sdd/fixtures/preloads.js +14 -12
- package/react/components/sdd/fixtures/preloads.js.map +1 -1
- package/react/components/sdd/smartDesktopClient.d.ts +163 -0
- package/react/components/sdd/smartDesktopClient.js +573 -0
- package/react/components/sdd/smartDesktopClient.js.map +1 -0
- package/react/components/sdd/smartDesktopClient.spec.d.ts +1 -0
- package/react/components/sdd/smartDesktopClient.spec.js +61 -0
- package/react/components/sdd/smartDesktopClient.spec.js.map +1 -0
- package/react/components/sdd/stories/AddApp.stories.d.ts +10 -0
- package/react/components/sdd/stories/AddApp.stories.js +18 -0
- package/react/components/sdd/stories/AddApp.stories.js.map +1 -0
- package/react/components/sdd/stories/AppEditPage.stories.d.ts +2 -0
- package/react/components/sdd/stories/AppEditPage.stories.js +2 -0
- package/react/components/sdd/stories/AppEditPage.stories.js.map +1 -1
- package/react/components/sdd/stories/Appearance.stories.d.ts +1 -1
- package/react/components/sdd/stories/Appearance.stories.js +1 -0
- package/react/components/sdd/stories/Appearance.stories.js.map +1 -1
- package/react/components/sdd/stories/Authentication.stories.js +2 -16
- package/react/components/sdd/stories/Authentication.stories.js.map +1 -1
- package/react/components/sdd/stories/OptionalSettingsView.stories.js +1 -1
- package/react/components/sdd/stories/OptionalSettingsView.stories.js.map +1 -1
- package/react/components/sdd/stories/SmartDesktopDesigner.stories.d.ts +1 -1
- package/react/components/sdd/stories/SmartDesktopDesigner.stories.js +3 -0
- package/react/components/sdd/stories/SmartDesktopDesigner.stories.js.map +1 -1
- package/react/components/sdd/stories/Themes.stories.d.ts +1 -1
- package/react/components/sdd/stories/Themes.stories.js +1 -0
- package/react/components/sdd/stories/Themes.stories.js.map +1 -1
- package/react/components/sdd/tests/AddApp.spec.d.ts +1 -0
- package/react/components/sdd/tests/AddApp.spec.js +96 -0
- package/react/components/sdd/tests/AddApp.spec.js.map +1 -0
- package/react/components/sdd/tests/AppEditPage.spec.js +92 -23
- package/react/components/sdd/tests/AppEditPage.spec.js.map +1 -1
- package/react/components/sdd/tests/Application.spec.js +411 -24
- package/react/components/sdd/tests/Application.spec.js.map +1 -1
- package/react/components/sdd/tests/Applications.spec.js +1 -45
- package/react/components/sdd/tests/Applications.spec.js.map +1 -1
- package/react/components/sdd/tests/Authentication.spec.js +1 -1
- package/react/components/sdd/tests/Authentication.spec.js.map +1 -1
- package/react/components/sdd/tests/EditPreload.spec.js +50 -7
- package/react/components/sdd/tests/EditPreload.spec.js.map +1 -1
- package/react/components/sdd/tests/Navigation.spec.js +2 -2
- package/react/components/sdd/tests/Navigation.spec.js.map +1 -1
- package/react/components/sdd/tests/OptionalSettingsView.spec.js +235 -0
- package/react/components/sdd/tests/OptionalSettingsView.spec.js.map +1 -1
- package/react/components/sdd/tests/ProjectErrors.spec.js +1 -1
- package/react/components/sdd/tests/ProjectErrors.spec.js.map +1 -1
- package/react/components/sdd/tests/SmartDesktopDesigner.spec.js +2 -2
- package/react/components/sdd/tests/SmartDesktopDesigner.spec.js.map +1 -1
- package/react/components/search/Search.js +1 -1
- package/react/components/search/Search.js.map +1 -1
- package/react/components/shared/DefaultDropdownButton.js +12 -1
- package/react/components/shared/DefaultDropdownButton.js.map +1 -1
- package/react/components/shared/tests/DefaultDropdownButton.spec.js +12 -0
- package/react/components/shared/tests/DefaultDropdownButton.spec.js.map +1 -1
- package/react/components/smartDesktopDesigner/SmartDesktopDesigner.d.ts +1 -16
- package/react/components/smartDesktopDesigner/SmartDesktopDesigner.js +0 -4
- package/react/components/smartDesktopDesigner/SmartDesktopDesigner.js.map +1 -1
- package/react/components/toolbar/DragHandle.stories.js.map +1 -1
- package/react/components/toolbar/ToolbarIcon.js +2 -2
- package/react/components/toolbar/ToolbarIcon.js.map +1 -1
- package/react/components/toolbar/ToolbarSection.d.ts +1 -9
- package/react/components/toolbar/ToolbarSection.js +3 -7
- package/react/components/toolbar/ToolbarSection.js.map +1 -1
- package/react/components/toolbar/advancedAppLauncher/stores/StoreActions.js +1 -1
- package/react/components/toolbar/advancedAppLauncher/stores/StoreActions.js.map +1 -1
- package/react/components/toolbar/dashbar/Dashbar.js +21 -12
- package/react/components/toolbar/dashbar/Dashbar.js.map +1 -1
- package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js +1 -1
- package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js.map +1 -1
- package/react/components/userPreferences/components/ContentSection.js +1 -1
- package/react/components/userPreferences/components/ContentSection.js.map +1 -1
- package/react/components/userPreferences/components/content/notificationViews/NotificationsPreferencesHome.js +4 -3
- package/react/components/userPreferences/components/content/notificationViews/NotificationsPreferencesHome.js.map +1 -1
- package/react/components/userPreferences/components/general/ScheduledClose.js +12 -3
- package/react/components/userPreferences/components/general/ScheduledClose.js.map +1 -1
- package/react/components/userPreferences/components/workspaces/WorkspaceButton.js +1 -1
- package/react/components/userPreferences/components/workspaces/WorkspaceButton.js.map +1 -1
- package/react/components/windowTitleBar/WindowTitleBarShell.d.ts +17 -2
- package/react/components/windowTitleBar/WindowTitleBarShell.js +160 -6
- package/react/components/windowTitleBar/WindowTitleBarShell.js.map +1 -1
- package/react/components/windowTitleBar/components/left/LinkerButton.js +7 -1
- package/react/components/windowTitleBar/components/left/LinkerButton.js.map +1 -1
- package/react/components/windowTitleBar/components/windowTitle.js +10 -2
- package/react/components/windowTitleBar/components/windowTitle.js.map +1 -1
- package/react/components/windowTitleBar/stores/windowTitleBarStore.js +11 -1
- package/react/components/windowTitleBar/stores/windowTitleBarStore.js.map +1 -1
- package/react/reducers/rootReducer.d.ts +2 -2
- package/react/store.d.ts +4 -4
- package/react/tsconfig.tsbuildinfo +1 -0
- package/react/types/smartDesktopDesignerTypes.d.ts +3 -0
- package/react/types/smartDesktopDesignerTypes.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcessMonitor.js","sourceRoot":"","sources":["../../../src/components/processMonitor/ProcessMonitor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,qCAAqC,CAAC;AAC7C,OAAO,EAAe,aAAa,EAAmB,MAAM,uBAAuB,CAAC;AAGpF,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAGrD,IAAI,aAAa,EAAE,CAAC;AAOp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CAAC,KAAK,CAAC,QAAQ,KAAK,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAClE,CACD,CACD,CACD,CACN,CAAC;IACH,CAAC;CACD;AAKD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,oBAAC,kBAAkB,OAAG,CAAC","sourcesContent":["import React from \"react\";\nimport { Store, Actions } from \"./stores/ProcessMonitorStore\";\nimport ListHeader from \"./components/ListHeader\";\nimport ProcessStatistics from \"./components/ProcessStatistics\";\nimport ChildWindow from \"./components/ChildWindow\";\nimport { EMPTY_TOTALS, SIMPLE_MODE_STATISTICS, ADVANCED_MODE_STATISTICS } from \"./constants.js\";\nimport { statReducer, roundDecimalToPrecision, bytesToSize } from \"./helpers.js\";\nimport \"../../assets/css/processMonitor.css\";\nimport { ProcessType, ViewModeEnums, ChildWindowType } from \"./ProcessMonitorTypes\";\nimport { StandardError } from \"@finsemble/finsemble-api/types/types\";\n\nimport FloatingFocus from \"@q42/floating-focus-a11y\";\n// The package FloatingFocus injects a focus indicator that moves around the page, but only for\n// keyboard users. (Mouse users don't see the indicator.) All that needs to be done is to envoke it.\nnew FloatingFocus();\n\ninterface IProps {}\ninterface IState {\n\tprocessList: ProcessType[];\n\tviewMode: ViewModeEnums;\n}\nclass ProcessMonitorBase extends React.Component<IProps, IState> {\n\tconstructor(props: {}) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tprocessList: [],\n\t\t\tviewMode: ViewModeEnums.SIMPLE,\n\t\t};\n\t\tthis.bindCorrectContext();\n\t}\n\n\tbindCorrectContext() {\n\t\tthis.onProcessListChanged = this.onProcessListChanged.bind(this);\n\t\tthis.onViewModeChanged = this.onViewModeChanged.bind(this);\n\t}\n\n\t/**\n\t * Handler for when we go from simple to advanced mode, or the opposite.\n\t */\n\tonViewModeChanged(err: StandardError, response: { value: ViewModeEnums }) {\n\t\tlet { value } = response;\n\t\tthis.setState({\n\t\t\tviewMode: value,\n\t\t});\n\t}\n\n\t/**\n\t * Invoked at minimum, once per second. This listener handles updates that we receive from the system.\n\t */\n\tonProcessListChanged(err: StandardError, response: { value: ProcessType[] }) {\n\t\tlet { value } = response;\n\t\tthis.setState({\n\t\t\tprocessList: value,\n\t\t});\n\t}\n\n\tcomponentDidMount() {\n\t\tActions.initialize(() => {\n\t\t\tStore?.addListener({ field: \"processList\" }, this.onProcessListChanged);\n\t\t\tStore?.addListener({ field: \"viewMode\" }, this.onViewModeChanged);\n\t\t});\n\t}\n\n\tcomponentWillUnmount() {\n\t\tStore?.removeListener({ field: \"processList\" }, this.onProcessListChanged);\n\t\tStore?.removeListener({ field: \"viewMode\" }, this.onViewModeChanged);\n\t}\n\n\trender() {\n\t\tif (!Store) return null;\n\t\t// View modes are:\n\t\t// * Simple - Top-level views, showing stats: CPU, Memory\n\t\t// * Advanced - Expanded processes, showing stats: CPU, Memory, Peak Memory, PID\n\n\t\t// statReducer is an array.reduce function that will sum all of the CPU/memory usage across the app.\n\t\tconst totals = this.state.processList.length ? this.state.processList.reduce(statReducer) : EMPTY_TOTALS;\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<div className=\"process-list-wrapper\">\n\t\t\t\t\t<ListHeader\n\t\t\t\t\t\tfields={this.state.viewMode === ViewModeEnums.SIMPLE ? SIMPLE_MODE_STATISTICS : ADVANCED_MODE_STATISTICS}\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"process-list\">\n\t\t\t\t\t\t{/* Filter will remove the hidden processes. Afterwards, map will render the remaining processes in turn. */}\n\t\t\t\t\t\t{this.state.processList\n\t\t\t\t\t\t\t.filter((proc) => proc.visible)\n\t\t\t\t\t\t\t.map((proc, i) => (\n\t\t\t\t\t\t\t\t<div key={i} className=\"process\">\n\t\t\t\t\t\t\t\t\t{/* Process statistics is the meat of this component. It's the statistics and the child windows. */}\n\t\t\t\t\t\t\t\t\t<ProcessStatistics\n\t\t\t\t\t\t\t\t\t\tmode={this.state.viewMode}\n\t\t\t\t\t\t\t\t\t\tfields={\n\t\t\t\t\t\t\t\t\t\t\tthis.state.viewMode === ViewModeEnums.SIMPLE ? SIMPLE_MODE_STATISTICS : ADVANCED_MODE_STATISTICS\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tstats={proc.statistics}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{proc.childWindows?.map((cw: ChildWindowType, j: number) => (\n\t\t\t\t\t\t\t\t\t\t<ChildWindow key={j} viewMode={this.state.viewMode} cw={cw} />\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"bottom-section\">\n\t\t\t\t\t<div className=\"summary-statistics-wrapper\">\n\t\t\t\t\t\t<div className=\"summary-statistics-header\">Finsemble Total Usage</div>\n\t\t\t\t\t\t<div className=\"summary-statistics\">\n\t\t\t\t\t\t\t{typeof totals.statistics.cpuUsage !== \"undefined\" && (\n\t\t\t\t\t\t\t\t<div className=\"summary-statistic\">\n\t\t\t\t\t\t\t\t\t<div className=\"summary-statistic-label\">CPU</div>\n\t\t\t\t\t\t\t\t\t<div className=\"summary-statistic-number\">{`${roundDecimalToPrecision(\n\t\t\t\t\t\t\t\t\t\ttotals.statistics.cpuUsage,\n\t\t\t\t\t\t\t\t\t\t2\n\t\t\t\t\t\t\t\t\t)}%`}</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{typeof totals.statistics.workingSetSize !== \"undefined\" && (\n\t\t\t\t\t\t\t\t<div className=\"summary-statistic\">\n\t\t\t\t\t\t\t\t\t<div className=\"summary-statistic-label\">Memory</div>\n\t\t\t\t\t\t\t\t\t<div className=\"summary-statistic-number\">{bytesToSize(totals.statistics.workingSetSize)}</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"advanced-button-wrapper\">\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"fsbl-button advanced-button\"\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tActions.toggleViewMode();\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\ttabIndex={0}\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\tonKeyDown={(e: React.KeyboardEvent) => {\n\t\t\t\t\t\t\t\tif (e.key === \"Enter\" || e.key === \" \") {\n\t\t\t\t\t\t\t\t\tActions.toggleViewMode();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{this.state.viewMode === ViewModeEnums.ADVANCED ? \"Simple\" : \"Advanced\"}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\n/**\n * The window that shows performance data for applications running in Finsemble, such as CPU and memory usage.\n */\nexport const ProcessMonitor = () => <ProcessMonitorBase />;\n"]}
|
|
1
|
+
{"version":3,"file":"ProcessMonitor.js","sourceRoot":"","sources":["../../../src/components/processMonitor/ProcessMonitor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,qCAAqC,CAAC;AAC7C,OAAO,E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,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAO,CAC1F,CACN,CACI,CACD;gBACN,6BAAK,SAAS,EAAC,yBAAyB;oBACvC,6BACC,SAAS,EAAC,6BAA6B,EACvC,OAAO,EAAE,GAAG,EAAE;4BACb,OAAO,CAAC,cAAc,EAAE,CAAC;wBAC1B,CAAC,EACD,QAAQ,EAAE,CAAC,EACX,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,CAAC,CAAsB,EAAE,EAAE;4BACrC,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE;gCACvC,OAAO,CAAC,cAAc,EAAE,CAAC;6BACzB;wBACF,CAAC,IAEA,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAClE,CACD,CACD,CACD,CACN,CAAC;IACH,CAAC;CACD;AAKD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,oBAAC,kBAAkB,OAAG,CAAC","sourcesContent":["import React from \"react\";\nimport { Store, Actions } from \"./stores/ProcessMonitorStore\";\nimport ListHeader from \"./components/ListHeader\";\nimport ProcessStatistics from \"./components/ProcessStatistics\";\nimport ChildWindow from \"./components/ChildWindow\";\nimport { EMPTY_TOTALS, SIMPLE_MODE_STATISTICS, ADVANCED_MODE_STATISTICS } from \"./constants.js\";\nimport { statReducer, roundDecimalToPrecision, bytesToSize } from \"./helpers.js\";\nimport \"../../assets/css/processMonitor.css\";\nimport { ProcessType, ViewModeEnums, ChildWindowType } from \"./ProcessMonitorTypes\";\nimport { StandardError } from \"@finsemble/finsemble-api/types/types\";\n\nimport FloatingFocus from \"@q42/floating-focus-a11y\";\n// The package FloatingFocus injects a focus indicator that moves around the page, but only for\n// keyboard users. (Mouse users don't see the indicator.) All that needs to be done is to envoke it.\nnew FloatingFocus();\n\ninterface IProps {}\ninterface IState {\n\tprocessList: ProcessType[];\n\tviewMode: ViewModeEnums;\n}\n\nfunction isAffinityGroupProcess(proc: ProcessType) {\n\treturn Object.values(proc.statistics.webContents || {}).some((obj) => /Affinity Group/.test(obj.windowName));\n}\nclass ProcessMonitorBase extends React.Component<IProps, IState> {\n\tconstructor(props: {}) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tprocessList: [],\n\t\t\tviewMode: ViewModeEnums.SIMPLE,\n\t\t};\n\t\tthis.bindCorrectContext();\n\t}\n\n\tbindCorrectContext() {\n\t\tthis.onProcessListChanged = this.onProcessListChanged.bind(this);\n\t\tthis.onViewModeChanged = this.onViewModeChanged.bind(this);\n\t}\n\n\t/**\n\t * Handler for when we go from simple to advanced mode, or the opposite.\n\t */\n\tonViewModeChanged(err: StandardError, response: { value: ViewModeEnums }) {\n\t\tlet { value } = response;\n\t\tthis.setState({\n\t\t\tviewMode: value,\n\t\t});\n\t}\n\n\t/**\n\t * Invoked at minimum, once per second. This listener handles updates that we receive from the system.\n\t */\n\tonProcessListChanged(err: StandardError, response: { value: ProcessType[] }) {\n\t\tlet { value } = response;\n\t\tthis.setState({\n\t\t\tprocessList: value,\n\t\t});\n\t}\n\n\tcomponentDidMount() {\n\t\tActions.initialize(() => {\n\t\t\tStore?.addListener({ field: \"processList\" }, this.onProcessListChanged);\n\t\t\tStore?.addListener({ field: \"viewMode\" }, this.onViewModeChanged);\n\t\t});\n\t}\n\n\tcomponentWillUnmount() {\n\t\tStore?.removeListener({ field: \"processList\" }, this.onProcessListChanged);\n\t\tStore?.removeListener({ field: \"viewMode\" }, this.onViewModeChanged);\n\t}\n\n\trender() {\n\t\tif (!Store) return null;\n\t\t// View modes are:\n\t\t// * Simple - Top-level views, showing stats: CPU, Memory\n\t\t// * Advanced - Expanded processes, showing stats: CPU, Memory, Peak Memory, PID\n\n\t\t// statReducer is an array.reduce function that will sum all of the CPU/memory usage across the app.\n\t\tconst totals = this.state.processList.length ? this.state.processList.reduce(statReducer) : EMPTY_TOTALS;\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<div className=\"process-list-wrapper\">\n\t\t\t\t\t<ListHeader\n\t\t\t\t\t\tfields={this.state.viewMode === ViewModeEnums.SIMPLE ? SIMPLE_MODE_STATISTICS : ADVANCED_MODE_STATISTICS}\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"process-list\">\n\t\t\t\t\t\t{/* Filter will remove the hidden processes. Afterwards, map will render the remaining processes in turn. */}\n\t\t\t\t\t\t{this.state.processList\n\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t(proc) =>\n\t\t\t\t\t\t\t\t\tproc.visible && (!isAffinityGroupProcess(proc) || this.state.viewMode === ViewModeEnums.ADVANCED)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map((proc, i) => (\n\t\t\t\t\t\t\t\t<div key={i} className=\"process\">\n\t\t\t\t\t\t\t\t\t{/* Process statistics is the meat of this component. It's the statistics and the child windows. */}\n\t\t\t\t\t\t\t\t\t<ProcessStatistics\n\t\t\t\t\t\t\t\t\t\tmode={this.state.viewMode}\n\t\t\t\t\t\t\t\t\t\tfields={\n\t\t\t\t\t\t\t\t\t\t\tthis.state.viewMode === ViewModeEnums.SIMPLE ? SIMPLE_MODE_STATISTICS : ADVANCED_MODE_STATISTICS\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tstats={proc.statistics}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{proc.childWindows?.map((cw: ChildWindowType, j: number) => (\n\t\t\t\t\t\t\t\t\t\t<ChildWindow key={j} viewMode={this.state.viewMode} cw={cw} />\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"bottom-section\">\n\t\t\t\t\t<div className=\"summary-statistics-wrapper\">\n\t\t\t\t\t\t<div className=\"summary-statistics-header\">Finsemble Total Usage</div>\n\t\t\t\t\t\t<div className=\"summary-statistics\">\n\t\t\t\t\t\t\t{typeof totals.statistics.cpuUsage !== \"undefined\" && (\n\t\t\t\t\t\t\t\t<div className=\"summary-statistic\">\n\t\t\t\t\t\t\t\t\t<div className=\"summary-statistic-label\">CPU</div>\n\t\t\t\t\t\t\t\t\t<div className=\"summary-statistic-number\">{`${roundDecimalToPrecision(\n\t\t\t\t\t\t\t\t\t\ttotals.statistics.cpuUsage,\n\t\t\t\t\t\t\t\t\t\t2\n\t\t\t\t\t\t\t\t\t)}%`}</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{typeof totals.statistics.workingSetSize !== \"undefined\" && (\n\t\t\t\t\t\t\t\t<div className=\"summary-statistic\">\n\t\t\t\t\t\t\t\t\t<div className=\"summary-statistic-label\">Memory</div>\n\t\t\t\t\t\t\t\t\t<div className=\"summary-statistic-number\">{bytesToSize(totals.statistics.workingSetSize)}</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"advanced-button-wrapper\">\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"fsbl-button advanced-button\"\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tActions.toggleViewMode();\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\ttabIndex={0}\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\tonKeyDown={(e: React.KeyboardEvent) => {\n\t\t\t\t\t\t\t\tif (e.key === \"Enter\" || e.key === \" \") {\n\t\t\t\t\t\t\t\t\tActions.toggleViewMode();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{this.state.viewMode === ViewModeEnums.ADVANCED ? \"Simple\" : \"Advanced\"}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\n/**\n * The window that shows performance data for applications running in Finsemble, such as CPU and memory usage.\n */\nexport const ProcessMonitor = () => <ProcessMonitorBase />;\n"]}
|
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { Actions } from "../stores/ProcessMonitorStore";
|
|
3
3
|
import { HIGH_CPU, HIGH_MEMORY_USAGE, MODERATE_CPU_USAGE, MODERATE_MEMORY_USAGE, TO_MB } from "../constants";
|
|
4
4
|
import { bytesToSize, roundDecimalToPrecision } from "../helpers";
|
|
5
|
-
import { ViewModeEnums } from "../ProcessMonitorTypes";
|
|
6
5
|
function getClassesForStat(number, statType) {
|
|
7
6
|
let classes = "statistic", high_comparison = HIGH_MEMORY_USAGE * TO_MB, moderate_comparison = MODERATE_MEMORY_USAGE * TO_MB;
|
|
8
7
|
if (typeof number === "undefined") {
|
|
@@ -40,8 +39,7 @@ export default class ProcessStatistics extends React.Component {
|
|
|
40
39
|
render() {
|
|
41
40
|
const { processId, webContents } = this.props.stats;
|
|
42
41
|
const items = Object.values(webContents !== null && webContents !== void 0 ? webContents : {});
|
|
43
|
-
const
|
|
44
|
-
const displayName = this.props.mode === ViewModeEnums.SIMPLE ? simpleName : this.props.stats.name;
|
|
42
|
+
const displayName = this.props.stats.name;
|
|
45
43
|
return (React.createElement("div", { className: "process-row" },
|
|
46
44
|
React.createElement("div", { className: "process-name" }, displayName),
|
|
47
45
|
React.createElement("div", { className: "process-statistics" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcessStatistics.js","sourceRoot":"","sources":["../../../../src/components/processMonitor/components/ProcessStatistics.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ProcessStatistics.js","sourceRoot":"","sources":["../../../../src/components/processMonitor/components/ProcessStatistics.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAalE,SAAS,iBAAiB,CAAC,MAA0B,EAAE,QAAgB;IACtE,IAAI,OAAO,GAAG,WAAW,EACxB,eAAe,GAAG,iBAAiB,GAAG,KAAK,EAC3C,mBAAmB,GAAG,qBAAqB,GAAG,KAAK,CAAC;IAErD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAClC,OAAO,OAAO,CAAC;KACf;IAED,IAAI,QAAQ,KAAK,KAAK,EAAE;QACvB,CAAC,eAAe,GAAG,QAAQ,CAAC,EAAE,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,CAAC;KACzE;IACD,IAAI,MAAM,GAAG,eAAe,EAAE;QAC7B,OAAO,GAAG,GAAG,OAAO,aAAa,CAAC;KAClC;SAAM,IAAI,MAAM,GAAG,mBAAmB,EAAE;QACxC,OAAO,GAAG,GAAG,OAAO,iBAAiB,CAAC;KACtC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAMD,SAAS,WAAW,CAAC,MAA0B,EAAE,QAAgB;IAChE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAClC,OAAO,EAAE,CAAC;KACV;IAED,IAAI,QAAQ,KAAK,KAAK,EAAE;QAEvB,OAAO,GAAG,uBAAuB,CAAC,MAAM,EA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,OAAO,EAAE,GAAG,EAAE;wBACb,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;oBACvC,CAAC,EACD,QAAQ,EAAE,CAAC,EACX,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,CAAC,CAAsB,EAAE,EAAE;wBACrC,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE;4BACvC,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;yBACtC;oBACF,CAAC,gBAGI,CACN,CAAC,CAAC,CAAC,IAAI,CACH,CACD,CACD,CACN,CAAC;IACH,CAAC;CACD","sourcesContent":["import React from \"react\";\nimport { Actions } from \"../stores/ProcessMonitorStore\";\nimport { HIGH_CPU, HIGH_MEMORY_USAGE, MODERATE_CPU_USAGE, MODERATE_MEMORY_USAGE, TO_MB } from \"../constants\";\nimport { bytesToSize, roundDecimalToPrecision } from \"../helpers\";\nimport { ProcessType, ViewModeEnums, ModeStatsType } from \"../ProcessMonitorTypes\";\n//Not used right now. Currently using alerts. This is for the future.\n\ninterface IProps {\n\tmode: ViewModeEnums;\n\tfields: ModeStatsType[];\n\tstats: ProcessType[\"statistics\"];\n}\n\n/**\n * Given a number, will return modifier classes that change the background. High usage === red. Moderate === orange.\n */\nfunction getClassesForStat(number: number | undefined, statType: string) {\n\tlet classes = \"statistic\",\n\t\thigh_comparison = HIGH_MEMORY_USAGE * TO_MB,\n\t\tmoderate_comparison = MODERATE_MEMORY_USAGE * TO_MB;\n\n\tif (typeof number === \"undefined\") {\n\t\treturn classes;\n\t}\n\n\tif (statType === \"CPU\") {\n\t\t(high_comparison = HIGH_CPU), (moderate_comparison = MODERATE_CPU_USAGE);\n\t}\n\tif (number > high_comparison) {\n\t\tclasses = `${classes} high-usage`;\n\t} else if (number > moderate_comparison) {\n\t\tclasses = `${classes} moderate-usage`;\n\t}\n\treturn classes;\n}\n\n/**\n * Outputs something nice. 102423465243 outputs whatever that number is in KB/MB/GB.\n * 0.35123 will output 0.35% for CPU.\n */\nfunction prettyPrint(number: number | undefined, statType: string) {\n\tif (typeof number === \"undefined\") {\n\t\treturn \"\";\n\t}\n\n\tif (statType === \"CPU\") {\n\t\t//make it a percent.\n\t\treturn `${roundDecimalToPrecision(number, 2)}%`;\n\t} else if (statType !== \"PID\") {\n\t\treturn bytesToSize(number);\n\t} else {\n\t\treturn number;\n\t}\n}\n\nexport default class ProcessStatistics extends React.Component<IProps> {\n\tconstructor(props: IProps) {\n\t\tsuper(props);\n\t}\n\n\trender() {\n\t\tconst { processId, webContents } = this.props.stats;\n\t\tconst items = Object.values(webContents ?? {});\n\n\t\t// In Advanced mode we always display the process name because it includes the pid\n\t\tconst displayName = this.props.stats.name; //this.props.mode === ViewModeEnums.SIMPLE ? simpleName : this.props.stats.name;\n\t\t//simple mode: CPU, memory\n\t\t//Advanced mode: add Peak Memory.\n\n\t\treturn (\n\t\t\t<div className=\"process-row\">\n\t\t\t\t<div className=\"process-name\">{displayName}</div>\n\t\t\t\t<div className=\"process-statistics\">\n\t\t\t\t\t{this.props.fields.map((field, i) => (\n\t\t\t\t\t\t<div key={i} className={getClassesForStat(this.props.stats[field.value], field.label)}>\n\t\t\t\t\t\t\t{prettyPrint(this.props.stats[field.value], field.label)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t\t<div className=\"statistic process-actions\">\n\t\t\t\t\t\t{this.props.stats.type === \"Tab\" && processId ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\" terminate fsbl-button-negative process-action\"\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\tActions.terminateProcess(webContents);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttabIndex={0}\n\t\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\t\tonKeyDown={(e: React.KeyboardEvent) => {\n\t\t\t\t\t\t\t\t\tif (e.key === \"Enter\" || e.key === \" \") {\n\t\t\t\t\t\t\t\t\t\tActions.terminateProcess(webContents);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tTerminate\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t);\n\t}\n}\n"]}
|
|
@@ -5,11 +5,12 @@ export function toProperCase(str) {
|
|
|
5
5
|
.replace(/^./, (char) => char.toUpperCase()));
|
|
6
6
|
}
|
|
7
7
|
export function bytesToSize(bytes) {
|
|
8
|
-
if (bytes
|
|
9
|
-
return "0
|
|
8
|
+
if (bytes === 0)
|
|
9
|
+
return "0 Bytes";
|
|
10
10
|
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
|
11
11
|
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
12
|
-
|
|
12
|
+
const bytesByScale = bytes / Math.pow(1024, i);
|
|
13
|
+
return `${Math.round(bytesByScale * 100) / 100} ${sizes[i]}`;
|
|
13
14
|
}
|
|
14
15
|
export const statReducer = (prev, curr) => {
|
|
15
16
|
const statistics = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/components/processMonitor/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAIrD,MAAM,UAAU,YAAY,CAAC,GAAW;IACvC,OAAO,CACN,GAAG;SACD,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;SAE1B,OAAO,CAAC,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CACrD,CAAC;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/components/processMonitor/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAA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AC,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,mCAAI,CAAC,CAAC,CAAC;IAClG,CAAC,CAAC,CAAC;IAEH,UAAU,CAAC,IAAI,GAAG,QAAQ,CAAC;IAE3B,OAAO;QACN,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU;KACV,CAAC;AACH,CAAC,CAAC;AAMF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAE,SAAiB,EAAU,EAAE;IAEpF,MAAM,aAAa,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACvD,MAAM,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACvD,OAAO,oBAAoB,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AACvD,CAAC,CAAC","sourcesContent":["import { SIMPLE_MODE_STATISTICS } from \"./constants\";\nimport { ProcessStatisticsType, ProcessType } from \"./ProcessMonitorTypes\";\n\n// This Is Proper Case\nexport function toProperCase(str: string) {\n\treturn (\n\t\tstr\n\t\t\t.replace(/([A-Z])/g, \" $1\")\n\t\t\t// uppercase the first character\n\t\t\t.replace(/^./, (char: string) => char.toUpperCase())\n\t);\n}\n/**\n * Given a number, will return a nice string, 1,024 will return 1KB, 100 will return 100 Bytes, and so on.\n *\n * The result is displayed with 2 decimal points of precision.\n */\nexport function bytesToSize(bytes: number) {\n\tif (bytes === 0) return \"0 Bytes\";\n\n\t// Size powers, in English\n\tconst sizes = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\"];\n\n\t// Determine the size power for the number of bytes\n\tconst i = Math.floor(Math.log(bytes) / Math.log(1024));\n\n\t// Adjusted down to how many KB, MB, GB, etc...\n\tconst bytesByScale = bytes / Math.pow(1024, i);\n\n\t// Return the size, rounded, with 2 decimal points of precision\n\treturn `${Math.round(bytesByScale * 100) / 100} ${sizes[i]}`;\n}\n\n/**\n * Handler for Array.reduce. It takes the array of statistics and sums each value.\n * This outputs an object that has total CPU and memory consumption.\n */\nexport const statReducer = (prev: ProcessType, curr: ProcessType): ProcessType => {\n\tconst statistics: ProcessStatisticsType[\"statistics\"] = {};\n\tSIMPLE_MODE_STATISTICS.forEach((stat) => {\n\t\tif (typeof prev.statistics[stat.value] === \"undefined\" || typeof curr.statistics[stat.value] === \"undefined\") {\n\t\t\tstatistics[stat.value] = undefined;\n\t\t\treturn;\n\t\t}\n\n\t\tstatistics[stat.value] = (prev.statistics[stat.value] ?? 0) + (curr.statistics[stat.value] ?? 0);\n\t});\n\n\tstatistics.name = \"Totals\";\n\n\treturn {\n\t\tvisible: curr.visible,\n\t\tstatistics,\n\t};\n};\n\n/**\n * Convenience function for rounding decimals to a given precision\n * Note that \"precision\" here means \"number of digits to the right of the decimal point\"\n */\nexport const roundDecimalToPrecision = (number: number, precision: number): number => {\n\t// Example: number = .12345, precision = 2\n\tconst shiftedNumber = number * Math.pow(10, precision); // example: 12.345\n\tconst roundedShiftedNumber = Math.round(shiftedNumber); // example: 12\n\treturn roundedShiftedNumber / Math.pow(10, precision); // example: .12\n};\n"]}
|
|
@@ -4,13 +4,17 @@ import { bytesToSize, roundDecimalToPrecision } from "./helpers";
|
|
|
4
4
|
describe("Process Monitor helpers", () => {
|
|
5
5
|
it("bytesToSize", () => {
|
|
6
6
|
[
|
|
7
|
-
[0, "0
|
|
7
|
+
[0, "0 Bytes"],
|
|
8
8
|
[1, "1 Bytes"],
|
|
9
9
|
[1023, "1023 Bytes"],
|
|
10
10
|
[1024, "1 KB"],
|
|
11
11
|
[1025, "1 KB"],
|
|
12
|
-
[1024 * 1.4, "1 KB"],
|
|
13
|
-
[1024 * 1.
|
|
12
|
+
[1024 * 1.4, "1.4 KB"],
|
|
13
|
+
[1024 * 1.41, "1.41 KB"],
|
|
14
|
+
[1024 * 1.412, "1.41 KB"],
|
|
15
|
+
[1024 * 1.415, "1.42 KB"],
|
|
16
|
+
[1024 * 1.5, "1.5 KB"],
|
|
17
|
+
[1024 * 1.999, "2 KB"],
|
|
14
18
|
[1024 * 2, "2 KB"],
|
|
15
19
|
[1024 * 1000, "1000 KB"],
|
|
16
20
|
[Math.pow(1024, 2), "1 MB"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.spec.js","sourceRoot":"","sources":["../../../src/components/processMonitor/helpers.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEjE,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;QACtB;YACC,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"helpers.spec.js","sourceRoot":"","sources":["../../../src/components/processMonitor/helpers.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAEjE,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;QACtB;YACC,CAAC,CAAC,EAAE,SAAS,CAAC;YACd,CAAC,CAAC,EAAE,SAAS,CAAC;YACd,CAAC,IAAI,EAAE,YAAY,CAAC;YACpB,CAAC,IAAI,EAAE,MAAM,CAAC;YACd,CAAC,IAAI,EAAE,MAAM,CAAC;YACd,CAAC,IAAI,GAAG,G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,CAAC,EAAE,GAAG,CAAC;YACjB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC;YAClB,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC;YACnB,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC;YACpB,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC;YACrB,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC;YACrB,CAAC,UAAU,EAAE,CAAC,EAAE,OAAO,CAAC;SACxB,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,EAAE;YACnD,MAAM,CAAC,uBAAuB,CAAC,WAAqB,EAAE,cAAwB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACtG,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it } from \"mocha\";\nimport { expect } from \"chai\";\n\nimport { bytesToSize, roundDecimalToPrecision } from \"./helpers\";\n\ndescribe(\"Process Monitor helpers\", () => {\n\tit(\"bytesToSize\", () => {\n\t\t[\n\t\t\t[0, \"0 Bytes\"],\n\t\t\t[1, \"1 Bytes\"],\n\t\t\t[1023, \"1023 Bytes\"],\n\t\t\t[1024, \"1 KB\"],\n\t\t\t[1025, \"1 KB\"],\n\t\t\t[1024 * 1.4, \"1.4 KB\"],\n\t\t\t[1024 * 1.41, \"1.41 KB\"],\n\t\t\t[1024 * 1.412, \"1.41 KB\"],\n\t\t\t[1024 * 1.415, \"1.42 KB\"],\n\t\t\t[1024 * 1.5, \"1.5 KB\"],\n\t\t\t[1024 * 1.999, \"2 KB\"],\n\t\t\t[1024 * 2, \"2 KB\"],\n\t\t\t[1024 * 1000, \"1000 KB\"],\n\t\t\t[Math.pow(1024, 2), \"1 MB\"],\n\t\t\t[Math.pow(1024, 3), \"1 GB\"],\n\t\t\t[Math.pow(1024, 4), \"1 TB\"],\n\t\t].forEach(([input, output]) => {\n\t\t\texpect(bytesToSize(input as number)).to.be.equal(output);\n\t\t});\n\t});\n\n\tit(\"roundDecimalToPrecision\", () => {\n\t\t[\n\t\t\t[1000, 2, 1000],\n\t\t\t[1, 2, 1],\n\t\t\t[0, 1, 0],\n\t\t\t[1, 0, 1],\n\t\t\t[0.5, 0, 1],\n\t\t\t[0.5, 1, 0.5],\n\t\t\t[0.5, 2, 0.5],\n\t\t\t[0.12345, 1, 0.1],\n\t\t\t[0.12345, 2, 0.12],\n\t\t\t[0.12345, 3, 0.123],\n\t\t\t[0.12345, 4, 0.1235],\n\t\t\t[0.12345, 5, 0.12345],\n\t\t\t[0.12345, 6, 0.12345],\n\t\t\t[1000.12345, 2, 1000.12],\n\t\t].forEach(([inputNumber, inputPrecision, output]) => {\n\t\t\texpect(roundDecimalToPrecision(inputNumber as number, inputPrecision as number)).to.be.equal(output);\n\t\t});\n\t});\n});\n"]}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/// <reference types="react" />
|
|
6
|
-
|
|
6
|
+
import "./css/addApp.css";
|
|
7
|
+
export declare type AddAppProps = {
|
|
7
8
|
checkValidURL: (url: string) => boolean;
|
|
8
9
|
addAppByUrl: (url: string, name: string) => void;
|
|
9
|
-
addAppByPath: (path: string, name: string) => void;
|
|
10
|
+
addAppByPath: (path: string, name: string, apiAccess: boolean) => void;
|
|
11
|
+
addAppCitrix: (alias: string, name: string) => void;
|
|
10
12
|
close: () => void;
|
|
11
13
|
show: boolean;
|
|
12
14
|
};
|
|
13
15
|
export declare const AddApp: (props: AddAppProps) => JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -7,54 +7,156 @@ import { Button } from "../common/Button";
|
|
|
7
7
|
import { ButtonIcon } from "../common/ButtonIcon";
|
|
8
8
|
import { FileInput } from "../common/FileInput";
|
|
9
9
|
import { VALID_APP_EXTENSIONS } from "../common/file_helpers";
|
|
10
|
+
import { FinsembleIcon } from "../common/FinsembleIcon";
|
|
11
|
+
import { FinsembleToggleButtonBar } from "../common/FinsembleToggleButtonBar";
|
|
12
|
+
import { Tooltip } from "../common/Tooltip";
|
|
10
13
|
import { getDefaultName } from "./sdd_helpers";
|
|
14
|
+
import "./css/addApp.css";
|
|
15
|
+
const isValid = ({ visible, appUrl, appPath, appCitrix, webAppName, pathAppName, citrixAppName, }) => {
|
|
16
|
+
if (visible === "web") {
|
|
17
|
+
if (appUrl === "" || webAppName === "") {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else if (visible === "native") {
|
|
22
|
+
if (appPath === "" || pathAppName === "") {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else if (visible === "citrix" && (appCitrix === "" || citrixAppName === "")) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
11
31
|
export const AddApp = (props) => {
|
|
12
|
-
const [
|
|
13
|
-
const [
|
|
14
|
-
const [
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
const [visible, setVisible] = useState("web");
|
|
33
|
+
const [appUrl, setAppUrl] = useState("");
|
|
34
|
+
const [appPath, setAppPath] = useState("");
|
|
35
|
+
const [appCitrix, setAppCitrix] = useState("");
|
|
36
|
+
const [webAppName, setWebAppName] = useState("");
|
|
37
|
+
const [pathAppName, setPathAppName] = useState("");
|
|
38
|
+
const [citrixAppName, setCitrixAppName] = useState("");
|
|
39
|
+
const [apiAccess, setApiAccess] = useState(true);
|
|
40
|
+
const isAppUrlValid = props.checkValidURL(appUrl);
|
|
41
|
+
const clearAll = () => {
|
|
42
|
+
setAppUrl("");
|
|
43
|
+
setAppPath("");
|
|
44
|
+
setAppCitrix("");
|
|
45
|
+
setWebAppName("");
|
|
46
|
+
setPathAppName("");
|
|
47
|
+
setCitrixAppName("");
|
|
48
|
+
setApiAccess(true);
|
|
49
|
+
};
|
|
50
|
+
const close = () => {
|
|
51
|
+
clearAll();
|
|
52
|
+
props.close();
|
|
53
|
+
};
|
|
54
|
+
if (!props.show && (appUrl !== "" || appPath !== "" || appCitrix !== "")) {
|
|
55
|
+
clearAll();
|
|
19
56
|
}
|
|
57
|
+
const isEnabledFlag = isValid({
|
|
58
|
+
visible,
|
|
59
|
+
appUrl,
|
|
60
|
+
appPath,
|
|
61
|
+
appCitrix,
|
|
62
|
+
webAppName,
|
|
63
|
+
pathAppName,
|
|
64
|
+
citrixAppName,
|
|
65
|
+
});
|
|
20
66
|
return (React.createElement("div", { className: `quick-add-app${props.show ? "" : " collapsed"}`, style: { position: "relative" }, "aria-hidden": !props.show },
|
|
21
|
-
React.createElement(ButtonIcon, { icon: "times", onClick:
|
|
22
|
-
React.createElement(
|
|
23
|
-
|
|
67
|
+
React.createElement(ButtonIcon, { icon: "times", onClick: close, text: "Close", className: "quick-add-close" }),
|
|
68
|
+
React.createElement(FinsembleToggleButtonBar, { selected: visible, onChange: setVisible, options: [
|
|
69
|
+
{
|
|
70
|
+
label: (React.createElement("span", null,
|
|
71
|
+
React.createElement(FinsembleIcon, { icon: "linker" }),
|
|
72
|
+
" URL")),
|
|
73
|
+
value: "web",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: (React.createElement("span", null,
|
|
77
|
+
React.createElement(FinsembleIcon, { icon: "folder" }),
|
|
78
|
+
" Path")),
|
|
79
|
+
value: "native",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: (React.createElement("span", null,
|
|
83
|
+
React.createElement(FinsembleIcon, { icon: "server" }),
|
|
84
|
+
" Virtual")),
|
|
85
|
+
value: "citrix",
|
|
86
|
+
},
|
|
87
|
+
] }),
|
|
88
|
+
React.createElement("table", { role: "presentation", style: { width: "100%" } },
|
|
89
|
+
visible === "web" && (React.createElement("tbody", null,
|
|
24
90
|
React.createElement("tr", { className: "quick-add-url" },
|
|
25
91
|
React.createElement("td", { style: { width: "20%" } },
|
|
26
92
|
React.createElement("label", { htmlFor: "app-url" }, "App URL")),
|
|
27
93
|
React.createElement("td", null,
|
|
28
|
-
React.createElement("input", { type: "text", placeholder: "https://...", id: "app-url", value:
|
|
29
|
-
|
|
30
|
-
|
|
94
|
+
React.createElement("input", { type: "text", placeholder: "https://...", id: "app-url", value: appUrl, "aria-invalid": !isAppUrlValid, "aria-errormessage": "app-url-error-message", onChange: (e) => {
|
|
95
|
+
setAppUrl(e.target.value);
|
|
96
|
+
setWebAppName(getDefaultName(e.target.value));
|
|
31
97
|
}, onKeyUp: (e) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, style: { width: "95%" }
|
|
35
|
-
!isAppUrlValid
|
|
98
|
+
setAppUrl(e.currentTarget.value);
|
|
99
|
+
setWebAppName(getDefaultName(e.currentTarget.value));
|
|
100
|
+
}, style: { width: "95%" } }),
|
|
101
|
+
!isAppUrlValid && (React.createElement("div", { id: "app-url-error-message", className: "invalid-message" }, "URL must be valid (e.g., https://cosaic.io/). Only http and https prototcols are supported.")))),
|
|
36
102
|
React.createElement("tr", null,
|
|
37
|
-
React.createElement("td",
|
|
38
|
-
|
|
103
|
+
React.createElement("td", null,
|
|
104
|
+
React.createElement("label", { htmlFor: "url-app-name" }, "App name")),
|
|
105
|
+
React.createElement("td", null,
|
|
106
|
+
React.createElement("input", { type: "text", id: "url-app-name", value: webAppName, onChange: (e) => {
|
|
107
|
+
setWebAppName(e.target.value);
|
|
108
|
+
}, style: { width: "95%" } }))))),
|
|
109
|
+
visible === "native" && (React.createElement("tbody", null,
|
|
110
|
+
React.createElement("tr", { className: "quick-add-url" },
|
|
39
111
|
React.createElement("td", { colSpan: 2 },
|
|
40
|
-
React.createElement(FileInput, { id: "app-path", acceptTypes: VALID_APP_EXTENSIONS, shouldUpload: false, value:
|
|
41
|
-
|
|
112
|
+
React.createElement(FileInput, { id: "app-path", acceptTypes: VALID_APP_EXTENSIONS, shouldUpload: false, value: appPath, onSetValue: (value) => {
|
|
113
|
+
setAppPath(value);
|
|
42
114
|
} }))),
|
|
43
115
|
React.createElement("tr", null,
|
|
44
116
|
React.createElement("td", null,
|
|
45
|
-
React.createElement("label", { htmlFor: "app-name" }, "App name")),
|
|
117
|
+
React.createElement("label", { htmlFor: "path-app-name" }, "App name")),
|
|
46
118
|
React.createElement("td", null,
|
|
47
|
-
React.createElement("input", { type: "text", id: "app-name", value:
|
|
48
|
-
|
|
49
|
-
}, style: { width: "95%" } })))
|
|
119
|
+
React.createElement("input", { type: "text", id: "path-app-name", value: pathAppName, onChange: (e) => {
|
|
120
|
+
setPathAppName(e.target.value);
|
|
121
|
+
}, style: { width: "95%" } }))),
|
|
122
|
+
React.createElement("tr", null,
|
|
123
|
+
React.createElement("td", null,
|
|
124
|
+
React.createElement("label", { htmlFor: "app-access" }, "API access")),
|
|
125
|
+
React.createElement("td", null,
|
|
126
|
+
React.createElement("input", { type: "checkbox", id: "api-access", checked: apiAccess, onChange: (e) => {
|
|
127
|
+
setApiAccess(e.target.checked);
|
|
128
|
+
} })),
|
|
129
|
+
React.createElement("td", null,
|
|
130
|
+
React.createElement(Tooltip, { position: "left" }, "Specify if your app needs to access Finsemble API. Your app must be built with the Finsemble native integration library (see Finsemble documentation for details)."))))),
|
|
131
|
+
visible === "citrix" && (React.createElement("tbody", null,
|
|
132
|
+
React.createElement("tr", { className: "quick-add-citrix" },
|
|
133
|
+
React.createElement("td", { style: { width: "20%" } },
|
|
134
|
+
React.createElement("label", { htmlFor: "app-citrix" }, "Virtual app name")),
|
|
135
|
+
React.createElement("td", null,
|
|
136
|
+
React.createElement("input", { type: "text", placeholder: "", id: "app-citrix", value: appCitrix, onChange: (e) => {
|
|
137
|
+
if (citrixAppName === "" || citrixAppName === appCitrix) {
|
|
138
|
+
setCitrixAppName(e.target.value);
|
|
139
|
+
}
|
|
140
|
+
setAppCitrix(e.target.value);
|
|
141
|
+
}, style: { width: "95%" } }))),
|
|
142
|
+
React.createElement("tr", null,
|
|
143
|
+
React.createElement("td", null,
|
|
144
|
+
React.createElement("label", { htmlFor: "citrix-display-name" }, "Display name")),
|
|
145
|
+
React.createElement("td", null,
|
|
146
|
+
React.createElement("input", { type: "text", id: "citrix-display-name", value: citrixAppName, onChange: (e) => {
|
|
147
|
+
setCitrixAppName(e.target.value);
|
|
148
|
+
}, style: { width: "95%" } })))))),
|
|
50
149
|
React.createElement("div", { className: "save-button-container" },
|
|
51
150
|
React.createElement(Button, { fashion: "secondary", className: "quick-add-save", onClick: () => {
|
|
52
|
-
if (
|
|
53
|
-
props.addAppByUrl(
|
|
151
|
+
if (visible === "web") {
|
|
152
|
+
props.addAppByUrl(appUrl, webAppName);
|
|
153
|
+
}
|
|
154
|
+
else if (visible === "native") {
|
|
155
|
+
props.addAppByPath(appPath, pathAppName, apiAccess);
|
|
54
156
|
}
|
|
55
|
-
else if (
|
|
56
|
-
props.
|
|
157
|
+
else if (visible === "citrix") {
|
|
158
|
+
props.addAppCitrix(appCitrix, citrixAppName);
|
|
57
159
|
}
|
|
58
|
-
}, text: "Save", disabled:
|
|
160
|
+
}, text: "Save", disabled: !isEnabledFlag }))));
|
|
59
161
|
};
|
|
60
162
|
//# sourceMappingURL=AddApp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddApp.js","sourceRoot":"","sources":["../../../src/components/sdd/AddApp.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAU/C,MAAM,CA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CAAC,EAAE,EAAE;gCACf,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;4BAC/B,CAAC,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GACtB,CACE,CACD,CACE,CACD;QACR,6BAAK,SAAS,EAAC,uBAAuB;YACrC,oBAAC,MAAM,IACN,OAAO,EAAC,WAAW,EACnB,SAAS,EAAC,gBAAgB,EAC1B,OAAO,EAAE,GAAG,EAAE;oBACb,IAAI,SAAS,KAAK,EAAE,EAAE;wBACrB,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;qBACzC;yBAAM,IAAI,cAAc,KAAK,EAAE,EAAE;wBACjC,KAAK,CAAC,YAAY,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;qBAC/C;gBACF,CAAC,EACD,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,CAAC,SAAS,KAAK,EAAE,IAAI,cAAc,KAAK,EAAE,CAAC,IAAI,CAAC,aAAa,IAAI,UAAU,KAAK,EAAE,GAC3F,CACG,CACD,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright 2021 by Cosaic\n * All rights reserved.\n */\n\nimport React, { useState } from \"react\";\nimport { Button } from \"../common/Button\";\nimport { ButtonIcon } from \"../common/ButtonIcon\";\nimport { FileInput } from \"../common/FileInput\";\nimport { VALID_APP_EXTENSIONS } from \"../common/file_helpers\";\nimport { getDefaultName } from \"./sdd_helpers\";\n\ntype AddAppProps = {\n\tcheckValidURL: (url: string) => boolean;\n\taddAppByUrl: (url: string, name: string) => void;\n\taddAppByPath: (path: string, name: string) => void;\n\tclose: () => void;\n\tshow: boolean;\n};\n\nexport const AddApp = (props: AddAppProps) => {\n\tconst [newAppUrl, setNewAppUrl] = useState(\"\");\n\tconst [currentAppPath, setCurrentAppPath] = useState(\"\");\n\tconst [newAppName, setNewAppName] = useState(\"\");\n\n\tconst isAppUrlValid = props.checkValidURL(newAppUrl);\n\n\tif (!props.show && (newAppName !== \"\" || newAppUrl !== \"\")) {\n\t\tsetNewAppUrl(\"\");\n\t\tsetNewAppName(\"\");\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`quick-add-app${props.show ? \"\" : \" collapsed\"}`}\n\t\t\tstyle={{ position: \"relative\" }}\n\t\t\taria-hidden={!props.show}\n\t\t>\n\t\t\t<ButtonIcon icon=\"times\" onClick={props.close} text=\"Close\" className=\"quick-add-close\" />\n\t\t\t<table role=\"presentation\" style={{ width: \"100%\", paddingTop: \"30px\" }}>\n\t\t\t\t<tbody>\n\t\t\t\t\t<tr className=\"quick-add-url\">\n\t\t\t\t\t\t<td style={{ width: \"20%\" }}>\n\t\t\t\t\t\t\t<label htmlFor=\"app-url\">App URL</label>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tplaceholder=\"https://...\"\n\t\t\t\t\t\t\t\tid=\"app-url\"\n\t\t\t\t\t\t\t\tvalue={newAppUrl}\n\t\t\t\t\t\t\t\taria-invalid={!isAppUrlValid}\n\t\t\t\t\t\t\t\taria-errormessage=\"app-url-error-message\"\n\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\tsetNewAppUrl(e.target.value);\n\t\t\t\t\t\t\t\t\tsetNewAppName(getDefaultName(e.target.value));\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tonKeyUp={(e) => {\n\t\t\t\t\t\t\t\t\tsetNewAppUrl(e.currentTarget.value);\n\t\t\t\t\t\t\t\t\tsetNewAppName(getDefaultName(e.currentTarget.value));\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tstyle={{ width: \"95%\" }}\n\t\t\t\t\t\t\t\tdisabled={currentAppPath !== \"\"}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{!isAppUrlValid ? (\n\t\t\t\t\t\t\t\t<div id=\"app-url-error-message\" className=\"invalid-message\">\n\t\t\t\t\t\t\t\t\tURL must be valid (e.g., https://cosaic.io/). Only http and https prototcols are supported.\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style={{ fontStyle: \"italic\" }}>or</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr className=\"quick-add-path\">\n\t\t\t\t\t\t<td colSpan={2}>\n\t\t\t\t\t\t\t<FileInput\n\t\t\t\t\t\t\t\tid=\"app-path\"\n\t\t\t\t\t\t\t\tacceptTypes={VALID_APP_EXTENSIONS}\n\t\t\t\t\t\t\t\tshouldUpload={false}\n\t\t\t\t\t\t\t\tvalue={currentAppPath}\n\t\t\t\t\t\t\t\tdisabled={newAppUrl !== \"\"}\n\t\t\t\t\t\t\t\tonSetValue={(value: string) => {\n\t\t\t\t\t\t\t\t\tsetCurrentAppPath(value);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<label htmlFor=\"app-name\">App name</label>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tid=\"app-name\"\n\t\t\t\t\t\t\t\tvalue={newAppName}\n\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\tsetNewAppName(e.target.value);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tstyle={{ width: \"95%\" }}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<div className=\"save-button-container\">\n\t\t\t\t<Button\n\t\t\t\t\tfashion=\"secondary\"\n\t\t\t\t\tclassName=\"quick-add-save\"\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tif (newAppUrl !== \"\") {\n\t\t\t\t\t\t\tprops.addAppByUrl(newAppUrl, newAppName);\n\t\t\t\t\t\t} else if (currentAppPath !== \"\") {\n\t\t\t\t\t\t\tprops.addAppByPath(currentAppPath, newAppName);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\ttext=\"Save\"\n\t\t\t\t\tdisabled={(newAppUrl === \"\" && currentAppPath === \"\") || !isAppUrlValid || newAppName === \"\"}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"AddApp.js","sourceRoot":"","sources":["../../../src/components/sdd/AddApp.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,kBAAkB,CAAC;AAW1B,MAAM,OAAO,GAAG,CAAC,EAChB,OAAO,EACP,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,WAAW,EACX,aAAa,GAGb,EAAE,EAAE;IACJ,IAAI,OAAO,KA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C,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;qBACpD;yBAAM,IAAI,OAAO,KAAK,QAAQ,EAAE;wBAChC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;qBAC7C;gBACF,CAAC,EACD,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,CAAC,aAAa,GACvB,CACG,CACD,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright 2021 by Cosaic\n * All rights reserved.\n */\n\nimport React, { useState } from \"react\";\nimport { Button } from \"../common/Button\";\nimport { ButtonIcon } from \"../common/ButtonIcon\";\nimport { FileInput } from \"../common/FileInput\";\nimport { VALID_APP_EXTENSIONS } from \"../common/file_helpers\";\nimport { FinsembleIcon } from \"../common/FinsembleIcon\";\nimport { FinsembleToggleButtonBar } from \"../common/FinsembleToggleButtonBar\";\nimport { Tooltip } from \"../common/Tooltip\";\nimport { getDefaultName } from \"./sdd_helpers\";\nimport \"./css/addApp.css\";\n\nexport type AddAppProps = {\n\tcheckValidURL: (url: string) => boolean;\n\taddAppByUrl: (url: string, name: string) => void;\n\taddAppByPath: (path: string, name: string, apiAccess: boolean) => void;\n\taddAppCitrix: (alias: string, name: string) => void;\n\tclose: () => void;\n\tshow: boolean;\n};\n\nconst isValid = ({\n\tvisible,\n\tappUrl,\n\tappPath,\n\tappCitrix,\n\twebAppName,\n\tpathAppName,\n\tcitrixAppName,\n}: {\n\t[key: string]: string;\n}) => {\n\tif (visible === \"web\") {\n\t\tif (appUrl === \"\" || webAppName === \"\") {\n\t\t\treturn false;\n\t\t}\n\t} else if (visible === \"native\") {\n\t\tif (appPath === \"\" || pathAppName === \"\") {\n\t\t\treturn false;\n\t\t}\n\t} else if (visible === \"citrix\" && (appCitrix === \"\" || citrixAppName === \"\")) {\n\t\treturn false;\n\t}\n\treturn true;\n};\n\nexport const AddApp = (props: AddAppProps) => {\n\tconst [visible, setVisible] = useState<any>(\"web\");\n\tconst [appUrl, setAppUrl] = useState(\"\");\n\tconst [appPath, setAppPath] = useState(\"\");\n\tconst [appCitrix, setAppCitrix] = useState(\"\");\n\tconst [webAppName, setWebAppName] = useState(\"\");\n\tconst [pathAppName, setPathAppName] = useState(\"\");\n\tconst [citrixAppName, setCitrixAppName] = useState(\"\");\n\tconst [apiAccess, setApiAccess] = useState(true);\n\n\tconst isAppUrlValid = props.checkValidURL(appUrl);\n\n\tconst clearAll = () => {\n\t\tsetAppUrl(\"\");\n\t\tsetAppPath(\"\");\n\t\tsetAppCitrix(\"\");\n\t\tsetWebAppName(\"\");\n\t\tsetPathAppName(\"\");\n\t\tsetCitrixAppName(\"\");\n\t\tsetApiAccess(true);\n\t};\n\n\tconst close = () => {\n\t\tclearAll();\n\t\tprops.close();\n\t};\n\n\tif (!props.show && (appUrl !== \"\" || appPath !== \"\" || appCitrix !== \"\")) {\n\t\tclearAll();\n\t}\n\n\tconst isEnabledFlag = isValid({\n\t\tvisible,\n\t\tappUrl,\n\t\tappPath,\n\t\tappCitrix,\n\t\twebAppName,\n\t\tpathAppName,\n\t\tcitrixAppName,\n\t});\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`quick-add-app${props.show ? \"\" : \" collapsed\"}`}\n\t\t\tstyle={{ position: \"relative\" }}\n\t\t\taria-hidden={!props.show}\n\t\t>\n\t\t\t<ButtonIcon icon=\"times\" onClick={close} text=\"Close\" className=\"quick-add-close\" />\n\t\t\t<FinsembleToggleButtonBar\n\t\t\t\tselected={visible}\n\t\t\t\tonChange={setVisible}\n\t\t\t\toptions={[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<FinsembleIcon icon=\"linker\" /> URL\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: \"web\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<FinsembleIcon icon=\"folder\" /> Path\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: \"native\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<FinsembleIcon icon=\"server\" /> Virtual\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: \"citrix\",\n\t\t\t\t\t},\n\t\t\t\t]}\n\t\t\t/>\n\t\t\t<table role=\"presentation\" style={{ width: \"100%\" }}>\n\t\t\t\t{visible === \"web\" && (\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr className=\"quick-add-url\">\n\t\t\t\t\t\t\t<td style={{ width: \"20%\" }}>\n\t\t\t\t\t\t\t\t<label htmlFor=\"app-url\">App URL</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\tplaceholder=\"https://...\"\n\t\t\t\t\t\t\t\t\tid=\"app-url\"\n\t\t\t\t\t\t\t\t\tvalue={appUrl}\n\t\t\t\t\t\t\t\t\taria-invalid={!isAppUrlValid}\n\t\t\t\t\t\t\t\t\taria-errormessage=\"app-url-error-message\"\n\t\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\t\tsetAppUrl(e.target.value);\n\t\t\t\t\t\t\t\t\t\tsetWebAppName(getDefaultName(e.target.value));\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonKeyUp={(e) => {\n\t\t\t\t\t\t\t\t\t\tsetAppUrl(e.currentTarget.value);\n\t\t\t\t\t\t\t\t\t\tsetWebAppName(getDefaultName(e.currentTarget.value));\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tstyle={{ width: \"95%\" }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{!isAppUrlValid && (\n\t\t\t\t\t\t\t\t\t<div id=\"app-url-error-message\" className=\"invalid-message\">\n\t\t\t\t\t\t\t\t\t\tURL must be valid (e.g., https://cosaic.io/). Only http and https prototcols are supported.\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label htmlFor=\"url-app-name\">App name</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\tid=\"url-app-name\"\n\t\t\t\t\t\t\t\t\tvalue={webAppName}\n\t\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\t\tsetWebAppName(e.target.value);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tstyle={{ width: \"95%\" }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t)}\n\t\t\t\t{visible === \"native\" && (\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr className=\"quick-add-url\">\n\t\t\t\t\t\t\t<td colSpan={2}>\n\t\t\t\t\t\t\t\t<FileInput\n\t\t\t\t\t\t\t\t\tid=\"app-path\"\n\t\t\t\t\t\t\t\t\tacceptTypes={VALID_APP_EXTENSIONS}\n\t\t\t\t\t\t\t\t\tshouldUpload={false}\n\t\t\t\t\t\t\t\t\tvalue={appPath}\n\t\t\t\t\t\t\t\t\tonSetValue={(value: string) => {\n\t\t\t\t\t\t\t\t\t\tsetAppPath(value);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label htmlFor=\"path-app-name\">App name</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\tid=\"path-app-name\"\n\t\t\t\t\t\t\t\t\tvalue={pathAppName}\n\t\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\t\tsetPathAppName(e.target.value);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tstyle={{ width: \"95%\" }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label htmlFor=\"app-access\">API access</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\t\t\tid=\"api-access\"\n\t\t\t\t\t\t\t\t\tchecked={apiAccess}\n\t\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\t\tsetApiAccess(e.target.checked);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<Tooltip position=\"left\">\n\t\t\t\t\t\t\t\t\tSpecify if your app needs to access Finsemble API. Your app must be built with the Finsemble native\n\t\t\t\t\t\t\t\t\tintegration library (see Finsemble documentation for details).\n\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t)}\n\t\t\t\t{visible === \"citrix\" && (\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr className=\"quick-add-citrix\">\n\t\t\t\t\t\t\t<td style={{ width: \"20%\" }}>\n\t\t\t\t\t\t\t\t<label htmlFor=\"app-citrix\">Virtual app name</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\tplaceholder=\"\"\n\t\t\t\t\t\t\t\t\tid=\"app-citrix\"\n\t\t\t\t\t\t\t\t\tvalue={appCitrix}\n\t\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\t\tif (citrixAppName === \"\" || citrixAppName === appCitrix) {\n\t\t\t\t\t\t\t\t\t\t\tsetCitrixAppName(e.target.value);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tsetAppCitrix(e.target.value);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tstyle={{ width: \"95%\" }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<label htmlFor=\"citrix-display-name\">Display name</label>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\tid=\"citrix-display-name\"\n\t\t\t\t\t\t\t\t\tvalue={citrixAppName}\n\t\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\t\tsetCitrixAppName(e.target.value);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tstyle={{ width: \"95%\" }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t)}\n\t\t\t</table>\n\t\t\t<div className=\"save-button-container\">\n\t\t\t\t<Button\n\t\t\t\t\tfashion=\"secondary\"\n\t\t\t\t\tclassName=\"quick-add-save\"\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tif (visible === \"web\") {\n\t\t\t\t\t\t\tprops.addAppByUrl(appUrl, webAppName);\n\t\t\t\t\t\t} else if (visible === \"native\") {\n\t\t\t\t\t\t\tprops.addAppByPath(appPath, pathAppName, apiAccess);\n\t\t\t\t\t\t} else if (visible === \"citrix\") {\n\t\t\t\t\t\t\tprops.addAppCitrix(appCitrix, citrixAppName);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\ttext=\"Save\"\n\t\t\t\t\tdisabled={!isEnabledFlag}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n"]}
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/// <reference types="react" />
|
|
6
6
|
import { ApplicationRule } from "../../types/smartDesktopDesignerTypes";
|
|
7
|
+
import { SmartDesktopClient } from "./smartDesktopClient";
|
|
7
8
|
export declare type AppEditAccessProps = {
|
|
8
9
|
appName: string;
|
|
9
10
|
rules: ApplicationRule[];
|
|
10
11
|
onChange: (data: ApplicationRule[]) => any;
|
|
11
|
-
addApp: typeof
|
|
12
|
-
isInboundInteropAuthorized: typeof
|
|
13
|
-
isOutboundInteropAuthorized: typeof
|
|
12
|
+
addApp: typeof SmartDesktopClient.addApp;
|
|
13
|
+
isInboundInteropAuthorized: typeof SmartDesktopClient.isInboundInteropAuthorized;
|
|
14
|
+
isOutboundInteropAuthorized: typeof SmartDesktopClient.isOutboundInteropAuthorized;
|
|
14
15
|
};
|
|
15
16
|
export declare const AppEditAccess: (props: AppEditAccessProps) => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppEditAccess.js","sourceRoot":"","sources":["../../../src/components/sdd/App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AAC,CAAA,EAAA,CACxE,CAAC;qBACF;yBAAM;wBACN,QAAQ,CAAC,IAAI,CAAC;4BACb,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;yBAC/B,CAAC,CAAC;qBACH;gBACF,CAAC,CAAC,CAAC;gBAEH,UAAU,CAAC,QAAQ,CAAC,CAAC;YACtB,CAAC,EACD,UAAU,EAAE,IAAI,GACE,CACd,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright 2017 - 2020 by ChartIQ, Inc.\n * All rights reserved.\n */\n\nimport React, { useEffect, useState } from \"react\";\nimport { SmartDesktopDesignerActions } from \"../../actions/smartDesktopDesignerActions\";\nimport { RootState } from \"../../reducers/rootReducer\";\nimport { useDispatch, useSelector } from \"../../store\";\nimport { ApplicationRule } from \"../../types/smartDesktopDesignerTypes\";\nimport { FinsembleSelect } from \"../common/FinsembleSelect\";\nimport { Tooltip } from \"../common/Tooltip\";\nimport RelativePortal from \"react-relative-portal\";\nimport { FinsembleIcon } from \"../common/FinsembleIcon\";\nimport { services } from \"@finsemble/finsemble-api\";\n\ntype AppDefinition = services.Interop.types.AppDefinition;\n\nexport type AppEditAccessProps = {\n\tappName: string;\n\trules: ApplicationRule[];\n\tonChange: (data: ApplicationRule[]) => any;\n\taddApp: typeof FSBL.Clients.SmartDesktopClient.prototype.addApp;\n\tisInboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isInboundInteropAuthorized;\n\tisOutboundInteropAuthorized: typeof FSBL.Clients.SmartDesktopClient.isOutboundInteropAuthorized;\n};\n\nexport const AppEditAccess = (props: AppEditAccessProps) => {\n\tconst dispatch = useDispatch();\n\n\tconst apps = useSelector((state: RootState) => state.smartDesktopDesigner.apps);\n\n\tconst [rules, setRules] = useState(props.rules);\n\n\tconst [scrolling, setScrolling] = useState(false);\n\tlet timeout: any = null;\n\n\tuseEffect(() => {\n\t\tconst handleScroll = () => {\n\t\t\tsetScrolling(true);\n\t\t\tclearTimeout(timeout);\n\n\t\t\ttimeout = setTimeout(() => {\n\t\t\t\tsetScrolling(false);\n\t\t\t}, 50);\n\t\t};\n\n\t\twindow.addEventListener(\"scroll\", handleScroll, { passive: true, capture: true });\n\n\t\treturn () => window.removeEventListener(\"scroll\", handleScroll);\n\t}, []);\n\n\t/**\n\t * Get a list of all apps other than this one (in order to pick which ones to authorize)\n\t */\n\tconst filteredApps = apps\n\t\t.filter((app) => !app.manifest?.temporary && app.name !== props.appName)\n\t\t.sort((a, b) => {\n\t\t\tif (a.name > b.name) {\n\t\t\t\treturn 1;\n\t\t\t} else if (b.name > a.name) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t});\n\n\t/**\n\t * When adding an app, there will not yet be a name. The app that is flagged as temporary is us.\n\t * During editing of an app, the app will not be temporary but it will have a name.\n\t * We must check for both circumstances in order to know which app in the list is the current app.\n\t */\n\tconst currentApp = apps.find((app) => app.manifest?.temporary || app.name === props.appName);\n\n\tconst [inboundAuthorizedApps, setInboundAuthorizedApps] = useState<string[]>([]);\n\tconst [outboundAuthorizedApps, setOutboundAuthorizedApps] = useState<string[]>([]);\n\tconst [advancedExpanded, setAdvancedExpanded] = useState(false);\n\n\tfunction doSetRules(newRules: ApplicationRule[]) {\n\t\tsetRules(newRules);\n\n\t\tprops.onChange(newRules);\n\t}\n\n\tfunction updateBlockingApp(config: AppDefinition) {\n\t\tprops.addApp(config.appId, config).then(() => {\n\t\t\tdispatch(SmartDesktopDesignerActions.update_app(config));\n\t\t});\n\t}\n\n\tfunction getOptions() {\n\t\treturn filteredApps.map((app) => {\n\t\t\tconst isInboundAuthorized = inboundAuthorizedApps.includes(app.name);\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclassName={[\"app-edit-access-item\", !isInboundAuthorized ? \"app-edit-access-blocked\" : \"\"].join(\" \")}\n\t\t\t\t\tkey={app.name}\n\t\t\t\t>\n\t\t\t\t\t<span className=\"app-edit-access-item-name\">{app.name}</span>\n\t\t\t\t\t{!isInboundAuthorized && (\n\t\t\t\t\t\t<RelativePortal\n\t\t\t\t\t\t\tclassName={[\"tooltip-portal\", scrolling || !advancedExpanded ? \"is-scrolling\" : \"\"].join(\" \")}\n\t\t\t\t\t\t\tcomponent=\"div\"\n\t\t\t\t\t\t\tleft={-13}\n\t\t\t\t\t\t\ttop={0}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\ttype=\"lock\"\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\tupdateBlockingApp({\n\t\t\t\t\t\t\t\t\t\t...app,\n\t\t\t\t\t\t\t\t\t\tmanifest: {\n\t\t\t\t\t\t\t\t\t\t\t...app.manifest,\n\t\t\t\t\t\t\t\t\t\t\tinterop: {\n\t\t\t\t\t\t\t\t\t\t\t\t...app.manifest?.interop,\n\t\t\t\t\t\t\t\t\t\t\t\tselectConnect: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t...(app.manifest?.interop?.selectConnect || []),\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tauthorize: [{ name: props.appName || \"\" }],\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tThis app is blocking access. Click to allow access\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</RelativePortal>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t);\n\t\t});\n\t}\n\n\tuseEffect(() => {\n\t\tif (currentApp) {\n\t\t\tfilteredApps.forEach((targetApp) => {\n\t\t\t\tif (targetApp.name === props.appName) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprops\n\t\t\t\t\t.isInboundInteropAuthorized(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...currentApp,\n\t\t\t\t\t\t\tname: props.appName,\n\t\t\t\t\t\t\tmanifest: {\n\t\t\t\t\t\t\t\tinterop: {\n\t\t\t\t\t\t\t\t\tselectConnect: rules,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttargetApp\n\t\t\t\t\t)\n\t\t\t\t\t.then((inboundAuthorized: boolean) => {\n\t\t\t\t\t\tif (inboundAuthorized && !inboundAuthorizedApps.includes(targetApp.name)) {\n\t\t\t\t\t\t\tsetInboundAuthorizedApps([...inboundAuthorizedApps, targetApp.name]);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\tprops\n\t\t\t\t\t.isOutboundInteropAuthorized(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...currentApp,\n\t\t\t\t\t\t\tname: props.appName,\n\t\t\t\t\t\t\tmanifest: {\n\t\t\t\t\t\t\t\tinterop: {\n\t\t\t\t\t\t\t\t\tselectConnect: rules,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttargetApp\n\t\t\t\t\t)\n\t\t\t\t\t.then((outboundAuthorized: boolean) => {\n\t\t\t\t\t\tif (outboundAuthorized && !outboundAuthorizedApps.includes(targetApp.name)) {\n\t\t\t\t\t\t\tsetOutboundAuthorizedApps([...outboundAuthorizedApps, targetApp.name]);\n\t\t\t\t\t\t} else if (!outboundAuthorized && outboundAuthorizedApps.includes(targetApp.name)) {\n\t\t\t\t\t\t\tconst outboundAuthorizedAppsCopy = outboundAuthorizedApps.slice(0);\n\t\t\t\t\t\t\toutboundAuthorizedAppsCopy.splice(outboundAuthorizedAppsCopy.indexOf(targetApp.name), 1);\n\t\t\t\t\t\t\tsetOutboundAuthorizedApps(outboundAuthorizedAppsCopy);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t});\n\t\t}\n\t});\n\n\treturn (\n\t\t<div className=\"app-edit-access\">\n\t\t\t<FinsembleSelect\n\t\t\t\toptions={filteredApps.map((app) => app.name)}\n\t\t\t\toptionComponents={getOptions()}\n\t\t\t\tselected={filteredApps.filter((app) => outboundAuthorizedApps.includes(app.name)).map((app) => app.name)}\n\t\t\t\tupdateCallback={(selected) => {\n\t\t\t\t\tlet newRules = [...rules];\n\n\t\t\t\t\tfilteredApps.forEach((app) => {\n\t\t\t\t\t\tconst isSelected = selected.find((name) => name === app.name);\n\n\t\t\t\t\t\tif (!isSelected) {\n\t\t\t\t\t\t\tnewRules = newRules.filter((rule) =>\n\t\t\t\t\t\t\t\trule.authorize?.some((auth: { name: string }) => auth.name !== app.name)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnewRules.push({\n\t\t\t\t\t\t\t\tauthorize: [{ name: app.name }],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tdoSetRules(newRules);\n\t\t\t\t}}\n\t\t\t\tshowSearch={true}\n\t\t\t></FinsembleSelect>\n\t\t</div>\n\t);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"AppEditAccess.js","sourceRoot":"","sources":["../../../src/components/sdd/AppEditAccess.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,cAAc,MAAM,uBAAuB,CAAC;AAenD,MAAM,CA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, useState } from \"react\";\nimport { SmartDesktopDesignerActions } from \"../../actions/smartDesktopDesignerActions\";\nimport { RootState } from \"../../reducers/rootReducer\";\nimport { useDispatch, useSelector } from \"../../store\";\nimport { ApplicationRule } from \"../../types/smartDesktopDesignerTypes\";\nimport { FinsembleSelect } from \"../common/FinsembleSelect\";\nimport { Tooltip } from \"../common/Tooltip\";\nimport RelativePortal from \"react-relative-portal\";\nimport { services } from \"@finsemble/finsemble-api\";\nimport { SmartDesktopClient } from \"./smartDesktopClient\";\n\ntype AppDefinition = services.Interop.types.AppDefinition;\n\nexport type AppEditAccessProps = {\n\tappName: string;\n\trules: ApplicationRule[];\n\tonChange: (data: ApplicationRule[]) => any;\n\taddApp: typeof SmartDesktopClient.addApp;\n\tisInboundInteropAuthorized: typeof SmartDesktopClient.isInboundInteropAuthorized;\n\tisOutboundInteropAuthorized: typeof SmartDesktopClient.isOutboundInteropAuthorized;\n};\n\nexport const AppEditAccess = (props: AppEditAccessProps) => {\n\tconst dispatch = useDispatch();\n\n\tconst apps = useSelector((state: RootState) => state.smartDesktopDesigner.apps);\n\n\tconst [rules, setRules] = useState(props.rules);\n\n\tconst [scrolling, setScrolling] = useState(false);\n\tlet timeout: any = null;\n\n\tuseEffect(() => {\n\t\tconst handleScroll = () => {\n\t\t\tsetScrolling(true);\n\t\t\tclearTimeout(timeout);\n\n\t\t\ttimeout = setTimeout(() => {\n\t\t\t\tsetScrolling(false);\n\t\t\t}, 50);\n\t\t};\n\n\t\twindow.addEventListener(\"scroll\", handleScroll, { passive: true, capture: true });\n\n\t\treturn () => window.removeEventListener(\"scroll\", handleScroll);\n\t}, []);\n\n\t/**\n\t * Get a list of all apps other than this one (in order to pick which ones to authorize)\n\t */\n\tconst filteredApps = apps\n\t\t.filter((app) => !app.manifest?.temporary && app.name !== props.appName)\n\t\t.sort((a, b) => {\n\t\t\tif (a.name > b.name) {\n\t\t\t\treturn 1;\n\t\t\t} else if (b.name > a.name) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\treturn 0;\n\t\t});\n\n\t/**\n\t * When adding an app, there will not yet be a name. The app that is flagged as temporary is us.\n\t * During editing of an app, the app will not be temporary but it will have a name.\n\t * We must check for both circumstances in order to know which app in the list is the current app.\n\t */\n\tconst currentApp = apps.find((app) => app.manifest?.temporary || app.name === props.appName);\n\n\tconst [inboundAuthorizedApps, setInboundAuthorizedApps] = useState<string[]>([]);\n\tconst [outboundAuthorizedApps, setOutboundAuthorizedApps] = useState<string[]>([]);\n\tconst [advancedExpanded, setAdvancedExpanded] = useState(false);\n\n\tfunction doSetRules(newRules: ApplicationRule[]) {\n\t\tsetRules(newRules);\n\n\t\tprops.onChange(newRules);\n\t}\n\n\tfunction updateBlockingApp(config: AppDefinition) {\n\t\tprops.addApp(config.appId, config).then(() => {\n\t\t\tdispatch(SmartDesktopDesignerActions.update_app(config));\n\t\t});\n\t}\n\n\tfunction getOptions() {\n\t\treturn filteredApps.map((app) => {\n\t\t\tconst isInboundAuthorized = inboundAuthorizedApps.includes(app.name);\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclassName={[\"app-edit-access-item\", !isInboundAuthorized ? \"app-edit-access-blocked\" : \"\"].join(\" \")}\n\t\t\t\t\tkey={app.name}\n\t\t\t\t>\n\t\t\t\t\t<span className=\"app-edit-access-item-name\">{app.name}</span>\n\t\t\t\t\t{!isInboundAuthorized && (\n\t\t\t\t\t\t<RelativePortal\n\t\t\t\t\t\t\tclassName={[\"tooltip-portal\", scrolling || !advancedExpanded ? \"is-scrolling\" : \"\"].join(\" \")}\n\t\t\t\t\t\t\tcomponent=\"div\"\n\t\t\t\t\t\t\tleft={-13}\n\t\t\t\t\t\t\ttop={0}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\ttype=\"lock\"\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\tupdateBlockingApp({\n\t\t\t\t\t\t\t\t\t\t...app,\n\t\t\t\t\t\t\t\t\t\tmanifest: {\n\t\t\t\t\t\t\t\t\t\t\t...app.manifest,\n\t\t\t\t\t\t\t\t\t\t\tinterop: {\n\t\t\t\t\t\t\t\t\t\t\t\t...app.manifest?.interop,\n\t\t\t\t\t\t\t\t\t\t\t\tselectConnect: [\n\t\t\t\t\t\t\t\t\t\t\t\t\t...(app.manifest?.interop?.selectConnect || []),\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tauthorize: [{ name: props.appName || \"\" }],\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tThis app is blocking access. Click to allow access\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</RelativePortal>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t);\n\t\t});\n\t}\n\n\tuseEffect(() => {\n\t\tif (currentApp) {\n\t\t\tfilteredApps.forEach((targetApp) => {\n\t\t\t\tif (targetApp.name === props.appName) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tprops\n\t\t\t\t\t.isInboundInteropAuthorized(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...currentApp,\n\t\t\t\t\t\t\tname: props.appName,\n\t\t\t\t\t\t\tmanifest: {\n\t\t\t\t\t\t\t\tinterop: {\n\t\t\t\t\t\t\t\t\tselectConnect: rules,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttargetApp\n\t\t\t\t\t)\n\t\t\t\t\t.then((inboundAuthorized: boolean) => {\n\t\t\t\t\t\tif (inboundAuthorized && !inboundAuthorizedApps.includes(targetApp.name)) {\n\t\t\t\t\t\t\tsetInboundAuthorizedApps([...inboundAuthorizedApps, targetApp.name]);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\tprops\n\t\t\t\t\t.isOutboundInteropAuthorized(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...currentApp,\n\t\t\t\t\t\t\tname: props.appName,\n\t\t\t\t\t\t\tmanifest: {\n\t\t\t\t\t\t\t\tinterop: {\n\t\t\t\t\t\t\t\t\tselectConnect: rules,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttargetApp\n\t\t\t\t\t)\n\t\t\t\t\t.then((outboundAuthorized: boolean) => {\n\t\t\t\t\t\tif (outboundAuthorized && !outboundAuthorizedApps.includes(targetApp.name)) {\n\t\t\t\t\t\t\tsetOutboundAuthorizedApps([...outboundAuthorizedApps, targetApp.name]);\n\t\t\t\t\t\t} else if (!outboundAuthorized && outboundAuthorizedApps.includes(targetApp.name)) {\n\t\t\t\t\t\t\tconst outboundAuthorizedAppsCopy = outboundAuthorizedApps.slice(0);\n\t\t\t\t\t\t\toutboundAuthorizedAppsCopy.splice(outboundAuthorizedAppsCopy.indexOf(targetApp.name), 1);\n\t\t\t\t\t\t\tsetOutboundAuthorizedApps(outboundAuthorizedAppsCopy);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t});\n\t\t}\n\t});\n\n\treturn (\n\t\t<div className=\"app-edit-access\">\n\t\t\t<FinsembleSelect\n\t\t\t\toptions={filteredApps.map((app) => app.name)}\n\t\t\t\toptionComponents={getOptions()}\n\t\t\t\tselected={filteredApps.filter((app) => outboundAuthorizedApps.includes(app.name)).map((app) => app.name)}\n\t\t\t\tupdateCallback={(selected) => {\n\t\t\t\t\tlet newRules = [...rules];\n\n\t\t\t\t\tfilteredApps.forEach((app) => {\n\t\t\t\t\t\tconst isSelected = selected.find((name) => name === app.name);\n\n\t\t\t\t\t\tif (!isSelected) {\n\t\t\t\t\t\t\tnewRules = newRules.filter((rule) =>\n\t\t\t\t\t\t\t\trule.authorize?.some((auth: { name: string }) => auth.name !== app.name)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tnewRules.push({\n\t\t\t\t\t\t\t\tauthorize: [{ name: app.name }],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tdoSetRules(newRules);\n\t\t\t\t}}\n\t\t\t\tshowSearch={true}\n\t\t\t></FinsembleSelect>\n\t\t</div>\n\t);\n};\n"]}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/// <reference types="react" />
|
|
6
6
|
import * as Types from "../../types/smartDesktopDesignerTypes";
|
|
7
7
|
import "../common/css/application-edit-page.css";
|
|
8
|
+
import { SmartDesktopClient } from "./smartDesktopClient";
|
|
8
9
|
export declare const defaultAppData: Types.ApplicationSaveData;
|
|
9
10
|
export declare type AppEditPageProps = {
|
|
10
11
|
startingDisplayName: string;
|
|
@@ -16,9 +17,9 @@ export declare type AppEditPageProps = {
|
|
|
16
17
|
removeApplicationFn: () => void;
|
|
17
18
|
cancelFn: () => void;
|
|
18
19
|
submitFn: (data: Types.ApplicationSaveData) => void;
|
|
19
|
-
addApp: typeof
|
|
20
|
-
isInboundInteropAuthorized: typeof
|
|
21
|
-
isOutboundInteropAuthorized: typeof
|
|
20
|
+
addApp: typeof SmartDesktopClient.addApp;
|
|
21
|
+
isInboundInteropAuthorized: typeof SmartDesktopClient.isInboundInteropAuthorized;
|
|
22
|
+
isOutboundInteropAuthorized: typeof SmartDesktopClient.isOutboundInteropAuthorized;
|
|
22
23
|
preloadAliasList: string[];
|
|
23
24
|
};
|
|
24
25
|
export declare const AppEditPage: ({ startingDisplayName, startingAppType, startingWindowURL, startingNativePath, appData, validateURL, removeApplicationFn, cancelFn, submitFn, addApp, isInboundInteropAuthorized, isOutboundInteropAuthorized, preloadAliasList, }: AppEditPageProps) => JSX.Element;
|