Skip to content

Commit

Permalink
Merge branch 'components-in-the-ui'
Browse files Browse the repository at this point in the history
  • Loading branch information
mullr committed Sep 22, 2024
2 parents 22a2b01 + a51f7e5 commit e1de76c
Show file tree
Hide file tree
Showing 11 changed files with 323 additions and 47 deletions.
24 changes: 21 additions & 3 deletions vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
},
{
"command": "auxon.timelines.deleteMany",
"when": "view == auxon.timelines && ((viewItem == timeline && listMultiSelection) || viewItem == timelineGroup || viewItem == timelineGroupByName)",
"when": "view == auxon.timelines && ((viewItem == timeline && listMultiSelection) || viewItem == timelineGroup)",
"group": "2_context@2"
},
{
Expand Down Expand Up @@ -406,6 +406,16 @@
"when": "view == auxon.timelines",
"group": "navigation@1"
},
{
"command": "auxon.timelines.groupTimelinesByComponent",
"when": "view == auxon.timelines && auxon.timelinesGroupingMode != 'BY_COMPONENT'",
"group": "7_modification@1"
},
{
"command": "auxon.timelines.clearGroupTimelinesByComponent",
"when": "view == auxon.timelines && auxon.timelinesGroupingMode == 'BY_COMPONENT'",
"group": "7_modification@1"
},
{
"command": "auxon.timelines.setGroupingAttrs",
"when": "view == auxon.timelines && auxon.timelinesGroupingMode != 'BY_ATTRIBUTES'",
Expand Down Expand Up @@ -615,13 +625,21 @@
"command": "auxon.timelines.clearGroupingAttrs",
"title": "✓ Group timelines by attribute"
},
{
"command": "auxon.timelines.groupTimelinesByComponent",
"title": "Group timelines by component"
},
{
"command": "auxon.timelines.clearGroupTimelinesByComponent",
"title": "✓ Group timelines by component"
},
{
"command": "auxon.timelines.groupTimelinesByNameComponents",
"title": "Group timelines by name components"
"title": "Group timelines by period-separated name"
},
{
"command": "auxon.timelines.clearGroupTimelinesByNameComponents",
"title": "✓ Group timelines by name components"
"title": "✓ Group timelines by period-separated name"
},
{
"command": "auxon.timelines.inspect",
Expand Down
1 change: 1 addition & 0 deletions vscode/src/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export class ExperimentsTreeDataProvider implements vscode.TreeDataProvider<Expe
title: `Experiment Impact for scenario '${scenario.scenarioName}'`,
groupBy: ["timeline.name"],
assignNodeProps,
workspaceVersionId: this.wss.activeWorkspaceVersionId,
});
}

Expand Down
21 changes: 19 additions & 2 deletions vscode/src/generated/src/modality-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,11 @@ export interface components {
* @description How many times did events of this group occur?
*/
count?: number | null;
/**
* @description (rule, component) pairs for any timeline components associated with this
* node. Will be present if the graph was grouped by timeline component.
*/
timeline_components: ((string & string)[])[];
};
LocatedError: {
end: number;
Expand Down Expand Up @@ -612,7 +617,7 @@ export interface components {
};
SegmentRegionKind: {
id: components["schemas"]["WorkspaceSegmentId"];
timeline_filter?: components["schemas"]["UnstructuredTimelineFilter"] | null;
timeline_selection?: components["schemas"]["TimelineSelection"] | null;
workspace_name: components["schemas"]["WorkspaceName"];
};
SegmentationRuleName: string;
Expand Down Expand Up @@ -703,9 +708,15 @@ export interface components {
/** Format: uuid */
TimelineId: string;
TimelineOverview: {
components: ((string & string)[])[];
id: components["schemas"]["TimelineId"];
name?: string | null;
};
TimelineSelection: OneOf<[{
Filter: components["schemas"]["UnstructuredTimelineFilter"];
}, {
Explicit: components["schemas"]["TimelineId"][];
}]>;
/** @description Timelines operation errors */
TimelinesError: OneOf<[{
/** @description Invalid Uuid */
Expand All @@ -729,7 +740,7 @@ export interface components {
*/
UnstructuredTimelineFilter: string;
WholeWorkspaceRegionKind: {
timeline_filter?: components["schemas"]["UnstructuredTimelineFilter"] | null;
timeline_selection?: components["schemas"]["TimelineSelection"] | null;
workspace_name: components["schemas"]["WorkspaceName"];
workspace_version_id: components["schemas"]["WorkspaceVersionId"];
};
Expand Down Expand Up @@ -1664,6 +1675,8 @@ export interface operations {
query?: {
/** @description Grouping attr key */
group_by?: string[] | null;
/** @description Workspace version id */
workspace_version_id?: components["schemas"]["WorkspaceVersionId"] | null;
};
};
requestBody: {
Expand Down Expand Up @@ -1822,6 +1835,8 @@ export interface operations {
query?: {
/** @description Grouping attr key */
group_by?: string[] | null;
/** @description Group by timeline component */
group_by_timeline_component?: boolean | null;
};
path: {
/** @description Workspace version id */
Expand Down Expand Up @@ -1959,6 +1974,8 @@ export interface operations {
query?: {
/** @description Grouping attr key */
group_by?: string[] | null;
/** @description Group by timeline component */
group_by_timeline_component?: boolean | null;
};
path: {
/** @description Workspace Version Id */
Expand Down
106 changes: 100 additions & 6 deletions vscode/src/modality-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,20 @@
"nullable": true
},
"explode": true
},
{
"name": "workspace_version_id",
"in": "query",
"description": "Workspace version id",
"required": false,
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/WorkspaceVersionId"
}
],
"nullable": true
}
}
],
"requestBody": {
Expand Down Expand Up @@ -1918,6 +1932,17 @@
"nullable": true
},
"explode": true
},
{
"name": "group_by_timeline_component",
"in": "query",
"description": "Group by timeline component",
"required": false,
"schema": {
"type": "boolean",
"nullable": true
},
"explode": true
}
],
"responses": {
Expand Down Expand Up @@ -2179,6 +2204,17 @@
"nullable": true
},
"explode": true
},
{
"name": "group_by_timeline_component",
"in": "query",
"description": "Group by timeline component",
"required": false,
"schema": {
"type": "boolean",
"nullable": true
},
"explode": true
}
],
"responses": {
Expand Down Expand Up @@ -3697,7 +3733,7 @@
"GroupedGraphNode": {
"type": "object",
"description": "A node in a `GroupedGraph`",
"required": ["attr_vals"],
"required": ["attr_vals", "timeline_components"],
"properties": {
"attr_vals": {
"type": "array",
Expand All @@ -3717,6 +3753,23 @@
"description": "How many times did events of this group occur?",
"nullable": true,
"minimum": 0
},
"timeline_components": {
"type": "array",
"items": {
"type": "array",
"items": {
"allOf": [
{
"type": "string"
},
{
"type": "string"
}
]
}
},
"description": "(rule, component) pairs for any timeline components associated with this\nnode. Will be present if the graph was grouped by timeline component."
}
}
},
Expand Down Expand Up @@ -4112,10 +4165,10 @@
"id": {
"$ref": "#/components/schemas/WorkspaceSegmentId"
},
"timeline_filter": {
"timeline_selection": {
"allOf": [
{
"$ref": "#/components/schemas/UnstructuredTimelineFilter"
"$ref": "#/components/schemas/TimelineSelection"
}
],
"nullable": true
Expand Down Expand Up @@ -4406,8 +4459,24 @@
},
"TimelineOverview": {
"type": "object",
"required": ["id"],
"required": ["id", "components"],
"properties": {
"components": {
"type": "array",
"items": {
"type": "array",
"items": {
"allOf": [
{
"type": "string"
},
{
"type": "string"
}
]
}
}
},
"id": {
"$ref": "#/components/schemas/TimelineId"
},
Expand All @@ -4417,6 +4486,31 @@
}
}
},
"TimelineSelection": {
"oneOf": [
{
"type": "object",
"required": ["Filter"],
"properties": {
"Filter": {
"$ref": "#/components/schemas/UnstructuredTimelineFilter"
}
}
},
{
"type": "object",
"required": ["Explicit"],
"properties": {
"Explicit": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TimelineId"
}
}
}
}
]
},
"TimelinesError": {
"oneOf": [
{
Expand Down Expand Up @@ -4467,10 +4561,10 @@
"type": "object",
"required": ["workspace_name", "workspace_version_id"],
"properties": {
"timeline_filter": {
"timeline_selection": {
"allOf": [
{
"$ref": "#/components/schemas/UnstructuredTimelineFilter"
"$ref": "#/components/schemas/TimelineSelection"
}
],
"nullable": true
Expand Down
23 changes: 20 additions & 3 deletions vscode/src/modalityApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,12 @@ export class SegmentClient {
return unwrapData<string[], any>(res);
}

async groupedGraph(groupBy: string[]): Promise<GroupedGraph> {
async groupedGraph(groupBy: string[], groupByTimelineComponent: boolean): Promise<GroupedGraph> {
const query = groupBy.map((gb) => ["group_by", gb]);
if (groupByTimelineComponent) {
query.push(["group_by_timeline_component", "true"]);
}

const res = await this.client.get(
"/v2/workspaces/{workspace_version_id}/segments/{rule_name}/{segment_name}/grouped_graph",
{
Expand All @@ -354,7 +359,7 @@ export class SegmentClient {
// The actual type is "Something you can pass to the UrlSearchParams constructor".
// Here, we use the 'array of tuples' form to get the group_by query parameter
// to appear multiple times.
query: groupBy.map((gb) => ["group_by", gb]),
query,
},
}
);
Expand Down Expand Up @@ -496,8 +501,20 @@ export class SegmentClient {
export class TimelinesClient {
constructor(private readonly client: InternalClient) {}

async groupedGraph(timeline_ids: string[], groupBy: string[]): Promise<GroupedGraph> {
async groupedGraph(
timeline_ids: string[],
groupBy: string[],
groupByTimelineComponent: boolean,
workspaceVersionId?: WorkspaceVersionId
): Promise<GroupedGraph> {
const query = groupBy.map((gb) => ["group_by", gb]);
if (groupByTimelineComponent) {
query.push(["group_by_timeline_component", "true"]);
}

if (workspaceVersionId) {
query.push(["workspace_version_id", workspaceVersionId]);
}

const res = await this.client.post("/v2/timelines/grouped_graph", {
body: timeline_ids,
Expand Down
9 changes: 7 additions & 2 deletions vscode/src/segments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,13 @@ export class SegmentsTreeDataProvider implements vscode.TreeDataProvider<Segment
}

transitionGraph(item: SegmentTreeItemData) {
transitionGraph.promptForGraphGrouping((groupBy) => {
transitionGraph.showGraphForSegment(item.segment.id, groupBy);
transitionGraph.promptForGraphGrouping((groupBy, groupByTimelineComponent) => {
transitionGraph.showGraphForSegment(
item.segment.id,
groupBy,
groupByTimelineComponent,
this.wss.activeWorkspaceVersionId
);
});
}
}
Expand Down
Loading

0 comments on commit e1de76c

Please sign in to comment.