From 897284b6b588b38188e013dee94bc911ba1fe8ff Mon Sep 17 00:00:00 2001 From: Andriy Malish Date: Sun, 27 Mar 2022 06:06:31 +0000 Subject: [PATCH] Merged PR 249216: Add ability to hide / show status bar Add ability to hide / show status bar ![image.png](https://powerbi.visualstudio.com/4c7b5adb-c2d0-4f18-b23c-edc4ac30f4e1/_apis/git/repositories/3e42401e-931d-4a96-b4b9-3533d1cf56ce/pullRequests/249216/attachments/image.png) --- src/models.ts | 3 +++ src/validators/core/validator.ts | 3 ++- src/validators/models/barsValidator.ts | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/models.ts b/src/models.ts index 39c48bf..5ce2dec 100644 --- a/src/models.ts +++ b/src/models.ts @@ -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; diff --git a/src/validators/core/validator.ts b/src/validators/core/validator.ts index 821f51f..a418f7e 100644 --- a/src/validators/core/validator.ts +++ b/src/validators/core/validator.ts @@ -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()]), diff --git a/src/validators/models/barsValidator.ts b/src/validators/models/barsValidator.ts index 2fb4d76..71384f0 100644 --- a/src/validators/models/barsValidator.ts +++ b/src/validators/models/barsValidator.ts @@ -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); + } +}