import { Observable } from 'rxjs'; import { ChartOptions, FilterOptions, GroupingOptions, PeriodOptions } from './modifier-options'; import { PipeTransform } from '@angular/core'; /** * Represents a saved state of an ui-filter * that can be applied. */ export type SavedGcpFilter = { id: number; name: string; filter: T; default?: boolean; }; export type DisabledStatus = { disabled: boolean; tooltip: string; }; export type EnrolledCloud = { cloudProvider: string; imageURL: string; }; /** * Contains the modifier's options. */ export type GcpFilterModifiers = { outputObject: T; /** * If these options are provided, the filter component will be rendered * according to the options. */ filterOptions: FilterOptions; /** * If these options are provided, the grouping component will be rendered * according to the options. */ groupingOptions?: GroupingOptions; /** * If these options are provided, the period component will be rendered * according to the options. */ periodOptions?: PeriodOptions; /** * If these options are provided, the chart component will be rendered * according to the options. */ chartOptions?: ChartOptions; }; /** * Control options for the GcpFilter. */ export type GcpFilterOptions = { /** * Filters that are going to be shown in the right tab and can be applied. */ savedFilters: Array>; /** * The filter modifiers. */ modifiers: GcpFilterModifiers; /** * Create a GitHub issue. */ createIssue(): void; /** * Save the given filter. * * @param filter The filter to be saved. */ saveFilter(filter: SavedGcpFilter): Observable>; /** * Delete the filter with the given id. * * @param id The id of the filter to be deleted */ deleteFilter(id: number): Observable; /** * Called when an attempt is made to set the given filter as default. * The filter will be set as default when a response is received. * * @param filter {@link SavedGcpFilter} * */ setFilterAsDefault: (filter: SavedGcpFilter) => Observable; /** * Callback function when the filter selection has changed. * * @param selection The selected filter options. */ onApply: (selection: T) => void; /** * Used to set regional and time settings */ datePipe: PipeTransform; /** * Export filter as widget. */ exportWidget?(): void; /** * Save changes to a widget */ saveWidget?(): void; /** * A filter coming from a resolver, that we would want applied to a view */ filterForEdit?: SavedGcpFilter; /** * Used to enable or disable the "create issue" button */ canCreateIssue?: boolean; /** * Tooltip and status during loading of widget for edit */ disableEdit?: DisabledStatus; /** * This flag stops the component from calling "onApply" on every change, removes additional options, makes the initial tab "Saved Filters" */ savedFiltersMode?: boolean; /** * This flag removes the action buttons */ disableActionButtons?: boolean; /** * This flag removes the saved filter tab */ disableSavedFilters?: boolean; /** * Used to divide all filter options by cloud and provide their icons */ enrolledClouds?: Array; /** * Skips updating and reading filter from URL */ skipURL?: boolean; };