@finos/legend-application-pure-ide 6.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/lib/application/LegendPureIDE.d.ts +26 -0
  4. package/lib/application/LegendPureIDE.d.ts.map +1 -0
  5. package/lib/application/LegendPureIDE.js +43 -0
  6. package/lib/application/LegendPureIDE.js.map +1 -0
  7. package/lib/application/LegendPureIDEApplicationConfig.d.ts +28 -0
  8. package/lib/application/LegendPureIDEApplicationConfig.d.ts.map +1 -0
  9. package/lib/application/LegendPureIDEApplicationConfig.js +30 -0
  10. package/lib/application/LegendPureIDEApplicationConfig.js.map +1 -0
  11. package/lib/application/LegendPureIDEPluginManager.d.ts +32 -0
  12. package/lib/application/LegendPureIDEPluginManager.d.ts.map +1 -0
  13. package/lib/application/LegendPureIDEPluginManager.js +46 -0
  14. package/lib/application/LegendPureIDEPluginManager.js.map +1 -0
  15. package/lib/components/Core_LegendPureIDEApplicationPlugin.d.ts +23 -0
  16. package/lib/components/Core_LegendPureIDEApplicationPlugin.d.ts.map +1 -0
  17. package/lib/components/Core_LegendPureIDEApplicationPlugin.js +29 -0
  18. package/lib/components/Core_LegendPureIDEApplicationPlugin.js.map +1 -0
  19. package/lib/components/LegendPureIDEApplication.d.ts +18 -0
  20. package/lib/components/LegendPureIDEApplication.d.ts.map +1 -0
  21. package/lib/components/LegendPureIDEApplication.js +21 -0
  22. package/lib/components/LegendPureIDEApplication.js.map +1 -0
  23. package/lib/components/LegendPureIDEBaseStoreProvider.d.ts +23 -0
  24. package/lib/components/LegendPureIDEBaseStoreProvider.d.ts.map +1 -0
  25. package/lib/components/LegendPureIDEBaseStoreProvider.js +30 -0
  26. package/lib/components/LegendPureIDEBaseStoreProvider.js.map +1 -0
  27. package/lib/components/editor/ActivityBar.d.ts +20 -0
  28. package/lib/components/editor/ActivityBar.d.ts.map +1 -0
  29. package/lib/components/editor/ActivityBar.js +41 -0
  30. package/lib/components/editor/ActivityBar.js.map +1 -0
  31. package/lib/components/editor/Editor.d.ts +18 -0
  32. package/lib/components/editor/Editor.d.ts.map +1 -0
  33. package/lib/components/editor/Editor.js +80 -0
  34. package/lib/components/editor/Editor.js.map +1 -0
  35. package/lib/components/editor/EditorStoreProvider.d.ts +22 -0
  36. package/lib/components/editor/EditorStoreProvider.d.ts.map +1 -0
  37. package/lib/components/editor/EditorStoreProvider.js +32 -0
  38. package/lib/components/editor/EditorStoreProvider.js.map +1 -0
  39. package/lib/components/editor/StatusBar.d.ts +22 -0
  40. package/lib/components/editor/StatusBar.d.ts.map +1 -0
  41. package/lib/components/editor/StatusBar.js +39 -0
  42. package/lib/components/editor/StatusBar.js.map +1 -0
  43. package/lib/components/editor/aux-panel/AuxiliaryPanel.d.ts +20 -0
  44. package/lib/components/editor/aux-panel/AuxiliaryPanel.d.ts.map +1 -0
  45. package/lib/components/editor/aux-panel/AuxiliaryPanel.js +65 -0
  46. package/lib/components/editor/aux-panel/AuxiliaryPanel.js.map +1 -0
  47. package/lib/components/editor/aux-panel/ConsolePanel.d.ts +20 -0
  48. package/lib/components/editor/aux-panel/ConsolePanel.d.ts.map +1 -0
  49. package/lib/components/editor/aux-panel/ConsolePanel.js +24 -0
  50. package/lib/components/editor/aux-panel/ConsolePanel.js.map +1 -0
  51. package/lib/components/editor/aux-panel/SearchPanel.d.ts +20 -0
  52. package/lib/components/editor/aux-panel/SearchPanel.d.ts.map +1 -0
  53. package/lib/components/editor/aux-panel/SearchPanel.js +90 -0
  54. package/lib/components/editor/aux-panel/SearchPanel.js.map +1 -0
  55. package/lib/components/editor/aux-panel/TestRunnerPanel.d.ts +20 -0
  56. package/lib/components/editor/aux-panel/TestRunnerPanel.d.ts.map +1 -0
  57. package/lib/components/editor/aux-panel/TestRunnerPanel.js +151 -0
  58. package/lib/components/editor/aux-panel/TestRunnerPanel.js.map +1 -0
  59. package/lib/components/editor/command-center/CreateNewDirectoryCommand.d.ts +20 -0
  60. package/lib/components/editor/command-center/CreateNewDirectoryCommand.d.ts.map +1 -0
  61. package/lib/components/editor/command-center/CreateNewDirectoryCommand.js +48 -0
  62. package/lib/components/editor/command-center/CreateNewDirectoryCommand.js.map +1 -0
  63. package/lib/components/editor/command-center/CreateNewFileCommand.d.ts +20 -0
  64. package/lib/components/editor/command-center/CreateNewFileCommand.d.ts.map +1 -0
  65. package/lib/components/editor/command-center/CreateNewFileCommand.js +48 -0
  66. package/lib/components/editor/command-center/CreateNewFileCommand.js.map +1 -0
  67. package/lib/components/editor/command-center/FileSearchCommand.d.ts +20 -0
  68. package/lib/components/editor/command-center/FileSearchCommand.d.ts.map +1 -0
  69. package/lib/components/editor/command-center/FileSearchCommand.js +60 -0
  70. package/lib/components/editor/command-center/FileSearchCommand.js.map +1 -0
  71. package/lib/components/editor/command-center/TextSearchCommand.d.ts +20 -0
  72. package/lib/components/editor/command-center/TextSearchCommand.d.ts.map +1 -0
  73. package/lib/components/editor/command-center/TextSearchCommand.js +50 -0
  74. package/lib/components/editor/command-center/TextSearchCommand.js.map +1 -0
  75. package/lib/components/editor/edit-panel/DiagramEditor.d.ts +23 -0
  76. package/lib/components/editor/edit-panel/DiagramEditor.d.ts.map +1 -0
  77. package/lib/components/editor/edit-panel/DiagramEditor.js +71 -0
  78. package/lib/components/editor/edit-panel/DiagramEditor.js.map +1 -0
  79. package/lib/components/editor/edit-panel/EditPanel.d.ts +21 -0
  80. package/lib/components/editor/edit-panel/EditPanel.d.ts.map +1 -0
  81. package/lib/components/editor/edit-panel/EditPanel.js +55 -0
  82. package/lib/components/editor/edit-panel/EditPanel.js.map +1 -0
  83. package/lib/components/editor/edit-panel/FileEditor.d.ts +23 -0
  84. package/lib/components/editor/edit-panel/FileEditor.d.ts.map +1 -0
  85. package/lib/components/editor/edit-panel/FileEditor.js +114 -0
  86. package/lib/components/editor/edit-panel/FileEditor.js.map +1 -0
  87. package/lib/components/editor/shared/ConceptIconUtils.d.ts +17 -0
  88. package/lib/components/editor/shared/ConceptIconUtils.d.ts.map +1 -0
  89. package/lib/components/editor/shared/ConceptIconUtils.js +50 -0
  90. package/lib/components/editor/shared/ConceptIconUtils.js.map +1 -0
  91. package/lib/components/editor/side-bar/ConceptTreeExplorer.d.ts +24 -0
  92. package/lib/components/editor/side-bar/ConceptTreeExplorer.d.ts.map +1 -0
  93. package/lib/components/editor/side-bar/ConceptTreeExplorer.js +165 -0
  94. package/lib/components/editor/side-bar/ConceptTreeExplorer.js.map +1 -0
  95. package/lib/components/editor/side-bar/DirectoryTreeExplorer.d.ts +20 -0
  96. package/lib/components/editor/side-bar/DirectoryTreeExplorer.d.ts.map +1 -0
  97. package/lib/components/editor/side-bar/DirectoryTreeExplorer.js +142 -0
  98. package/lib/components/editor/side-bar/DirectoryTreeExplorer.js.map +1 -0
  99. package/lib/components/editor/side-bar/SideBar.d.ts +23 -0
  100. package/lib/components/editor/side-bar/SideBar.d.ts.map +1 -0
  101. package/lib/components/editor/side-bar/SideBar.js +40 -0
  102. package/lib/components/editor/side-bar/SideBar.js.map +1 -0
  103. package/lib/extensions.css +17 -0
  104. package/lib/extensions.css.map +1 -0
  105. package/lib/index.css +17 -0
  106. package/lib/index.css.map +1 -0
  107. package/lib/index.d.ts +22 -0
  108. package/lib/index.d.ts.map +1 -0
  109. package/lib/index.js +39 -0
  110. package/lib/index.js.map +1 -0
  111. package/lib/package.json +85 -0
  112. package/lib/server/PureServerClient.d.ts +55 -0
  113. package/lib/server/PureServerClient.d.ts.map +1 -0
  114. package/lib/server/PureServerClient.js +120 -0
  115. package/lib/server/PureServerClient.js.map +1 -0
  116. package/lib/server/models/Command.d.ts +24 -0
  117. package/lib/server/models/Command.d.ts.map +1 -0
  118. package/lib/server/models/Command.js +35 -0
  119. package/lib/server/models/Command.js.map +1 -0
  120. package/lib/server/models/ConceptTree.d.ts +76 -0
  121. package/lib/server/models/ConceptTree.d.ts.map +1 -0
  122. package/lib/server/models/ConceptTree.js +116 -0
  123. package/lib/server/models/ConceptTree.js.map +1 -0
  124. package/lib/server/models/DiagramInfo.d.ts +144 -0
  125. package/lib/server/models/DiagramInfo.d.ts.map +1 -0
  126. package/lib/server/models/DiagramInfo.js +478 -0
  127. package/lib/server/models/DiagramInfo.js.map +1 -0
  128. package/lib/server/models/DirectoryTree.d.ts +37 -0
  129. package/lib/server/models/DirectoryTree.d.ts.map +1 -0
  130. package/lib/server/models/DirectoryTree.js +70 -0
  131. package/lib/server/models/DirectoryTree.js.map +1 -0
  132. package/lib/server/models/Execution.d.ts +100 -0
  133. package/lib/server/models/Execution.d.ts.map +1 -0
  134. package/lib/server/models/Execution.js +183 -0
  135. package/lib/server/models/Execution.js.map +1 -0
  136. package/lib/server/models/Initialization.d.ts +49 -0
  137. package/lib/server/models/Initialization.d.ts.map +1 -0
  138. package/lib/server/models/Initialization.js +64 -0
  139. package/lib/server/models/Initialization.js.map +1 -0
  140. package/lib/server/models/PureFile.d.ts +34 -0
  141. package/lib/server/models/PureFile.d.ts.map +1 -0
  142. package/lib/server/models/PureFile.js +56 -0
  143. package/lib/server/models/PureFile.js.map +1 -0
  144. package/lib/server/models/SearchEntry.d.ts +36 -0
  145. package/lib/server/models/SearchEntry.d.ts.map +1 -0
  146. package/lib/server/models/SearchEntry.js +63 -0
  147. package/lib/server/models/SearchEntry.js.map +1 -0
  148. package/lib/server/models/SourceInformation.d.ts +25 -0
  149. package/lib/server/models/SourceInformation.d.ts.map +1 -0
  150. package/lib/server/models/SourceInformation.js +35 -0
  151. package/lib/server/models/SourceInformation.js.map +1 -0
  152. package/lib/server/models/Test.d.ts +57 -0
  153. package/lib/server/models/Test.d.ts.map +1 -0
  154. package/lib/server/models/Test.js +92 -0
  155. package/lib/server/models/Test.js.map +1 -0
  156. package/lib/server/models/Usage.d.ts +31 -0
  157. package/lib/server/models/Usage.d.ts.map +1 -0
  158. package/lib/server/models/Usage.js +36 -0
  159. package/lib/server/models/Usage.js.map +1 -0
  160. package/lib/stores/ConceptTreeState.d.ts +34 -0
  161. package/lib/stores/ConceptTreeState.d.ts.map +1 -0
  162. package/lib/stores/ConceptTreeState.js +117 -0
  163. package/lib/stores/ConceptTreeState.js.map +1 -0
  164. package/lib/stores/DiagramEditorState.d.ts +40 -0
  165. package/lib/stores/DiagramEditorState.d.ts.map +1 -0
  166. package/lib/stores/DiagramEditorState.js +90 -0
  167. package/lib/stores/DiagramEditorState.js.map +1 -0
  168. package/lib/stores/DirectoryTreeState.d.ts +35 -0
  169. package/lib/stores/DirectoryTreeState.d.ts.map +1 -0
  170. package/lib/stores/DirectoryTreeState.js +119 -0
  171. package/lib/stores/DirectoryTreeState.js.map +1 -0
  172. package/lib/stores/EditorConfig.d.ts +25 -0
  173. package/lib/stores/EditorConfig.d.ts.map +1 -0
  174. package/lib/stores/EditorConfig.js +27 -0
  175. package/lib/stores/EditorConfig.js.map +1 -0
  176. package/lib/stores/EditorStore.d.ts +102 -0
  177. package/lib/stores/EditorStore.d.ts.map +1 -0
  178. package/lib/stores/EditorStore.js +761 -0
  179. package/lib/stores/EditorStore.js.map +1 -0
  180. package/lib/stores/EditorTabManagerState.d.ts +31 -0
  181. package/lib/stores/EditorTabManagerState.d.ts.map +1 -0
  182. package/lib/stores/EditorTabManagerState.js +62 -0
  183. package/lib/stores/EditorTabManagerState.js.map +1 -0
  184. package/lib/stores/FileEditorState.d.ts +37 -0
  185. package/lib/stores/FileEditorState.d.ts.map +1 -0
  186. package/lib/stores/FileEditorState.js +99 -0
  187. package/lib/stores/FileEditorState.js.map +1 -0
  188. package/lib/stores/LegendPureIDEApplicationPlugin.d.ts +26 -0
  189. package/lib/stores/LegendPureIDEApplicationPlugin.d.ts.map +1 -0
  190. package/lib/stores/LegendPureIDEApplicationPlugin.js +27 -0
  191. package/lib/stores/LegendPureIDEApplicationPlugin.js.map +1 -0
  192. package/lib/stores/LegendPureIDEBaseStore.d.ts +25 -0
  193. package/lib/stores/LegendPureIDEBaseStore.d.ts.map +1 -0
  194. package/lib/stores/LegendPureIDEBaseStore.js +25 -0
  195. package/lib/stores/LegendPureIDEBaseStore.js.map +1 -0
  196. package/lib/stores/LegendPureIDECommand.d.ts +32 -0
  197. package/lib/stores/LegendPureIDECommand.d.ts.map +1 -0
  198. package/lib/stores/LegendPureIDECommand.js +82 -0
  199. package/lib/stores/LegendPureIDECommand.js.map +1 -0
  200. package/lib/stores/SearchCommandState.d.ts +28 -0
  201. package/lib/stores/SearchCommandState.d.ts.map +1 -0
  202. package/lib/stores/SearchCommandState.js +53 -0
  203. package/lib/stores/SearchCommandState.js.map +1 -0
  204. package/lib/stores/SearchResultState.d.ts +43 -0
  205. package/lib/stores/SearchResultState.d.ts.map +1 -0
  206. package/lib/stores/SearchResultState.js +92 -0
  207. package/lib/stores/SearchResultState.js.map +1 -0
  208. package/lib/stores/TestRunnerState.d.ts +87 -0
  209. package/lib/stores/TestRunnerState.d.ts.map +1 -0
  210. package/lib/stores/TestRunnerState.js +336 -0
  211. package/lib/stores/TestRunnerState.js.map +1 -0
  212. package/lib/stores/TreeState.d.ts +42 -0
  213. package/lib/stores/TreeState.d.ts.map +1 -0
  214. package/lib/stores/TreeState.js +139 -0
  215. package/lib/stores/TreeState.js.map +1 -0
  216. package/package.json +85 -0
  217. package/src/application/LegendPureIDE.tsx +73 -0
  218. package/src/application/LegendPureIDEApplicationConfig.ts +58 -0
  219. package/src/application/LegendPureIDEPluginManager.ts +67 -0
  220. package/src/components/Core_LegendPureIDEApplicationPlugin.tsx +37 -0
  221. package/src/components/LegendPureIDEApplication.tsx +27 -0
  222. package/src/components/LegendPureIDEBaseStoreProvider.tsx +57 -0
  223. package/src/components/editor/ActivityBar.tsx +74 -0
  224. package/src/components/editor/Editor.tsx +180 -0
  225. package/src/components/editor/EditorStoreProvider.tsx +57 -0
  226. package/src/components/editor/StatusBar.tsx +95 -0
  227. package/src/components/editor/aux-panel/AuxiliaryPanel.tsx +155 -0
  228. package/src/components/editor/aux-panel/ConsolePanel.tsx +49 -0
  229. package/src/components/editor/aux-panel/SearchPanel.tsx +421 -0
  230. package/src/components/editor/aux-panel/TestRunnerPanel.tsx +455 -0
  231. package/src/components/editor/command-center/CreateNewDirectoryCommand.tsx +86 -0
  232. package/src/components/editor/command-center/CreateNewFileCommand.tsx +84 -0
  233. package/src/components/editor/command-center/FileSearchCommand.tsx +112 -0
  234. package/src/components/editor/command-center/TextSearchCommand.tsx +103 -0
  235. package/src/components/editor/edit-panel/DiagramEditor.tsx +108 -0
  236. package/src/components/editor/edit-panel/EditPanel.tsx +114 -0
  237. package/src/components/editor/edit-panel/FileEditor.tsx +156 -0
  238. package/src/components/editor/shared/ConceptIconUtils.tsx +78 -0
  239. package/src/components/editor/side-bar/ConceptTreeExplorer.tsx +401 -0
  240. package/src/components/editor/side-bar/DirectoryTreeExplorer.tsx +366 -0
  241. package/src/components/editor/side-bar/SideBar.tsx +51 -0
  242. package/src/index.tsx +46 -0
  243. package/src/server/PureServerClient.ts +299 -0
  244. package/src/server/models/Command.ts +40 -0
  245. package/src/server/models/ConceptTree.ts +152 -0
  246. package/src/server/models/DiagramInfo.ts +793 -0
  247. package/src/server/models/DirectoryTree.ts +100 -0
  248. package/src/server/models/Execution.ts +223 -0
  249. package/src/server/models/Initialization.ts +92 -0
  250. package/src/server/models/PureFile.ts +76 -0
  251. package/src/server/models/SearchEntry.ts +85 -0
  252. package/src/server/models/SourceInformation.ts +37 -0
  253. package/src/server/models/Test.ts +125 -0
  254. package/src/server/models/Usage.ts +49 -0
  255. package/src/stores/ConceptTreeState.ts +156 -0
  256. package/src/stores/DiagramEditorState.ts +150 -0
  257. package/src/stores/DirectoryTreeState.ts +168 -0
  258. package/src/stores/EditorConfig.ts +26 -0
  259. package/src/stores/EditorStore.ts +1087 -0
  260. package/src/stores/EditorTabManagerState.ts +74 -0
  261. package/src/stores/FileEditorState.ts +148 -0
  262. package/src/stores/LegendPureIDEApplicationPlugin.ts +30 -0
  263. package/src/stores/LegendPureIDEBaseStore.ts +36 -0
  264. package/src/stores/LegendPureIDECommand.ts +84 -0
  265. package/src/stores/SearchCommandState.ts +61 -0
  266. package/src/stores/SearchResultState.ts +131 -0
  267. package/src/stores/TestRunnerState.ts +470 -0
  268. package/src/stores/TreeState.ts +179 -0
  269. package/tsconfig.json +98 -0
@@ -0,0 +1,421 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { observer } from 'mobx-react-lite';
18
+ import type {
19
+ SearchResultCoordinate,
20
+ SearchResultEntry,
21
+ } from '../../../server/models/SearchEntry.js';
22
+ import {
23
+ FileCoordinate,
24
+ trimPathLeadingSlash,
25
+ } from '../../../server/models/PureFile.js';
26
+ import { flowResult } from 'mobx';
27
+ import {
28
+ SearchResultState,
29
+ UnmatchedFunctionExecutionResultState,
30
+ UnmatchExecutionResultState,
31
+ UsageResultState,
32
+ } from '../../../stores/SearchResultState.js';
33
+ import type {
34
+ CandidateWithPackageImported,
35
+ CandidateWithPackageNotImported,
36
+ } from '../../../server/models/Execution.js';
37
+ import { getUsageConceptLabel } from '../../../server/models/Usage.js';
38
+ import {
39
+ ArrowCircleRightIcon,
40
+ BlankPanelContent,
41
+ FileAltIcon,
42
+ PanelLoadingIndicator,
43
+ PlusIcon,
44
+ TimesIcon,
45
+ } from '@finos/legend-art';
46
+ import { useApplicationStore } from '@finos/legend-application';
47
+ import { useEditorStore } from '../EditorStoreProvider.js';
48
+
49
+ const SearchResultEntryDisplay = observer(
50
+ (props: {
51
+ searchState: SearchResultState;
52
+ searchEntry: SearchResultEntry;
53
+ }) => {
54
+ const { searchState, searchEntry } = props;
55
+ const editorStore = useEditorStore();
56
+ const applicationStore = useApplicationStore();
57
+ const goToResult =
58
+ (coordinate: SearchResultCoordinate): (() => void) =>
59
+ (): Promise<void> =>
60
+ flowResult(
61
+ editorStore.loadFile(
62
+ searchEntry.sourceId,
63
+ new FileCoordinate(
64
+ searchEntry.sourceId,
65
+ coordinate.startLine,
66
+ coordinate.startColumn,
67
+ ),
68
+ ),
69
+ ).catch(applicationStore.alertUnhandledError);
70
+ const dismissResultForFile = (): void =>
71
+ searchState.dismissSearchEntry(searchEntry);
72
+ const dismissCoordinate =
73
+ (coordinate: SearchResultCoordinate): (() => void) =>
74
+ (): void => {
75
+ searchEntry.dismissCoordinate(coordinate);
76
+ if (!searchEntry.coordinates.length) {
77
+ searchState.dismissSearchEntry(searchEntry);
78
+ }
79
+ };
80
+
81
+ return (
82
+ <div className="search-panel__entry">
83
+ <div className="search-panel__entry__header">
84
+ <div className="search-panel__entry__header__title">
85
+ <div className="search-panel__entry__header__title__label">
86
+ <FileAltIcon />
87
+ </div>
88
+ <div className="search-panel__entry__header__title__content">
89
+ {trimPathLeadingSlash(searchEntry.sourceId)}
90
+ </div>
91
+ </div>
92
+ <div className="search-panel__entry__header__actions">
93
+ <div className="search-panel__entry__header__action search-panel__entry__header__action--with-counter">
94
+ <div className="search-panel__entry__header__action__counter">
95
+ {searchEntry.coordinates.length}
96
+ </div>
97
+ </div>
98
+ <button
99
+ className="search-panel__entry__header__action search-panel__entry__header__action--hidden"
100
+ tabIndex={-1}
101
+ title="Dismiss"
102
+ onClick={dismissResultForFile}
103
+ >
104
+ <TimesIcon />
105
+ </button>
106
+ </div>
107
+ </div>
108
+ <div className="search-panel__entry__content">
109
+ {searchEntry.coordinates.map((coordinate) => (
110
+ <div
111
+ key={coordinate.uuid}
112
+ className="search-panel__entry__content__item"
113
+ >
114
+ <div
115
+ className="search-panel__entry__content__item__label search-panel__entry__content__item__label--full"
116
+ title="Go to Result"
117
+ onClick={goToResult(coordinate)}
118
+ >
119
+ {`line: ${coordinate.startLine} - column: ${coordinate.startColumn}`}
120
+ </div>
121
+ <div className="search-panel__entry__content__item__actions">
122
+ <button
123
+ className="search-panel__entry__content__item__action search-panel__entry__content__item__action--hidden"
124
+ tabIndex={-1}
125
+ title="Dismiss"
126
+ onClick={dismissCoordinate(coordinate)}
127
+ >
128
+ <TimesIcon />
129
+ </button>
130
+ </div>
131
+ </div>
132
+ ))}
133
+ </div>
134
+ </div>
135
+ );
136
+ },
137
+ );
138
+
139
+ const SearchResultDisplay = observer(
140
+ (props: { searchState: SearchResultState }) => {
141
+ const { searchState } = props;
142
+ const editorStore = useEditorStore();
143
+ if (!searchState.searchEntries.length) {
144
+ return (
145
+ <BlankPanelContent>{`No occurrences found for '${editorStore.textSearchCommandState.text}'`}</BlankPanelContent>
146
+ );
147
+ }
148
+ return (
149
+ <div className="search-panel__content">
150
+ <div className="search-panel__content__header">{`Showing ${searchState.numberOfResults} result(s) in ${searchState.numberOfFiles} files for '${editorStore.textSearchCommandState.text}'`}</div>
151
+ {searchState.searchEntries.map((searchEntry) => (
152
+ <SearchResultEntryDisplay
153
+ key={searchEntry.uuid}
154
+ searchState={searchState}
155
+ searchEntry={searchEntry}
156
+ />
157
+ ))}
158
+ </div>
159
+ );
160
+ },
161
+ );
162
+
163
+ const UsageResultDisplay = observer(
164
+ (props: { usageState: UsageResultState }) => {
165
+ const { usageState } = props;
166
+ if (!usageState.searchEntries.length) {
167
+ return (
168
+ <BlankPanelContent>{`No usages found for ${getUsageConceptLabel(
169
+ usageState.usageConcept,
170
+ )}`}</BlankPanelContent>
171
+ );
172
+ }
173
+ return (
174
+ <div className="search-panel__content">
175
+ <div className="search-panel__content__header">{`Showing ${
176
+ usageState.numberOfResults
177
+ } usages(s) in ${
178
+ usageState.numberOfFiles
179
+ } files for ${getUsageConceptLabel(usageState.usageConcept)}`}</div>
180
+ {usageState.searchEntries.map((searchEntry) => (
181
+ <SearchResultEntryDisplay
182
+ key={searchEntry.uuid}
183
+ searchState={usageState}
184
+ searchEntry={searchEntry}
185
+ />
186
+ ))}
187
+ </div>
188
+ );
189
+ },
190
+ );
191
+
192
+ const CandidateWithPackageImportedDisplay = observer(
193
+ (props: { candidate: CandidateWithPackageImported }) => {
194
+ const { candidate } = props;
195
+ const editorStore = useEditorStore();
196
+ const applicationStore = useApplicationStore();
197
+ const goToResult = (): void => {
198
+ flowResult(
199
+ editorStore.loadFile(
200
+ candidate.sourceID,
201
+ new FileCoordinate(
202
+ candidate.sourceID,
203
+ candidate.line,
204
+ candidate.column,
205
+ ),
206
+ ),
207
+ ).catch(applicationStore.alertUnhandledError);
208
+ };
209
+
210
+ return (
211
+ <div className="search-panel__entry__content__item">
212
+ <div
213
+ className="search-panel__entry__content__item__label__candidate"
214
+ title="Go to Result"
215
+ onClick={goToResult}
216
+ >
217
+ <div className="search-panel__entry__content__item__label__candidate-name">
218
+ {candidate.foundName}
219
+ </div>
220
+ <div className="search-panel__entry__content__item__label__candidate-location">
221
+ {`${trimPathLeadingSlash(candidate.sourceID)} [${candidate.line}:${
222
+ candidate.column
223
+ }]`}
224
+ </div>
225
+ </div>
226
+ <div className="search-panel__entry__content__item__actions">
227
+ <button
228
+ className="search-panel__entry__content__item__action"
229
+ tabIndex={-1}
230
+ title="Go to Result"
231
+ onClick={goToResult}
232
+ >
233
+ <ArrowCircleRightIcon />
234
+ </button>
235
+ </div>
236
+ </div>
237
+ );
238
+ },
239
+ );
240
+
241
+ const CandidateWithPackageNotImportedDisplay = observer(
242
+ (props: { candidate: CandidateWithPackageNotImported }) => {
243
+ const { candidate } = props;
244
+ const editorStore = useEditorStore();
245
+ const applicationStore = useApplicationStore();
246
+ const goToResult = (): void => {
247
+ flowResult(
248
+ editorStore.loadFile(
249
+ candidate.sourceID,
250
+ new FileCoordinate(
251
+ candidate.sourceID,
252
+ candidate.line,
253
+ candidate.column,
254
+ ),
255
+ ),
256
+ ).catch(applicationStore.alertUnhandledError);
257
+ };
258
+ const useCandidate = (): void => {
259
+ flowResult(
260
+ editorStore.updateFileUsingSuggestionCandidate(candidate),
261
+ ).catch(applicationStore.alertUnhandledError);
262
+ };
263
+
264
+ return (
265
+ <div className="search-panel__entry__content__item">
266
+ <div
267
+ className="search-panel__entry__content__item__label__candidate"
268
+ title="Add Suggested Import"
269
+ onClick={useCandidate}
270
+ >
271
+ <div className="search-panel__entry__content__item__label__candidate-name">
272
+ {candidate.foundName}
273
+ </div>
274
+ <div className="search-panel__entry__content__item__label__candidate-location">
275
+ {`${trimPathLeadingSlash(candidate.sourceID)} [${candidate.line}:${
276
+ candidate.column
277
+ }]`}
278
+ </div>
279
+ </div>
280
+ <div className="search-panel__entry__content__item__actions">
281
+ <button
282
+ className="search-panel__entry__content__item__action"
283
+ tabIndex={-1}
284
+ title="Go to Result"
285
+ onClick={goToResult}
286
+ >
287
+ <ArrowCircleRightIcon />
288
+ </button>
289
+ </div>
290
+ </div>
291
+ );
292
+ },
293
+ );
294
+
295
+ const UnmatchedFunctionExecutionResultDisplay = observer(
296
+ (props: { searchState: UnmatchedFunctionExecutionResultState }) => {
297
+ const { searchState } = props;
298
+ const result = searchState.result;
299
+
300
+ return (
301
+ <div className="search-panel__content">
302
+ {!result.candidatesWithPackageImported.length && (
303
+ <div className="search-panel__content__header">{`No functions, in packages already imported, match the function '${result.candidateName}'`}</div>
304
+ )}
305
+ {Boolean(result.candidatesWithPackageImported.length) && (
306
+ <>
307
+ <div className="search-panel__content__header">
308
+ {`These functions, in packages already imported, would match the function '${result.candidateName}' if you changed the parameters`}
309
+ </div>
310
+ <div className="search-panel__entry">
311
+ {result.candidatesWithPackageImported.map((candidate) => (
312
+ <CandidateWithPackageImportedDisplay
313
+ key={candidate.uuid}
314
+ candidate={candidate}
315
+ />
316
+ ))}
317
+ </div>
318
+ </>
319
+ )}
320
+ {!result.candidatesWithPackageNotImported.length && (
321
+ <div className="search-panel__content__header">{`No functions, in packages not imported, match the function '${result.candidateName}'`}</div>
322
+ )}
323
+ {Boolean(result.candidatesWithPackageNotImported.length) && (
324
+ <>
325
+ <div className="search-panel__content__header">
326
+ {`These functions, in packages not imported, match the function '${result.candidateName}'. Click on result to import the necessary package`}
327
+ </div>
328
+ <div className="search-panel__entry">
329
+ {result.candidatesWithPackageNotImported.map((candidate) => (
330
+ <CandidateWithPackageNotImportedDisplay
331
+ key={candidate.uuid}
332
+ candidate={candidate}
333
+ />
334
+ ))}
335
+ </div>
336
+ </>
337
+ )}
338
+ </div>
339
+ );
340
+ },
341
+ );
342
+
343
+ const UnmatchExecutionResultDisplay = observer(
344
+ (props: { searchState: UnmatchExecutionResultState }) => {
345
+ const { searchState } = props;
346
+ const result = searchState.result;
347
+
348
+ return (
349
+ <div className="search-panel__content">
350
+ {!result.candidates.length && (
351
+ <div className="search-panel__content__header">{`No possible matches found for '${result.candidateName}'`}</div>
352
+ )}
353
+ {Boolean(result.candidates.length) && (
354
+ <>
355
+ <div className="search-panel__content__header">
356
+ {`Found possible matches for '${result.candidateName}'. Click on result to import the necessary package`}
357
+ </div>
358
+ <div className="search-panel__entry">
359
+ {result.candidates.map((candidate) => (
360
+ <CandidateWithPackageNotImportedDisplay
361
+ key={candidate.uuid}
362
+ candidate={candidate}
363
+ />
364
+ ))}
365
+ </div>
366
+ </>
367
+ )}
368
+ </div>
369
+ );
370
+ },
371
+ );
372
+
373
+ export const SearchPanel = observer(() => {
374
+ const editorStore = useEditorStore();
375
+ return (
376
+ <div className="search-panel">
377
+ <PanelLoadingIndicator
378
+ isLoading={editorStore.textSearchCommandLoadingState.isInProgress}
379
+ />
380
+ {!editorStore.searchState && (
381
+ <BlankPanelContent>
382
+ <div className="auxiliary-panel__splash-screen">
383
+ <div className="auxiliary-panel__splash-screen__content">
384
+ <div className="auxiliary-panel__splash-screen__content__item">
385
+ <div className="auxiliary-panel__splash-screen__content__item__label">
386
+ Search something
387
+ </div>
388
+ <div className="auxiliary-panel__splash-screen__content__item__hot-keys">
389
+ <div className="hotkey__key">Ctrl</div>
390
+ <div className="hotkey__plus">
391
+ <PlusIcon />
392
+ </div>
393
+ <div className="hotkey__key">Shift</div>
394
+ <div className="hotkey__plus">
395
+ <PlusIcon />
396
+ </div>
397
+ <div className="hotkey__key">F</div>
398
+ </div>
399
+ </div>
400
+ </div>
401
+ </div>
402
+ </BlankPanelContent>
403
+ )}
404
+ {editorStore.searchState instanceof UsageResultState && (
405
+ <UsageResultDisplay usageState={editorStore.searchState} />
406
+ )}
407
+ {editorStore.searchState instanceof SearchResultState && (
408
+ <SearchResultDisplay searchState={editorStore.searchState} />
409
+ )}
410
+ {editorStore.searchState instanceof
411
+ UnmatchedFunctionExecutionResultState && (
412
+ <UnmatchedFunctionExecutionResultDisplay
413
+ searchState={editorStore.searchState}
414
+ />
415
+ )}
416
+ {editorStore.searchState instanceof UnmatchExecutionResultState && (
417
+ <UnmatchExecutionResultDisplay searchState={editorStore.searchState} />
418
+ )}
419
+ </div>
420
+ );
421
+ });