Skip to content

Commit 1a4bb53

Browse files
authored
bootstrap 5 (#132)
* bootstrap 5 * bootstrap 5, UI updates
1 parent 8a92c4e commit 1a4bb53

9 files changed

Lines changed: 77 additions & 58 deletions

File tree

webapp/angular.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"index": "src/index.html",
1818
"tsConfig": "src/tsconfig.app.json",
1919
"polyfills": [
20+
"@angular/localize/init",
2021
"src/polyfills.ts"
2122
],
2223
"assets": [

webapp/package-lock.json

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

webapp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@ng-bootstrap/ng-bootstrap": "^17.0.0",
3030
"@schematics/angular": "^8.3.29",
3131
"awesome-bootstrap-checkbox": "^1.0.1",
32-
"bootstrap": "^4.4.1",
32+
"bootstrap": "^5.0.0",
3333
"core-js": "^2.6.11",
3434
"font-awesome": "^4.7.0",
3535
"html-webpack-plugin": "^4.5.2",

webapp/src/app/app-navbar/app-navbar.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
</button>
66
<ul class="navbar-nav mr-auto">
77
<li class="nav-item active">
8-
<a class="nav-link" [routerLink]="['/services']">Services</a>
8+
<a class="nav-link top-link" [routerLink]="['/services']">Services</a>
99
</li>
1010
<li class="nav-item active">
11-
<a class="nav-link" [routerLink]="['/deployments']">Deployments</a>
11+
<a class="nav-link top-link" [routerLink]="['/deployments']">Deployments</a>
1212
</li>
1313
</ul>
1414
</nav>

webapp/src/app/deployment-list/deployment-list.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ <h2>Deployments</h2>
2424
<tr *ngFor="let deployment of deployments">
2525
<td>{{deployment.Date}}</td>
2626
<td>{{deployment.ServiceName}}</td>
27-
<td *ngIf="deployment.Status == 'success'"><span class="badge badge-success">{{deployment.Status}}</span></td>
28-
<td *ngIf="deployment.Status == 'failed'"><span class="badge badge-danger">{{deployment.Status}}</span></td>
29-
<td *ngIf="deployment.Status == 'aborted'"><span class="badge badge-info">{{deployment.Status}}</span></td>
27+
<td *ngIf="deployment.Status == 'success'"><span class="badge rounded-pill bg-success">{{deployment.Status}}</span></td>
28+
<td *ngIf="deployment.Status == 'failed'"><span class="badge rounded-pill bg-danger">{{deployment.Status}}</span></td>
29+
<td *ngIf="deployment.Status == 'aborted'"><span class="badge rounded-pill bg-info">{{deployment.Status}}</span></td>
3030
<td *ngIf="deployment.Status == ''"></td>
3131
<td>{{deployment.TaskDefinitionVersion}}</td>
3232
</tr>

webapp/src/app/deployment-list/deployment-list.component.ts

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { DeploymentList, DeploymentListService } from './deployment-list.servic
1414
export class DeploymentListComponent implements OnInit {
1515
services: string[] = [];
1616
deployments: string[] = [];
17-
filterActive: boolean = false
17+
filterList: string[] = [];
1818

1919
constructor(
2020
private route: ActivatedRoute,
@@ -27,43 +27,29 @@ export class DeploymentListComponent implements OnInit {
2727
.subscribe((data: { dl: DeploymentList }) => {
2828
this.deployments = data.dl.deployments;
2929
this.services = data.dl.services;
30+
this.filterList = []
3031
});
3132
}
3233

3334
filter(event: any, serviceName: string) {
34-
console.log("Filter: " + serviceName + ": " + event.target.checked)
3535
if(event.target.checked) {
36-
this.ds.getDeploymentList(serviceName).subscribe((data: DeploymentList ) => {
37-
if(data.deployments.length != 0) {
38-
if(this.filterActive) {
39-
// merge if filter is active
40-
this.deployments = [ ...this.deployments, ...data.deployments];
41-
} else {
42-
this.deployments = data.deployments
43-
}
44-
this.deployments.sort(function(a,b) {return (a["Time"] > b["Time"]) ? -1 : ((b["Time"] > a["Time"]) ? 1 : 0);} );
45-
this.filterActive = true
46-
}
47-
});
36+
this.filterList.push(serviceName)
4837
} else {
49-
var newDeployments = [];
50-
for (let deployment of this.deployments) {
51-
if(deployment["ServiceName"] != serviceName) {
52-
newDeployments.push(deployment)
53-
}
54-
}
55-
if(newDeployments.length != this.deployments.length) {
56-
this.deployments = newDeployments
57-
}
58-
if(newDeployments.length == 0) {
59-
this.filterActive = false
60-
this.ds.getDeploymentList("").subscribe((data: DeploymentList ) => {
61-
if(data.deployments.length != 0) {
62-
this.deployments = data.deployments
38+
this.filterList = this.filterList.filter(a => a !== serviceName)
39+
}
40+
41+
this.ds.getDeploymentList(serviceName).subscribe((data: DeploymentList ) => {
42+
if(data.deployments.length != 0) {
43+
this.deployments = data.deployments.filter((deployment) => {
44+
if (this.filterList.length === 0) { return true }
45+
for (var i = 0; i < this.filterList.length; i++) {
46+
if(this.filterList[i] == deployment["ServiceName"]) {
47+
return true
48+
}
6349
}
64-
});
50+
return false
51+
})
6552
}
66-
}
53+
});
6754
}
68-
6955
}

webapp/src/app/deployment-list/deployment-list.service.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ export class DeploymentListService {
3232
}
3333

3434
getDeployments(serviceName: string) {
35-
var url
36-
if(serviceName == "") {
37-
url = "/ecs-deploy/api/v1/deploy/list"
38-
} else {
39-
url = "/ecs-deploy/api/v1/deploy/list/" + serviceName
40-
}
41-
this.http.get(url, {headers: new HttpHeaders().set('Authorization', "Bearer " + this.auth.getToken())})
35+
this.http.get("/ecs-deploy/api/v1/deploy/list", {headers: new HttpHeaders().set('Authorization', "Bearer " + this.auth.getToken())})
4236
.subscribe(data => {
4337
// Read the result field from the JSON response.
4438
this.dl.deployments = data["deployments"]
@@ -52,7 +46,7 @@ export class DeploymentListService {
5246
this.dl.deployments[i]["TaskDefinitionVersion"] = s[1]
5347
}
5448
}
55-
this.dl.deployments.sort(function(a,b) {return (a["Time"] > b["Time"]) ? -1 : ((b["Time"] > a["Time"]) ? 1 : 0);} );
49+
this.dl.deployments.sort(function(a,b) {return (a["Time"] > b["Time"]) ? -1 : ((b["Time"] > a["Time"]) ? 1 : 0);} );
5650
if(this.dl.services.length > 0) {
5751
this.dl$.next(this.dl)
5852
this.dl$.complete()
@@ -66,6 +60,7 @@ export class DeploymentListService {
6660
this.http.get('/ecs-deploy/api/v1/service/list', {headers: new HttpHeaders().set('Authorization', "Bearer " + this.auth.getToken())}).subscribe(data => {
6761
// Read the result field from the JSON response.
6862
this.dl.services = data['services'];
63+
this.dl.services.sort(function(a,b) {return (a["S"] < b["S"]) ? -1 : ((b["S"] < a["S"]) ? 1 : 0);} );
6964
if(this.dl.deployments == null) {
7065
return
7166
}

webapp/src/app/service-detail/inspect.component.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<ng-template #inspect let-c="close" let-d="dismiss">
22
<div class="modal-header">
33
<h4 class="modal-title">{{serviceName}}</h4>
4-
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
5-
<span aria-hidden="true">&times;</span>
6-
</button>
4+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" (click)="d('Cross click')"></button>
75
</div>
86
<div class="modal-body">
97
<span *ngIf="loading" class="sr-only">Loading...</span>
@@ -70,6 +68,6 @@ <h5>Container info</h5>
7068
</div>
7169
</div>
7270
<div class="modal-footer">
73-
<button type="button" class="btn btn-outline-dark" (click)="c('Close click')">Close</button>
71+
<button type="button" class="btn btn-dark" (click)="c('Close click')">Close</button>
7472
</div>
7573
</ng-template>

webapp/src/styles.css

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,44 @@ h1 {
4949

5050
ngb-modal-backdrop {
5151
z-index: 1050 !important;
52+
}
53+
54+
/* fix bootstrap 4 -> 5 form groups */
55+
56+
.form-group {
57+
margin-bottom: 1rem;
58+
}
59+
60+
.form-inline .form-control {
61+
display: inline-block;
62+
width: auto;
63+
vertical-align: middle;
64+
}
65+
66+
.form-row {
67+
display: flex;
68+
flex-wrap: wrap;
69+
margin-right: -5px;
70+
margin-left: -5px;
71+
}
72+
73+
.form-row > .col {
74+
padding-left: 5px;
75+
padding-right: 5px;
76+
}
77+
78+
label {
79+
margin-bottom: 0.5rem;
80+
}
81+
82+
/* navbar fixes */
83+
nav.navbar {
84+
padding-left: 1rem;
85+
padding-right: 1rem;
86+
}
87+
.nav-link {
88+
cursor: pointer
89+
}
90+
.top-link {
91+
color:#FFFFFF;
5292
}

0 commit comments

Comments
 (0)