@finsemble/finsemble-ui 6.3.0 → 6.3.1-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finsemble/finsemble-ui",
3
- "version": "6.3.0",
3
+ "version": "6.3.1-beta-1",
4
4
  "description": "Ready-made React components to give you a head-start building your SmartDesktop.",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -4,6 +4,7 @@ import { StandardCallback, StandardError } from "@finsemble/finsemble-core/types
4
4
  import { ProcessInfo } from "@finsemble/finsemble-core/types/FEA";
5
5
  declare let ProcessMonitorStore: StoreModel | undefined;
6
6
  declare type VoidCallback = () => void;
7
+ export declare let storeWrapper: StoreModel | null | undefined;
7
8
  declare const Actions: {
8
9
  initialize: (cb: VoidCallback) => void;
9
10
  getInitialData: () => void;
@@ -10,13 +10,14 @@ const DEFAULT_STORE_DATA = {
10
10
  },
11
11
  };
12
12
  const MAGIC_NUMBER_TERMINATION_TIMEOUT = 4000;
13
+ export let storeWrapper;
13
14
  function createLocalStore(done) {
14
15
  FSBL.Clients.DistributedStoreClient.createStore({
15
16
  store: "Finsemble-ProcessMonitor-Local-Store",
16
17
  values: DEFAULT_STORE_DATA,
17
18
  }, (err, store) => {
18
19
  ProcessMonitorStore = store;
19
- module.exports.Store = store;
20
+ storeWrapper = store;
20
21
  done();
21
22
  });
22
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ProcessMonitorStore.js","sourceRoot":"","sources":["../../../../src/components/processMonitor/stores/ProcessMonitorStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAM1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,IAAI,mBAA2C,CAAC;AAKhD,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAC3C,MAAM,kBAAkB,GAAG;IAC1B,QAAQ,EAA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AAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAG5D,OAAO,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAEnC,MAAM,cAAc,GAAG,GAAG,EAAE;YAE3B,IAAI,KAAK,EAAE;gBACV,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAC9B,OAAO,EACP;oBACC,KAAK,EAAE,oBAAoB;oBAC3B,QAAQ,EACP,kJAAkJ;oBACnJ,wBAAwB,EAAE,WAAW;oBACrC,kBAAkB,EAAE,KAAK;iBACzB,EACD,CAAC,GAAkB,EAAE,QAA4B,EAAE,EAAE;oBACpD,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,aAAa,EAAE;wBAC7C,OAAO,OAAO,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;qBAC5D;gBACF,CAAC,CACD,CAAC;aACF;iBAAM;gBACN,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;aACjC;QACF,CAAC,CAAC;QAGF,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE;YACpC,cAAc,EAAE,CAAC;QAClB,CAAC,EAAE,gCAAgC,CAAC,CAAC;QAErC,MAAM,cAAc,GAAG,GAAG,EAAE;YAC3B,YAAY,CAAC,YAAY,CAAC,CAAC;QAC5B,CAAC,CAAC;QAEF,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IAClD,CAAC;CACD,CAAC;AAEF,OAAO,EAAE,mBAAmB,IAAI,KAAK,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { getViewName, getViewBaseName } from \"../helpers\";\r\nimport { ChildWindowType, ProcessType, SortObjectType } from \"../ProcessMonitorTypes\";\r\nimport StoreModel from \"@finsemble/finsemble-core/types/clients/StoreModel\";\r\nimport { StandardCallback, StandardError } from \"@finsemble/finsemble-core/types/types\";\r\nimport { ProcessInfo } from \"@finsemble/finsemble-core/types/FEA\";\r\nimport { FinsembleWindow } from \"@finsemble/finsemble-core/types/main\";\r\nimport async from \"async\";\r\n\r\nlet ProcessMonitorStore: StoreModel | undefined;\r\n\r\ntype VoidCallback = () => void;\r\n\r\n//Regex code taken from https://gist.github.com/mattheyan/46a230da86a0894a5ff654b9139ec5f2\r\nconst DEFAULT_SORT_DIRECTION = \"ascending\";\r\nconst DEFAULT_STORE_DATA = {\r\n\tviewMode: \"simple\",\r\n\tsort: {\r\n\t\tfield: \"name\",\r\n\t\tdirection: \"ascending\",\r\n\t},\r\n};\r\nconst MAGIC_NUMBER_TERMINATION_TIMEOUT = 4000;\r\n\r\nfunction createLocalStore(done: VoidCallback) {\r\n\tFSBL.Clients.DistributedStoreClient.createStore(\r\n\t\t{\r\n\t\t\tstore: \"Finsemble-ProcessMonitor-Local-Store\",\r\n\t\t\tvalues: DEFAULT_STORE_DATA,\r\n\t\t},\r\n\t\t(err: StandardError, store?: StoreModel) => {\r\n\t\t\tProcessMonitorStore = store;\r\n\t\t\tmodule.exports.Store = store;\r\n\t\t\tdone();\r\n\t\t}\r\n\t);\r\n}\r\n\r\nconst Actions = {\r\n\t/**\r\n\t * Creates the local store, then gets the first cut at stats for the process list.\r\n\t */\r\n\tinitialize: (cb: VoidCallback) => {\r\n\t\tcreateLocalStore(() => {\r\n\t\t\tActions.getInitialData();\r\n\t\t\tcb();\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Gets the process list, pulls the statistics out, and renders the app. Also sets up an interval where we'll retrieve more stats from the system.\r\n\t */\r\n\tgetInitialData: () => {\r\n\t\tFSBL.System.getProcessList(Actions.extractData);\r\n\t\tsetInterval(() => {\r\n\t\t\tFSBL.System.getProcessList(Actions.extractData);\r\n\t\t}, 1000);\r\n\t},\r\n\r\n\t/**\r\n\t * Sets the sort field; if it's the same field as we had previously, we flip the sort direction.\r\n\t */\r\n\tsetSort: (field: string) => {\r\n\t\tconst currentSort = ProcessMonitorStore?.getValue({ field: \"sort\" });\r\n\t\tlet procs = ProcessMonitorStore?.getValue({ field: \"processList\" });\r\n\t\tlet newSort;\r\n\t\t//If it's the same field as before, flip the direction\r\n\t\tif (currentSort.field === field) {\r\n\t\t\tnewSort = currentSort;\r\n\t\t\tif (currentSort.direction == \"ascending\") {\r\n\t\t\t\tnewSort.direction = \"descending\";\r\n\t\t\t} else {\r\n\t\t\t\tnewSort.direction = \"ascending\";\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tnewSort = {\r\n\t\t\t\tfield,\r\n\t\t\t\tdirection: DEFAULT_SORT_DIRECTION,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tProcessMonitorStore?.setValue({ field: \"sort\", value: newSort }, () => {\r\n\t\t\t// When changing sort we'll re-render the UI immediately instead of waiting for the process list to update. Without this step, it could be 999ms until the next update, which makes the process monitor feel very unresponsive and very bad.\r\n\t\t\tprocs = Actions.sortProcesses(procs);\r\n\t\t\tProcessMonitorStore?.setValue({ field: \"processList\", value: procs });\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Extracts data from the process list (via the createDataModel function), and then sets the processList value on the store. This causes the UI to re-render.\r\n\t */\r\n\textractData: (processes: ProcessInfo[]) => {\r\n\t\tActions.createDataModel(processes, (procs) => {\r\n\t\t\t//set store.\r\n\t\t\tProcessMonitorStore?.setValue({ field: \"processList\", value: procs });\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Converts the system.getProcessList response into something that's easily render-able.\r\n\t */\r\n\tcreateDataModel: (processes: ProcessInfo[], cb: (procs: ProcessType[]) => void) => {\r\n\t\tlet procs: ProcessType[] = [];\r\n\t\tlet mode = ProcessMonitorStore?.getValue({ field: \"viewMode\" });\r\n\r\n\t\tfor (const proc of processes) {\r\n\t\t\tif (\r\n\t\t\t\tmode === \"simple\" &&\r\n\t\t\t\t(proc.name.toLowerCase().includes(\"service\") ||\r\n\t\t\t\t\tproc.name.toLowerCase().includes(\"system\") ||\r\n\t\t\t\t\tproc.name.toLowerCase().includes(\"unnamed\"))\r\n\t\t\t) {\r\n\t\t\t\tprocs.push({\r\n\t\t\t\t\tstatistics: proc,\r\n\t\t\t\t\tvisible: false,\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tconst childWindows: ChildWindowType[] = [...proc.windows, ...proc.views]\r\n\t\t\t\t\t.filter((item) => {\r\n\t\t\t\t\t\tconst name: string = \"name\" in item ? item.name : item.windowName;\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t!(\r\n\t\t\t\t\t\t\t\tmode === \"simple\" &&\r\n\t\t\t\t\t\t\t\t(name.toLowerCase().includes(\"service\") ||\r\n\t\t\t\t\t\t\t\t\tname.toLowerCase().includes(\"system\") ||\r\n\t\t\t\t\t\t\t\t\tname.toLowerCase().includes(\"unnamed\"))\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\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.map((item) => {\r\n\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\tname:\r\n\t\t\t\t\t\t\t\t\"name\" in item\r\n\t\t\t\t\t\t\t\t\t? item.name\r\n\t\t\t\t\t\t\t\t\t: getViewName({\r\n\t\t\t\t\t\t\t\t\t\t\twindowName: item.windowName,\r\n\t\t\t\t\t\t\t\t\t\t\tviewId: String(item.id),\r\n\t\t\t\t\t\t\t\t\t }),\r\n\t\t\t\t\t\t\ttype: \"name\" in item ? \"window\" : \"view\",\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.sort((a, b) => {\r\n\t\t\t\t\t\tif (a.name < b.name) return -1;\r\n\t\t\t\t\t\tif (a.name > b.name) return 1;\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\tprocs.push({\r\n\t\t\t\t\tstatistics: proc,\r\n\t\t\t\t\tvisible: true,\r\n\t\t\t\t\ttype: proc.type,\r\n\t\t\t\t\tchildWindows,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprocs = Actions.sortProcesses(procs);\r\n\t\tcb(procs);\r\n\t},\r\n\r\n\t/**\r\n\t * Sorting function. Handles ascending and descending.\r\n\t */\r\n\tsortProcesses: (procs: ProcessType[]) => {\r\n\t\tlet currentSort: SortObjectType = ProcessMonitorStore?.getValue({ field: \"sort\" });\r\n\t\tlet sortFN = (a: ProcessType, b: ProcessType) => {\r\n\t\t\tlet aValue = a.statistics[currentSort.field];\r\n\t\t\tlet bValue = b.statistics[currentSort.field];\r\n\r\n\t\t\tif (typeof aValue === \"undefined\" || typeof bValue === \"undefined\") {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\t\t\t//Comparing upper and lowercase names makes the sort look wrong. we equalize all strings here.\r\n\t\t\tif (typeof aValue === \"string\") {\r\n\t\t\t\taValue = aValue.toLowerCase();\r\n\t\t\t}\r\n\t\t\tif (typeof bValue === \"string\") {\r\n\t\t\t\tbValue = bValue.toLowerCase();\r\n\t\t\t}\r\n\r\n\t\t\tif (currentSort.direction === \"ascending\") {\r\n\t\t\t\tif (aValue < bValue) return -1;\r\n\t\t\t\tif (aValue > bValue) return 1;\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\t\t\tif (aValue > bValue) return -1;\r\n\t\t\tif (aValue < bValue) return 1;\r\n\t\t\treturn 0;\r\n\t\t};\r\n\t\treturn procs.sort(sortFN);\r\n\t},\r\n\r\n\t/**\r\n\t * Toggles advanced/simple mode\r\n\t */\r\n\ttoggleViewMode: () => {\r\n\t\tconst mode = ProcessMonitorStore?.getValue({ field: \"viewMode\" });\r\n\t\tProcessMonitorStore?.setValue({\r\n\t\t\tfield: \"viewMode\",\r\n\t\t\tvalue: mode === \"advanced\" ? \"simple\" : \"advanced\",\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Gets the current \"flashing\" state - whether the process monitor is currently flashing a window\r\n\t */\r\n\tgetFlashingState: (cb?: StandardCallback) => {\r\n\t\tProcessMonitorStore?.getValue(\"flashing\", cb);\r\n\t},\r\n\r\n\t/**\r\n\t * Gets the current \"flashing\" state for the process monitor\r\n\t */\r\n\tsetFlashingState: (value: boolean, cb?: StandardCallback) => {\r\n\t\tProcessMonitorStore?.setValue({ field: \"flashing\", value }, cb);\r\n\t},\r\n\r\n\t/**\r\n\t * Make the window flash a couple of times so that the user can identify it.\r\n\t */\r\n\tidentifyWindow: function (winID: ChildWindowType) {\r\n\t\tif (winID.name.includes(\"Service\")) return;\r\n\t\t// If the item clicked is a view, the window for that view should flash, thus we need to get that window's name here\r\n\t\tconst baseName = getViewBaseName(winID);\r\n\r\n\t\tthis.setFlashingState(true);\r\n\r\n\t\tconst OPACITY_ANIMATION_DURATION = 200;\r\n\t\tFSBL.FinsembleWindow.getInstance({ name: baseName }, (err: StandardError, win: FinsembleWindow) => {\r\n\t\t\tlet windowState = \"hidden\";\r\n\t\t\tfunction flash(n: any, done: any) {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\twin.hide(() => {\r\n\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\twin.show(() => {\r\n\t\t\t\t\t\t\t\tdone(null);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}, OPACITY_ANIMATION_DURATION / 1.5);\r\n\t\t\t\t\t});\r\n\t\t\t\t}, OPACITY_ANIMATION_DURATION / 1.5);\r\n\t\t\t}\r\n\t\t\twin.isShowing({}, (error: StandardError, isVisible) => {\r\n\t\t\t\t//cache the visible state of the window prior to making it flash. If it was hidden before, hide it when the flashing is done.\r\n\t\t\t\twindowState = isVisible ? \"visible\" : \"hidden\";\r\n\t\t\t\twin.show(() => {\r\n\t\t\t\t\twin.bringToFront(() => {\r\n\t\t\t\t\t\t//Flash 5 times, in series.\r\n\t\t\t\t\t\tasync.timesSeries(5, flash, () => {\r\n\t\t\t\t\t\t\tif (windowState === \"hidden\") {\r\n\t\t\t\t\t\t\t\twin.hide();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tthis.setFlashingState(false);\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});\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Terminates a process. Prompts first. If it fails to terminate the process, displays an error message.\r\n\t */\r\n\tterminateProcess: (AppIdentifier: { uuid: string }, force = false) => {\r\n\t\t// AppIdentifier should be of type ChildWindow, but that has `uuid` as optional, and\r\n\t\t// uuid is required for this function\r\n\r\n\t\tconst app = FSBL.System.Application.wrap(AppIdentifier.uuid);\r\n\t\t/**\r\n\t\t * This whole routine is a little hectic because of all of the closures - but there's a method to the madness. Here's the logic.\r\n\t\t *\r\n\t\t * 1st time we try to close: Politely close the window. If that fails, recurse, but pass \"force\" === true.\r\n\t\t * 2nd time, we try to forceClose the process. If that fails, we will terminate the process forcibly, which isn't graceful.\r\n\t\t */\r\n\r\n\t\tconst onCloseFailure = () => {\r\n\t\t\t//If Actions.terminateProcess is invoked with force === true, that means that we tried to force close the process, and it failed. So we will terminate it. If not, we will try to force close (the else block).\r\n\t\t\tif (force) {\r\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\r\n\t\t\t\tterminateProcess();\r\n\t\t\t} else {\r\n\t\t\t\t//If we've already tried to close the process once, but it failed, we'll try to terminate it. The first attempt is a close, which is more graceful.\r\n\t\t\t\tActions.terminateProcess(AppIdentifier, true);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tconst forceCloseProcess = () => {\r\n\t\t\t//If the process fails to close in 4 seconds, we will call this method again, but try to force close it.\r\n\t\t\tconst closeTimeout = setTimeout(() => {\r\n\t\t\t\tonCloseFailure();\r\n\t\t\t}, MAGIC_NUMBER_TERMINATION_TIMEOUT);\r\n\r\n\t\t\tconst onCloseSuccess = () => {\r\n\t\t\t\tclearTimeout(closeTimeout);\r\n\t\t\t};\r\n\t\t\tapp.close(force, onCloseSuccess, onCloseFailure);\r\n\t\t};\r\n\r\n\t\tconst terminateProcess = () => {\r\n\t\t\t// Should never get into here, but just in case the process is hung, we'll show an error message to the user.\r\n\t\t\tapp.terminate(\r\n\t\t\t\t() => {},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tFSBL.Clients.DialogManager.open(\r\n\t\t\t\t\t\t\"yesNo\",\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\ttitle: \"Error\",\r\n\t\t\t\t\t\t\tquestion: \"The process that you are attempting to close is unresponsive. Please contact support.\",\r\n\t\t\t\t\t\t\taffirmativeButtonLabel: \"Okay\",\r\n\t\t\t\t\t\t\tshowCancelButton: false,\r\n\t\t\t\t\t\t\tshowNegativeButton: false,\r\n\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);\r\n\t\t};\r\n\r\n\t\t// If we're force closing, no need to prompt the user (which is what happens below);\r\n\t\tif (force) {\r\n\t\t\treturn forceCloseProcess();\r\n\t\t}\r\n\r\n\t\t//Ask user if they're sure. If they says \"yes\", close it.\r\n\t\tFSBL.Clients.DialogManager.open(\r\n\t\t\t\"yesNo\",\r\n\t\t\t{\r\n\t\t\t\ttitle: \"Terminate Process?\",\r\n\t\t\t\tquestion: \"Terminating the process may close other apps. Are you sure you want to continue?\",\r\n\t\t\t\taffirmativeResponseLabel: \"Terminate\",\r\n\t\t\t\tshowNegativeButton: false,\r\n\t\t\t},\r\n\t\t\t(err: StandardError, response: { choice: string }) => {\r\n\t\t\t\tif (err || response.choice === \"affirmative\") {\r\n\t\t\t\t\tforceCloseProcess();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t},\r\n\r\n\t/**\r\n\t * This function exists to make the UI feel snappy. May take a second or so for the window to close properly and for the change to flow to system.getProcessList. To make that lag go away, we immediately render the change.\r\n\t */\r\n\tremoveWindowLocally: function (winID: { uuid: string; name: string }) {\r\n\t\tlet procs: ProcessType[] = ProcessMonitorStore?.getValue({ field: \"processList\" });\r\n\t\tprocs = procs.map((proc) => {\r\n\t\t\tif (proc.childWindows) {\r\n\t\t\t\tconst cwIndex = proc.childWindows.findIndex((cw) => cw.name === winID.name);\r\n\t\t\t\tproc.childWindows.splice(cwIndex, 1);\r\n\t\t\t}\r\n\t\t\treturn proc;\r\n\t\t});\r\n\t\tProcessMonitorStore?.setValue({ field: \"processList\", value: procs });\r\n\t},\r\n\r\n\t/**\r\n\t * Try to close the window. If that fails, try to force close the window. If that fails, ask if they'd like to terminate the parent process.\r\n\t */\r\n\tcloseWindow: function (winID: { uuid: string; name: string }, force = false) {\r\n\t\tconst win = FSBL.System.Window.wrap(winID.uuid, winID.name);\r\n\r\n\t\t//Make the UI feel snappy.\r\n\t\tActions.removeWindowLocally(winID);\r\n\r\n\t\tconst onCloseFailure = () => {\r\n\t\t\t//If Actions.closeWindow was called with force === true, and the close failed, give the user the opportunity to terminate the process.\r\n\t\t\tif (force) {\r\n\t\t\t\tFSBL.Clients.DialogManager.open(\r\n\t\t\t\t\t\"yesNo\",\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttitle: \"Terminate Process?\",\r\n\t\t\t\t\t\tquestion:\r\n\t\t\t\t\t\t\t\"The app that you are attempting to close is unresponsive. Would you like to terminate the process? Terminating the process may close other apps.\",\r\n\t\t\t\t\t\taffirmativeResponseLabel: \"Terminate\",\r\n\t\t\t\t\t\tshowNegativeButton: false,\r\n\t\t\t\t\t},\r\n\t\t\t\t\t(err: StandardError, response: { choice: string }) => {\r\n\t\t\t\t\t\tif (err || response.choice === \"affirmative\") {\r\n\t\t\t\t\t\t\treturn Actions.terminateProcess({ uuid: winID.uuid }, true);\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} else {\r\n\t\t\t\tActions.closeWindow(winID, true);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t//If we can't close within 4 seconds, something's wrong - try to force close it.\r\n\t\tconst closeTimeout = setTimeout(() => {\r\n\t\t\tonCloseFailure();\r\n\t\t}, MAGIC_NUMBER_TERMINATION_TIMEOUT);\r\n\r\n\t\tconst onCloseSuccess = () => {\r\n\t\t\tclearTimeout(closeTimeout);\r\n\t\t};\r\n\r\n\t\twin.close(force, onCloseSuccess, onCloseFailure);\r\n\t},\r\n};\r\n\r\nexport { ProcessMonitorStore as Store, Actions };\r\n"]}
1
+ {"version":3,"file":"ProcessMonitorStore.js","sourceRoot":"","sources":["../../../../src/components/processMonitor/stores/ProcessMonitorStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAM1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,IAAI,mBAA2C,CAAC;AAKhD,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAC3C,MAAM,kBAAkB,GAAG;IAC1B,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE;QACL,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,WAAW;KACtB;CACD,CAAC;AACF,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAE9C,MAAM,CAAC,IAAI,YAA2C,CAAC;AAEvD,SAAS,gBAAgB,CAAC,IAAkB;IAC3C,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,WAAW,CAC9C;QACC,KAAK,EAAE,sCAAsC;QAC7C,MAAM,EAAE,kBAAkB;KAC1B,EACD,CAAC,GAAkB,EAAE,KAAkB,EAAE,EAAE;QAC1C,mBAAmB,GAAG,KAAK,CAAC;QAC5B,YAAY,GAAG,KAAK,CAAC;QACrB,IAAI,EAAE,CAAC;IACR,CAAC,CACD,CAAC;AACH,CAAC;AAED,MAAM,OAAO,GAAG;IAIf,UAAU,EAAE,CAAC,EAAgB,EAAE,E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gB,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;qBAC5D;gBACF,CAAC,CACD,CAAC;aACF;iBAAM;gBACN,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;aACjC;QACF,CAAC,CAAC;QAGF,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE;YACpC,cAAc,EAAE,CAAC;QAClB,CAAC,EAAE,gCAAgC,CAAC,CAAC;QAErC,MAAM,cAAc,GAAG,GAAG,EAAE;YAC3B,YAAY,CAAC,YAAY,CAAC,CAAC;QAC5B,CAAC,CAAC;QAEF,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IAClD,CAAC;CACD,CAAC;AAEF,OAAO,EAAE,mBAAmB,IAAI,KAAK,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { getViewName, getViewBaseName } from \"../helpers\";\r\nimport { ChildWindowType, ProcessType, SortObjectType } from \"../ProcessMonitorTypes\";\r\nimport StoreModel from \"@finsemble/finsemble-core/types/clients/StoreModel\";\r\nimport { StandardCallback, StandardError } from \"@finsemble/finsemble-core/types/types\";\r\nimport { ProcessInfo } from \"@finsemble/finsemble-core/types/FEA\";\r\nimport { FinsembleWindow } from \"@finsemble/finsemble-core/types/main\";\r\nimport async from \"async\";\r\n\r\nlet ProcessMonitorStore: StoreModel | undefined;\r\n\r\ntype VoidCallback = () => void;\r\n\r\n//Regex code taken from https://gist.github.com/mattheyan/46a230da86a0894a5ff654b9139ec5f2\r\nconst DEFAULT_SORT_DIRECTION = \"ascending\";\r\nconst DEFAULT_STORE_DATA = {\r\n\tviewMode: \"simple\",\r\n\tsort: {\r\n\t\tfield: \"name\",\r\n\t\tdirection: \"ascending\",\r\n\t},\r\n};\r\nconst MAGIC_NUMBER_TERMINATION_TIMEOUT = 4000;\r\n\r\nexport let storeWrapper: StoreModel | null | undefined;\r\n\r\nfunction createLocalStore(done: VoidCallback) {\r\n\tFSBL.Clients.DistributedStoreClient.createStore(\r\n\t\t{\r\n\t\t\tstore: \"Finsemble-ProcessMonitor-Local-Store\",\r\n\t\t\tvalues: DEFAULT_STORE_DATA,\r\n\t\t},\r\n\t\t(err: StandardError, store?: StoreModel) => {\r\n\t\t\tProcessMonitorStore = store;\r\n\t\t\tstoreWrapper = store;\r\n\t\t\tdone();\r\n\t\t}\r\n\t);\r\n}\r\n\r\nconst Actions = {\r\n\t/**\r\n\t * Creates the local store, then gets the first cut at stats for the process list.\r\n\t */\r\n\tinitialize: (cb: VoidCallback) => {\r\n\t\tcreateLocalStore(() => {\r\n\t\t\tActions.getInitialData();\r\n\t\t\tcb();\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Gets the process list, pulls the statistics out, and renders the app. Also sets up an interval where we'll retrieve more stats from the system.\r\n\t */\r\n\tgetInitialData: () => {\r\n\t\tFSBL.System.getProcessList(Actions.extractData);\r\n\t\tsetInterval(() => {\r\n\t\t\tFSBL.System.getProcessList(Actions.extractData);\r\n\t\t}, 1000);\r\n\t},\r\n\r\n\t/**\r\n\t * Sets the sort field; if it's the same field as we had previously, we flip the sort direction.\r\n\t */\r\n\tsetSort: (field: string) => {\r\n\t\tconst currentSort = ProcessMonitorStore?.getValue({ field: \"sort\" });\r\n\t\tlet procs = ProcessMonitorStore?.getValue({ field: \"processList\" });\r\n\t\tlet newSort;\r\n\t\t//If it's the same field as before, flip the direction\r\n\t\tif (currentSort.field === field) {\r\n\t\t\tnewSort = currentSort;\r\n\t\t\tif (currentSort.direction == \"ascending\") {\r\n\t\t\t\tnewSort.direction = \"descending\";\r\n\t\t\t} else {\r\n\t\t\t\tnewSort.direction = \"ascending\";\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tnewSort = {\r\n\t\t\t\tfield,\r\n\t\t\t\tdirection: DEFAULT_SORT_DIRECTION,\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tProcessMonitorStore?.setValue({ field: \"sort\", value: newSort }, () => {\r\n\t\t\t// When changing sort we'll re-render the UI immediately instead of waiting for the process list to update. Without this step, it could be 999ms until the next update, which makes the process monitor feel very unresponsive and very bad.\r\n\t\t\tprocs = Actions.sortProcesses(procs);\r\n\t\t\tProcessMonitorStore?.setValue({ field: \"processList\", value: procs });\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Extracts data from the process list (via the createDataModel function), and then sets the processList value on the store. This causes the UI to re-render.\r\n\t */\r\n\textractData: (processes: ProcessInfo[]) => {\r\n\t\tActions.createDataModel(processes, (procs) => {\r\n\t\t\t//set store.\r\n\t\t\tProcessMonitorStore?.setValue({ field: \"processList\", value: procs });\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Converts the system.getProcessList response into something that's easily render-able.\r\n\t */\r\n\tcreateDataModel: (processes: ProcessInfo[], cb: (procs: ProcessType[]) => void) => {\r\n\t\tlet procs: ProcessType[] = [];\r\n\t\tlet mode = ProcessMonitorStore?.getValue({ field: \"viewMode\" });\r\n\r\n\t\tfor (const proc of processes) {\r\n\t\t\tif (\r\n\t\t\t\tmode === \"simple\" &&\r\n\t\t\t\t(proc.name.toLowerCase().includes(\"service\") ||\r\n\t\t\t\t\tproc.name.toLowerCase().includes(\"system\") ||\r\n\t\t\t\t\tproc.name.toLowerCase().includes(\"unnamed\"))\r\n\t\t\t) {\r\n\t\t\t\tprocs.push({\r\n\t\t\t\t\tstatistics: proc,\r\n\t\t\t\t\tvisible: false,\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tconst childWindows: ChildWindowType[] = [...proc.windows, ...proc.views]\r\n\t\t\t\t\t.filter((item) => {\r\n\t\t\t\t\t\tconst name: string = \"name\" in item ? item.name : item.windowName;\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t!(\r\n\t\t\t\t\t\t\t\tmode === \"simple\" &&\r\n\t\t\t\t\t\t\t\t(name.toLowerCase().includes(\"service\") ||\r\n\t\t\t\t\t\t\t\t\tname.toLowerCase().includes(\"system\") ||\r\n\t\t\t\t\t\t\t\t\tname.toLowerCase().includes(\"unnamed\"))\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\treturn true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.map((item) => {\r\n\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\tname:\r\n\t\t\t\t\t\t\t\t\"name\" in item\r\n\t\t\t\t\t\t\t\t\t? item.name\r\n\t\t\t\t\t\t\t\t\t: getViewName({\r\n\t\t\t\t\t\t\t\t\t\t\twindowName: item.windowName,\r\n\t\t\t\t\t\t\t\t\t\t\tviewId: String(item.id),\r\n\t\t\t\t\t\t\t\t\t }),\r\n\t\t\t\t\t\t\ttype: \"name\" in item ? \"window\" : \"view\",\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t})\r\n\t\t\t\t\t.sort((a, b) => {\r\n\t\t\t\t\t\tif (a.name < b.name) return -1;\r\n\t\t\t\t\t\tif (a.name > b.name) return 1;\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\tprocs.push({\r\n\t\t\t\t\tstatistics: proc,\r\n\t\t\t\t\tvisible: true,\r\n\t\t\t\t\ttype: proc.type,\r\n\t\t\t\t\tchildWindows,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprocs = Actions.sortProcesses(procs);\r\n\t\tcb(procs);\r\n\t},\r\n\r\n\t/**\r\n\t * Sorting function. Handles ascending and descending.\r\n\t */\r\n\tsortProcesses: (procs: ProcessType[]) => {\r\n\t\tlet currentSort: SortObjectType = ProcessMonitorStore?.getValue({ field: \"sort\" });\r\n\t\tlet sortFN = (a: ProcessType, b: ProcessType) => {\r\n\t\t\tlet aValue = a.statistics[currentSort.field];\r\n\t\t\tlet bValue = b.statistics[currentSort.field];\r\n\r\n\t\t\tif (typeof aValue === \"undefined\" || typeof bValue === \"undefined\") {\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\t\t\t//Comparing upper and lowercase names makes the sort look wrong. we equalize all strings here.\r\n\t\t\tif (typeof aValue === \"string\") {\r\n\t\t\t\taValue = aValue.toLowerCase();\r\n\t\t\t}\r\n\t\t\tif (typeof bValue === \"string\") {\r\n\t\t\t\tbValue = bValue.toLowerCase();\r\n\t\t\t}\r\n\r\n\t\t\tif (currentSort.direction === \"ascending\") {\r\n\t\t\t\tif (aValue < bValue) return -1;\r\n\t\t\t\tif (aValue > bValue) return 1;\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\r\n\t\t\tif (aValue > bValue) return -1;\r\n\t\t\tif (aValue < bValue) return 1;\r\n\t\t\treturn 0;\r\n\t\t};\r\n\t\treturn procs.sort(sortFN);\r\n\t},\r\n\r\n\t/**\r\n\t * Toggles advanced/simple mode\r\n\t */\r\n\ttoggleViewMode: () => {\r\n\t\tconst mode = ProcessMonitorStore?.getValue({ field: \"viewMode\" });\r\n\t\tProcessMonitorStore?.setValue({\r\n\t\t\tfield: \"viewMode\",\r\n\t\t\tvalue: mode === \"advanced\" ? \"simple\" : \"advanced\",\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Gets the current \"flashing\" state - whether the process monitor is currently flashing a window\r\n\t */\r\n\tgetFlashingState: (cb?: StandardCallback) => {\r\n\t\tProcessMonitorStore?.getValue(\"flashing\", cb);\r\n\t},\r\n\r\n\t/**\r\n\t * Gets the current \"flashing\" state for the process monitor\r\n\t */\r\n\tsetFlashingState: (value: boolean, cb?: StandardCallback) => {\r\n\t\tProcessMonitorStore?.setValue({ field: \"flashing\", value }, cb);\r\n\t},\r\n\r\n\t/**\r\n\t * Make the window flash a couple of times so that the user can identify it.\r\n\t */\r\n\tidentifyWindow: function (winID: ChildWindowType) {\r\n\t\tif (winID.name.includes(\"Service\")) return;\r\n\t\t// If the item clicked is a view, the window for that view should flash, thus we need to get that window's name here\r\n\t\tconst baseName = getViewBaseName(winID);\r\n\r\n\t\tthis.setFlashingState(true);\r\n\r\n\t\tconst OPACITY_ANIMATION_DURATION = 200;\r\n\t\tFSBL.FinsembleWindow.getInstance({ name: baseName }, (err: StandardError, win: FinsembleWindow) => {\r\n\t\t\tlet windowState = \"hidden\";\r\n\t\t\tfunction flash(n: any, done: any) {\r\n\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\twin.hide(() => {\r\n\t\t\t\t\t\tsetTimeout(() => {\r\n\t\t\t\t\t\t\twin.show(() => {\r\n\t\t\t\t\t\t\t\tdone(null);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}, OPACITY_ANIMATION_DURATION / 1.5);\r\n\t\t\t\t\t});\r\n\t\t\t\t}, OPACITY_ANIMATION_DURATION / 1.5);\r\n\t\t\t}\r\n\t\t\twin.isShowing({}, (error: StandardError, isVisible) => {\r\n\t\t\t\t//cache the visible state of the window prior to making it flash. If it was hidden before, hide it when the flashing is done.\r\n\t\t\t\twindowState = isVisible ? \"visible\" : \"hidden\";\r\n\t\t\t\twin.show(() => {\r\n\t\t\t\t\twin.bringToFront(() => {\r\n\t\t\t\t\t\t//Flash 5 times, in series.\r\n\t\t\t\t\t\tasync.timesSeries(5, flash, () => {\r\n\t\t\t\t\t\t\tif (windowState === \"hidden\") {\r\n\t\t\t\t\t\t\t\twin.hide();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tthis.setFlashingState(false);\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});\r\n\t\t});\r\n\t},\r\n\r\n\t/**\r\n\t * Terminates a process. Prompts first. If it fails to terminate the process, displays an error message.\r\n\t */\r\n\tterminateProcess: (AppIdentifier: { uuid: string }, force = false) => {\r\n\t\t// AppIdentifier should be of type ChildWindow, but that has `uuid` as optional, and\r\n\t\t// uuid is required for this function\r\n\r\n\t\tconst app = FSBL.System.Application.wrap(AppIdentifier.uuid);\r\n\t\t/**\r\n\t\t * This whole routine is a little hectic because of all of the closures - but there's a method to the madness. Here's the logic.\r\n\t\t *\r\n\t\t * 1st time we try to close: Politely close the window. If that fails, recurse, but pass \"force\" === true.\r\n\t\t * 2nd time, we try to forceClose the process. If that fails, we will terminate the process forcibly, which isn't graceful.\r\n\t\t */\r\n\r\n\t\tconst onCloseFailure = () => {\r\n\t\t\t//If Actions.terminateProcess is invoked with force === true, that means that we tried to force close the process, and it failed. So we will terminate it. If not, we will try to force close (the else block).\r\n\t\t\tif (force) {\r\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\r\n\t\t\t\tterminateProcess();\r\n\t\t\t} else {\r\n\t\t\t\t//If we've already tried to close the process once, but it failed, we'll try to terminate it. The first attempt is a close, which is more graceful.\r\n\t\t\t\tActions.terminateProcess(AppIdentifier, true);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tconst forceCloseProcess = () => {\r\n\t\t\t//If the process fails to close in 4 seconds, we will call this method again, but try to force close it.\r\n\t\t\tconst closeTimeout = setTimeout(() => {\r\n\t\t\t\tonCloseFailure();\r\n\t\t\t}, MAGIC_NUMBER_TERMINATION_TIMEOUT);\r\n\r\n\t\t\tconst onCloseSuccess = () => {\r\n\t\t\t\tclearTimeout(closeTimeout);\r\n\t\t\t};\r\n\t\t\tapp.close(force, onCloseSuccess, onCloseFailure);\r\n\t\t};\r\n\r\n\t\tconst terminateProcess = () => {\r\n\t\t\t// Should never get into here, but just in case the process is hung, we'll show an error message to the user.\r\n\t\t\tapp.terminate(\r\n\t\t\t\t() => {},\r\n\t\t\t\t() => {\r\n\t\t\t\t\tFSBL.Clients.DialogManager.open(\r\n\t\t\t\t\t\t\"yesNo\",\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\ttitle: \"Error\",\r\n\t\t\t\t\t\t\tquestion: \"The process that you are attempting to close is unresponsive. Please contact support.\",\r\n\t\t\t\t\t\t\taffirmativeButtonLabel: \"Okay\",\r\n\t\t\t\t\t\t\tshowCancelButton: false,\r\n\t\t\t\t\t\t\tshowNegativeButton: false,\r\n\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);\r\n\t\t};\r\n\r\n\t\t// If we're force closing, no need to prompt the user (which is what happens below);\r\n\t\tif (force) {\r\n\t\t\treturn forceCloseProcess();\r\n\t\t}\r\n\r\n\t\t//Ask user if they're sure. If they says \"yes\", close it.\r\n\t\tFSBL.Clients.DialogManager.open(\r\n\t\t\t\"yesNo\",\r\n\t\t\t{\r\n\t\t\t\ttitle: \"Terminate Process?\",\r\n\t\t\t\tquestion: \"Terminating the process may close other apps. Are you sure you want to continue?\",\r\n\t\t\t\taffirmativeResponseLabel: \"Terminate\",\r\n\t\t\t\tshowNegativeButton: false,\r\n\t\t\t},\r\n\t\t\t(err: StandardError, response: { choice: string }) => {\r\n\t\t\t\tif (err || response.choice === \"affirmative\") {\r\n\t\t\t\t\tforceCloseProcess();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t);\r\n\t},\r\n\r\n\t/**\r\n\t * This function exists to make the UI feel snappy. May take a second or so for the window to close properly and for the change to flow to system.getProcessList. To make that lag go away, we immediately render the change.\r\n\t */\r\n\tremoveWindowLocally: function (winID: { uuid: string; name: string }) {\r\n\t\tlet procs: ProcessType[] = ProcessMonitorStore?.getValue({ field: \"processList\" });\r\n\t\tprocs = procs.map((proc) => {\r\n\t\t\tif (proc.childWindows) {\r\n\t\t\t\tconst cwIndex = proc.childWindows.findIndex((cw) => cw.name === winID.name);\r\n\t\t\t\tproc.childWindows.splice(cwIndex, 1);\r\n\t\t\t}\r\n\t\t\treturn proc;\r\n\t\t});\r\n\t\tProcessMonitorStore?.setValue({ field: \"processList\", value: procs });\r\n\t},\r\n\r\n\t/**\r\n\t * Try to close the window. If that fails, try to force close the window. If that fails, ask if they'd like to terminate the parent process.\r\n\t */\r\n\tcloseWindow: function (winID: { uuid: string; name: string }, force = false) {\r\n\t\tconst win = FSBL.System.Window.wrap(winID.uuid, winID.name);\r\n\r\n\t\t//Make the UI feel snappy.\r\n\t\tActions.removeWindowLocally(winID);\r\n\r\n\t\tconst onCloseFailure = () => {\r\n\t\t\t//If Actions.closeWindow was called with force === true, and the close failed, give the user the opportunity to terminate the process.\r\n\t\t\tif (force) {\r\n\t\t\t\tFSBL.Clients.DialogManager.open(\r\n\t\t\t\t\t\"yesNo\",\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\ttitle: \"Terminate Process?\",\r\n\t\t\t\t\t\tquestion:\r\n\t\t\t\t\t\t\t\"The app that you are attempting to close is unresponsive. Would you like to terminate the process? Terminating the process may close other apps.\",\r\n\t\t\t\t\t\taffirmativeResponseLabel: \"Terminate\",\r\n\t\t\t\t\t\tshowNegativeButton: false,\r\n\t\t\t\t\t},\r\n\t\t\t\t\t(err: StandardError, response: { choice: string }) => {\r\n\t\t\t\t\t\tif (err || response.choice === \"affirmative\") {\r\n\t\t\t\t\t\t\treturn Actions.terminateProcess({ uuid: winID.uuid }, true);\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} else {\r\n\t\t\t\tActions.closeWindow(winID, true);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t//If we can't close within 4 seconds, something's wrong - try to force close it.\r\n\t\tconst closeTimeout = setTimeout(() => {\r\n\t\t\tonCloseFailure();\r\n\t\t}, MAGIC_NUMBER_TERMINATION_TIMEOUT);\r\n\r\n\t\tconst onCloseSuccess = () => {\r\n\t\t\tclearTimeout(closeTimeout);\r\n\t\t};\r\n\r\n\t\twin.close(force, onCloseSuccess, onCloseFailure);\r\n\t},\r\n};\r\n\r\nexport { ProcessMonitorStore as Store, Actions };\r\n"]}