Skip to content

Commit

Permalink
Store hidden status of timeline viz config in persistent state
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Oct 4, 2023
1 parent b1b232f commit 4819811
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/hub/tabControllers/TimelineVizController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export default abstract class TimelineVizController implements TabController {
private TIMELINE_LABEL: HTMLElement;
private DRAG_HIGHLIGHT: HTMLElement;
private CONFIG_TABLE: HTMLElement;
private HIDE_BUTTON: HTMLButtonElement;
private SHOW_BUTTON: HTMLButtonElement;

private type: TabType;
private title: string = "";
Expand Down Expand Up @@ -76,16 +78,16 @@ export default abstract class TimelineVizController implements TabController {
}
}
});
let hideButton = content.getElementsByClassName("timeline-viz-hide-button")[0] as HTMLButtonElement;
let showButton = content.getElementsByClassName("timeline-viz-show-button")[0] as HTMLButtonElement;
hideButton.addEventListener("click", () => {
hideButton.hidden = true;
showButton.hidden = false;
this.HIDE_BUTTON = content.getElementsByClassName("timeline-viz-hide-button")[0] as HTMLButtonElement;
this.SHOW_BUTTON = content.getElementsByClassName("timeline-viz-show-button")[0] as HTMLButtonElement;
this.HIDE_BUTTON.addEventListener("click", () => {
this.HIDE_BUTTON.hidden = true;
this.SHOW_BUTTON.hidden = false;
this.CONFIG_TABLE.hidden = true;
});
showButton.addEventListener("click", () => {
hideButton.hidden = false;
showButton.hidden = true;
this.SHOW_BUTTON.addEventListener("click", () => {
this.HIDE_BUTTON.hidden = false;
this.SHOW_BUTTON.hidden = true;
this.CONFIG_TABLE.hidden = false;
});
content.getElementsByClassName("timeline-viz-popup-button")[0].addEventListener("click", () => {
Expand Down Expand Up @@ -137,7 +139,8 @@ export default abstract class TimelineVizController implements TabController {
type: type,
fields: this.fields,
listFields: this.listFields,
options: this.options
options: this.options,
configHidden: this.CONFIG_TABLE.hidden
};
}

Expand All @@ -146,6 +149,9 @@ export default abstract class TimelineVizController implements TabController {
this.fields = state.fields;
this.listFields = state.listFields;
this.options = state.options;
this.HIDE_BUTTON.hidden = state.configHidden;
this.SHOW_BUTTON.hidden = !state.configHidden;
this.CONFIG_TABLE.hidden = state.configHidden;
this.updateFields();
}

Expand Down
1 change: 1 addition & 0 deletions src/shared/HubState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,5 @@ export interface TimelineVisualizerState {
fields: ({ key: string; sourceTypeIndex: number; sourceType: LoggableType | string } | null)[];
listFields: { type: string; key: string; sourceTypeIndex: number; sourceType: LoggableType | string }[][];
options: { [id: string]: any };
configHidden: boolean;
}

0 comments on commit 4819811

Please sign in to comment.