Scopes: Generate new field for default parent node (#108666)
* Generate new field for default parent node * Update ScopeSpec with defaultPath and fix list types. Remove unused field * Update frontend types * Fix some errors * ScopesSelector: Update zod types for spec schema * Promlib: Update Scopes schema --------- Co-authored-by: Matheus Macabu <macabu.matheus@gmail.com>
This commit is contained in:
co-authored by
Matheus Macabu
parent
60fed679c4
commit
eb16fa1642
@@ -49,10 +49,10 @@ export interface ScopeSpecFilter {
|
||||
|
||||
export interface ScopeSpec {
|
||||
title: string;
|
||||
type: string;
|
||||
description: string;
|
||||
category: string;
|
||||
filters: ScopeSpecFilter[];
|
||||
// Used to display the title next to the selected scope and expand the selector to the proper path.
|
||||
// This will override whichever is selected from in the selector.
|
||||
defaultPath?: string[];
|
||||
filters?: ScopeSpecFilter[];
|
||||
}
|
||||
|
||||
// TODO: Use Resource from apiserver when we export the types
|
||||
|
||||
@@ -488,7 +488,9 @@ export default class PromQlLanguageProvider extends LanguageProvider implements
|
||||
})
|
||||
),
|
||||
scopes: scopes?.reduce<ScopeSpecFilter[]>((acc, scope) => {
|
||||
acc.push(...scope.spec.filters);
|
||||
if (scope.spec.filters) {
|
||||
acc.push(...scope.spec.filters);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []),
|
||||
|
||||
Reference in New Issue
Block a user