Skip to content

Commit

Permalink
Repository formatted with prettier
Browse files Browse the repository at this point in the history
You can remove this commit from your 'git blame' history by seting up the
.git-blame-ignore-revs file with your enviormnemts Git CLI.

This is outlined in CONTRIBUTING.md.

Signed-off-by: Will Yang <[email protected]>
  • Loading branch information
williamsyang-work authored and hriday-panchasara committed Aug 28, 2023
1 parent 39ff536 commit d9243b9
Show file tree
Hide file tree
Showing 38 changed files with 2,351 additions and 2,101 deletions.
2 changes: 1 addition & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Code formatted w Prettier
d12683728c74866ea0bbea8b7847e91b122e220d
d12683728c74866ea0bbea8b7847e91b122e220d
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ file. Adding the SHA-1 of a commit to this file will make `git-blame` ignore tha

* For GitHub, this file is automatically detected and will ignore all the commits that are included in the file.
* With Git CLI, run `git blame --ignore-revs-file=.git-blame-ignore-revs <pathToSomeFile>` to ignore the commits.
<<<<<<< HEAD
* `git config --global blame.ignoreRevsFile .git-blame-ignore-revs` will automatically detect these files for every repository.
=======
>>>>>>> d126837 (Repository formatted with prettier)
## Contact

Expand Down
10 changes: 6 additions & 4 deletions vscode-trace-common/src/client/tsp-client-provider-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { VsCodeMessageManager } from '../messages/vscode-message-manager';
import { TraceServerUrlProvider } from '../server/trace-server-url-provider';

export class TspClientProvider implements ITspClientProvider {

private _tspClient: TspClient;
private _traceManager: TraceManager;
private _experimentManager: ExperimentManager;
Expand All @@ -16,16 +15,19 @@ export class TspClientProvider implements ITspClientProvider {
private _urlProvider: TraceServerUrlProvider;
private _listeners: ((tspClient: TspClient) => void)[];

constructor(traceServerUrl: string, signalHandler: VsCodeMessageManager | undefined, _urlProvider: TraceServerUrlProvider
constructor(
traceServerUrl: string,
signalHandler: VsCodeMessageManager | undefined,
_urlProvider: TraceServerUrlProvider
) {
this._tspClient = new TspClient(traceServerUrl);
this._traceManager = new TraceManager(this._tspClient);
this._experimentManager = new ExperimentManager(this._tspClient, this._traceManager);

this._signalHandler = signalHandler;
this._statusListener = ((status: boolean) => {
this._statusListener = (status: boolean) => {
this._signalHandler?.notifyConnection(status);
});
};
RestClient.addConnectionStatusListener(this._statusListener);
this._tspClient.checkHealth();

Expand Down
56 changes: 32 additions & 24 deletions vscode-trace-common/src/messages/vscode-message-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import JSONBigConfig from 'json-bigint';
import { TimeRangeUpdatePayload } from 'traceviewer-base/lib/signals/time-range-data-signal-payloads';

const JSONBig = JSONBigConfig({
useNativeBigInt: true,
useNativeBigInt: true
});

/* eslint-disable @typescript-eslint/no-explicit-any */
Expand Down Expand Up @@ -66,58 +66,63 @@ export const VSCODE_MESSAGES = {
SELECTION_RANGE_UPDATED: 'selectionRangeUpdated',
REQUEST_SELECTION_RANGE_CHANGE: 'requestSelectionRangeChange',
RESTORE_VIEW: 'restoreView',
RESTORE_COMPLETE: 'restoreComplete',
RESTORE_COMPLETE: 'restoreComplete'
};

export class VsCodeMessageManager extends Messages.MessageManager {
constructor() {
super();
}

addStatusMessage(messageKey: string, {text,
category = Messages.MessageCategory.SERVER_MESSAGE,
severity = Messages.MessageSeverity.INFO }: Messages.StatusMessage): void {
vscode.postMessage({command: VSCODE_MESSAGES.NEW_STATUS, data: {messageKey, text, category, severity }});
addStatusMessage(
messageKey: string,
{
text,
category = Messages.MessageCategory.SERVER_MESSAGE,
severity = Messages.MessageSeverity.INFO
}: Messages.StatusMessage
): void {
vscode.postMessage({ command: VSCODE_MESSAGES.NEW_STATUS, data: { messageKey, text, category, severity } });
}

removeStatusMessage(messageKey: string): void {
vscode.postMessage({command: VSCODE_MESSAGES.REMOVE_STATUS, data: { messageKey }});
vscode.postMessage({ command: VSCODE_MESSAGES.REMOVE_STATUS, data: { messageKey } });
}

notifyReady(): void {
vscode.postMessage({command: VSCODE_MESSAGES.WEBVIEW_READY});
vscode.postMessage({ command: VSCODE_MESSAGES.WEBVIEW_READY });
}

notifyConnection(serverStatus: boolean): void {
const status: string = JSON.stringify(serverStatus);
vscode.postMessage({command: VSCODE_MESSAGES.CONNECTION_STATUS, data: { status }});
vscode.postMessage({ command: VSCODE_MESSAGES.CONNECTION_STATUS, data: { status } });
}

/**************************************************************************
* Trace Explorer React APP
*************************************************************************/

openTrace(): void {
vscode.postMessage({command: VSCODE_MESSAGES.OPEN_TRACE});
vscode.postMessage({ command: VSCODE_MESSAGES.OPEN_TRACE });
}

updateOpenedTraces(numberOfOpenedTraces: number): void {
vscode.postMessage({command: VSCODE_MESSAGES.OPENED_TRACES_UPDATED, numberOfOpenedTraces});
vscode.postMessage({ command: VSCODE_MESSAGES.OPENED_TRACES_UPDATED, numberOfOpenedTraces });
}

reOpenTrace(experiment: Experiment): void {
const wrapper: string = JSONBig.stringify(experiment);
vscode.postMessage({command: VSCODE_MESSAGES.RE_OPEN_TRACE, data: {wrapper}});
vscode.postMessage({ command: VSCODE_MESSAGES.RE_OPEN_TRACE, data: { wrapper } });
}

closeTrace(experiment: Experiment): void {
const wrapper: string = JSONBig.stringify(experiment);
vscode.postMessage({command: VSCODE_MESSAGES.CLOSE_TRACE, data: {wrapper}});
vscode.postMessage({ command: VSCODE_MESSAGES.CLOSE_TRACE, data: { wrapper } });
}

deleteTrace(experiment: Experiment): void {
const wrapper: string = JSONBig.stringify(experiment);
vscode.postMessage({command: VSCODE_MESSAGES.DELETE_TRACE, data: {wrapper}});
vscode.postMessage({ command: VSCODE_MESSAGES.DELETE_TRACE, data: { wrapper } });
}

experimentSelected(experiment?: Experiment | undefined): void {
Expand All @@ -139,11 +144,14 @@ export class VsCodeMessageManager extends Messages.MessageManager {
outputAdded(payload: OutputAddedSignalPayload): void {
const expWrapper = JSONBig.stringify(payload.getExperiment());
const descWrapper = JSONBig.stringify(payload.getOutputDescriptor());
vscode.postMessage({command: VSCODE_MESSAGES.OUTPUT_ADDED, data: {data: expWrapper, descriptor: descWrapper }});
vscode.postMessage({
command: VSCODE_MESSAGES.OUTPUT_ADDED,
data: { data: expWrapper, descriptor: descWrapper }
});
}

propertiesUpdated(properties: { [key: string]: string }): void {
vscode.postMessage({command: VSCODE_MESSAGES.UPDATE_PROPERTIES, data: {properties}});
vscode.postMessage({ command: VSCODE_MESSAGES.UPDATE_PROPERTIES, data: { properties } });
}

viewRangeUpdated(payload: TimeRangeUpdatePayload): void {
Expand All @@ -161,27 +169,27 @@ export class VsCodeMessageManager extends Messages.MessageManager {
vscode.postMessage({ command: VSCODE_MESSAGES.REQUEST_SELECTION_RANGE_CHANGE, data });
}

saveAsCSV(payload: {traceId: string, data: string}): void {
vscode.postMessage({command: VSCODE_MESSAGES.SAVE_AS_CSV, payload});
saveAsCSV(payload: { traceId: string; data: string }): void {
vscode.postMessage({ command: VSCODE_MESSAGES.SAVE_AS_CSV, payload });
}

fetchMarkerCategories(payload: Map<string, { categoryCount: number, toggleInd: boolean }>): void {
fetchMarkerCategories(payload: Map<string, { categoryCount: number; toggleInd: boolean }>): void {
const wrapper: string = JSON.stringify([...payload]);
vscode.postMessage({command: VSCODE_MESSAGES.SHOW_MARKER_CATEGORIES, data: {wrapper}});
vscode.postMessage({ command: VSCODE_MESSAGES.SHOW_MARKER_CATEGORIES, data: { wrapper } });
}

fetchMarkerSets(payload: Map<string, { marker: MarkerSet, enabled: boolean }>): void {
fetchMarkerSets(payload: Map<string, { marker: MarkerSet; enabled: boolean }>): void {
const wrapper: string = JSON.stringify([...payload]);
vscode.postMessage({command: VSCODE_MESSAGES.SEND_MARKER_SETS, data: {wrapper}});
vscode.postMessage({ command: VSCODE_MESSAGES.SEND_MARKER_SETS, data: { wrapper } });
}

setMarkerSetsContext(context: boolean): void {
const status: string = JSON.stringify(context);
vscode.postMessage({command: VSCODE_MESSAGES.MARKER_SETS_CONTEXT, data: { status }});
vscode.postMessage({ command: VSCODE_MESSAGES.MARKER_SETS_CONTEXT, data: { status } });
}

setMarkerCategoriesContext(context: boolean): void {
const status: string = JSON.stringify(context);
vscode.postMessage({command: VSCODE_MESSAGES.MARKER_CATEGORIES_CONTEXT, data: { status }});
vscode.postMessage({ command: VSCODE_MESSAGES.MARKER_CATEGORIES_CONTEXT, data: { status } });
}
}
26 changes: 13 additions & 13 deletions vscode-trace-common/src/server/trace-server-url-provider.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export class TraceServerUrlProvider {
private onDidChangeConfigurationHandlers: ((url: string) => void)[] = [];

public updateTraceServerUrl = (newUrl: string): void => {
this.onDidChangeConfigurationHandlers.forEach(handler => {
handler(newUrl);
});
};

public onTraceServerUrlChange(handler: ((url: string) => void)): void{
this.onDidChangeConfigurationHandlers.push(handler);
}
}
export class TraceServerUrlProvider {
private onDidChangeConfigurationHandlers: ((url: string) => void)[] = [];

public updateTraceServerUrl = (newUrl: string): void => {
this.onDidChangeConfigurationHandlers.forEach(handler => {
handler(newUrl);
});
};

public onTraceServerUrlChange(handler: (url: string) => void): void {
this.onDidChangeConfigurationHandlers.push(handler);
}
}
1 change: 0 additions & 1 deletion vscode-trace-common/src/signals/vscode-signal-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ export function convertSignalTraces(signalExperiment: Experiment): Trace[] {
});
return traces;
}

57 changes: 32 additions & 25 deletions vscode-trace-extension/src/common/trace-message.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import * as vscode from 'vscode';
import * as Messages from 'traceviewer-base/lib/message-manager';

const statusBarItem: { [ key: string ]: vscode.StatusBarItem} = {};
const statusBarItem: { [key: string]: vscode.StatusBarItem } = {};

const statusPerExperiment: { [ key: string]: { [key: string]: string}} = {};
const statusPerExperiment: { [key: string]: { [key: string]: string } } = {};

function getOrCreateBarItem(key: string, category: Messages.MessageCategory) {
const statusBar = getBarItem(key);
if (statusBar) {
return statusBar;
}
const newBarItem = vscode.window.createStatusBarItem(category === Messages.MessageCategory.TRACE_CONTEXT ? vscode.StatusBarAlignment.Left : vscode.StatusBarAlignment.Right);
const newBarItem = vscode.window.createStatusBarItem(
category === Messages.MessageCategory.TRACE_CONTEXT
? vscode.StatusBarAlignment.Left
: vscode.StatusBarAlignment.Right
);
statusBarItem[key] = newBarItem;
return newBarItem;
}
Expand All @@ -31,33 +35,36 @@ function removeStatusForPanel(panelName: string, messageKey: string) {
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export function handleStatusMessage(panelName: string, {
text = '',
category = Messages.MessageCategory.SERVER_MESSAGE,
severity = Messages.MessageSeverity.INFO,
messageKey = ''
}): void {
export function handleStatusMessage(
panelName: string,
{
text = '',
category = Messages.MessageCategory.SERVER_MESSAGE,
severity = Messages.MessageSeverity.INFO,
messageKey = ''
}
): void {
switch (severity) {
case Messages.MessageSeverity.ERROR:
vscode.window.showErrorMessage(text);
return;
case Messages.MessageSeverity.WARNING:
case Messages.MessageSeverity.INFO:
const barItem = getOrCreateBarItem(messageKey, category);
barItem.text = text;
barItem.show();
if (messageKey) {
setStatusForPanel(panelName, messageKey, text);
}
return;
case Messages.MessageSeverity.DEBUG:
console.log('Status message ' + messageKey + '(' + category + '): ' + text);
return;
case Messages.MessageSeverity.ERROR:
vscode.window.showErrorMessage(text);
return;
case Messages.MessageSeverity.WARNING:
case Messages.MessageSeverity.INFO:
const barItem = getOrCreateBarItem(messageKey, category);
barItem.text = text;
barItem.show();
if (messageKey) {
setStatusForPanel(panelName, messageKey, text);
}
return;
case Messages.MessageSeverity.DEBUG:
console.log('Status message ' + messageKey + '(' + category + '): ' + text);
return;
}
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export function handleRemoveMessage(panelName: string, {messageKey = '' }): void {
export function handleRemoveMessage(panelName: string, { messageKey = '' }): void {
const barItem = getBarItem(messageKey);
if (barItem) {
barItem.text = '';
Expand Down
Loading

0 comments on commit d9243b9

Please sign in to comment.