Commit 54f0bd4b7ab0cab4091e20b6d7261147e4c6fe0a
1 parent
f95a5910
Added default cloudEndpoint for new edges
Showing
2 changed files
with
11 additions
and
7 deletions
@@ -17,13 +17,14 @@ | @@ -17,13 +17,14 @@ | ||
17 | import { BaseData, HasId } from '@shared/models/base-data'; | 17 | import { BaseData, HasId } from '@shared/models/base-data'; |
18 | import { FormBuilder, FormGroup } from '@angular/forms'; | 18 | import { FormBuilder, FormGroup } from '@angular/forms'; |
19 | import { PageComponent } from '@shared/components/page.component'; | 19 | import { PageComponent } from '@shared/components/page.component'; |
20 | -import { Directive, EventEmitter, Input, OnInit, Output } from '@angular/core'; | 20 | +import { Directive, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core'; |
21 | import { Store } from '@ngrx/store'; | 21 | import { Store } from '@ngrx/store'; |
22 | import { AppState } from '@core/core.state'; | 22 | import { AppState } from '@core/core.state'; |
23 | import { EntityAction } from '@home/models/entity/entity-component.models'; | 23 | import { EntityAction } from '@home/models/entity/entity-component.models'; |
24 | import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; | 24 | import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; |
25 | import { PageLink } from '@shared/models/page/page-link'; | 25 | import { PageLink } from '@shared/models/page/page-link'; |
26 | import { isObject, isString } from '@core/utils'; | 26 | import { isObject, isString } from '@core/utils'; |
27 | +import { WINDOW } from "@core/services/window.service"; | ||
27 | 28 | ||
28 | // @dynamic | 29 | // @dynamic |
29 | @Directive() | 30 | @Directive() |
@@ -80,7 +81,8 @@ export abstract class EntityComponent<T extends BaseData<HasId>, | @@ -80,7 +81,8 @@ export abstract class EntityComponent<T extends BaseData<HasId>, | ||
80 | protected constructor(protected store: Store<AppState>, | 81 | protected constructor(protected store: Store<AppState>, |
81 | protected fb: FormBuilder, | 82 | protected fb: FormBuilder, |
82 | protected entityValue: T, | 83 | protected entityValue: T, |
83 | - protected entitiesTableConfigValue: C) { | 84 | + protected entitiesTableConfigValue: C, |
85 | + @Inject(WINDOW) protected window: Window) { | ||
84 | super(store); | 86 | super(store); |
85 | this.entityForm = this.buildForm(this.entityValue); | 87 | this.entityForm = this.buildForm(this.entityValue); |
86 | } | 88 | } |
@@ -18,7 +18,7 @@ import { Component, Inject } from '@angular/core'; | @@ -18,7 +18,7 @@ import { Component, Inject } from '@angular/core'; | ||
18 | import { Store } from '@ngrx/store'; | 18 | import { Store } from '@ngrx/store'; |
19 | import { AppState } from "@core/core.state"; | 19 | import { AppState } from "@core/core.state"; |
20 | import { EntityComponent } from "@home/components/entity/entity.component"; | 20 | import { EntityComponent } from "@home/components/entity/entity.component"; |
21 | -import {FormBuilder, FormControl, FormGroup, NgModel, Validators} from "@angular/forms"; | 21 | +import { FormBuilder, FormGroup, Validators } from "@angular/forms"; |
22 | import { EntityType } from "@shared/models/entity-type.models"; | 22 | import { EntityType } from "@shared/models/entity-type.models"; |
23 | import { EdgeInfo } from "@shared/models/edge.models"; | 23 | import { EdgeInfo } from "@shared/models/edge.models"; |
24 | import { TranslateService } from "@ngx-translate/core"; | 24 | import { TranslateService } from "@ngx-translate/core"; |
@@ -26,6 +26,7 @@ import { NULL_UUID } from "@shared/models/id/has-uuid"; | @@ -26,6 +26,7 @@ import { NULL_UUID } from "@shared/models/id/has-uuid"; | ||
26 | import { ActionNotificationShow } from "@core/notification/notification.actions"; | 26 | import { ActionNotificationShow } from "@core/notification/notification.actions"; |
27 | import { guid, isUndefined } from "@core/utils"; | 27 | import { guid, isUndefined } from "@core/utils"; |
28 | import { EntityTableConfig } from "@home/models/entity/entities-table-config.models"; | 28 | import { EntityTableConfig } from "@home/models/entity/entities-table-config.models"; |
29 | +import { WINDOW } from "@core/services/window.service"; | ||
29 | 30 | ||
30 | @Component({ | 31 | @Component({ |
31 | selector: 'tb-edge', | 32 | selector: 'tb-edge', |
@@ -42,8 +43,9 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | @@ -42,8 +43,9 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | ||
42 | protected translate: TranslateService, | 43 | protected translate: TranslateService, |
43 | @Inject('entity') protected entityValue: EdgeInfo, | 44 | @Inject('entity') protected entityValue: EdgeInfo, |
44 | @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EdgeInfo>, | 45 | @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EdgeInfo>, |
45 | - public fb: FormBuilder) { | ||
46 | - super(store, fb, entityValue, entitiesTableConfigValue); | 46 | + public fb: FormBuilder, |
47 | + @Inject(WINDOW) protected window: Window) { | ||
48 | + super(store, fb, entityValue, entitiesTableConfigValue, window); | ||
47 | } | 49 | } |
48 | 50 | ||
49 | ngOnInit() { | 51 | ngOnInit() { |
@@ -69,8 +71,8 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | @@ -69,8 +71,8 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { | ||
69 | name: [entity ? entity.name : '', [Validators.required]], | 71 | name: [entity ? entity.name : '', [Validators.required]], |
70 | type: [entity ? entity.type : null, [Validators.required]], | 72 | type: [entity ? entity.type : null, [Validators.required]], |
71 | label: [entity ? entity.label : ''], | 73 | label: [entity ? entity.label : ''], |
72 | - cloudEndpoint: '', | ||
73 | - edgeLicenseKey: '', | 74 | + cloudEndpoint: [this.window.location.origin, [Validators.required]], |
75 | + edgeLicenseKey: ['', [Validators.required]], | ||
74 | routingKey: guid(), | 76 | routingKey: guid(), |
75 | secret: this.generateSecret(20), | 77 | secret: this.generateSecret(20), |
76 | additionalInfo: this.fb.group( | 78 | additionalInfo: this.fb.group( |