You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2022/10/20 19:14:31 UTC
[incubator-streampipes] branch STREAMPIPES-597 created (now bf99bbae7)
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a change to branch STREAMPIPES-597
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
at bf99bbae7 [STREAMPIPES-597] Add warning schema message when adapter is edited
This branch includes the following new commits:
new fc5aa42a0 Merge branch 'dev' into STREAMPIPES-597
new bf99bbae7 [STREAMPIPES-597] Add warning schema message when adapter is edited
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-streampipes] 01/02: Merge branch 'dev' into STREAMPIPES-597
Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-597
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit fc5aa42a0371c8e9e7cf15bcf38a2ac12ced1cf3
Merge: 6b1c0836f a99b7b5f8
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Thu Oct 20 16:12:01 2022 +0200
Merge branch 'dev' into STREAMPIPES-597
pom.xml | 2 +-
.../streampipes/container/api/MonitoringResource.java | 19 +++++++++++++++++++
streampipes-maven-plugin/pom.xml | 2 +-
streampipes-model-client/.java-version | 1 -
streampipes-model/.java-version | 1 -
.../rest/impl/AdapterMonitoringResource.java | 19 +++++++++++++++++++
.../edit-adapter/edit-adapter.component.html | 19 +++++++++++++++++++
.../edit-adapter/edit-adapter.component.scss | 17 +++++++++++++++++
.../components/edit-adapter/edit-adapter.component.ts | 18 ++++++++++++++++++
.../components/new-adapter/new-adapter.component.html | 18 ++++++++++++++++++
.../components/new-adapter/new-adapter.component.scss | 17 +++++++++++++++++
.../components/new-adapter/new-adapter.component.ts | 18 ++++++++++++++++++
.../pipeline-logs/pipeline-logs.component.scss | 17 +++++++++++++++++
13 files changed, 164 insertions(+), 4 deletions(-)
[incubator-streampipes] 02/02: [STREAMPIPES-597] Add warning schema message when adapter is edited
Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-597
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit bf99bbae7ac2a619410604618bd0c282f9bef1e7
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Thu Oct 20 21:13:59 2022 +0200
[STREAMPIPES-597] Add warning schema message when adapter is edited
---
ui/.eslintrc.json | 6 +-
ui/cypress.config.ts | 2 +-
ui/cypress/tests/adapter/editAdapter.smoke.spec.ts | 15 +-
.../adapter-configuration.component.html | 3 +-
.../adapter-configuration.component.ts | 2 +
.../event-schema/event-schema.component.ts | 511 ++++++++++++---------
6 files changed, 300 insertions(+), 239 deletions(-)
diff --git a/ui/.eslintrc.json b/ui/.eslintrc.json
index d5d4441ce..4c9a40ad0 100644
--- a/ui/.eslintrc.json
+++ b/ui/.eslintrc.json
@@ -9,14 +9,12 @@
"createDefaultProgram": true
},
"extends": [
- "plugin:@angular-eslint/recommended",
+ "prettier",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/recommended--extra",
- "plugin:@angular-eslint/template/process-inline-templates",
- "prettier"
+ "plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
- "max-len": [2, {"ignorePattern": "^import .*" }],
"@angular-eslint/component-selector": [
"error",
{
diff --git a/ui/cypress.config.ts b/ui/cypress.config.ts
index 6f71f8cca..7d7feb5e6 100644
--- a/ui/cypress.config.ts
+++ b/ui/cypress.config.ts
@@ -44,7 +44,7 @@ export default defineConfig({
return require('./cypress/plugins/index.ts')(on, config);
},
specPattern: 'cypress/tests/**/*.{js,jsx,ts,tsx}',
- baseUrl: 'http://localhost:80',
+ baseUrl: 'http://localhost:8082',
},
component: {
diff --git a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
index a017c5ee8..77a8984db 100644
--- a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
+++ b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
@@ -55,17 +55,12 @@ describe('Test Edit Adapter', () => {
.build();
ConnectUtils.configureAdapter(newUserConfiguration);
- // check warning that event schema might have changed
- // cy.dataCy('sp-connect-adapter-warning-event-schema-change', {
- // timeout: 10000,
- // }).should('be.visible');
+ cy.get('.schema-validation-text-warning').contains('Edit mode');
// Update event schema
ConnectBtns.refreshSchema().click();
- // cy.dataCy('sp-connect-adapter-warning-event-schema-change', {
- // timeout: 10000,
- // }).should('not.be.visible');
+ cy.dataCy('schema-validation-ok').should('not.exist');
ConnectUtils.finishEventSchemaConfiguration();
@@ -94,8 +89,8 @@ describe('Test Edit Adapter', () => {
);
// validate that three event properties
- // cy.get('.preview-row', { timeout: 10000 })
- // .its('length')
- // .should('eq', 3);
+ cy.get('.preview-row', { timeout: 10000 })
+ .its('length')
+ .should('eq', 3);
});
});
diff --git a/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.html b/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.html
index d2788180c..1d2217a8c 100644
--- a/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.html
+++ b/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.html
@@ -18,7 +18,7 @@
<sp-basic-view [padding]="true" [showBackLink]="false">
- <div fxFlex="100" fxLayout="row" fxLayoutAlign="end center">
+ <div nav fxFlex="100" fxLayout="row" fxLayoutAlign="end center">
<button mat-icon-button (click)="removeSelection()" matTooltip="Cancel">
<i class="material-icons">close</i>
</button>
@@ -66,6 +66,7 @@
[adapterDescription]="adapter"
[(eventSchema)]="eventSchema"
[(oldEventSchema)]="oldEventSchema"
+ [isEditMode]="isEditMode"
(clickNextEmitter)="clickEventSchemaNextButtonButton()"
(goBackEmitter)="goBack()"
(removeSelectionEmitter)="removeSelection()">
diff --git a/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts b/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
index 32a52968d..251594467 100644
--- a/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
+++ b/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
@@ -115,6 +115,8 @@ export class AdapterConfigurationComponent implements OnInit {
} else {
this.oldEventSchema = eventSchema;
}
+
+
}
public setSchema() {
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.ts b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.ts
index c6b896a30..0fcbd1082 100644
--- a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.ts
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.ts
@@ -16,262 +16,327 @@
*
*/
-import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnChanges,
+ Output,
+ SimpleChanges,
+ ViewChild,
+} from '@angular/core';
import { RestService } from '../../../../services/rest.service';
import { ITreeOptions, TreeComponent } from '@circlon/angular-tree-component';
import { UUID } from 'angular2-uuid';
import { DataTypesService } from '../../../../services/data-type.service';
import {
- AdapterDescription,
- EventProperty,
- EventPropertyNested,
- EventPropertyPrimitive,
- EventSchema,
- GuessSchema
+ AdapterDescription,
+ EventProperty,
+ EventPropertyNested,
+ EventPropertyPrimitive,
+ EventSchema,
+ GuessSchema,
+ FieldStatusInfo,
+ GuessTypeInfo,
+ StreamPipesErrorMessage,
} from '@streampipes/platform-services';
import { MatStepper } from '@angular/material/stepper';
import { UserErrorMessage } from '../../../../../core-model/base/UserErrorMessage';
-import {
- FieldStatusInfo, GuessTypeInfo,
- StreamPipesErrorMessage
-} from '../../../../../../../projects/streampipes/platform-services/src/lib/model/gen/streampipes-model';
import { TransformationRuleService } from '../../../../services/transformation-rule.service';
@Component({
- selector: 'sp-event-schema',
- templateUrl: './event-schema.component.html',
- styleUrls: ['./event-schema.component.scss']
+ selector: 'sp-event-schema',
+ templateUrl: './event-schema.component.html',
+ styleUrls: ['./event-schema.component.scss'],
})
export class EventSchemaComponent implements OnChanges {
+ constructor(
+ private restService: RestService,
+ private dataTypesService: DataTypesService,
+ private transformationRuleService: TransformationRuleService,
+ ) {}
+
+ @Input()
+ adapterDescription: AdapterDescription;
+
+ isEditable = true;
+
+ @Input()
+ oldEventSchema: EventSchema;
+
+ @Input()
+ eventSchema: EventSchema = new EventSchema();
+
+ @Input()
+ isEditMode;
+ refreshedEventSchema = false;
+
+ @Output()
+ isEditableChange = new EventEmitter<boolean>();
+ @Output()
+ adapterChange = new EventEmitter<AdapterDescription>();
+ @Output()
+ eventSchemaChange = new EventEmitter<EventSchema>();
+ @Output()
+ oldEventSchemaChange = new EventEmitter<EventSchema>();
+
+ @Output()
+ goBackEmitter: EventEmitter<MatStepper> = new EventEmitter();
+
+ /**
+ * Cancels the adapter configuration process
+ */
+ @Output()
+ removeSelectionEmitter: EventEmitter<boolean> = new EventEmitter();
+
+ /**
+ * Go to next configuration step when this is complete
+ */
+ @Output()
+ clickNextEmitter: EventEmitter<MatStepper> = new EventEmitter();
+
+ @ViewChild(TreeComponent, { static: true })
+ tree: TreeComponent;
+
+ schemaGuess: GuessSchema = new GuessSchema();
+ countSelected = 0;
+ isLoading = false;
+ isError = false;
+ isPreviewEnabled = false;
+ errorMessage: StreamPipesErrorMessage;
+ nodes: EventProperty[] = new Array<EventProperty>();
+ validEventSchema = false;
+ schemaErrorHints: UserErrorMessage[] = [];
+
+ eventPreview: Record<string, GuessTypeInfo>[];
+ desiredPreview: Record<string, GuessTypeInfo>;
+ fieldStatusInfo: Record<string, FieldStatusInfo>;
+
+ options: ITreeOptions = {
+ childrenField: 'eventProperties',
+ allowDrag: () => {
+ return this.isEditable;
+ },
+ allowDrop: (node, { parent }) => {
+ return (
+ parent.data.eventProperties !== undefined &&
+ parent.parent !== null
+ );
+ },
+ displayField: 'runTimeName',
+ };
+
+ public onUpdateData(treeComponent: TreeComponent): void {
+ treeComponent.treeModel.expandAll();
+ }
- constructor(private restService: RestService,
- private dataTypesService: DataTypesService,
- private transformationRuleService: TransformationRuleService ) {
- }
-
- @Input() adapterDescription: AdapterDescription;
- isEditable = true;
- @Input() oldEventSchema: EventSchema;
- @Input() eventSchema: EventSchema = new EventSchema();
-
- @Output() isEditableChange = new EventEmitter<boolean>();
- @Output() adapterChange = new EventEmitter<AdapterDescription>();
- @Output() eventSchemaChange = new EventEmitter<EventSchema>();
- @Output() oldEventSchemaChange = new EventEmitter<EventSchema>();
-
- @Output() goBackEmitter: EventEmitter<MatStepper> = new EventEmitter();
-
- /**
- * Cancels the adapter configuration process
- */
- @Output() removeSelectionEmitter: EventEmitter<boolean> = new EventEmitter();
-
- /**
- * Go to next configuration step when this is complete
- */
- @Output() clickNextEmitter: EventEmitter<MatStepper> = new EventEmitter();
-
-
- @ViewChild(TreeComponent, { static: true }) tree: TreeComponent;
-
- schemaGuess: GuessSchema = new GuessSchema();
- countSelected = 0;
- isLoading = false;
- isError = false;
- isPreviewEnabled = false;
- errorMessage: StreamPipesErrorMessage;
- nodes: EventProperty[] = new Array<EventProperty>();
- validEventSchema = false;
- schemaErrorHints: UserErrorMessage[] = [];
-
- eventPreview: Record<string, GuessTypeInfo>[];
- desiredPreview: Record<string, GuessTypeInfo>;
- fieldStatusInfo: Record<string, FieldStatusInfo>;
-
- options: ITreeOptions = {
- childrenField: 'eventProperties',
- allowDrag: () => {
- return this.isEditable;
- },
- allowDrop: (node, { parent }) => {
- return parent.data.eventProperties !== undefined && parent.parent !== null;
- },
- displayField: 'runTimeName'
- };
-
-
- public onUpdateData(treeComponent: TreeComponent): void {
- treeComponent.treeModel.expandAll();
- }
-
- public guessSchema(): void {
- this.isLoading = true;
- this.isError = false;
- this.restService.getGuessSchema(this.adapterDescription).subscribe(guessSchema => {
- this.eventPreview = guessSchema.eventPreview;
- this.fieldStatusInfo = guessSchema.fieldStatusInfo;
- this.eventSchema = guessSchema.eventSchema;
- this.eventSchema.eventProperties.sort((a, b) => {
- return a.runtimeName < b.runtimeName ? -1 : 1;
- });
- this.eventSchemaChange.emit(this.eventSchema);
- this.schemaGuess = guessSchema;
+ public setEventSchemaEditWarning() {
+ this.schemaErrorHints.push(
+ new UserErrorMessage(
+ 'Edit mode',
+ 'Changes in the adapter might require you to refresh the event schema.',
+ 'info',
+ ),
+ );
+ }
+
+ public guessSchema(): void {
+ this.isLoading = true;
+ this.isError = false;
+ this.restService.getGuessSchema(this.adapterDescription).subscribe(
+ guessSchema => {
+ this.eventPreview = guessSchema.eventPreview;
+ this.fieldStatusInfo = guessSchema.fieldStatusInfo;
+ this.eventSchema = guessSchema.eventSchema;
+ this.eventSchema.eventProperties.sort((a, b) => {
+ return a.runtimeName < b.runtimeName ? -1 : 1;
+ });
+ this.eventSchemaChange.emit(this.eventSchema);
+ this.schemaGuess = guessSchema;
+
+ this.validEventSchema = this.checkIfValid(this.eventSchema);
+
+ this.oldEventSchema = EventSchema.fromData(
+ this.eventSchema,
+ new EventSchema(),
+ );
+ this.oldEventSchemaChange.emit(this.oldEventSchema);
+
+ this.refreshTree();
+
+ this.isEditable = true;
+ this.isEditableChange.emit(true);
+ this.isLoading = false;
+ this.refreshedEventSchema = true;
+
+ if (
+ guessSchema.eventPreview &&
+ guessSchema.eventPreview.length > 0
+ ) {
+ this.updatePreview();
+ }
+ },
+ errorMessage => {
+ this.errorMessage = errorMessage.error;
+ this.isError = true;
+ this.isLoading = false;
+ this.eventSchema = new EventSchema();
+ },
+ );
+ }
+ public refreshTree(refreshPreview = true): void {
+ this.nodes = new Array<EventProperty>();
+ this.nodes.push((this.eventSchema as unknown) as EventProperty);
this.validEventSchema = this.checkIfValid(this.eventSchema);
+ if (refreshPreview) {
+ this.updatePreview();
+ }
+ }
- this.oldEventSchema = EventSchema.fromData(this.eventSchema, new EventSchema());
- this.oldEventSchemaChange.emit(this.oldEventSchema);
+ public addNestedProperty(eventProperty?: EventPropertyNested): void {
+ const uuid: string = UUID.UUID();
+ const nested: EventPropertyNested = new EventPropertyNested();
+ nested['@class'] =
+ 'org.apache.streampipes.model.schema.EventPropertyNested';
+ nested.elementId = uuid;
+ nested.eventProperties = [];
+ nested.domainProperties = [];
+ if (!eventProperty) {
+ this.eventSchema.eventProperties.push(nested);
+ } else {
+ eventProperty.eventProperties.push(nested);
+ }
+ this.refreshTree();
+ }
+ public removeSelectedProperties(eventProperties?: any): void {
+ eventProperties = eventProperties || this.eventSchema.eventProperties;
+ for (let i = eventProperties.length - 1; i >= 0; --i) {
+ if (eventProperties[i].eventProperties) {
+ this.removeSelectedProperties(
+ eventProperties[i].eventProperties,
+ );
+ }
+ if (eventProperties[i].selected) {
+ eventProperties.splice(i, 1);
+ }
+ }
+ this.countSelected = 0;
this.refreshTree();
+ }
- this.isEditable = true;
- this.isEditableChange.emit(true);
- this.isLoading = false;
+ public addStaticValueProperty(): void {
+ const eventProperty = new EventPropertyPrimitive();
+ eventProperty['@class'] =
+ 'org.apache.streampipes.model.schema.EventPropertyPrimitive';
+ eventProperty.elementId =
+ 'http://eventProperty.de/staticValue/' + UUID.UUID();
- if (guessSchema.eventPreview && guessSchema.eventPreview.length > 0) {
- this.updatePreview();
- }
- },
- errorMessage => {
- this.errorMessage = errorMessage.error;
- this.isError = true;
- this.isLoading = false;
- this.eventSchema = new EventSchema();
- });
-
- }
-
- public refreshTree(refreshPreview = true): void {
- this.nodes = new Array<EventProperty>();
- this.nodes.push(this.eventSchema as unknown as EventProperty);
- this.validEventSchema = this.checkIfValid(this.eventSchema);
- if (refreshPreview) {
- this.updatePreview();
+ eventProperty.runtimeName = 'key_0';
+ (eventProperty as any).staticValue = '';
+ eventProperty.runtimeType = this.dataTypesService.getStringTypeUrl();
+ eventProperty.domainProperties = [];
+
+ this.eventSchema.eventProperties.push(eventProperty);
+ this.refreshTree();
}
- }
-
- public addNestedProperty(eventProperty?: EventPropertyNested): void {
- const uuid: string = UUID.UUID();
- const nested: EventPropertyNested = new EventPropertyNested();
- nested['@class'] = 'org.apache.streampipes.model.schema.EventPropertyNested';
- nested.elementId = uuid;
- nested.eventProperties = [];
- nested.domainProperties = [];
- if (!eventProperty) {
- this.eventSchema.eventProperties.push(nested);
- } else {
- eventProperty.eventProperties.push(nested);
+
+ public addTimestampProperty(): void {
+ const eventProperty = new EventPropertyPrimitive();
+ eventProperty['@class'] =
+ 'org.apache.streampipes.model.schema.EventPropertyPrimitive';
+ eventProperty.elementId =
+ 'http://eventProperty.de/timestamp/' + UUID.UUID();
+
+ eventProperty.runtimeName = 'timestamp';
+ eventProperty.label = 'Timestamp';
+ eventProperty.description = 'The current timestamp value';
+ eventProperty.domainProperties = ['http://schema.org/DateTime'];
+ eventProperty.propertyScope = 'HEADER_PROPERTY';
+ eventProperty.runtimeType = 'http://www.w3.org/2001/XMLSchema#long';
+
+ this.eventSchema.eventProperties.push(eventProperty);
+ this.refreshTree();
}
- this.refreshTree();
- }
-
-
- public removeSelectedProperties(eventProperties?: any): void {
- eventProperties = eventProperties || this.eventSchema.eventProperties;
- for (let i = eventProperties.length - 1; i >= 0; --i) {
- if (eventProperties[i].eventProperties) {
- this.removeSelectedProperties(eventProperties[i].eventProperties);
- }
- if (eventProperties[i].selected) {
- eventProperties.splice(i, 1);
- }
+
+ public updatePreview(): void {
+ this.isPreviewEnabled = false;
+ this.transformationRuleService.setOldEventSchema(this.oldEventSchema);
+ this.transformationRuleService.setNewEventSchema(this.eventSchema);
+ const ruleDescriptions = this.transformationRuleService.getTransformationRuleDescriptions();
+ if (this.eventPreview && this.eventPreview.length > 0) {
+ this.restService
+ .getAdapterEventPreview({
+ rules: ruleDescriptions,
+ inputData: this.eventPreview[0],
+ })
+ .subscribe(preview => {
+ this.desiredPreview = preview;
+ this.isPreviewEnabled = true;
+ });
+ }
}
- this.countSelected = 0;
- this.refreshTree();
- }
-
- public addStaticValueProperty(): void {
- const eventProperty = new EventPropertyPrimitive();
- eventProperty['@class'] = 'org.apache.streampipes.model.schema.EventPropertyPrimitive';
- eventProperty.elementId = 'http://eventProperty.de/staticValue/' + UUID.UUID();
-
- eventProperty.runtimeName = 'key_0';
- (eventProperty as any).staticValue = '';
- eventProperty.runtimeType = this.dataTypesService.getStringTypeUrl();
- eventProperty.domainProperties = [];
-
- this.eventSchema.eventProperties.push(eventProperty);
- this.refreshTree();
- }
-
- public addTimestampProperty(): void {
- const eventProperty = new EventPropertyPrimitive();
- eventProperty['@class'] = 'org.apache.streampipes.model.schema.EventPropertyPrimitive';
- eventProperty.elementId = 'http://eventProperty.de/timestamp/' + UUID.UUID();
-
- eventProperty.runtimeName = 'timestamp';
- eventProperty.label = 'Timestamp';
- eventProperty.description = 'The current timestamp value';
- eventProperty.domainProperties = ['http://schema.org/DateTime'];
- eventProperty.propertyScope = 'HEADER_PROPERTY';
- eventProperty.runtimeType = 'http://www.w3.org/2001/XMLSchema#long';
-
- this.eventSchema.eventProperties.push(eventProperty);
- this.refreshTree();
- }
-
- public updatePreview(): void {
- this.isPreviewEnabled = false;
- this.transformationRuleService.setOldEventSchema(this.oldEventSchema);
- this.transformationRuleService.setNewEventSchema(this.eventSchema);
- const ruleDescriptions = this.transformationRuleService.getTransformationRuleDescriptions();
- if (this.eventPreview && this.eventPreview.length > 0) {
- this.restService.getAdapterEventPreview({
- rules: ruleDescriptions,
- inputData: this.eventPreview[0]
- }).subscribe(preview => {
- this.desiredPreview = preview;
- this.isPreviewEnabled = true;
- });
+
+ ngOnChanges(changes: SimpleChanges) {
+ setTimeout(() => {
+ this.refreshTree();
+ }, 200);
}
- }
- ngOnChanges(changes: SimpleChanges) {
- setTimeout(() => {
- this.refreshTree();
- }, 200);
- }
+ public removeSelection() {
+ this.removeSelectionEmitter.emit();
+ }
+ public clickNext() {
+ this.clickNextEmitter.emit();
+ }
- public removeSelection() {
- this.removeSelectionEmitter.emit();
- }
+ public goBack() {
+ this.goBackEmitter.emit();
+ }
- public clickNext() {
- this.clickNextEmitter.emit();
- }
+ private checkIfValid(eventSchema: EventSchema): boolean {
+ let hasTimestamp = false;
+ eventSchema.eventProperties.forEach(p => {
+ if (p.domainProperties.indexOf('http://schema.org/DateTime') > -1) {
+ hasTimestamp = true;
+ }
+ });
- public goBack() {
- this.goBackEmitter.emit();
- }
+ this.schemaErrorHints = [];
- private checkIfValid(eventSchema: EventSchema): boolean {
+ if (this.isEditMode && !this.refreshedEventSchema) {
+ this.setEventSchemaEditWarning();
+ }
- let hasTimestamp = false;
- eventSchema.eventProperties.forEach(p => {
- if (p.domainProperties.indexOf('http://schema.org/DateTime') > -1) {
- hasTimestamp = true;
- }
- });
+ if (!hasTimestamp) {
+ this.schemaErrorHints.push(
+ new UserErrorMessage(
+ 'Missing Timestamp',
+ 'The timestamp must be a UNIX timestamp in milliseconds. Edit the timestamp field or add an ingestion timestamp.',
+ ),
+ );
+ }
- this.schemaErrorHints = [];
- if (!hasTimestamp) {
- this.schemaErrorHints.push(new UserErrorMessage('Missing Timestamp', 'The timestamp must be a UNIX timestamp in milliseconds. Edit the timestamp field or add an ingestion timestamp.'));
- }
+ if (this.fieldStatusInfo) {
+ const badFields = eventSchema.eventProperties
+ .filter(
+ ep => this.fieldStatusInfo[ep.runtimeName] !== undefined,
+ )
+ .map(ep => this.fieldStatusInfo[ep.runtimeName])
+ .find(field => field.fieldStatus !== 'GOOD');
+ if (badFields !== undefined) {
+ this.schemaErrorHints.push(
+ new UserErrorMessage(
+ 'Bad reading',
+ 'At least one field could not be properly read. If this is a permanent problem, consider removing it - keeping this field might cause the adapter to fail or to omit sending events.',
+ 'warning',
+ ),
+ );
+ }
+ }
- if (this.fieldStatusInfo) {
- const badFields = eventSchema.eventProperties
- .filter(ep => this.fieldStatusInfo[ep.runtimeName] !== undefined)
- .map(ep => this.fieldStatusInfo[ep.runtimeName])
- .find(field => field.fieldStatus !== 'GOOD');
- if (badFields !== undefined) {
- this.schemaErrorHints.push(new UserErrorMessage(
- 'Bad reading',
- 'At least one field could not be properly read. If this is a permanent problem, consider removing it - keeping this field might cause the adapter to fail or to omit sending events.',
- 'warning'));
- }
+ return hasTimestamp;
}
-
- return hasTimestamp;
- }
}