Skip to content

Commit bcefa6a

Browse files
committed
classify UserActions into 3 types
* fix `UserAction` helper functions * rename `UserEvent` to `UserAction`
1 parent 28494fd commit bcefa6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+407
-421
lines changed

dbux-code/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,15 +482,15 @@
482482
}
483483
},
484484
{
485-
"command": "dbuxDataFlowView.setSearchMode.ByAccessId",
485+
"command": "dbuxDataFlowView.nextSearchMode.ByAccessId",
486486
"title": "Search by: accessId",
487487
"icon": {
488488
"light": "resources/light/variable.svg",
489489
"dark": "resources/dark/variable.svg"
490490
}
491491
},
492492
{
493-
"command": "dbuxDataFlowView.setSearchMode.ByValueId",
493+
"command": "dbuxDataFlowView.nextSearchMode.ByValueId",
494494
"title": "Search by: valueId",
495495
"icon": {
496496
"light": "resources/light/brackets.svg",
@@ -642,7 +642,7 @@
642642
}
643643
},
644644
{
645-
"command": "dbux.deleteUserEvents",
645+
"command": "dbux.deleteUserActions",
646646
"title": "Dbux Dev: Delete all user events"
647647
},
648648
{
@@ -972,12 +972,12 @@
972972
"group": "navigation@20"
973973
},
974974
{
975-
"command": "dbuxDataFlowView.setSearchMode.ByAccessId",
975+
"command": "dbuxDataFlowView.nextSearchMode.ByAccessId",
976976
"when": "view == dbuxDataFlowView && dbuxDataFlowView.context.searchModeName == ByAccessId",
977977
"group": "navigation@1"
978978
},
979979
{
980-
"command": "dbuxDataFlowView.setSearchMode.ByValueId",
980+
"command": "dbuxDataFlowView.nextSearchMode.ByValueId",
981981
"when": "view == dbuxDataFlowView && dbuxDataFlowView.context.searchModeName == ByValueId",
982982
"group": "navigation@1"
983983
},
@@ -1248,7 +1248,7 @@
12481248
"when": "dbux.context.activated"
12491249
},
12501250
{
1251-
"command": "dbux.deleteUserEvents",
1251+
"command": "dbux.deleteUserActions",
12521252
"when": "dbux.context.activated && dbux.context.nodeEnv == development"
12531253
},
12541254
{
@@ -1328,11 +1328,11 @@
13281328
"when": "false"
13291329
},
13301330
{
1331-
"command": "dbuxDataFlowView.setSearchMode.ByAccessId",
1331+
"command": "dbuxDataFlowView.nextSearchMode.ByAccessId",
13321332
"when": "false"
13331333
},
13341334
{
1335-
"command": "dbuxDataFlowView.setSearchMode.ByValueId",
1335+
"command": "dbuxDataFlowView.nextSearchMode.ByValueId",
13361336
"when": "false"
13371337
},
13381338
{

dbux-code/src/codeDeco/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { renderTraceDecorations, clearTraceDecorations } from './traceDecorator'
1010
import { initTraceDecorators } from './traceDecoConfig';
1111
import { initEditedWarning } from './editedWarning';
1212
import { set as mementoSet, get as mementoGet } from '../memento';
13-
import { emitShowHideDecorationAction } from '../userEvents';
13+
import { emitShowHideDecorationAction } from '../userActions';
1414
// import DataProvider from '@dbux/data/src/DataProvider';
1515
// import StaticContextType from '@dbux/common/src/types/constants/StaticContextType';
1616

dbux-code/src/codeUtil/treeView/BaseTreeViewNodeProvider.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import NestedError from '@dbux/common/src/NestedError';
66
import { throttle } from '@dbux/common/src/util/scheduling';
77
import { getThemeResourcePath } from '../codePath';
88
import { registerCommand } from '../../commands/commandUtil';
9-
import { emitTreeViewAction, emitTreeViewCollapseChangeAction } from '../../userEvents';
9+
import { emitTreeViewAction, emitTreeViewCollapseChangeAction } from '../../userActions';
1010
import BaseTreeViewNode from './BaseTreeViewNode';
1111

1212
/** @typedef { import("./BaseTreeViewNode").default } BaseTreeViewNode */
@@ -184,7 +184,6 @@ export default class BaseTreeViewNodeProvider {
184184

185185
// record user action
186186
const { treeViewName } = this;
187-
const action = ''; // not a button click
188187
const nodeId = node.id;
189188
const args = {
190189
description: node.description,
@@ -195,7 +194,7 @@ export default class BaseTreeViewNodeProvider {
195194
// trigger event handlers
196195
evtHandler.call(this, node);
197196
this.handleNodeCollapsibleStateChanged(node);
198-
emitTreeViewCollapseChangeAction(treeViewName, action, nodeId, node.label, node.collapseChangeUserActionType, args);
197+
emitTreeViewCollapseChangeAction(treeViewName, nodeId, node.label, node.collapseChangeUserActionType, args);
199198
}
200199

201200
handleExpanded(node) {
@@ -225,7 +224,6 @@ export default class BaseTreeViewNodeProvider {
225224
*/
226225
handleClick = async (node) => {
227226
const { treeViewName } = this;
228-
const action = ''; // not a button click
229227
const nodeId = node.id;
230228
const args = {
231229
description: node.description,
@@ -237,7 +235,7 @@ export default class BaseTreeViewNodeProvider {
237235
await node.handleClick?.();
238236
const { clickUserActionType } = node;
239237
if (clickUserActionType !== false) {
240-
emitTreeViewAction(treeViewName, action, nodeId, node.label, clickUserActionType, args);
238+
emitTreeViewAction(treeViewName, nodeId, node.label, clickUserActionType, args);
241239
}
242240
}
243241
catch (err) {

dbux-code/src/codeUtil/treeView/TraceContainerNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { TreeItemCollapsibleState } from 'vscode';
22
import allApplications from '@dbux/data/src/applications/allApplications';
33
import { makeContextLabel, makeTraceLabel } from '@dbux/data/src/helpers/makeLabels';
44
import traceSelection from '@dbux/data/src/traceSelection';
5-
import { emitTDExecutionGroupModeChangedAction } from '../../userEvents';
5+
import { emitTDExecutionGroupModeChangedAction } from '../../userActions';
66
import BaseTreeViewNode from './BaseTreeViewNode';
77
import TraceNode from './TraceNode';
88

dbux-code/src/commands/applicationsViewCommands.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { newLogger } from '@dbux/common/src/log/logger';
22
import { registerCommand } from './commandUtil';
33
import { showTextDocument } from '../codeUtil/codeNav';
44
import { initRuntimeServer, stopRuntimeServer } from '../net/SocketServer';
5-
import { emitShowApplicationEntryFileAction } from '../userEvents';
5+
import { emitShowApplicationEntryFileAction } from '../userActions';
66

77
// eslint-disable-next-line no-unused-vars
88
const { log, debug, warn, error: logError } = newLogger('Commands');
@@ -21,9 +21,10 @@ export function initApplicationsViewCommands(context) {
2121
registerCommand(context,
2222
'dbuxApplicationsView.showEntryPoint',
2323
async (node) => {
24-
const filePath = node.application.entryPointPath;
25-
await showTextDocument(filePath);
26-
emitShowApplicationEntryFileAction(filePath);
24+
const { application } = node;
25+
const { entryPointPath } = application;
26+
await showTextDocument(entryPointPath);
27+
emitShowApplicationEntryFileAction(application, entryPointPath);
2728
}
2829
);
2930
}

dbux-code/src/commands/dataFlowViewCommands.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { emitDataFlowViewFilterModeChangedAction, emitDataFlowViewSearchModeChangedAction } from '../userEvents';
1+
import { emitDataFlowViewFilterModeChangedAction, emitDataFlowViewSearchModeChangedAction } from '../userActions';
22
import DataFlowFilterModeType from '../dataFlowView/DataFlowFilterModeType';
33
import DataFlowSearchModeType from '../dataFlowView/DataFlowSearchModeType';
44
import { registerCommand } from './commandUtil';
@@ -10,18 +10,18 @@ import { registerCommand } from './commandUtil';
1010
*/
1111
export function initDataFlowViewCommands(context, dataFlowViewController) {
1212
registerCommand(context,
13-
'dbuxDataFlowView.setSearchMode.ByAccessId',
13+
'dbuxDataFlowView.nextSearchMode.ByAccessId',
1414
(/* node */) => {
1515
dataFlowViewController.setSearchMode(DataFlowSearchModeType.nextValue(DataFlowSearchModeType.ByAccessId));
16-
emitDataFlowViewSearchModeChangedAction(DataFlowSearchModeType.ByAccessId);
16+
emitDataFlowViewSearchModeChangedAction(dataFlowViewController.searchMode);
1717
}
1818
);
1919

2020
registerCommand(context,
21-
'dbuxDataFlowView.setSearchMode.ByValueId',
21+
'dbuxDataFlowView.nextSearchMode.ByValueId',
2222
(/* node */) => {
2323
dataFlowViewController.setSearchMode(DataFlowSearchModeType.nextValue(DataFlowSearchModeType.ByValueId));
24-
emitDataFlowViewSearchModeChangedAction(DataFlowSearchModeType.ByValueId);
24+
emitDataFlowViewSearchModeChangedAction(dataFlowViewController.searchMode);
2525
}
2626
);
2727

dbux-code/src/commands/globalAnalysisViewCommands.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { nextMode } from '../globalAnalysisView/nodes/GlobalModulesNode';
22
import { showInformationMessage } from '../codeUtil/codeModals';
33
import searchController from '../search/searchController';
4-
import { emitShowErrorAction } from '../userEvents';
4+
import { emitTraceUserAction } from '../userActions';
55
import { registerCommand } from './commandUtil';
66

77
/** @typedef {import('../globalAnalysisView/GlobalAnalysisViewController').default} GlobalAnalysisViewController */
@@ -15,7 +15,7 @@ export function initGlobalAnalysisViewCommands(context, globalAnalysisViewContro
1515
async () => {
1616
const selectedNode = await globalAnalysisViewController.showError();
1717
if (selectedNode) {
18-
emitShowErrorAction(selectedNode.trace);
18+
emitTraceUserAction(selectedNode.trace);
1919
}
2020
}
2121
);

dbux-code/src/commands/projectCommands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { registerCommand } from './commandUtil';
77
import { chooseFile, showInformationMessage, showWarningMessage } from '../codeUtil/codeModals';
88
import { getCurrentResearch } from '../research/Research';
99
import { translate } from '../lang';
10-
import { emitAnnotateTraceAction, emitStopRunnerAction } from '../userEvents';
10+
import { emitAnnotateTraceAction, emitStopRunnerAction } from '../userActions';
1111
import { addProjectFolderToWorkspace } from '../codeUtil/workspaceUtil';
1212

1313
/** @typedef {import('../projectViews/projectViewsController').ProjectViewController} ProjectViewController */

dbux-code/src/commands/runCommands.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { initRuntimeServer } from '../net/SocketServer';
1010
import { installDbuxDependencies } from '../codeUtil/installUtil';
1111
import { initProjectView } from '../projectViews/projectViewsController';
1212
import { getNodePath } from '../codeUtil/codePath';
13-
import { emitRunFileAction } from '../userEvents';
13+
import { emitRunFileAction } from '../userActions';
1414

1515
// eslint-disable-next-line no-unused-vars
1616
const { log, debug, warn, error: logError } = newLogger('DBUX run file');

dbux-code/src/commands/userCommands.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { translate } from '../lang';
3030
import { getDefaultExportDirectory, getLogsDirectory } from '../codeUtil/codePath';
3131
import { runTaskWithProgressBar } from '../codeUtil/runTaskWithProgressBar';
3232
import searchController from '../search/searchController';
33-
import { emitSelectTraceAction, emitShowOutputChannelAction } from '../userEvents';
33+
import { emitTraceUserAction, emitShowOutputChannelAction } from '../userActions';
3434
import { runFile } from './runCommands';
3535

3636
// eslint-disable-next-line no-unused-vars
@@ -218,7 +218,7 @@ export function initUserCommands(extensionContext) {
218218
}
219219
else {
220220
traceSelection.selectTrace(trace);
221-
emitSelectTraceAction(trace, UserActionType.SelectTraceById, { userInput });
221+
emitTraceUserAction(UserActionType.SelectTraceById, trace, { userInput });
222222
}
223223
}
224224

@@ -249,11 +249,11 @@ export function initUserCommands(extensionContext) {
249249
return backend.containers.survey1.storeSurveyResult(data);
250250
});
251251

252-
registerCommand(extensionContext, 'dbux.deleteUserEvents', async () => {
252+
registerCommand(extensionContext, 'dbux.deleteUserActions', async () => {
253253
if (process.env.NODE_ENV === 'production') {
254254
throw new Error('This command is currently disabled in Production mode.');
255255
}
256-
await getProjectManager().deleteUserEvents();
256+
await getProjectManager().deleteUserActions();
257257
});
258258

259259
// ###########################################################################

0 commit comments

Comments
 (0)