|
|
@ -32,6 +32,7 @@ import { |
|
|
CalculatedFieldType, |
|
|
CalculatedFieldType, |
|
|
getCalculatedFieldArgumentsEditorCompleter, |
|
|
getCalculatedFieldArgumentsEditorCompleter, |
|
|
getCalculatedFieldArgumentsHighlights, |
|
|
getCalculatedFieldArgumentsHighlights, |
|
|
|
|
|
notEmptyObjectValidator, |
|
|
OutputType, |
|
|
OutputType, |
|
|
PropagationDirectionTranslations |
|
|
PropagationDirectionTranslations |
|
|
} from '@shared/models/calculated-field.models'; |
|
|
} from '@shared/models/calculated-field.models'; |
|
|
@ -72,14 +73,21 @@ export class RelatedEntitiesAggregationComponentComponent implements ControlValu |
|
|
@Input({required: true}) |
|
|
@Input({required: true}) |
|
|
entityName: string; |
|
|
entityName: string; |
|
|
|
|
|
|
|
|
|
|
|
readonly ScriptLanguage = ScriptLanguage; |
|
|
|
|
|
readonly CalculatedFieldType = CalculatedFieldType; |
|
|
|
|
|
readonly OutputType = OutputType; |
|
|
|
|
|
readonly Directions = Object.values(EntitySearchDirection) as Array<EntitySearchDirection>; |
|
|
|
|
|
readonly PropagationDirectionTranslations = PropagationDirectionTranslations; |
|
|
|
|
|
readonly minAllowedDeduplicationIntervalInSecForCF = getCurrentAuthState(this.store).minAllowedDeduplicationIntervalInSecForCF; |
|
|
|
|
|
|
|
|
relatedAggregationConfiguration = this.fb.group({ |
|
|
relatedAggregationConfiguration = this.fb.group({ |
|
|
relation: this.fb.group({ |
|
|
relation: this.fb.group({ |
|
|
direction: [EntitySearchDirection.FROM, Validators.required], |
|
|
direction: [EntitySearchDirection.FROM, Validators.required], |
|
|
relationType: ['Contains', Validators.required], |
|
|
relationType: ['Contains', Validators.required], |
|
|
}), |
|
|
}), |
|
|
arguments: this.fb.control({}), |
|
|
arguments: this.fb.control({}, notEmptyObjectValidator()), |
|
|
metrics: this.fb.control({}), |
|
|
metrics: this.fb.control({}, notEmptyObjectValidator()), |
|
|
deduplicationIntervalInSec: [], |
|
|
deduplicationIntervalInSec: [this.minAllowedDeduplicationIntervalInSecForCF], |
|
|
output: this.fb.control<CalculatedFieldOutput>({ |
|
|
output: this.fb.control<CalculatedFieldOutput>({ |
|
|
scope: AttributeScope.SERVER_SCOPE, |
|
|
scope: AttributeScope.SERVER_SCOPE, |
|
|
type: OutputType.Timeseries, |
|
|
type: OutputType.Timeseries, |
|
|
@ -87,14 +95,6 @@ export class RelatedEntitiesAggregationComponentComponent implements ControlValu |
|
|
useLatestTs: [false] |
|
|
useLatestTs: [false] |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
readonly ScriptLanguage = ScriptLanguage; |
|
|
|
|
|
readonly CalculatedFieldType = CalculatedFieldType; |
|
|
|
|
|
readonly OutputType = OutputType; |
|
|
|
|
|
readonly Directions = Object.values(EntitySearchDirection) as Array<EntitySearchDirection>; |
|
|
|
|
|
readonly PropagationDirectionTranslations = PropagationDirectionTranslations; |
|
|
|
|
|
readonly minAllowedDeduplicationIntervalInSecForCF = getCurrentAuthState(this.store).minAllowedDeduplicationIntervalInSecForCF; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arguments$ = this.relatedAggregationConfiguration.get('arguments').valueChanges.pipe( |
|
|
arguments$ = this.relatedAggregationConfiguration.get('arguments').valueChanges.pipe( |
|
|
map(argumentsObj => Object.keys(argumentsObj)) |
|
|
map(argumentsObj => Object.keys(argumentsObj)) |
|
|
); |
|
|
); |
|
|
@ -120,7 +120,7 @@ export class RelatedEntitiesAggregationComponentComponent implements ControlValu |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
validate(): ValidationErrors | null { |
|
|
validate(): ValidationErrors | null { |
|
|
return this.relatedAggregationConfiguration.valid || this.relatedAggregationConfiguration.status === "DISABLED" ? null : {invalidPropagateConfig: false}; |
|
|
return this.relatedAggregationConfiguration.valid || this.relatedAggregationConfiguration.disabled ? null : {invalidPropagateConfig: false}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
writeValue(value: CalculatedFieldRelatedAggregationConfiguration): void { |
|
|
writeValue(value: CalculatedFieldRelatedAggregationConfiguration): void { |
|
|
|