|
|
|
@ -17,6 +17,7 @@ import { |
|
|
|
ApiUrlConfig, |
|
|
|
DateTime, |
|
|
|
HTTP, |
|
|
|
Model, |
|
|
|
StringHelper, |
|
|
|
ValidatorsEx, |
|
|
|
Version, |
|
|
|
@ -60,32 +61,35 @@ export function createProperties(fieldType: string, values: Object | null = null |
|
|
|
let properties: FieldPropertiesDto; |
|
|
|
|
|
|
|
switch (fieldType) { |
|
|
|
case 'Number': |
|
|
|
properties = new NumberFieldPropertiesDto(null, null, null, null, false, false, false, 'Input'); |
|
|
|
case 'Array': |
|
|
|
properties = new ArrayFieldPropertiesDto(); |
|
|
|
break; |
|
|
|
case 'String': |
|
|
|
properties = new StringFieldPropertiesDto(null, null, null, null, false, false, false, 'Input'); |
|
|
|
case 'Assets': |
|
|
|
properties = new AssetsFieldPropertiesDto(); |
|
|
|
break; |
|
|
|
case 'Boolean': |
|
|
|
properties = new BooleanFieldPropertiesDto(null, null, null, null, false, false, false, 'Checkbox'); |
|
|
|
properties = new BooleanFieldPropertiesDto('Checkbox'); |
|
|
|
break; |
|
|
|
case 'DateTime': |
|
|
|
properties = new DateTimeFieldPropertiesDto(null, null, null, null, false, false, 'DateTime'); |
|
|
|
properties = new DateTimeFieldPropertiesDto('DateTime'); |
|
|
|
break; |
|
|
|
case 'Geolocation': |
|
|
|
properties = new GeolocationFieldPropertiesDto(null, null, null, null, false, false, 'Map'); |
|
|
|
properties = new GeolocationFieldPropertiesDto(); |
|
|
|
break; |
|
|
|
case 'Json': |
|
|
|
properties = new JsonFieldPropertiesDto(null, null, null, null, false, false); |
|
|
|
properties = new JsonFieldPropertiesDto(); |
|
|
|
break; |
|
|
|
case 'Number': |
|
|
|
properties = new NumberFieldPropertiesDto('Input'); |
|
|
|
break; |
|
|
|
case 'References': |
|
|
|
properties = new ReferencesFieldPropertiesDto(null, null, null, null, false, false); |
|
|
|
properties = new ReferencesFieldPropertiesDto(); |
|
|
|
break; |
|
|
|
case 'Assets': |
|
|
|
properties = new AssetsFieldPropertiesDto(null, null, null, null, false, false); |
|
|
|
case 'String': |
|
|
|
properties = new StringFieldPropertiesDto('Input'); |
|
|
|
break; |
|
|
|
case 'Tags': |
|
|
|
properties = new TagsFieldPropertiesDto(null, null, null, null, false, false); |
|
|
|
properties = new TagsFieldPropertiesDto(); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw 'Invalid properties type'; |
|
|
|
@ -98,8 +102,8 @@ export function createProperties(fieldType: string, values: Object | null = null |
|
|
|
return properties; |
|
|
|
} |
|
|
|
|
|
|
|
export class SchemaDto { |
|
|
|
public readonly displayName = StringHelper.firstNonEmpty(this.properties.label, this.name); |
|
|
|
export class SchemaDto extends Model { |
|
|
|
public displayName: string; |
|
|
|
|
|
|
|
constructor( |
|
|
|
public readonly id: string, |
|
|
|
@ -107,27 +111,42 @@ export class SchemaDto { |
|
|
|
public readonly category: string, |
|
|
|
public readonly properties: SchemaPropertiesDto, |
|
|
|
public readonly isPublished: boolean, |
|
|
|
public readonly createdBy: string, |
|
|
|
public readonly lastModifiedBy: string, |
|
|
|
public readonly created: DateTime, |
|
|
|
public readonly createdBy: string, |
|
|
|
public readonly lastModified: DateTime, |
|
|
|
public readonly lastModifiedBy: string, |
|
|
|
public readonly version: Version |
|
|
|
) { |
|
|
|
super(); |
|
|
|
} |
|
|
|
|
|
|
|
public onCreated() { |
|
|
|
this.displayName = StringHelper.firstNonEmpty(this.properties.label, this.name); |
|
|
|
} |
|
|
|
|
|
|
|
public with(value: Partial<SchemaDto>): SchemaDto { |
|
|
|
return this.clone(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class SchemaDetailsDto extends SchemaDto { |
|
|
|
public readonly listFields: FieldDto[]; |
|
|
|
public listFields: RootFieldDto[]; |
|
|
|
|
|
|
|
constructor(id: string, name: string, category: string, properties: SchemaPropertiesDto, isPublished: boolean, createdBy: string, lastModifiedBy: string, created: DateTime, lastModified: DateTime, version: Version, |
|
|
|
public readonly fields: FieldDto[], |
|
|
|
constructor(id: string, name: string, category: string, properties: SchemaPropertiesDto, isPublished: boolean, created: DateTime, createdBy: string, lastModified: DateTime, lastModifiedBy: string, version: Version, |
|
|
|
public readonly fields: RootFieldDto[], |
|
|
|
public readonly scriptQuery?: string, |
|
|
|
public readonly scriptCreate?: string, |
|
|
|
public readonly scriptUpdate?: string, |
|
|
|
public readonly scriptDelete?: string, |
|
|
|
public readonly scriptChange?: string |
|
|
|
) { |
|
|
|
super(id, name, category, properties, isPublished, createdBy, lastModifiedBy, created, lastModified, version); |
|
|
|
super(id, name, category, properties, isPublished, created, createdBy, lastModified, lastModifiedBy, version); |
|
|
|
|
|
|
|
this.onCreated(); |
|
|
|
} |
|
|
|
|
|
|
|
public onCreated() { |
|
|
|
super.onCreated(); |
|
|
|
|
|
|
|
this.listFields = this.fields.filter(x => x.properties.isListField); |
|
|
|
|
|
|
|
@ -139,23 +158,27 @@ export class SchemaDetailsDto extends SchemaDto { |
|
|
|
this.listFields = [<any>{ properties: {} }]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class FieldDto { |
|
|
|
public readonly displayName = StringHelper.firstNonEmpty(this.properties.label, this.name); |
|
|
|
public readonly displayPlaceholder = this.properties.placeholder || ''; |
|
|
|
public with(value: Partial<SchemaDetailsDto>): SchemaDetailsDto { |
|
|
|
return this.clone(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public readonly isLocalizable = this.partitioning !== 'invariant'; |
|
|
|
export class FieldDto extends Model { |
|
|
|
public displayName: string; |
|
|
|
public displayPlaceholder: string; |
|
|
|
|
|
|
|
constructor( |
|
|
|
public readonly fieldId: number, |
|
|
|
public readonly name: string, |
|
|
|
public readonly isLocked: boolean, |
|
|
|
public readonly isHidden: boolean, |
|
|
|
public readonly isDisabled: boolean, |
|
|
|
public readonly partitioning: string, |
|
|
|
public readonly properties: FieldPropertiesDto |
|
|
|
) { |
|
|
|
super(); |
|
|
|
} |
|
|
|
|
|
|
|
public onCreated() { |
|
|
|
this.displayName = StringHelper.firstNonEmpty(this.properties.label, this.name); |
|
|
|
this.displayPlaceholder = this.properties.placeholder || ''; |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
@ -169,18 +192,66 @@ export class FieldDto { |
|
|
|
public defaultValue(): any { |
|
|
|
return this.properties.getDefaultValue(); |
|
|
|
} |
|
|
|
|
|
|
|
public with(value: Partial<FieldDto>): FieldDto { |
|
|
|
return this.clone(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class RootFieldDto extends FieldDto { |
|
|
|
public readonly isLocalizable = this.partitioning === 'language'; |
|
|
|
|
|
|
|
constructor(fieldId: number, name: string, properties: FieldPropertiesDto, |
|
|
|
public readonly partitioning: string, |
|
|
|
public readonly isHidden: boolean = false, |
|
|
|
public readonly isDisabled: boolean = false, |
|
|
|
public readonly isLocked: boolean = false, |
|
|
|
public readonly nested: NestedFieldDto[] = [] |
|
|
|
) { |
|
|
|
super(fieldId, name, properties); |
|
|
|
|
|
|
|
this.onCreated(); |
|
|
|
} |
|
|
|
|
|
|
|
public with(value: Partial<RootFieldDto>): RootFieldDto { |
|
|
|
return this.clone(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class NestedFieldDto extends FieldDto { |
|
|
|
constructor(fieldId: number, name: string, properties: FieldPropertiesDto, |
|
|
|
public readonly parentId: number, |
|
|
|
public readonly isHidden: boolean = false, |
|
|
|
public readonly isDisabled: boolean = false |
|
|
|
) { |
|
|
|
super(fieldId, name, properties); |
|
|
|
|
|
|
|
this.onCreated(); |
|
|
|
} |
|
|
|
|
|
|
|
public with(value: Partial<NestedFieldDto>): NestedFieldDto { |
|
|
|
return this.clone(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export type AnyFieldDto = RootFieldDto | NestedFieldDto; |
|
|
|
|
|
|
|
export abstract class FieldPropertiesDto { |
|
|
|
constructor( |
|
|
|
public readonly fieldType: string, |
|
|
|
public readonly label: string | null, |
|
|
|
public readonly hints: string | null, |
|
|
|
public readonly placeholder: string | null, |
|
|
|
public readonly editorUrl: string | null, |
|
|
|
public readonly isRequired: boolean, |
|
|
|
public readonly isListField: boolean |
|
|
|
public abstract fieldType: string; |
|
|
|
|
|
|
|
public readonly editorUrl?: string; |
|
|
|
public readonly label?: string; |
|
|
|
public readonly hints?: string; |
|
|
|
public readonly placeholder?: string; |
|
|
|
public readonly isRequired: boolean = false; |
|
|
|
public readonly isListField: boolean = false; |
|
|
|
|
|
|
|
constructor(public readonly editor: string, |
|
|
|
props?: Partial<FieldPropertiesDto> |
|
|
|
) { |
|
|
|
if (props) { |
|
|
|
Object.assign(this, props); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public abstract formatValue(value: any): string; |
|
|
|
@ -192,20 +263,16 @@ export abstract class FieldPropertiesDto { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class StringFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
constructor(label: string | null, hints: string | null, placeholder: string | null, editorUrl: string | null, |
|
|
|
isRequired: boolean, |
|
|
|
isListField: boolean, |
|
|
|
public readonly inlineEditable: boolean, |
|
|
|
public readonly editor: string, |
|
|
|
public readonly defaultValue?: string, |
|
|
|
public readonly pattern?: string, |
|
|
|
public readonly patternMessage?: string, |
|
|
|
public readonly minLength?: number, |
|
|
|
public readonly maxLength?: number, |
|
|
|
public readonly allowedValues?: string[] |
|
|
|
export class ArrayFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
public readonly fieldType = 'Array'; |
|
|
|
|
|
|
|
public readonly minItems?: number; |
|
|
|
public readonly maxItems?: number; |
|
|
|
|
|
|
|
constructor( |
|
|
|
props?: Partial<ArrayFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super('String', label, hints, placeholder, editorUrl, isRequired, isListField); |
|
|
|
super('Default', props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
@ -213,58 +280,52 @@ export class StringFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
return value; |
|
|
|
if (value.length) { |
|
|
|
return `${value.length} Items(s)`; |
|
|
|
} else { |
|
|
|
return '0 Items'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public createValidators(isOptional: false): ValidatorFn[] { |
|
|
|
public createValidators(isOptional: boolean): ValidatorFn[] { |
|
|
|
const validators: ValidatorFn[] = []; |
|
|
|
|
|
|
|
if (this.isRequired && !isOptional) { |
|
|
|
validators.push(Validators.required); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.minLength) { |
|
|
|
validators.push(Validators.minLength(this.minLength)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.maxLength) { |
|
|
|
validators.push(Validators.maxLength(this.maxLength)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.pattern && this.pattern.length > 0) { |
|
|
|
validators.push(ValidatorsEx.pattern(this.pattern, this.patternMessage)); |
|
|
|
if (this.minItems) { |
|
|
|
validators.push(Validators.minLength(this.minItems)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.allowedValues && this.allowedValues.length > 0) { |
|
|
|
const values: (string | null)[] = this.allowedValues; |
|
|
|
|
|
|
|
if (this.isRequired && !isOptional) { |
|
|
|
validators.push(ValidatorsEx.validValues(values)); |
|
|
|
} else { |
|
|
|
validators.push(ValidatorsEx.validValues(values.concat([null]))); |
|
|
|
} |
|
|
|
if (this.maxItems) { |
|
|
|
validators.push(Validators.maxLength(this.maxItems)); |
|
|
|
} |
|
|
|
|
|
|
|
return validators; |
|
|
|
} |
|
|
|
|
|
|
|
public getDefaultValue(): any { |
|
|
|
return this.defaultValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class NumberFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
constructor(label: string | null, hints: string | null, placeholder: string | null, editorUrl: string | null, |
|
|
|
isRequired: boolean, |
|
|
|
isListField: boolean, |
|
|
|
public readonly inlineEditable: boolean, |
|
|
|
public readonly editor: string, |
|
|
|
public readonly defaultValue?: number, |
|
|
|
public readonly maxValue?: number, |
|
|
|
public readonly minValue?: number, |
|
|
|
public readonly allowedValues?: number[] |
|
|
|
export class AssetsFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
public readonly fieldType = 'Assets'; |
|
|
|
|
|
|
|
public readonly minItems?: number; |
|
|
|
public readonly maxItems?: number; |
|
|
|
public readonly minSize?: number; |
|
|
|
public readonly maxSize?: number; |
|
|
|
public readonly allowedExtensions?: string[]; |
|
|
|
public readonly mustBeImage?: boolean; |
|
|
|
public readonly minWidth?: number; |
|
|
|
public readonly maxWidth?: number; |
|
|
|
public readonly minHeight?: number; |
|
|
|
public readonly maxHeight?: number; |
|
|
|
public readonly aspectWidth?: number; |
|
|
|
public readonly aspectHeight?: number; |
|
|
|
|
|
|
|
constructor( |
|
|
|
props?: Partial<AssetsFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super('Number', label, hints, placeholder, editorUrl, isRequired, isListField); |
|
|
|
super('Default', props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
@ -272,7 +333,11 @@ export class NumberFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
return value; |
|
|
|
if (value.length) { |
|
|
|
return `${value.length} Asset(s)`; |
|
|
|
} else { |
|
|
|
return '0 Assets'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public createValidators(isOptional: boolean): ValidatorFn[] { |
|
|
|
@ -282,22 +347,43 @@ export class NumberFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
validators.push(Validators.required); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.minValue) { |
|
|
|
validators.push(Validators.min(this.minValue)); |
|
|
|
if (this.minItems) { |
|
|
|
validators.push(Validators.minLength(this.minItems)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.maxValue) { |
|
|
|
validators.push(Validators.max(this.maxValue)); |
|
|
|
if (this.maxItems) { |
|
|
|
validators.push(Validators.maxLength(this.maxItems)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.allowedValues && this.allowedValues.length > 0) { |
|
|
|
const values: (number | null)[] = this.allowedValues; |
|
|
|
return validators; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.isRequired && !isOptional) { |
|
|
|
validators.push(ValidatorsEx.validValues(values)); |
|
|
|
} else { |
|
|
|
validators.push(ValidatorsEx.validValues(values.concat([null]))); |
|
|
|
} |
|
|
|
export class BooleanFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
public readonly fieldType = 'Boolean'; |
|
|
|
|
|
|
|
public readonly inlineEditable: boolean = false; |
|
|
|
public readonly defaultValue?: boolean; |
|
|
|
|
|
|
|
constructor(editor: string, |
|
|
|
props?: Partial<BooleanFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super(editor, props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
if (value === null || value === undefined) { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
return value ? 'Yes' : 'No'; |
|
|
|
} |
|
|
|
|
|
|
|
public createValidators(isOptional: boolean): ValidatorFn[] { |
|
|
|
const validators: ValidatorFn[] = []; |
|
|
|
|
|
|
|
if (this.isRequired && !isOptional) { |
|
|
|
validators.push(Validators.required); |
|
|
|
} |
|
|
|
|
|
|
|
return validators; |
|
|
|
@ -309,16 +395,17 @@ export class NumberFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
} |
|
|
|
|
|
|
|
export class DateTimeFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
constructor(label: string | null, hints: string | null, placeholder: string | null, editorUrl: string | null, |
|
|
|
isRequired: boolean, |
|
|
|
isListField: boolean, |
|
|
|
public readonly editor: string, |
|
|
|
public readonly defaultValue?: string, |
|
|
|
public readonly maxValue?: string, |
|
|
|
public readonly minValue?: string, |
|
|
|
public readonly calculatedDefaultValue?: string |
|
|
|
public readonly fieldType = 'DateTime'; |
|
|
|
|
|
|
|
public readonly defaultValue?: string; |
|
|
|
public readonly maxValue?: string; |
|
|
|
public readonly minValue?: string; |
|
|
|
public readonly calculatedDefaultValue?: string; |
|
|
|
|
|
|
|
constructor(editor: string, |
|
|
|
props?: Partial<DateTimeFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super('DateTime', label, hints, placeholder, editorUrl, isRequired, isListField); |
|
|
|
super(editor, props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
@ -362,23 +449,21 @@ export class DateTimeFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class BooleanFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
constructor(label: string | null, hints: string | null, placeholder: string | null, editorUrl: string | null, |
|
|
|
isRequired: boolean, |
|
|
|
isListField: boolean, |
|
|
|
public readonly inlineEditable: boolean, |
|
|
|
public readonly editor: string, |
|
|
|
public readonly defaultValue?: boolean |
|
|
|
export class GeolocationFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
public readonly fieldType = 'Geolocation'; |
|
|
|
|
|
|
|
constructor( |
|
|
|
props?: Partial<GeolocationFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super('Boolean', label, hints, placeholder, editorUrl, isRequired, isListField); |
|
|
|
super('Default', props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
if (value === null || value === undefined) { |
|
|
|
if (!value) { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
return value ? 'Yes' : 'No'; |
|
|
|
return `${value.longitude}, ${value.latitude}`; |
|
|
|
} |
|
|
|
|
|
|
|
public createValidators(isOptional: boolean): ValidatorFn[] { |
|
|
|
@ -390,19 +475,15 @@ export class BooleanFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
|
|
|
|
return validators; |
|
|
|
} |
|
|
|
|
|
|
|
public getDefaultValue(): any { |
|
|
|
return this.defaultValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class GeolocationFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
constructor(label: string | null, hints: string | null, placeholder: string | null, editorUrl: string | null, |
|
|
|
isRequired: boolean, |
|
|
|
isListField: boolean, |
|
|
|
public readonly editor: string |
|
|
|
export class JsonFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
public readonly fieldType = 'Json'; |
|
|
|
|
|
|
|
constructor( |
|
|
|
props?: Partial<JsonFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super('Geolocation', label, hints, placeholder, editorUrl, isRequired, isListField); |
|
|
|
super('Default', props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
@ -410,7 +491,7 @@ export class GeolocationFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
return `${value.longitude}, ${value.latitude}`; |
|
|
|
return '<Json />'; |
|
|
|
} |
|
|
|
|
|
|
|
public createValidators(isOptional: boolean): ValidatorFn[] { |
|
|
|
@ -424,15 +505,19 @@ export class GeolocationFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class ReferencesFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
constructor(label: string | null, hints: string | null, placeholder: string | null, editorUrl: string | null, |
|
|
|
isRequired: boolean, |
|
|
|
isListField: boolean, |
|
|
|
public readonly minItems?: number, |
|
|
|
public readonly maxItems?: number, |
|
|
|
public readonly schemaId?: string |
|
|
|
export class NumberFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
public readonly fieldType = 'Number'; |
|
|
|
|
|
|
|
public readonly inlineEditable: boolean = false; |
|
|
|
public readonly defaultValue?: number; |
|
|
|
public readonly maxValue?: number; |
|
|
|
public readonly minValue?: number; |
|
|
|
public readonly allowedValues?: number[]; |
|
|
|
|
|
|
|
constructor(editor: string, |
|
|
|
props?: Partial<NumberFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super('References', label, hints, placeholder, editorUrl, isRequired, isListField); |
|
|
|
super(editor, props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
@ -440,11 +525,7 @@ export class ReferencesFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
if (value.length) { |
|
|
|
return `${value.length} Reference(s)`; |
|
|
|
} else { |
|
|
|
return '0 References'; |
|
|
|
} |
|
|
|
return value; |
|
|
|
} |
|
|
|
|
|
|
|
public createValidators(isOptional: boolean): ValidatorFn[] { |
|
|
|
@ -454,36 +535,43 @@ export class ReferencesFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
validators.push(Validators.required); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.minItems) { |
|
|
|
validators.push(Validators.minLength(this.minItems)); |
|
|
|
if (this.minValue) { |
|
|
|
validators.push(Validators.min(this.minValue)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.maxItems) { |
|
|
|
validators.push(Validators.maxLength(this.maxItems)); |
|
|
|
if (this.maxValue) { |
|
|
|
validators.push(Validators.max(this.maxValue)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.allowedValues && this.allowedValues.length > 0) { |
|
|
|
const values: (number | null)[] = this.allowedValues; |
|
|
|
|
|
|
|
if (this.isRequired && !isOptional) { |
|
|
|
validators.push(ValidatorsEx.validValues(values)); |
|
|
|
} else { |
|
|
|
validators.push(ValidatorsEx.validValues(values.concat([null]))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return validators; |
|
|
|
} |
|
|
|
|
|
|
|
public getDefaultValue(): any { |
|
|
|
return this.defaultValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class AssetsFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
constructor(label: string | null, hints: string | null, placeholder: string | null, editorUrl: string | null, |
|
|
|
isRequired: boolean, |
|
|
|
isListField: boolean, |
|
|
|
public readonly minItems?: number, |
|
|
|
public readonly maxItems?: number, |
|
|
|
public readonly minSize?: number, |
|
|
|
public readonly maxSize?: number, |
|
|
|
public readonly allowedExtensions?: string[], |
|
|
|
public readonly mustBeImage?: boolean, |
|
|
|
public readonly minWidth?: number, |
|
|
|
public readonly maxWidth?: number, |
|
|
|
public readonly minHeight?: number, |
|
|
|
public readonly maxHeight?: number, |
|
|
|
public readonly aspectWidth?: number, |
|
|
|
public readonly aspectHeight?: number |
|
|
|
export class ReferencesFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
public readonly fieldType = 'References'; |
|
|
|
|
|
|
|
public readonly minItems?: number; |
|
|
|
public readonly maxItems?: number; |
|
|
|
public readonly schemaId?: string; |
|
|
|
|
|
|
|
constructor( |
|
|
|
props?: Partial<ReferencesFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super('Assets', label, hints, placeholder, editorUrl, isRequired, isListField); |
|
|
|
super('Default', props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
@ -492,9 +580,9 @@ export class AssetsFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
} |
|
|
|
|
|
|
|
if (value.length) { |
|
|
|
return `${value.length} Asset(s)`; |
|
|
|
return `${value.length} Reference(s)`; |
|
|
|
} else { |
|
|
|
return '0 Assets'; |
|
|
|
return '0 References'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -517,14 +605,21 @@ export class AssetsFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class TagsFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
constructor(label: string | null, hints: string | null, placeholder: string | null, editorUrl: string | null, |
|
|
|
isRequired: boolean, |
|
|
|
isListField: boolean, |
|
|
|
public readonly minItems?: number, |
|
|
|
public readonly maxItems?: number |
|
|
|
export class StringFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
public readonly fieldType = 'String'; |
|
|
|
|
|
|
|
public readonly inlineEditable = false; |
|
|
|
public readonly defaultValue?: string; |
|
|
|
public readonly pattern?: string; |
|
|
|
public readonly patternMessage?: string; |
|
|
|
public readonly minLength?: number; |
|
|
|
public readonly maxLength?: number; |
|
|
|
public readonly allowedValues?: string[]; |
|
|
|
|
|
|
|
constructor(editor: string, |
|
|
|
props?: Partial<StringFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super('Tags', label, hints, placeholder, editorUrl, isRequired, isListField); |
|
|
|
super(editor, props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
@ -532,38 +627,56 @@ export class TagsFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
if (value.length) { |
|
|
|
return value.join(', '); |
|
|
|
} else { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
return value; |
|
|
|
} |
|
|
|
|
|
|
|
public createValidators(isOptional: boolean): ValidatorFn[] { |
|
|
|
public createValidators(isOptional: false): ValidatorFn[] { |
|
|
|
const validators: ValidatorFn[] = []; |
|
|
|
|
|
|
|
if (this.isRequired && !isOptional) { |
|
|
|
validators.push(Validators.required); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.minItems) { |
|
|
|
validators.push(Validators.minLength(this.minItems)); |
|
|
|
if (this.minLength) { |
|
|
|
validators.push(Validators.minLength(this.minLength)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.maxItems) { |
|
|
|
validators.push(Validators.maxLength(this.maxItems)); |
|
|
|
if (this.maxLength) { |
|
|
|
validators.push(Validators.maxLength(this.maxLength)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.pattern && this.pattern.length > 0) { |
|
|
|
validators.push(ValidatorsEx.pattern(this.pattern, this.patternMessage)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.allowedValues && this.allowedValues.length > 0) { |
|
|
|
const values: (string | null)[] = this.allowedValues; |
|
|
|
|
|
|
|
if (this.isRequired && !isOptional) { |
|
|
|
validators.push(ValidatorsEx.validValues(values)); |
|
|
|
} else { |
|
|
|
validators.push(ValidatorsEx.validValues(values.concat([null]))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return validators; |
|
|
|
} |
|
|
|
|
|
|
|
public getDefaultValue(): any { |
|
|
|
return this.defaultValue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class JsonFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
constructor(label: string | null, hints: string | null, placeholder: string | null, editorUrl: string | null, |
|
|
|
isRequired: boolean, |
|
|
|
isListField: boolean |
|
|
|
export class TagsFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
public readonly fieldType = 'Tags'; |
|
|
|
|
|
|
|
public readonly minItems?: number; |
|
|
|
public readonly maxItems?: number; |
|
|
|
|
|
|
|
constructor( |
|
|
|
props?: Partial<TagsFieldPropertiesDto> |
|
|
|
) { |
|
|
|
super('Json', label, hints, placeholder, editorUrl, isRequired, isListField); |
|
|
|
super('Default', props); |
|
|
|
} |
|
|
|
|
|
|
|
public formatValue(value: any): string { |
|
|
|
@ -571,7 +684,11 @@ export class JsonFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
return '<Json />'; |
|
|
|
if (value.length) { |
|
|
|
return value.join(', '); |
|
|
|
} else { |
|
|
|
return ''; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public createValidators(isOptional: boolean): ValidatorFn[] { |
|
|
|
@ -581,6 +698,14 @@ export class JsonFieldPropertiesDto extends FieldPropertiesDto { |
|
|
|
validators.push(Validators.required); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.minItems) { |
|
|
|
validators.push(Validators.minLength(this.minItems)); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.maxItems) { |
|
|
|
validators.push(Validators.maxLength(this.maxItems)); |
|
|
|
} |
|
|
|
|
|
|
|
return validators; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -627,7 +752,7 @@ export class UpdateFieldDto { |
|
|
|
export class CreateSchemaDto { |
|
|
|
constructor( |
|
|
|
public readonly name: string, |
|
|
|
public readonly fields?: FieldDto[], |
|
|
|
public readonly fields?: RootFieldDto[], |
|
|
|
public readonly properties?: SchemaPropertiesDto |
|
|
|
) { |
|
|
|
} |
|
|
|
@ -668,13 +793,10 @@ export class SchemasService { |
|
|
|
return new SchemaDto( |
|
|
|
item.id, |
|
|
|
item.name, |
|
|
|
item.category, |
|
|
|
properties, |
|
|
|
item.category, properties, |
|
|
|
item.isPublished, |
|
|
|
item.createdBy, |
|
|
|
item.lastModifiedBy, |
|
|
|
DateTime.parseISO_UTC(item.created), |
|
|
|
DateTime.parseISO_UTC(item.lastModified), |
|
|
|
DateTime.parseISO_UTC(item.created), item.createdBy, |
|
|
|
DateTime.parseISO_UTC(item.lastModified), item.lastModifiedBy, |
|
|
|
new Version(item.version.toString())); |
|
|
|
}); |
|
|
|
}) |
|
|
|
@ -694,14 +816,34 @@ export class SchemasService { |
|
|
|
item.properties.fieldType, |
|
|
|
item.properties); |
|
|
|
|
|
|
|
return new FieldDto( |
|
|
|
let nested: NestedFieldDto[] | null = null; |
|
|
|
|
|
|
|
if (item.nested && item.nested.length > 0) { |
|
|
|
nested = item.nested.map((nestedItem: any) => { |
|
|
|
const nestedPropertiesDto = |
|
|
|
createProperties( |
|
|
|
nestedItem.properties.fieldType, |
|
|
|
nestedItem.properties); |
|
|
|
|
|
|
|
return new NestedFieldDto( |
|
|
|
nestedItem.fieldId, |
|
|
|
nestedItem.name, |
|
|
|
nestedPropertiesDto, |
|
|
|
item.fieldId, |
|
|
|
nestedItem.isHidden, |
|
|
|
nestedItem.isDisabled); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
return new RootFieldDto( |
|
|
|
item.fieldId, |
|
|
|
item.name, |
|
|
|
item.isLocked, |
|
|
|
propertiesDto, |
|
|
|
item.partitioning, |
|
|
|
item.isHidden, |
|
|
|
item.isDisabled, |
|
|
|
item.partitioning, |
|
|
|
propertiesDto); |
|
|
|
item.isLocked, |
|
|
|
nested || []); |
|
|
|
}); |
|
|
|
|
|
|
|
const properties = new SchemaPropertiesDto(body.properties.label, body.properties.hints); |
|
|
|
@ -712,10 +854,8 @@ export class SchemasService { |
|
|
|
body.category, |
|
|
|
properties, |
|
|
|
body.isPublished, |
|
|
|
body.createdBy, |
|
|
|
body.lastModifiedBy, |
|
|
|
DateTime.parseISO_UTC(body.created), |
|
|
|
DateTime.parseISO_UTC(body.lastModified), |
|
|
|
DateTime.parseISO_UTC(body.created), body.createdBy, |
|
|
|
DateTime.parseISO_UTC(body.lastModified), body.lastModifiedBy, |
|
|
|
response.version, |
|
|
|
fields, |
|
|
|
body.scriptQuery, |
|
|
|
@ -742,10 +882,8 @@ export class SchemasService { |
|
|
|
'', |
|
|
|
dto.properties || new SchemaPropertiesDto(), |
|
|
|
false, |
|
|
|
user, |
|
|
|
user, |
|
|
|
now, |
|
|
|
now, |
|
|
|
now, user, |
|
|
|
now, user, |
|
|
|
response.version, |
|
|
|
dto.fields || [], |
|
|
|
body.scriptQuery, |
|
|
|
@ -760,30 +898,6 @@ export class SchemasService { |
|
|
|
.pretifyError('Failed to create schema. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public postField(appName: string, schemaName: string, dto: AddFieldDto, version: Version): Observable<Versioned<FieldDto>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields`); |
|
|
|
|
|
|
|
return HTTP.postVersioned<any>(this.http, url, dto, version) |
|
|
|
.map(response => { |
|
|
|
const body = response.payload.body; |
|
|
|
|
|
|
|
const field = new FieldDto( |
|
|
|
body.id, |
|
|
|
dto.name, |
|
|
|
false, |
|
|
|
false, |
|
|
|
false, |
|
|
|
dto.partitioning, |
|
|
|
dto.properties); |
|
|
|
|
|
|
|
return new Versioned(response.version, field); |
|
|
|
}) |
|
|
|
.do(() => { |
|
|
|
this.analytics.trackEvent('Schema', 'FieldCreated', appName); |
|
|
|
}) |
|
|
|
.pretifyError('Failed to add field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public deleteSchema(appName: string, schemaName: string, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}`); |
|
|
|
|
|
|
|
@ -814,16 +928,6 @@ export class SchemasService { |
|
|
|
.pretifyError('Failed to update schema. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public putFieldOrdering(appName: string, schemaName: string, dto: number[], version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/ordering`); |
|
|
|
|
|
|
|
return HTTP.putVersioned(this.http, url, { fieldIds: dto }, version) |
|
|
|
.do(() => { |
|
|
|
this.analytics.trackEvent('Schema', 'FieldsReordered', appName); |
|
|
|
}) |
|
|
|
.pretifyError('Failed to reorder fields. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public publishSchema(appName: string, schemaName: string, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/publish`); |
|
|
|
|
|
|
|
@ -854,8 +958,41 @@ export class SchemasService { |
|
|
|
.pretifyError('Failed to change category. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public putField(appName: string, schemaName: string, fieldId: number, dto: UpdateFieldDto, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}`); |
|
|
|
public postField(appName: string, schemaName: string, dto: AddFieldDto, parentId: number | undefined, version: Version): Observable<Versioned<AnyFieldDto>> { |
|
|
|
const url = this.buildUrl(appName, schemaName, parentId, ''); |
|
|
|
|
|
|
|
return HTTP.postVersioned<any>(this.http, url, dto, version) |
|
|
|
.map(response => { |
|
|
|
const body = response.payload.body; |
|
|
|
|
|
|
|
if (parentId) { |
|
|
|
const field = new NestedFieldDto(body.id, dto.name, dto.properties, parentId); |
|
|
|
|
|
|
|
return new Versioned(response.version, field); |
|
|
|
} else { |
|
|
|
const field = new RootFieldDto(body.id, dto.name, dto.properties, dto.partitioning); |
|
|
|
|
|
|
|
return new Versioned(response.version, field); |
|
|
|
} |
|
|
|
}) |
|
|
|
.do(() => { |
|
|
|
this.analytics.trackEvent('Schema', 'FieldCreated', appName); |
|
|
|
}) |
|
|
|
.pretifyError('Failed to add field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public putFieldOrdering(appName: string, schemaName: string, dto: number[], parentId: number | undefined, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.buildUrl(appName, schemaName, parentId, '/ordering'); |
|
|
|
|
|
|
|
return HTTP.putVersioned(this.http, url, { fieldIds: dto }, version) |
|
|
|
.do(() => { |
|
|
|
this.analytics.trackEvent('Schema', 'FieldsReordered', appName); |
|
|
|
}) |
|
|
|
.pretifyError('Failed to reorder fields. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public putField(appName: string, schemaName: string, fieldId: number, dto: UpdateFieldDto, parentId: number | undefined, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.buildUrl(appName, schemaName, parentId, `/${fieldId}`); |
|
|
|
|
|
|
|
return HTTP.putVersioned(this.http, url, dto, version) |
|
|
|
.do(() => { |
|
|
|
@ -864,38 +1001,38 @@ export class SchemasService { |
|
|
|
.pretifyError('Failed to update field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public enableField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/enable`); |
|
|
|
public lockField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/lock`); |
|
|
|
|
|
|
|
return HTTP.putVersioned(this.http, url, {}, version) |
|
|
|
.do(() => { |
|
|
|
this.analytics.trackEvent('Schema', 'FieldEnabled', appName); |
|
|
|
this.analytics.trackEvent('Schema', 'FieldLocked', appName); |
|
|
|
}) |
|
|
|
.pretifyError('Failed to enable field. Please reload.'); |
|
|
|
.pretifyError('Failed to lock field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public disableField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/disable`); |
|
|
|
public enableField(appName: string, schemaName: string, fieldId: number, parentId: number | undefined, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.buildUrl(appName, schemaName, parentId, `/${fieldId}/enable`); |
|
|
|
|
|
|
|
return HTTP.putVersioned(this.http, url, {}, version) |
|
|
|
.do(() => { |
|
|
|
this.analytics.trackEvent('Schema', 'FieldDisabled', appName); |
|
|
|
this.analytics.trackEvent('Schema', 'FieldEnabled', appName); |
|
|
|
}) |
|
|
|
.pretifyError('Failed to disable field. Please reload.'); |
|
|
|
.pretifyError('Failed to enable field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public lockField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/lock`); |
|
|
|
public disableField(appName: string, schemaName: string, fieldId: number, parentId: number | undefined, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.buildUrl(appName, schemaName, parentId, `/${fieldId}/disable`); |
|
|
|
|
|
|
|
return HTTP.putVersioned(this.http, url, {}, version) |
|
|
|
.do(() => { |
|
|
|
this.analytics.trackEvent('Schema', 'FieldLocked', appName); |
|
|
|
this.analytics.trackEvent('Schema', 'FieldDisabled', appName); |
|
|
|
}) |
|
|
|
.pretifyError('Failed to lock field. Please reload.'); |
|
|
|
.pretifyError('Failed to disable field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public showField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/show`); |
|
|
|
public showField(appName: string, schemaName: string, fieldId: number, parentId: number | undefined, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.buildUrl(appName, schemaName, parentId, `/${fieldId}/show`); |
|
|
|
|
|
|
|
return HTTP.putVersioned(this.http, url, {}, version) |
|
|
|
.do(() => { |
|
|
|
@ -904,8 +1041,8 @@ export class SchemasService { |
|
|
|
.pretifyError('Failed to show field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public hideField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}/hide`); |
|
|
|
public hideField(appName: string, schemaName: string, fieldId: number, parentId: number | undefined, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.buildUrl(appName, schemaName, parentId, `/${fieldId}/hide`); |
|
|
|
|
|
|
|
return HTTP.putVersioned(this.http, url, {}, version) |
|
|
|
.do(() => { |
|
|
|
@ -914,8 +1051,8 @@ export class SchemasService { |
|
|
|
.pretifyError('Failed to hide field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
public deleteField(appName: string, schemaName: string, fieldId: number, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${fieldId}`); |
|
|
|
public deleteField(appName: string, schemaName: string, fieldId: number, parentId: number | undefined, version: Version): Observable<Versioned<any>> { |
|
|
|
const url = this.buildUrl(appName, schemaName, parentId, `/${fieldId}`); |
|
|
|
|
|
|
|
return HTTP.deleteVersioned(this.http, url, version) |
|
|
|
.do(() => { |
|
|
|
@ -923,4 +1060,13 @@ export class SchemasService { |
|
|
|
}) |
|
|
|
.pretifyError('Failed to delete field. Please reload.'); |
|
|
|
} |
|
|
|
|
|
|
|
private buildUrl(appName: string, schemaName: string, parentId: number | undefined, suffix: string) { |
|
|
|
const url = |
|
|
|
parentId ? |
|
|
|
this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields/${parentId}/nested${suffix}`) : |
|
|
|
this.apiUrl.buildUrl(`api/apps/${appName}/schemas/${schemaName}/fields${suffix}`); |
|
|
|
|
|
|
|
return url; |
|
|
|
} |
|
|
|
} |