Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'powerbi/master'
- Loading branch information
Showing
6 changed files
with
246 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { IValidationError, Validators } from '../core/validator'; | ||
import { MultipleFieldsValidator, IFieldValidatorsPair } from '../core/multipleFieldsValidator'; | ||
import { ObjectValidator } from '../core/typeValidator'; | ||
|
||
export class VisualSelectorValidator 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: "visualName", | ||
validators: [Validators.fieldRequiredValidator, Validators.stringValidator] | ||
} | ||
]; | ||
|
||
const multipleFieldsValidator = new MultipleFieldsValidator(fields); | ||
return multipleFieldsValidator.validate(input, path, field); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { IValidationError, Validators } from '../core/validator'; | ||
import { MultipleFieldsValidator, IFieldValidatorsPair } from '../core/multipleFieldsValidator'; | ||
import { ObjectValidator } from '../core/typeValidator'; | ||
|
||
export class SlicerValidator 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: "selector", | ||
validators: [Validators.fieldRequiredValidator, Validators.visualSelectorValidator] | ||
}, | ||
{ | ||
field: "state", | ||
validators: [Validators.fieldRequiredValidator, Validators.slicerStateValidator] | ||
} | ||
]; | ||
|
||
const multipleFieldsValidator = new MultipleFieldsValidator(fields); | ||
return multipleFieldsValidator.validate(input, path, field); | ||
} | ||
} | ||
|
||
export class SlicerStateValidator 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: "filters", | ||
validators: [Validators.filtersArrayValidator] | ||
} | ||
]; | ||
|
||
const multipleFieldsValidator = new MultipleFieldsValidator(fields); | ||
return multipleFieldsValidator.validate(input, path, field); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters