Skip to content

Commit

Permalink
Follow recent tsp-typescript-client API additions for configurations
Browse files Browse the repository at this point in the history
- Use ProviderType enum instead of string for outputs
- Update API for global configuration
- Add new methods of ITspClient in TheiaRpcTspProxy

Signed-off-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
  • Loading branch information
bhufmann committed Nov 5, 2024
1 parent 0ae1fd4 commit 335ce43
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../../style/status-bar.css';
import { Layout, Responsive, WidthProvider } from 'react-grid-layout';
import { TimelineChart } from 'timeline-chart/lib/time-graph-model';
import { TimeGraphUnitController } from 'timeline-chart/lib/time-graph-unit-controller';
import { OutputDescriptor } from 'tsp-typescript-client/lib/models/output-descriptor';
import { OutputDescriptor, ProviderType } from 'tsp-typescript-client/lib/models/output-descriptor';

Check failure on line 10 in packages/react-components/src/components/trace-context-component.tsx

View workflow job for this annotation

GitHub Actions / Build and test (ubuntu-latest, 18)

Module '"tsp-typescript-client/lib/models/output-descriptor"' has no exported member 'ProviderType'.
import { Experiment } from 'tsp-typescript-client/lib/models/experiment';
import { ITspClient } from 'tsp-typescript-client/lib/protocol/tsp-client';
import { TimeRange, TimeRangeString } from 'traceviewer-base/lib/utils/time-range';
Expand Down Expand Up @@ -735,7 +735,7 @@ export class TraceContextComponent extends React.Component<TraceContextProps, Tr
{...outputProps}
></TraceOverviewComponent>
);
case 'TIME_GRAPH':
case ProviderType.TIME_GRAPH:
if (this.chartPersistedState && this.chartPersistedState.output.id === output.id) {
outputProps.persistChartState = this.chartPersistedState.payload;
this.chartPersistedState = undefined;
Expand All @@ -749,7 +749,7 @@ export class TraceContextComponent extends React.Component<TraceContextProps, Tr
className={this.state.pinnedView?.id === output.id ? 'pinned-view-shadow' : ''}
/>
);
case 'TREE_TIME_XY':
case ProviderType.TREE_TIME_XY:
if (this.chartPersistedState && this.chartPersistedState.output.id === output.id) {
outputProps.persistChartState = this.chartPersistedState.payload;
this.chartPersistedState = undefined;
Expand All @@ -761,15 +761,15 @@ export class TraceContextComponent extends React.Component<TraceContextProps, Tr
className={this.state.pinnedView?.id === output.id ? 'pinned-view-shadow' : ''}
/>
);
case 'TABLE':
case ProviderType.TABLE:
return (
<TableOutputComponent
key={output.id}
{...outputProps}
className={this.state.pinnedView?.id === output.id ? 'pinned-view-shadow' : ''}
/>
);
case 'DATA_TREE':
case ProviderType.DATA_TREE:
return (
<DataTreeOutputComponent
key={output.id}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { OutputAddedSignalPayload } from 'traceviewer-base/lib/signals/output-added-signal-payload';
import { signalManager, Signals } from 'traceviewer-base/lib/signals/signal-manager';
import { OutputDescriptor } from 'tsp-typescript-client/lib/models/output-descriptor';
import { OutputDescriptor, ProviderType } from 'tsp-typescript-client/lib/models/output-descriptor';

Check failure on line 4 in packages/react-components/src/trace-explorer/trace-explorer-views-widget.tsx

View workflow job for this annotation

GitHub Actions / Build and test (ubuntu-latest, 18)

Module '"tsp-typescript-client/lib/models/output-descriptor"' has no exported member 'ProviderType'.
import { Experiment } from 'tsp-typescript-client/lib/models/experiment';
import { ITspClientProvider } from 'traceviewer-base/lib/tsp-client-provider';
import { ExperimentManager } from 'traceviewer-base/lib/experiment-manager';
Expand Down Expand Up @@ -91,7 +91,7 @@ export class ReactAvailableViewsWidget extends React.Component<ReactAvailableVie
const selectedOutput: OutputDescriptor = this._nodeIdToOutput[id];
this.setState({ selectedOutput: id });
if (selectedOutput && this._selectedExperiment) {
if (selectedOutput.type !== 'NONE') {
if (selectedOutput.type !== ProviderType.NONE) {
signalManager().fireOutputAddedSignal(
new OutputAddedSignalPayload(selectedOutput, this._selectedExperiment)
);
Expand Down
106 changes: 88 additions & 18 deletions theia-extensions/viewer-prototype/src/browser/theia-rpc-tsp-proxy.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { inject, injectable, interfaces } from '@theia/core/shared/inversify';
import { ITspClient } from 'tsp-typescript-client/lib/protocol/tsp-client';
import { TspClientResponse } from 'tsp-typescript-client/lib/protocol/tsp-client-response';
import { Trace } from 'tsp-typescript-client/lib/models/trace';
import { Query } from 'tsp-typescript-client/lib/models/query/query';
import { AnnotationCategoriesModel, AnnotationModel } from 'tsp-typescript-client/lib/models/annotation';
import { Configuration } from 'tsp-typescript-client/lib/models/configuration';
import { ConfigurationSourceType } from 'tsp-typescript-client/lib/models/configuration-source';
import { DataTreeEntry } from 'tsp-typescript-client/lib/models/data-tree';
import { EntryModel } from 'tsp-typescript-client/lib/models/entry';
import { Experiment } from 'tsp-typescript-client/lib/models/experiment';
import { GenericResponse } from 'tsp-typescript-client/lib/models/response/responses';
import { HealthStatus } from 'tsp-typescript-client/lib/models/health';
import { Identifier } from 'tsp-typescript-client/lib/models/identifier';
import { XyEntry, XYModel } from 'tsp-typescript-client/lib/models/xy';
import { TimeGraphEntry, TimeGraphArrow, TimeGraphModel } from 'tsp-typescript-client/lib/models/timegraph';
import { AnnotationCategoriesModel, AnnotationModel } from 'tsp-typescript-client/lib/models/annotation';
import { TableModel, ColumnHeaderEntry } from 'tsp-typescript-client/lib/models/table';
import { MarkerSet } from 'tsp-typescript-client/lib/models/markerset';
import { OutputDescriptor } from 'tsp-typescript-client/lib/models/output-descriptor';
import { EntryModel } from 'tsp-typescript-client/lib/models/entry';
import { ConfigurationQuery, OutputConfigurationQuery, Query } from 'tsp-typescript-client/lib/models/query/query';
import { GenericResponse } from 'tsp-typescript-client/lib/models/response/responses';
import { OutputStyleModel } from 'tsp-typescript-client/lib/models/styles';
import { MarkerSet } from 'tsp-typescript-client/lib/models/markerset';
import { DataTreeEntry } from 'tsp-typescript-client/lib/models/data-tree';
import { ConfigurationSourceType } from 'tsp-typescript-client/lib/models/configuration-source';
import { Configuration } from 'tsp-typescript-client/lib/models/configuration';
import { ColumnHeaderEntry, TableModel } from 'tsp-typescript-client/lib/models/table';
import { TimeGraphArrow, TimeGraphEntry, TimeGraphModel } from 'tsp-typescript-client/lib/models/timegraph';
import { Trace } from 'tsp-typescript-client/lib/models/trace';
import { XyEntry, XYModel } from 'tsp-typescript-client/lib/models/xy';
import { ITspClient } from 'tsp-typescript-client/lib/protocol/tsp-client';
import { TspClientResponse } from 'tsp-typescript-client/lib/protocol/tsp-client-response';

export const TspClientProxy = Symbol('TspClientProxy') as symbol & interfaces.Abstract<TspClientProxy>;
export type TspClientProxy = ITspClient;
Expand Down Expand Up @@ -364,6 +364,73 @@ export class TheiaRpcTspProxy implements ITspClient {
);
}

/**
* Fetch all configuration source types for a given experiment and output
* @param expUUID Experiment UUID
* @param outputID Output ID
* @returns Generic response with the model
*/
public async fetchOutputConfigurationTypes(
expUUID: string,
outputID: string
): Promise<TspClientResponse<ConfigurationSourceType[]>> {
return this.toTspClientResponse<ConfigurationSourceType[]>(
await this.tspClient.fetchOutputConfigurationTypes(expUUID, outputID)
);
}

/**
* Fetch configuration source type for a given type ID, experiment and output
* @param expUUID Experiment UUID
* @param outputID Output ID
* @param typeID the ID of the configuration source type
* @returns Generic response with the model
*/
public async fetchOutputConfigurationType(
expUUID: string,
outputID: string,
typeID: string
): Promise<TspClientResponse<ConfigurationSourceType>> {
return this.toTspClientResponse<ConfigurationSourceType>(
await this.tspClient.fetchOutputConfigurationType(expUUID, outputID, typeID)
);
}

/**
* Create a derived output for a given experiment, output and parameters
* @param expUUID Experiment UUID
* @param outputID Output ID
* @param parameters OutputConfigurationQuery object
* @returns the output descriptor of the derived output
*/
public async createDerivedOutput(
expUUID: string,
outputID: string,
parameters: OutputConfigurationQuery
): Promise<TspClientResponse<OutputDescriptor>> {
return this.toTspClientResponse<OutputDescriptor>(
await this.tspClient.createDerivedOutput(expUUID, outputID, parameters)
);
}

/**
* Delete a derived output (and it's configuration) for a given experiment,
* output and derived output
* @param expUUID Experiment UUID
* @param outputID Output ID
* @param derivedOutputID the ID of the derived output
* @returns the output descriptor of the deleted derived output
*/
public async deleteDerivedOutput(
expUUID: string,
outputID: string,
derivedOutputID: string
): Promise<TspClientResponse<OutputDescriptor>> {
return this.toTspClientResponse<OutputDescriptor>(
await this.tspClient.deleteDerivedOutput(expUUID, outputID, derivedOutputID)
);
}

/**
* Check the health status of the server
* @returns The Health Status
Expand Down Expand Up @@ -423,24 +490,27 @@ export class TheiaRpcTspProxy implements ITspClient {
/**
* Create a configuration for a given type ID and parameters
* @param typeId the ID of the configuration source type
* @param parameters Query object
* @param parameters ConfigurationQuery object
* @returns Generic response with the model
*/
public async createConfiguration(typeId: string, parameters: Query): Promise<TspClientResponse<Configuration>> {
public async createConfiguration(
typeId: string,
parameters: ConfigurationQuery
): Promise<TspClientResponse<Configuration>> {
return this.toTspClientResponse<Configuration>(await this.tspClient.createConfiguration(typeId, parameters));
}

/**
* Update a configuration for a given type ID, config ID and parameters
* @param typeId the ID of the configuration source type
* @param configId the ID of the configuration
* @param parameters Query object
* @param parameters ConfigurationQuery object
* @returns Generic response with the model
*/
public async updateConfiguration(
typeId: string,
configId: string,
parameters: Query
parameters: ConfigurationQuery
): Promise<TspClientResponse<Configuration>> {
return this.toTspClientResponse<Configuration>(
await this.tspClient.updateConfiguration(typeId, configId, parameters)
Expand Down

0 comments on commit 335ce43

Please sign in to comment.