Andriy Malish 2022-03-27 06:06:31 +00:00
Родитель b01b2d7bbf
Коммит 897284b6b5
3 изменённых файлов: 31 добавлений и 1 удалений

Просмотреть файл

@ -1162,10 +1162,13 @@ export interface ISettings {
export interface IReportBars {
actionBar?: IActionBar;
statusBar?: IStatusBar;
}
export interface IActionBar extends IHideable { }
export interface IStatusBar extends IHideable { }
export interface IReportPanes extends IPanes {
bookmarks?: IBookmarksPane;
fields?: IFieldsPane;

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { ActionBarValidator, ReportBarsValidator } from '../models/barsValidator';
import { ActionBarValidator, StatusBarValidator, ReportBarsValidator } from '../models/barsValidator';
import { AddBookmarkRequestValidator, ApplyBookmarkByNameRequestValidator, ApplyBookmarkStateRequestValidator, CaptureBookmarkOptionsValidator, CaptureBookmarkRequestValidator, PlayBookmarkRequestValidator } from '../models/bookmarkValidator';
import { CommandsSettingsValidator, SingleCommandSettingsValidator, PaginatedReportCommandsValidator } from '../models/commandsSettingsValidator';
import { CustomThemeValidator } from '../models/customThemeValidator';
@ -81,6 +81,7 @@ export const Validators = {
anyFilterValidator: new AnyOfValidator([new BasicFilterValidator(), new AdvancedFilterValidator(), new IncludeExcludeFilterValidator(), new NotSupportedFilterValidator(), new RelativeDateFilterValidator(), new TopNFilterValidator(), new RelativeTimeFilterValidator(), new HierarchyFilterValidator()]),
anyValueValidator: new AnyOfValidator([new StringValidator(), new NumberValidator(), new BooleanValidator()]),
actionBarValidator: new ActionBarValidator(),
statusBarValidator: new StatusBarValidator(),
applyBookmarkByNameRequestValidator: new ApplyBookmarkByNameRequestValidator(),
applyBookmarkStateRequestValidator: new ApplyBookmarkStateRequestValidator(),
applyBookmarkValidator: new AnyOfValidator([new ApplyBookmarkByNameRequestValidator(), new ApplyBookmarkStateRequestValidator()]),

Просмотреть файл

@ -19,6 +19,10 @@ export class ReportBarsValidator extends ObjectValidator {
{
field: "actionBar",
validators: [Validators.actionBarValidator]
},
{
field: "statusBar",
validators: [Validators.statusBarValidator]
}
];
@ -48,3 +52,25 @@ export class ActionBarValidator extends ObjectValidator {
return multipleFieldsValidator.validate(input, path, field);
}
}
export class StatusBarValidator extends ObjectValidator {
public validate(input: any, path?: string, field?: string): IValidationError[] {
if (input == null) {
return null;
}
const errors = super.validate(input, path, field);
if (errors) {
return errors;
}
const fields: IFieldValidatorsPair[] = [
{
field: "visible",
validators: [Validators.booleanValidator]
},
];
const multipleFieldsValidator = new MultipleFieldsValidator(fields);
return multipleFieldsValidator.validate(input, path, field);
}
}