-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Show all opened traces - Show all available outputs for a trace Signed-off-by: Simon Delisle <simon.delisle@ericsson.com>
- Loading branch information
1 parent
f6a7b76
commit 8861810
Showing
8 changed files
with
316 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
.trace-explorer-container { | ||
display: grid; | ||
grid-template-columns: 100%; | ||
grid-template-rows: 1fr 1fr 1fr; | ||
grid-row-gap: 10px; | ||
} | ||
|
||
.trace-explorer-opened { | ||
grid-row-start: 1; | ||
display: grid; | ||
grid-template-columns: 100%; | ||
grid-template-rows: 25px 1fr; | ||
} | ||
|
||
.trace-explorer-files { | ||
grid-row-start: 2; | ||
display: grid; | ||
grid-template-columns: 100%; | ||
grid-template-rows: 25px 1fr; | ||
} | ||
|
||
.trace-explorer-analysis { | ||
grid-row-start: 3; | ||
display: grid; | ||
grid-template-columns: 100%; | ||
grid-template-rows: 25px 1fr; | ||
} | ||
|
||
.trace-explorer-panel-title { | ||
grid-row-start: 1; | ||
background-color: rgba(97, 97, 97, 0.5); | ||
color: white; | ||
text-align: center; | ||
line-height: 25px; | ||
} | ||
|
||
.trace-explorer-panel-content { | ||
grid-row-start: 2; | ||
border: 1px solid rgba(97, 97, 97, 0.5); | ||
color: white; | ||
padding-inline-start: 5px; | ||
overflow-x: scroll; | ||
white-space: nowrap; | ||
} | ||
|
||
.trace-explorer-panel-content>ul { | ||
list-style-type: none; | ||
padding-inline-start: 0px; | ||
} | ||
|
||
.trace-list-container, .outputs-list-container { | ||
color: white; | ||
overflow-x: scroll; | ||
white-space: nowrap; | ||
} | ||
|
||
.trace-list-name, .outputs-list-name { | ||
font-weight: bold; | ||
} | ||
|
||
.trace-list-path, .outputs-list-description { | ||
color: rgb(160, 160, 160); | ||
} |
15 changes: 15 additions & 0 deletions
15
viewer-prototype/src/browser/trace-explorer/trace-explorer-contribution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { AbstractViewContribution } from "@theia/core/lib/browser/shell/view-contribution"; | ||
import { TraceExplorerWidget, TRACE_EXPLORER_ID, TRACE_EXPLORER_LABEL } from "./trace-explorer-widget"; | ||
|
||
export class TraceExplorerContribution extends AbstractViewContribution<TraceExplorerWidget> { | ||
constructor() { | ||
super({ | ||
widgetId: TRACE_EXPLORER_ID, | ||
widgetName: TRACE_EXPLORER_LABEL, | ||
defaultWidgetOptions: { | ||
area: 'left' | ||
}, | ||
toggleCommandId: 'trace-explorer:toggle' | ||
}); | ||
} | ||
} |
150 changes: 150 additions & 0 deletions
150
viewer-prototype/src/browser/trace-explorer/trace-explorer-widget.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
import { injectable, inject } from 'inversify'; | ||
import { ReactWidget } from '@theia/core/lib/browser/widgets/react-widget'; | ||
import * as React from 'react'; | ||
import { TraceManager } from '../../common/trace-manager'; | ||
import { Trace } from 'tsp-typescript-client/lib/models/trace'; | ||
import { List, ListRowProps } from 'react-virtualized'; | ||
import { OutputDescriptor } from 'tsp-typescript-client/lib/models/output-descriptor'; | ||
|
||
export const TRACE_EXPLORER_ID = 'trace-explorer'; | ||
export const TRACE_EXPLORER_LABEL = 'Trace Explorer'; | ||
|
||
@injectable() | ||
export class TraceExplorerWidget extends ReactWidget { | ||
private OPENED_TRACE_TITLE: string = 'Opened traces'; | ||
private FILE_NAVIGATOR_TITLE: string = 'File navigator'; | ||
private ANALYSIS_TITLE: string = 'Available analysis'; | ||
|
||
private openedTraces: Array<Trace> = new Array(); | ||
private availableOutputDescriptors: Array<OutputDescriptor> = new Array(); | ||
|
||
constructor( | ||
@inject(TraceManager) private traceManager: TraceManager, | ||
) { | ||
super(); | ||
this.id = TRACE_EXPLORER_ID; | ||
this.title.label = TRACE_EXPLORER_LABEL; | ||
this.toDispose.push(traceManager.traceOpenedSignal(trace => this.onTraceOpened(trace))); | ||
this.toDispose.push(traceManager.traceClosedSignal(trace => this.onTraceClosed(trace))); | ||
this.initialize(); | ||
} | ||
|
||
private onTraceOpened(openedTrace: Trace) { | ||
this.updateOpenedTraces(); | ||
this.updateAvailableAnalysis(openedTrace); | ||
} | ||
|
||
private onTraceClosed(closedTrace: Trace) { | ||
this.updateOpenedTraces(); | ||
this.updateAvailableAnalysis(undefined); | ||
} | ||
|
||
async initialize(): Promise<void> { | ||
this.updateOpenedTraces(); | ||
this.updateAvailableAnalysis(undefined); | ||
} | ||
|
||
protected render(): React.ReactNode { | ||
this.updateOpenedTraces = this.updateOpenedTraces.bind(this); | ||
this.updateAvailableAnalysis = this.updateAvailableAnalysis.bind(this); | ||
this.traceRowRenderer = this.traceRowRenderer.bind(this); | ||
this.outputsRowRenderer = this.outputsRowRenderer.bind(this); | ||
return <div className='trace-explorer-container'> | ||
<div className='trace-explorer-opened'> | ||
<div className='trace-explorer-panel-title' onClick={this.updateOpenedTraces}> | ||
{this.OPENED_TRACE_TITLE} | ||
</div> | ||
<div className='trace-explorer-panel-content'> | ||
<List | ||
height={300} | ||
width={300} | ||
rowCount={this.openedTraces.length} | ||
rowHeight={50} | ||
rowRenderer={this.traceRowRenderer}/> | ||
</div> | ||
</div> | ||
<div className='trace-explorer-files'> | ||
<div className='trace-explorer-panel-title'> | ||
{this.FILE_NAVIGATOR_TITLE} | ||
</div> | ||
<div className='trace-explorer-panel-content'> | ||
{'List of files'} | ||
</div> | ||
</div> | ||
<div className='trace-explorer-analysis'> | ||
<div className='trace-explorer-panel-title'> | ||
{this.ANALYSIS_TITLE} | ||
</div> | ||
<div className='trace-explorer-panel-content'> | ||
<List | ||
height={300} | ||
width={300} | ||
rowCount={this.availableOutputDescriptors.length} | ||
rowHeight={50} | ||
rowRenderer={this.outputsRowRenderer} /> | ||
</div> | ||
</div> | ||
</div>; | ||
} | ||
|
||
private traceRowRenderer(props: ListRowProps): React.ReactNode { | ||
let traceName = ''; | ||
let tracePath = ''; | ||
if (this.openedTraces && this.openedTraces.length && props.index < this.openedTraces.length) { | ||
traceName = this.openedTraces[props.index].name; | ||
tracePath = this.openedTraces[props.index].path; | ||
} | ||
return <div className='trace-list-container' key={props.key} style={props.style}> | ||
<div className='trace-list-name'> | ||
{traceName} | ||
</div> | ||
<div className='trace-list-path'> | ||
{tracePath} | ||
</div> | ||
</div>; | ||
} | ||
|
||
private outputsRowRenderer(props: ListRowProps): React.ReactNode { | ||
let outputName = ''; | ||
let outputDescription = ''; | ||
if (this.availableOutputDescriptors && this.availableOutputDescriptors.length && props.index < this.availableOutputDescriptors.length) { | ||
outputName = this.availableOutputDescriptors[props.index].name; | ||
outputDescription = this.availableOutputDescriptors[props.index].description; | ||
} | ||
return <div className='outputs-list-container' key={props.key} style={props.style}> | ||
<div className='outputs-list-name'> | ||
{outputName} | ||
</div> | ||
<div className='outputs-list-description'> | ||
{outputDescription} | ||
</div> | ||
</div>; | ||
} | ||
|
||
private async updateOpenedTraces() { | ||
this.openedTraces = this.traceManager.getOpenTraces(); | ||
this.update(); | ||
} | ||
|
||
private async updateAvailableAnalysis(trace: Trace | undefined) { | ||
this.availableOutputDescriptors = new Array(); | ||
if (trace) { | ||
this.availableOutputDescriptors = await this.getOutputDescriptors(trace); | ||
} else { | ||
if (this.openedTraces.length) { | ||
this.availableOutputDescriptors = await this.getOutputDescriptors(this.openedTraces[0]); | ||
} | ||
} | ||
|
||
this.update(); | ||
} | ||
|
||
private async getOutputDescriptors(trace: Trace): Promise<OutputDescriptor[]> { | ||
const outputDescriptors: OutputDescriptor[] = new Array(); | ||
const descriptors = await this.traceManager.getAvailableOutputs(trace.name); | ||
if (descriptors && descriptors.length) { | ||
outputDescriptors.push(...descriptors); | ||
} | ||
return outputDescriptors; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.