Skip to content

Commit

Permalink
remove seed-datacenter handling (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrIncompetent committed Mar 6, 2018
1 parent a3938c0 commit 8c6a6ee
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@
</div>
</mat-card-content>
<mat-card-content class="km-card-list-content" fxLayout>
<div fxFlex="20%">
<strong>Seed Region:</strong>
</div>
<div fxFlex="25%">{{seedDc.spec.country}} / {{seedDc.spec.location}}</div>
<div fxFlex="20%"></div>
<div fxFlex="35%"></div>
</mat-card-content>

</mat-card>
Expand Down Expand Up @@ -117,7 +111,7 @@
</mat-card-content>
</mat-card>

<kubermatic-node [nodes]="nodes" [clusterName]="cluster.metadata.name" [seedDcName]="cluster.seed" [nodeProvider]="cluster.provider" [clusterRunning]="cluster.isRunning()"></kubermatic-node>
<kubermatic-node [nodes]="nodes" [clusterName]="cluster.metadata.name" [nodeProvider]="cluster.provider" [clusterRunning]="cluster.isRunning()"></kubermatic-node>

<mat-card [fxShow]="cluster.provider == 'bringyourown'">
<mat-card-content>
Expand Down
58 changes: 25 additions & 33 deletions src/app/cluster/cluster-details/cluster-details.component.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import { AddNodeModalComponent } from './add-node-modal/add-node-modal.component';
import { NotificationActions } from 'app/redux/actions/notification.actions';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { ApiService } from 'app/core/services/api/api.service';
import { environment } from '../../../environments/environment';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import { MatDialog } from '@angular/material';
import { ClusterDeleteConfirmationComponent } from './cluster-delete-confirmation/cluster-delete-confirmation.component';
import { NodeEntity } from 'app/shared/entity/NodeEntity';
import { ClusterEntity } from 'app/shared/entity/ClusterEntity';
import { DataCenterEntity } from 'app/shared/entity/DatacenterEntity';
import { NodeProvider } from 'app/shared/model/NodeProviderConstants';
import { AddNodeModalData } from 'app/shared/model/add-node-modal-data';
import { UpgradeClusterComponent } from './upgrade-cluster/upgrade-cluster.component';
import { CustomEventService, CreateNodesService, DatacenterService } from 'app/core/services';
import 'rxjs/add/operator/retry';

import { SSHKeyEntity } from 'app/shared/entity/SSHKeyEntity';
import { UpgradeClusterComponentData } from 'app/shared/model/UpgradeClusterDialogData';
import {ClusterConnectComponent} from './cluster-connect/cluster-connect.component';
import { environment } from '../../../environments/environment';
import { ClusterConnectComponent } from './cluster-connect/cluster-connect.component';
import { NodeEntity } from '../../shared/entity/NodeEntity';
import { ClusterEntity } from '../../shared/entity/ClusterEntity';
import { DataCenterEntity } from '../../shared/entity/DatacenterEntity';
import { SSHKeyEntity } from '../../shared/entity/SSHKeyEntity';
import { ApiService, CreateNodesService, CustomEventService, DatacenterService } from '../../core/services';
import { NodeProvider } from '../../shared/model/NodeProviderConstants';
import { AddNodeModalData } from '../../shared/model/add-node-modal-data';
import { UpgradeClusterComponentData } from '../../shared/model/UpgradeClusterDialogData';

@Component({
selector: 'kubermatic-cluster-details',
Expand All @@ -31,7 +28,6 @@ export class ClusterDetailsComponent implements OnInit, OnDestroy {
private restRoot: string = environment.restRoot;
public nodes: NodeEntity[];
public cluster: ClusterEntity;
public seedDc: DataCenterEntity;
public nodeDc: DataCenterEntity;
public timer: any = Observable.timer(0, 10000);
public sub: Subscription;
Expand All @@ -40,21 +36,21 @@ export class ClusterDetailsComponent implements OnInit, OnDestroy {
public clusterName: string;
public loading: boolean = true;
public sshKeys: SSHKeyEntity[] = [];
private upgradesList: string[] = [];
private gotUpgradesList: boolean;
public groupedNodes: object[];
public stateOfTheAccordion: object[];
public moreSshKeys: boolean = false;

constructor(
private customEventService: CustomEventService,
private route: ActivatedRoute,
private router: Router,
private api: ApiService,
public dialog: MatDialog,
private createNodesService: CreateNodesService,
private dcService: DatacenterService
) {}
private upgradesList: string[] = [];
private gotUpgradesList: boolean;

constructor(private customEventService: CustomEventService,
private route: ActivatedRoute,
private router: Router,
private api: ApiService,
public dialog: MatDialog,
private createNodesService: CreateNodesService,
private dcService: DatacenterService) {
}

public ngOnInit(): void {
this.clusterName = this.route.snapshot.paramMap.get('clusterName');
Expand Down Expand Up @@ -121,10 +117,6 @@ export class ClusterDetailsComponent implements OnInit, OnDestroy {
res.status,
);

if (!this.seedDc) {
this.loadDataCenter(this.cluster.spec.seedDatacenterName, 'seedDc');
}

if (!this.nodeDc && this.cluster.provider !== NodeProvider.BRINGYOUROWN) {
this.loadDataCenter(this.cluster.spec.cloud.dc, 'nodeDc');
}
Expand Down Expand Up @@ -194,9 +186,9 @@ export class ClusterDetailsComponent implements OnInit, OnDestroy {

public isLoaded(): boolean {
if (this.cluster && this.cluster.provider === NodeProvider.BRINGYOUROWN) {
return !!this.seedDc;
return true;
} else if (this.cluster) {
return !!this.seedDc && !!this.nodeDc;
return !!this.nodeDc;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@
</p>
</ng-container>
</div>

<div fxFlex="16%" fxHide.sm fxHide.xs>
<ng-container *ngIf="seedDC">
{{this.seedDC.spec.country}} ({{this.seedDC.spec.location}})
</ng-container>
</div>
<div fxFlex="16%" fxHide.sm fxHide.xs>
<div fxFlex="32%" fxHide.sm fxHide.xs>
<ng-container *ngIf="nodeDC">
{{this.nodeDC.spec.country}} ({{this.nodeDC.spec.location}})
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class ClusterItemComponent implements OnInit, OnDestroy {
@Input() index: number;
@Input() health: Health;
public nodeDC: DataCenterEntity;
public seedDC: DataCenterEntity;

constructor(private dcService: DatacenterService) {}

Expand All @@ -25,10 +24,6 @@ export class ClusterItemComponent implements OnInit, OnDestroy {
}
);
}
this.dcService.getDataCenter(this.cluster.spec.seedDatacenterName).subscribe(result => {
this.seedDC = result;
});

}

public getClusterImagePath(): string {
Expand Down
5 changes: 1 addition & 4 deletions src/app/cluster/cluster-list/cluster-list.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
<div fxFlex="16%" fxFlex.sm="20.66%" fxFlex.xs="25%" mat-sort-header="provider">
<strong>Provider</strong>
</div>
<div fxFlex="16%" fxHide.sm fxHide.xs mat-sort-header="seed-region">
<strong>Seed Region</strong>
</div>
<div fxFlex="16%" fxHide.sm fxHide.xs mat-sort-header="region">
<div fxFlex="32%" fxHide.sm fxHide.xs mat-sort-header="region">
<strong>Region</strong>
</div>
<div fxFlex="16%" fxFlex.sm="20.66%" fxHide.xs mat-sort-header="status">
Expand Down
3 changes: 0 additions & 3 deletions src/app/cluster/cluster-list/cluster-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Sort } from '@angular/material';
import { ApiService } from '../../core/services/api/api.service';
import { DataCenterEntity } from 'app/shared/entity/DatacenterEntity';
import { ClusterEntity } from '../../shared/entity/ClusterEntity';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
Expand All @@ -18,7 +17,6 @@ export class ClusterListComponent implements OnInit, OnDestroy {
public timer: any = Observable.timer(0, 10000);
public sub: Subscription;
public loading: boolean = true;

public sortedData: ClusterEntity[] = [];

constructor(public api: ApiService) {}
Expand Down Expand Up @@ -68,7 +66,6 @@ export class ClusterListComponent implements OnInit, OnDestroy {
switch (sort.active) {
case 'name': return this.compare(a.spec.humanReadableName, b.spec.humanReadableName, isAsc);
case 'provider': return this.getProvider(a, b, isAsc);
case 'seed-region': return this.compare(a.spec.seedDatacenterName, b.spec.seedDatacenterName, isAsc);
case 'region': return this.compare(a.spec.cloud.dc, b.spec.cloud.dc, isAsc);
case 'status': return this.compare(a.status.phase, b.status.phase, isAsc);
default: return 0;
Expand Down
6 changes: 1 addition & 5 deletions src/app/shared/entity/ClusterEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,13 @@ export class ClusterSpec {
cloud: CloudSpec;
humanReadableName: string;
masterVersion: string;
seedDatacenterName: string;

constructor(cloud: CloudSpec,
humanReadableName: string,
masterVersion: string,
seedDatacenterName: string) {
masterVersion: string) {
this.cloud = cloud;
this.humanReadableName = humanReadableName;
this.masterVersion = masterVersion;
this.seedDatacenterName = seedDatacenterName;
}
}

Expand Down Expand Up @@ -125,7 +122,6 @@ export class Status {
kubeletCert: Certificate;
apiserverSshKey: SSHKeyPair;
serviceAccountKey: string;
seed: string;
namespaceName: string;
}

Expand Down
2 changes: 0 additions & 2 deletions src/app/testing/fake-data/cluster.fake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const clusterModelFake: CreateClusterModel = {
},
humanReadableName: 'adoring-franklin',
masterVersion: '',
seedDatacenterName: ''
},
sshKeys: [
'key-ssh1'
Expand Down Expand Up @@ -55,7 +54,6 @@ export const clusterFake = {
humanReadableName: 'nifty-haibt',
masterVersion: '1.8.5',
workerName: '',
seedDatacenterName: 'europe-west3-c'
},
address: {
url: 'https://4k6txp5sq.europe-west3-c.dev.kubermatic.io:30002',
Expand Down
1 change: 0 additions & 1 deletion src/app/testing/fake-data/wizard.fake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const doClusterModelFake: CreateClusterModel = {
},
humanReadableName: 'wizardly-pike',
masterVersion: '',
seedDatacenterName: ''
},
sshKeys: [
'key1'
Expand Down
3 changes: 1 addition & 2 deletions src/app/wizard/set-settings/set-settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { ClusterSpec, CloudSpec } from '../../shared/entity/ClusterEntity';
import { CreateClusterModel } from '../../shared/model/CreateClusterModel';
import { select, NgRedux } from '@angular-redux/store';
import { Observable } from 'rxjs/Observable';
import { WizardActions } from 'app/redux/actions/wizard.actions';
import { Subscription } from 'rxjs/Subscription';
import { WizardActions } from '../../redux/actions/wizard.actions';

@Component({
selector: 'kubermatic-set-settings',
Expand Down Expand Up @@ -60,7 +60,6 @@ export class SetSettingsComponent implements OnInit, OnDestroy {
this.clusterSpec = new ClusterSpec(
this.cloudSpec,
this.clusterName,
'',
''
);

Expand Down

0 comments on commit 8c6a6ee

Please sign in to comment.