Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/models/annotation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { OutputElementStyle } from './styles';

export enum Type {
TREE = 'TREE',
CHART = 'CHART'
}

export interface AnnotationCategoriesModel {
annotationCategories: string[];
}

export interface AnnotationModel {
annotations: { [category: string]: Annotation[] };
}

/**
* Model for annotation
*/
export interface Annotation {

/**
* Label of the annotation
*/
label: string;

/**
* Time of the annotation
*/
time: number;

/**
* Duration of the annotation
*/
duration: number;

/**
* Entry Id of the annotation
*/
entryId: number;

/**
* Type of the annotation
*/
type: string;

/**
* Style of the annotation
*/
style?: OutputElementStyle;
}
24 changes: 24 additions & 0 deletions src/protocol/tsp-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Query } from '../models/query/query';
import { GenericResponse } from '../models/response/responses';
import { XYModel } from '../models/xy';
import { TimeGraphEntry, TimeGraphArrow, TimeGraphModel } from '../models/timegraph';
import { AnnotationCategoriesModel, AnnotationModel } from '../models/annotation';
import { TableModel, ColumnHeaderEntry } from '../models/table';
import { Trace } from '../models/trace';
import { RestClient } from './rest-client';
Expand Down Expand Up @@ -218,6 +219,29 @@ export class TspClient {
return await RestClient.post<GenericResponse<TimeGraphArrow>>(url, parameters);
}

/**
* Fetch annotations categories.
* @param expUUID Experiment UUID
* @param outputID Output ID
* @returns Generic response with the model
*/
public async fetchAnnotationsCategories(expUUID: string, outputID: string): Promise<TspClientResponse<GenericResponse<AnnotationCategoriesModel>>> {
const url = this.baseUrl + '/experiments/' + expUUID + '/outputs/' + outputID + '/annotations';
return await RestClient.get<GenericResponse<AnnotationCategoriesModel>>(url);
}

/**
* Fetch annotations.
* @param expUUID Experiment UUID
* @param outputID Output ID
* @param parameters Query object
* @returns Generic response with the model
*/
public async fetchAnnotations(expUUID: string, outputID: string, parameters: Query): Promise<TspClientResponse<GenericResponse<AnnotationModel>>> {
const url = this.baseUrl + '/experiments/' + expUUID + '/outputs/' + outputID + '/annotations';
return await RestClient.post<GenericResponse<AnnotationModel>>(url, parameters);
}

/**
* Fetch Time Graph tooltip for states and arrows
* @param expUUID Experiment UUID
Expand Down