Skip to content

Commit 48f55f4

Browse files
authored
Merge branch 'develop' into feature/add_delete_instance
2 parents 7b8ab14 + a1af630 commit 48f55f4

22 files changed

+913
-411
lines changed

client/package-lock.json

Lines changed: 796 additions & 283 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,49 @@
1111
},
1212
"private": true,
1313
"dependencies": {
14-
"@angular/animations": "^7.0.4",
15-
"@angular/cdk": "^7.0.4",
16-
"@angular/common": "^7.0.4",
17-
"@angular/compiler": "^7.0.4",
18-
"@angular/core": "^7.0.4",
19-
"@angular/forms": "^7.0.4",
20-
"@angular/http": "^7.0.4",
21-
"@angular/material": "^7.0.4",
22-
"@angular/platform-browser": "^7.0.4",
23-
"@angular/platform-browser-dynamic": "^7.0.4",
24-
"@angular/router": "^7.0.4",
25-
"@ng-bootstrap/ng-bootstrap": "^4.0.0",
14+
"@angular/animations": "^7.1.4",
15+
"@angular/cdk": "^7.2.0",
16+
"@angular/common": "^7.1.4",
17+
"@angular/compiler": "^7.1.4",
18+
"@angular/core": "^7.1.4",
19+
"@angular/forms": "^7.1.4",
20+
"@angular/http": "^7.1.4",
21+
"@angular/material": "^7.2.0",
22+
"@angular/platform-browser": "^7.1.4",
23+
"@angular/platform-browser-dynamic": "^7.1.4",
24+
"@angular/router": "^7.1.4",
25+
"@ng-bootstrap/ng-bootstrap": "^4.0.1",
2626
"bootstrap": "^4.1.3",
27-
"core-js": "^2.5.7",
27+
"core-js": "^2.6.1",
2828
"font-awesome": "^4.7.0",
29+
"hammerjs": "^2.0.8",
2930
"jquery": "^3.3.1",
3031
"material-design-icons": "^3.0.1",
31-
"popper.js": "^1.14.5",
32+
"popper.js": "^1.14.6",
3233
"rxjs": "^6.3.3",
3334
"zone.js": "^0.8.26"
3435
},
3536
"devDependencies": {
36-
"@angular-devkit/build-angular": "^0.10.6",
37-
"@angular/cli": "^7.0.6",
38-
"@angular/compiler-cli": "^7.0.4",
39-
"@angular/language-service": "^7.0.4",
40-
"@types/jasmine": "^2.8.11",
37+
"@angular-devkit/build-angular": "^0.10.7",
38+
"@angular/cli": "^7.1.4",
39+
"@angular/compiler-cli": "^7.1.4",
40+
"@angular/language-service": "^7.1.4",
41+
"@types/jasmine": "^2.8.14",
4142
"@types/jasminewd2": "^2.0.6",
42-
"@types/node": "^10.12.9",
43+
"@types/node": "^10.12.18",
4344
"codelyzer": "^4.5.0",
4445
"jasmine-core": "^3.3.0",
4546
"jasmine-spec-reporter": "^4.2.1",
46-
"karma": "^3.1.1",
47+
"karma": "^3.1.4",
4748
"karma-chrome-launcher": "^2.2.0",
4849
"karma-cli": "^1.0.1",
4950
"karma-coverage-istanbul-reporter": "^2.0.4",
5051
"karma-firefox-launcher": "^1.1.0",
51-
"karma-jasmine": "^2.0.0",
52+
"karma-jasmine": "^2.0.1",
5253
"karma-jasmine-html-reporter": "^1.4.0",
5354
"protractor": "^5.4.1",
5455
"ts-node": "^7.0.1",
55-
"tslint": "^5.11.0",
56+
"tslint": "^5.12.0",
5657
"typescript": "^3.1.6"
5758
}
5859
}

client/src/app/api/api/api.service.spec.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,19 @@
1616
* limitations under the License.
1717
*/
1818

19-
import { TestBed, async,fakeAsync, inject } from '@angular/core/testing';
19+
import { TestBed, async, inject } from '@angular/core/testing';
2020
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2121
import { ApiService } from './api.service';
2222
import { HttpClientModule } from '@angular/common/http';
2323

2424
describe('ApiService', () => {
2525

26-
let service, http;
27-
2826
beforeEach(() => {
2927
TestBed.configureTestingModule({
3028
imports: [HttpClientTestingModule, HttpClientModule],
3129
providers: [ApiService],
3230
});
3331

34-
service = TestBed.get(ApiService);
35-
http = TestBed.get(HttpTestingController);
3632
});
3733

3834

client/src/app/api/api/socket.service.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ import {InstanceLink} from '../model/instanceLink';
3232

3333

3434
interface ObserverMap {
35-
[key: string]: Subject<any>;
35+
[key: string]: Subject<ReturnType>;
3636
}
37-
37+
type ReturnType = Instance | InstanceLink | number | DockerOperationError;
3838
@Injectable({
3939
providedIn: 'root'
4040
})
@@ -89,17 +89,16 @@ export class SocketService {
8989
*
9090
* @param eventName
9191
*/
92-
public subscribeForEvent(eventName: EventType): Observable<number | InstanceLink | Instance | DockerOperationError> {
93-
94-
return new Observable((observer: Observer<any>) => {
92+
public subscribeForEvent<T extends ReturnType>(eventName: EventType): Observable<T> {
93+
return new Observable<T>((observer: Observer<T>) => {
9594

9695
/**
9796
* First step to subscribe for an event is to append the new observer to the set
9897
* or create a new set if there is no observer for the given event.
9998
*/
10099
const registeredEvents = Object.keys(this.observers);
101100

102-
let publishEventName;
101+
let publishEventName: EventType;
103102
/**
104103
* Map all numbers changed event to global registry event
105104
*/
@@ -111,7 +110,7 @@ export class SocketService {
111110
}
112111

113112
if (!registeredEvents.includes(eventName)) {
114-
this.observers[eventName] = new Subject<any>();
113+
this.observers[eventName] = new Subject<T>();
115114
console.log('registering for event', eventName);
116115

117116
this.send({event: publishEventName});
@@ -144,7 +143,7 @@ export class SocketService {
144143

145144
const {event, toSend} = this.getEventAndPayload(msg);
146145

147-
const relevantSubject: Subject<any> = this.observers[event];
146+
const relevantSubject = this.observers[event];
148147
if (relevantSubject) {
149148
relevantSubject.next(toSend);
150149
}
@@ -165,7 +164,7 @@ export class SocketService {
165164
* @param msg
166165
*/
167166
private getEventAndPayload(msg: RegistryEvent) {
168-
let toSend: any;
167+
let toSend: ReturnType;
169168
let event: EventType;
170169

171170
if (msg.eventType === EventTypeEnum.NumbersChangedEvent) {

client/src/app/dashboard/add-dialog/add-dialog.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Component, OnInit, Inject } from '@angular/core';
2-
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
1+
import { Component, OnInit } from '@angular/core';
2+
import { MatDialogRef } from '@angular/material';
33
import { FormControl, Validators } from '@angular/forms';
44
import { ApiService} from '../../api/api/api.service';
55

client/src/app/dashboard/crawler/crawler.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export class CrawlerComponent implements OnInit {
3232
compType: string;
3333

3434
constructor(private apiService: ApiService) {
35-
3635
}
3736

3837
ngOnInit() {
@@ -42,7 +41,7 @@ export class CrawlerComponent implements OnInit {
4241
this.apiService.getInstances(ComponentTypeEnum.Crawler).subscribe((result: Array<Instance>) => {
4342
this.tableData = result;
4443
}, err => {
45-
console.log('error receiving data for crawler');
44+
console.log('error receiving data for crawler', err);
4645
});
4746
}
4847

client/src/app/dashboard/dashboard-card/dashboard-card.component.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ <h5 class="card-title custom_title">{{title}}</h5>
2525
</div>
2626
<div class="text-center">
2727
<button type="button" class="btn btn-primary custom_btn" routerLink={{route}} routerLinkActive="active">View Details</button>
28-
<!--<button type="button" class="btn btn-secondary custom_btn">Logs/Statistics</button>-->
2928
</div>
3029
<hr>
3130
<div class="text-center">
3231
<p class="card-text">Number of Instances: {{numberOfInstances}}</p>
33-
<!--<p class="card-text">Number of failed Instances: {{numberOfFailedInstances}}</p>-->
34-
</div>
3532
</div>
33+
</div>

client/src/app/dashboard/dashboard-card/dashboard-card.component.spec.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
19-
2018
import { async, TestBed, inject } from '@angular/core/testing';
2119
import { Location } from '@angular/common';
2220
import { Router } from '@angular/router';
@@ -36,8 +34,6 @@ import { ApiService } from 'src/app/api/api/api.service';
3634

3735

3836
describe('component: DashboardCardComponent', () => {
39-
let location;
40-
let router;
4137

4238
beforeEach(() => {
4339
TestBed.configureTestingModule({
@@ -53,13 +49,11 @@ describe('component: DashboardCardComponent', () => {
5349
});
5450

5551
beforeEach(inject([Router, Location], (_router: Router, _location: Location) => {
56-
location = _location;
57-
router = _router;
5852
}));
5953

6054

6155
it(`should create`, async(inject([HttpTestingController, ApiService],
62-
(httpClient: HttpTestingController, apiService: ApiService) => {
56+
(apiService: ApiService) => {
6357
expect(apiService).toBeTruthy();
6458
})));
6559
});

client/src/app/dashboard/dashboard-card/dashboard-card.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class DashboardCardComponent implements OnInit {
7070

7171
const eventType: EventType = DashboardCardComponent.compTypeEventMap[this.componentType];
7272

73-
this.socketService.subscribeForEvent(eventType).subscribe((data: number) => {
73+
this.socketService.subscribeForEvent<number>(eventType).subscribe((data: number) => {
7474
console.log('data callback in card component', data);
7575

7676
this.numberOfInstances = '' + data;

client/src/app/dashboard/dashboard-overview/dashboard-overview.component.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@
1919
<div class="container-fluid">
2020
<div class="row">
2121
<div class="col-md-3 col-sm-4">
22-
<app-dashboard-card route="crawler" componentType={{crawler}} title="Crawler" img="../assets/images/crawler.png"></app-dashboard-card>
22+
<app-dashboard-card route="crawler" componentType={{crawler}} title="Crawler" img="../assets/images/crawler.png"></app-dashboard-card>
2323
</div>
2424
<div class="col-md-3 col-sm-4">
25-
<app-dashboard-card route="webApi" componentType={{webApi}} title="Web API" img="../assets/images/webapi.png"></app-dashboard-card>
25+
<app-dashboard-card route="webApi" componentType={{webApi}} title="Web API" img="../assets/images/webapi.png"></app-dashboard-card>
2626
</div>
2727
<div class="col-md-3 col-sm-4">
28-
<app-dashboard-card route="webapp" componentType={{webApp}} title="Web APP" img="../assets/images/webapp.png"></app-dashboard-card>
28+
<app-dashboard-card route="webapp" componentType={{webApp}} title="Web APP" img="../assets/images/webapp.png"></app-dashboard-card>
2929
</div>
30-
<div class="col-md-1 col-sm-4">
30+
<div class="col-md-1 col-sm-4">
3131
</div>
3232
<div class="col-md-2 col-sm-4">
33-
<app-statuscard></app-statuscard>
33+
<app-statuscard></app-statuscard>
34+
</div>
3435
</div>
3536
</div>
36-
</div>

client/src/app/dashboard/dashboard.component.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,17 @@
1616
* limitations under the License.
1717
*/
1818

19-
import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
19+
import { async, TestBed, inject } from '@angular/core/testing';
2020
import { Location } from '@angular/common';
21-
import { Router, RouterOutlet } from '@angular/router';
21+
import { Router } from '@angular/router';
2222
import { RouterTestingModule } from '@angular/router/testing';
2323
import { HeaderComponent } from './header/header.component';
2424
import { DashboardComponent } from './dashboard.component';
25-
import {HttpClientModule} from '@angular/common/http';
2625

2726

2827
describe('component: DashboardComponent', () => {
2928

30-
let location, router;
29+
let location: Location, router: Router;
3130

3231

3332
beforeEach(() => {

client/src/app/dashboard/dashboard.module.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import { DashboardModule } from './dashboard.module';
2121
describe('DashboardModule', () => {
2222
let dashboardModule: DashboardModule;
2323

24-
25-
2624
beforeEach(() => {
2725
dashboardModule = new DashboardModule();
2826
});

client/src/app/dashboard/dashboard.module.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,8 @@
1919
import { NgModule } from '@angular/core';
2020
import { BrowserModule } from '@angular/platform-browser';
2121
import { BrowserAnimationsModule} from '@angular/platform-browser/animations';
22-
import { MatButtonModule, MatMenuModule, MatTableModule, MatPaginatorModule} from '@angular/material';
23-
import { MatIconModule} from '@angular/material/icon';
24-
import { MatCheckboxModule} from '@angular/material/checkbox';
25-
import { MatDialogModule} from '@angular/material/dialog';
2622
import { CommonModule } from '@angular/common';
2723
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
28-
import { MatFormFieldModule} from '@angular/material/form-field';
29-
import { MatInputModule} from '@angular/material/input';
30-
import { MatTooltipModule} from '@angular/material/tooltip';
3124
import { DashboardRoutingModule } from './dashboard-routing.module';
3225
import { DashboardCardComponent } from './dashboard-card/dashboard-card.component';
3326
import { DashboardComponent } from './dashboard.component';
@@ -43,25 +36,17 @@ import { UserProfileComponent } from './user-profile/user-profile.component';
4336
import { DeleteDialogComponent } from './delete-dialog/delete-dialog.component';
4437
import { AddDialogComponent } from './add-dialog/add-dialog.component';
4538
import {ApiModule} from '../api/api.module';
39+
import { MaterialModule } from '../material-module/material.module';
4640

4741

4842
@NgModule({
4943
imports: [
5044
BrowserModule,
5145
BrowserAnimationsModule,
52-
MatButtonModule,
53-
MatMenuModule,
54-
MatIconModule,
55-
MatTableModule,
56-
MatPaginatorModule,
57-
MatCheckboxModule,
58-
MatDialogModule,
46+
MaterialModule,
5947
CommonModule,
6048
FormsModule,
6149
ReactiveFormsModule,
62-
MatFormFieldModule,
63-
MatInputModule,
64-
MatTooltipModule,
6550
DashboardRoutingModule,
6651
DashboardRoutingModule,
6752
ApiModule

client/src/app/dashboard/delete-dialog/delete-dialog.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Component, OnInit, Inject } from '@angular/core';
22
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
3-
import { MatDialogModule } from '@angular/material/dialog';
43
import { Instance } from '../../api/model/instance';
54

65
@Component({

client/src/app/dashboard/header/header.component.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<nav class="navbar w-auto p-4 navbar-expand-lg bg-light ">
2020

21-
<a class="navbar-brand" routerLink="/dashboard" routerLinkActive="active" href="/"> <img src="../assets/images/D.png"></a>
21+
<a class="navbar-brand" routerLink="/dashboard" routerLinkActive="active" href="/"> <img src="../assets/images/logo.png" height="50" width="120"></a>
2222
<div class="navbar-expand mr-auto">
2323
<div class="navbar-nav">
2424

@@ -31,10 +31,7 @@
3131
</div>
3232
<div class="navbar-expand ml-auto navbar-nav">
3333
<div class="navbar-nav">
34-
35-
<!--<a class="nav-item nav-link" href="#"><i class="fa fa-bell"></i></a>-->
36-
<a class="nav-item nav-link" href="/dashboard/userProfile"><i class="fa fa-user-circle"></i></a>
37-
34+
<a class="nav-item nav-link" href="/dashboard/userProfile"><i class="fa fa-user-circle"></i></a>
3835
</div>
3936
</div>
4037
</nav>

0 commit comments

Comments
 (0)