Skip to content

Commit

Permalink
Fix incorrect labels for dashboards with project configurator
Browse files Browse the repository at this point in the history
We need to update aliases if projects are updated to keep them in sync
  • Loading branch information
MaXal committed Nov 13, 2023
1 parent 3646659 commit f198bfb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ const props = withDefaults(defineProps<Props>(), {
const serverConfigurator = injectOrError(serverConfiguratorKey)
const dashboardConfigurators = injectOrError(dashboardConfiguratorsKey)
const aliases = props.aliases ?? removeCommonSegments(props.projects)
const scenarioConfigurator = dimensionConfigurator("project", serverConfigurator, null, true, [...(dashboardConfigurators as FilterConfigurator[])], null, aliases)
const scenarioConfigurator = dimensionConfigurator("project", serverConfigurator, null, true, [...(dashboardConfigurators as FilterConfigurator[])], null)
const configurators = [...dashboardConfigurators, scenarioConfigurator, serverConfigurator]
watch(
() => props.projects,
(projects) => {
() => [props.projects, props.aliases],
([projects, aliases]) => {
if (projects != null) {
scenarioConfigurator.aliases = aliases ?? removeCommonSegments(projects)
}
scenarioConfigurator.selected.value = projects
},
{ immediate: true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DimensionConfigurator implements DataQueryConfigurator, FilterConfi
constructor(
readonly name: string,
readonly multiple: boolean,
readonly aliases: string[] | null = null
public aliases: string[] | null = null
) {
this.observable = refToObservable(this.selected, true).pipe(shareReplay(1))
}
Expand Down

0 comments on commit f198bfb

Please sign in to comment.