Skip to content
Permalink
Browse files
Upgrade helix-front to Angular 10.2 (#2129)
Fix security vulnerabilities in helix-front dependencies. 
Upgrade helix-front dependencies to improve contributor productivity.
  • Loading branch information
micahstubbs committed Jun 2, 2022
1 parent ac0af96 commit 3a9990c2bd61e1a81af699667ee3177475e4bfbf
Showing 63 changed files with 259 additions and 229 deletions.
@@ -1 +1 @@
v10.13.0
v12.20.2
@@ -93,8 +93,8 @@
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
"client/tsconfig.app.json",
"client/tsconfig.spec.json"
],
"exclude": []
}
@@ -129,7 +129,7 @@
"schematics": {
"@schematics/angular:component": {
"prefix": "hi",
"styleext": "scss"
"style": "scss"
},
"@schematics/angular:directive": {
"prefix": "hi"
@@ -1,4 +1,4 @@
import { TestBed, async } from '@angular/core/testing';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';

// import { Angulartics2 } from 'angulartics2';
@@ -8,7 +8,7 @@ import { TestingModule } from '../testing/testing.module';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
TestingModule,
@@ -28,19 +28,19 @@ describe('AppComponent', () => {
}).compileComponents();
}));

it('should create the app', async(() => {
it('should create the app', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));

it(`should have a variable controlling footer`, async(() => {
it(`should have a variable controlling footer`, waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.footerEnabled).toBeDefined();
}));

xit('should render title in a mat-toolbar', async(() => {
xit('should render title in a mat-toolbar', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
@@ -88,13 +88,29 @@ export class AppComponent implements OnInit {
.subscribe(
isAuthorized => {
if (!isAuthorized) {
this.helper.showError("You're not part of helix-admin group or password incorrect");
this.helper.showError('You\'re not part of helix-admin group or password incorrect');
}
this.currentUser = this.service.getCurrentUser();
},
error => this.helper.showError(error)
error => {
// since rest API simply throws 404 instead of empty config when config is not initialized yet
// frontend has to treat 404 as normal result
if (error != 'Not Found') {
this.helper.showError(error);
}
this.isLoading = false;
},
);
}
});
},
error => {
// since rest API simply throws 404 instead of empty config when config is not initialized yet
// frontend has to treat 404 as normal result
if (error != 'Not Found') {
this.helper.showError(error);
}
this.isLoading = false;
},
);
}
}
@@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';

import { TestingModule } from '../../../testing/testing.module';
@@ -9,7 +9,7 @@ describe('HelixListComponent', () => {
let component: HelixListComponent;
let fixture: ComponentFixture<HelixListComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
TestingModule
@@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';

import { TestingModule } from '../../../testing/testing.module';
@@ -8,7 +8,7 @@ describe('ClusterDetailComponent', () => {
let component: ClusterDetailComponent;
let fixture: ComponentFixture<ClusterDetailComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
TestingModule
@@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';

import { TestingModule } from '../../../testing/testing.module';
@@ -8,7 +8,7 @@ describe('ClusterListComponent', () => {
let component: ClusterListComponent;
let fixture: ComponentFixture<ClusterListComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
TestingModule
@@ -16,9 +16,9 @@ import { InputDialogComponent } from '../../shared/dialog/input-dialog/input-dia
export class ClusterListComponent implements OnInit {

clusters: Cluster[] = [];
errorMessage: string = '';
isLoading: boolean = true;
can: boolean = false;
errorMessage = '';
isLoading = true;
can = false;
service = '';

constructor(
@@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';

@@ -9,7 +9,7 @@ describe('ClusterComponent', () => {
let component: ClusterComponent;
let fixture: ComponentFixture<ClusterComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
FlexLayoutModule,
@@ -34,7 +34,7 @@ describe('ClusterComponent', () => {
expect(component).toBeTruthy();
});

it('should contain cluster list', async(() => {
it('should contain cluster list', waitForAsync(() => {
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('hi-cluster-list')).toBeDefined();
@@ -24,7 +24,7 @@ export class ClusterComponent implements OnInit {
change.forEach((item) => {
this.isNarrowView = (item.mqAlias === 'xs' || item.mqAlias === 'sm');
})

});
}

@@ -23,8 +23,8 @@ export class Cluster {
this.resources = obj.resources;
this.inMaintenance = obj.maintenance;

let ins: Instance[] = [];
for (let instance of obj.instances) {
const ins: Instance[] = [];
for (const instance of obj.instances) {
ins.push(new Instance(
instance,
this.name,
@@ -1,5 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing'

import { TestingModule } from '../../../testing/testing.module';
import { ConfigDetailComponent } from './config-detail.component';
@@ -8,10 +9,10 @@ describe('ConfigDetailComponent', () => {
let component: ConfigDetailComponent;
let fixture: ComponentFixture<ConfigDetailComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
TestingModule
TestingModule, HttpClientTestingModule
],
declarations: [
ConfigDetailComponent
@@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';

import { ControllerDetailComponent } from './controller-detail.component';
@@ -9,11 +9,11 @@ describe('ControllerDetailComponent', () => {
let component: ControllerDetailComponent;
let fixture: ComponentFixture<ControllerDetailComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
HttpClientModule,
RouterTestingModule
HttpClientTestingModule,
RouterTestingModule,
],
declarations: [ ControllerDetailComponent ],
schemas: [
@@ -71,7 +71,7 @@ export class HelixService {
}

protected getHeaders() {
let headers = new HttpHeaders();
const headers = new HttpHeaders();
headers.append('Accept', 'application/json');
headers.append('Content-Type', 'application/json');
return headers;
@@ -31,7 +31,7 @@ export class UserService {
}

protected getHeaders() {
let headers = new HttpHeaders();
const headers = new HttpHeaders();
headers.append('Accept', 'application/json');
headers.append('Content-Type', 'application/json');
return headers;
@@ -1,5 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';

import { VisModule } from 'ngx-vis';

@@ -10,9 +11,9 @@ describe('DashboardComponent', () => {
let component: DashboardComponent;
let fixture: ComponentFixture<DashboardComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ TestingModule, VisModule ],
imports: [ TestingModule, VisModule, HttpClientTestingModule ],
schemas: [ NO_ERRORS_SCHEMA ],
declarations: [ DashboardComponent ]
})
@@ -5,8 +5,8 @@ import {
AfterViewInit,
OnDestroy
} from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Observable, Subscription } from 'rxjs';
import { ActivatedRoute } from '@angular/router';
import { Subscription } from 'rxjs';
import { map } from 'rxjs/operators';

import * as _ from 'lodash';
@@ -27,7 +27,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy {
public visNetworkData: Data;
public visNetworkOptions: Options;
public nodes: Node[];
public edges: Edge[];
public edges: Edge[];

public clusterName: string;
public isLoading = false;
@@ -39,7 +39,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy {
public updateInterval = 3000;

public constructor(
private el:ElementRef,
private el: ElementRef,
private route: ActivatedRoute,
protected visNetworkService: VisNetworkService,
protected resourceService: ResourceService,
@@ -82,7 +82,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy {
}

ngOnInit() {
this.nodes =
this.nodes = [];
this.edges = [];
this.visNetworkData = { nodes: this.nodes, edges: this.edges }
this.visNetworkOptions = {
@@ -131,20 +131,22 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy {

initDashboard() {
// resize container according to the parent
let width = this.el.nativeElement.offsetWidth;
let height = this.el.nativeElement.offsetHeight - 36;
let dashboardDom = this.el.nativeElement.getElementsByClassName(this.visNetwork)[0];
const width = this.el.nativeElement.offsetWidth;
const height = this.el.nativeElement.offsetHeight - 36;
const dashboardDom = this.el.nativeElement.getElementsByClassName(this.visNetwork)[0];
dashboardDom.style.width = `${ width }px`;
dashboardDom.style.height = `${ height }px`;

// load data
this.route.parent.params
.pipe(map(p => p.name))
.subscribe(name => {
this.clusterName = name;
this.fetchResources();
// this.updateResources();
if (this.route && this.route.parent) {
this.route.parent.params
.pipe(map(p => p.name))
.subscribe(name => {
this.clusterName = name;
this.fetchResources();
// this.updateResources();
});
}
}

ngAfterViewInit() {
@@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { RouterTestingModule } from '@angular/router/testing';
@@ -9,7 +9,7 @@ describe('HistoryListComponent', () => {
let component: HistoryListComponent;
let fixture: ComponentFixture<HistoryListComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
HttpClientModule,
@@ -36,9 +36,9 @@ export class HistoryListComponent implements OnInit {

ngOnInit() {
if (this.route.parent) {
let clusterName = this.route.parent.snapshot.params['cluster_name'];
let instanceName = this.route.parent.snapshot.params['instance_name'];
let observable = instanceName
const clusterName = this.route.parent.snapshot.params['cluster_name'];
const instanceName = this.route.parent.snapshot.params['instance_name'];
const observable = instanceName
? this.service.getInstanceHistory(clusterName, instanceName)
: this.service.getControllerHistory(clusterName);

0 comments on commit 3a9990c

Please sign in to comment.