Browse Source

Added default cloudEndpoint for new edges

pull/3811/head
Artem Babak 6 years ago
parent
commit
54f0bd4b7a
  1. 6
      ui-ngx/src/app/modules/home/components/entity/entity.component.ts
  2. 12
      ui-ngx/src/app/modules/home/pages/edge/edge.component.ts

6
ui-ngx/src/app/modules/home/components/entity/entity.component.ts

@ -17,13 +17,14 @@
import { BaseData, HasId } from '@shared/models/base-data';
import { FormBuilder, FormGroup } from '@angular/forms';
import { PageComponent } from '@shared/components/page.component';
import { Directive, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Directive, EventEmitter, Inject, Input, OnInit, Output } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { EntityAction } from '@home/models/entity/entity-component.models';
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models';
import { PageLink } from '@shared/models/page/page-link';
import { isObject, isString } from '@core/utils';
import { WINDOW } from "@core/services/window.service";
// @dynamic
@Directive()
@ -80,7 +81,8 @@ export abstract class EntityComponent<T extends BaseData<HasId>,
protected constructor(protected store: Store<AppState>,
protected fb: FormBuilder,
protected entityValue: T,
protected entitiesTableConfigValue: C) {
protected entitiesTableConfigValue: C,
@Inject(WINDOW) protected window: Window) {
super(store);
this.entityForm = this.buildForm(this.entityValue);
}

12
ui-ngx/src/app/modules/home/pages/edge/edge.component.ts

@ -18,7 +18,7 @@ import { Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from "@core/core.state";
import { EntityComponent } from "@home/components/entity/entity.component";
import {FormBuilder, FormControl, FormGroup, NgModel, Validators} from "@angular/forms";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { EntityType } from "@shared/models/entity-type.models";
import { EdgeInfo } from "@shared/models/edge.models";
import { TranslateService } from "@ngx-translate/core";
@ -26,6 +26,7 @@ import { NULL_UUID } from "@shared/models/id/has-uuid";
import { ActionNotificationShow } from "@core/notification/notification.actions";
import { guid, isUndefined } from "@core/utils";
import { EntityTableConfig } from "@home/models/entity/entities-table-config.models";
import { WINDOW } from "@core/services/window.service";
@Component({
selector: 'tb-edge',
@ -42,8 +43,9 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
protected translate: TranslateService,
@Inject('entity') protected entityValue: EdgeInfo,
@Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<EdgeInfo>,
public fb: FormBuilder) {
super(store, fb, entityValue, entitiesTableConfigValue);
public fb: FormBuilder,
@Inject(WINDOW) protected window: Window) {
super(store, fb, entityValue, entitiesTableConfigValue, window);
}
ngOnInit() {
@ -69,8 +71,8 @@ export class EdgeComponent extends EntityComponent<EdgeInfo> {
name: [entity ? entity.name : '', [Validators.required]],
type: [entity ? entity.type : null, [Validators.required]],
label: [entity ? entity.label : ''],
cloudEndpoint: '',
edgeLicenseKey: '',
cloudEndpoint: [this.window.location.origin, [Validators.required]],
edgeLicenseKey: ['', [Validators.required]],
routingKey: guid(),
secret: this.generateSecret(20),
additionalInfo: this.fb.group(

Loading…
Cancel
Save