Skip to content

Commit

Permalink
Improve schema updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikriemer committed Oct 15, 2023
1 parent 16dc365 commit 08c328b
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { UUID } from 'angular2-uuid';
import { DataTypesService } from '../../../../services/data-type.service';
import {
AdapterDescription,
EventProperty,
EventPropertyNested,
EventPropertyPrimitive,
EventPropertyUnion,
Expand Down Expand Up @@ -89,8 +88,7 @@ export class EventSchemaComponent implements OnChanges {
@Output()
clickNextEmitter: EventEmitter<MatStepper> = new EventEmitter();

@ViewChild(TreeComponent, { static: true })
tree: TreeComponent;
_tree: TreeComponent;

schemaGuess: GuessSchema = new GuessSchema();
countSelected = 0;
Expand Down Expand Up @@ -150,13 +148,11 @@ export class EventSchemaComponent implements OnChanges {
this.originalSchema = guessSchema.eventSchema;
this.validEventSchema = this.checkIfValid(this.targetSchema);

this.refreshTree();

this.isEditable = true;
this.isEditableChange.emit(true);
this.isLoading = false;
this.refreshedEventSchema = true;

this.refreshTree();
if (
guessSchema.eventPreview &&
guessSchema.eventPreview.length > 0
Expand All @@ -181,6 +177,11 @@ export class EventSchemaComponent implements OnChanges {
if (refreshPreview) {
this.updatePreview();
}
setTimeout(() => {
if (this._tree) {
this._tree.treeModel.expandAll();
}
});
}
}

Expand Down Expand Up @@ -346,4 +347,13 @@ export class EventSchemaComponent implements OnChanges {
this.targetSchema.eventProperties = this.nodes;
this.updatePreview();
}

@ViewChild('tree')
set tree(treeComponent: TreeComponent) {
this._tree = treeComponent;
}

get tree(): TreeComponent {
return this._tree;
}
}

0 comments on commit 08c328b

Please sign in to comment.