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 | 17 | import { BaseData, HasId } from '@shared/models/base-data'; |
18 | 18 | import { FormBuilder, FormGroup } from '@angular/forms'; |
19 | 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 | 21 | import { Store } from '@ngrx/store'; |
22 | 22 | import { AppState } from '@core/core.state'; |
23 | 23 | import { EntityAction } from '@home/models/entity/entity-component.models'; |
24 | 24 | import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; |
25 | 25 | import { PageLink } from '@shared/models/page/page-link'; |
26 | 26 | import { isObject, isString } from '@core/utils'; |
27 | +import { WINDOW } from "@core/services/window.service"; | |
27 | 28 | |
28 | 29 | // @dynamic |
29 | 30 | @Directive() |
... | ... | @@ -80,7 +81,8 @@ export abstract class EntityComponent<T extends BaseData<HasId>, |
80 | 81 | protected constructor(protected store: Store<AppState>, |
81 | 82 | protected fb: FormBuilder, |
82 | 83 | protected entityValue: T, |
83 | - protected entitiesTableConfigValue: C) { | |
84 | + protected entitiesTableConfigValue: C, | |
85 | + @Inject(WINDOW) protected window: Window) { | |
84 | 86 | super(store); |
85 | 87 | this.entityForm = this.buildForm(this.entityValue); |
86 | 88 | } | ... | ... |
... | ... | @@ -18,7 +18,7 @@ import { Component, Inject } from '@angular/core'; |
18 | 18 | import { Store } from '@ngrx/store'; |
19 | 19 | import { AppState } from "@core/core.state"; |
20 | 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 | 22 | import { EntityType } from "@shared/models/entity-type.models"; |
23 | 23 | import { EdgeInfo } from "@shared/models/edge.models"; |
24 | 24 | import { TranslateService } from "@ngx-translate/core"; |
... | ... | @@ -26,6 +26,7 @@ import { NULL_UUID } from "@shared/models/id/has-uuid"; |
26 | 26 | import { ActionNotificationShow } from "@core/notification/notification.actions"; |
27 | 27 | import { guid, isUndefined } from "@core/utils"; |
28 | 28 | import { EntityTableConfig } from "@home/models/entity/entities-table-config.models"; |
29 | +import { WINDOW } from "@core/services/window.service"; | |
29 | 30 | |
30 | 31 | @Component({ |
31 | 32 | selector: 'tb-edge', |
... | ... | @@ -42,8 +43,9 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { |
42 | 43 | protected translate: TranslateService, |
43 | 44 | @Inject('entity') protected entityValue: EdgeInfo, |
44 | 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 | 51 | ngOnInit() { |
... | ... | @@ -69,8 +71,8 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> { |
69 | 71 | name: [entity ? entity.name : '', [Validators.required]], |
70 | 72 | type: [entity ? entity.type : null, [Validators.required]], |
71 | 73 | label: [entity ? entity.label : ''], |
72 | - cloudEndpoint: '', | |
73 | - edgeLicenseKey: '', | |
74 | + cloudEndpoint: [this.window.location.origin, [Validators.required]], | |
75 | + edgeLicenseKey: ['', [Validators.required]], | |
74 | 76 | routingKey: guid(), |
75 | 77 | secret: this.generateSecret(20), |
76 | 78 | additionalInfo: this.fb.group( | ... | ... |