Skip to content

Commit ce3e89d

Browse files
committed
v0.9.11 add health check and CSP
1 parent 3930276 commit ce3e89d

38 files changed

+475
-190
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "janusec-admin",
3-
"version": "0.9.10",
3+
"version": "0.9.11",
44
"license": "MIT",
55
"scripts": {
66
"ng": "ng",
@@ -25,7 +25,7 @@
2525
"@angular/router": "^9.0.4",
2626
"@types/node": "^12.12.27",
2727
"bcryptjs": "^2.4.3",
28-
"chart.js": "^2.9.3",
28+
"chart.js": "^2.9.4",
2929
"classlist.js": "^1.1.20150312",
3030
"core-js": "^2.6.11",
3131
"crypto-js": "^3.3.0",
@@ -51,7 +51,7 @@
5151
"@angular/compiler-cli": "^9.0.4",
5252
"@angular/language-service": "^9.0.4",
5353
"@types/bcryptjs": "^2.4.2",
54-
"@types/chart.js": "^2.9.12",
54+
"@types/chart.js": "^2.9.27",
5555
"@types/crypto-js": "^3.1.43",
5656
"@types/jasmine": "~2.5.53",
5757
"@types/jasminewd2": "^2.0.8",

src/app/app-routing/app-routing.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { CCLogDetailComponent } from '../cclog-detail/cclog-detail.component';
1919
import { SettingsComponent } from '../settings/settings.component';
2020
import { FrontpageComponent } from '../frontpage/frontpage.component';
2121
import { WebsshComponent } from '../webssh/webssh.component';
22+
import { HealthCheckComponent } from '../health-check/health-check.component';
2223

2324
const routes: Routes = [
2425
{ path: '', redirectTo: '/index.html', pathMatch: 'full' },
@@ -40,7 +41,8 @@ const routes: Routes = [
4041
{ path: 'log/:id', component: LogDetailComponent},
4142
{ path: 'cclog/:id', component: CCLogDetailComponent},
4243
{ path: 'login', component: LoginFormComponent},
43-
{ path: 'ssh', component: WebsshComponent }
44+
{ path: 'ssh', component: WebsshComponent },
45+
{ path: 'health', component: HealthCheckComponent },
4446
];
4547

4648
@NgModule({

src/app/app.component.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.sidenav-container {
2-
min-height: 500px;
2+
min-height: 700px;
33
}
44

55
.sidenav {

src/app/app.component.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@
2424
<mat-icon>explore</mat-icon>
2525
<span i18n="@@app_mgmt">Application</span>
2626
</a>
27-
</mat-list-item>
27+
</mat-list-item>
28+
29+
<mat-list-item>
30+
<a routerLink="/health">
31+
<mat-icon>check_circle_outline</mat-icon>
32+
<span i18n="@@health_check">Health</span>
33+
</a>
34+
</mat-list-item>
2835

2936
<mat-list-item *ngIf="applicationService.auth_user.is_super_admin==true">
3037
<a routerLink="/nodes">
@@ -62,7 +69,7 @@
6269
</mat-list-item>
6370

6471
<mat-list-item>
65-
<a routerLink="/ssh" target="_blank">
72+
<a routerLink="/ssh">
6673
<mat-icon>computer</mat-icon>
6774
<span>Web SSH</span>
6875
</a>

src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import { MatNativeDateModule, MatRippleModule } from '@angular/material/core';
6363
import { WebsshComponent } from './webssh/webssh.component';
6464
import { HashLocationStrategy, LocationStrategy} from '@angular/common';
6565
import { FlexLayoutModule } from '@angular/flex-layout';
66+
import { HealthCheckComponent } from './health-check/health-check.component';
6667

6768
@NgModule({
6869
exports:[
@@ -128,7 +129,8 @@ export class MaterialModule{}
128129
CCLogDetailComponent,
129130
SettingsComponent,
130131
FrontpageComponent,
131-
WebsshComponent
132+
WebsshComponent,
133+
HealthCheckComponent
132134
],
133135
imports: [
134136
MaterialModule,

src/app/application-detail/application-detail.component.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
}
88

99
mat-form-field {
10-
margin-top:3px;
11-
margin-bottom:3px;
10+
margin-top: 10px;
11+
margin-bottom: 3px;
1212
background-color: #f5f5f5;
1313
}
1414

@@ -56,3 +56,7 @@ mat-form-field {
5656
padding: 5px;
5757
border-radius: 5px;
5858
}
59+
60+
button {
61+
margin-right: 5px;
62+
}

src/app/application-detail/application-detail.component.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ <h3 i18n="@@routing_configuration">Routing Configuration</h3>
147147
<input i18n-placeholder="@@session_seconds" type="number" matInput [(ngModel)]="application.session_seconds" [readonly]="readOnlyValue" placeholder="Session Expire Seconds for OAuth2"/>
148148
</mat-form-field>
149149

150+
<section>
151+
<mat-checkbox i18n="@@csp_enabled" [(ngModel)]="application.csp_enabled" [disabled]="readOnlyValue">
152+
Enable CSP (Content-Security-Policy, example: default-src 'self' )
153+
</mat-checkbox>
154+
</section>
155+
156+
<mat-form-field *ngIf="application.csp_enabled">
157+
<mat-label>Content-Security-Policy</mat-label>
158+
<input matInput i18n-placeholder="@@csp" [(ngModel)]="application.csp" #csp [readonly]="readOnlyValue" placeholder=""/>
159+
<mat-hint align="end">{{csp.value?.length || 0}}/1024</mat-hint>
160+
</mat-form-field>
161+
150162
<mat-form-field>
151163
<input matInput i18n-placeholder="@@owner" [(ngModel)]="application.owner" [readonly]="readOnlyValue" placeholder="Application Owner"/>
152164
</mat-form-field>
@@ -156,8 +168,8 @@ <h3 i18n="@@routing_configuration">Routing Configuration</h3>
156168
<mat-hint align="end">{{description.value?.length || 0}}/256</mat-hint>
157169
</mat-form-field>
158170
<div>
159-
<button i18n="@@save" mat-raised-button [disabled]="readOnlyValue" (click)="setApplication()" color="primary">Save</button>
160-
<button mat-raised-button (click)="changeEditable()" color="primary">{{readOnlyButtonText}}</button>
161-
<button i18n="@@delete" mat-raised-button [disabled]="readOnlyValue" (click)="deleteApplication()" color="primary">Delete</button>
171+
<button i18n="@@save" mat-stroked-button [disabled]="readOnlyValue" (click)="setApplication()">Save</button>
172+
<button mat-stroked-button (click)="changeEditable()">{{readOnlyButtonText}}</button>
173+
<button i18n="@@delete" mat-stroked-button [disabled]="readOnlyValue" (click)="deleteApplication()">Delete</button>
162174
</div>
163175
</div>

src/app/application-detail/application-detail.component.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,6 @@ export class ApplicationDetailComponent implements OnInit {
122122

123123
}
124124

125-
/*
126-
addStaticDir():void{
127-
if(this.readOnlyValue) return;
128-
this.application.static_dirs.push("");
129-
console.log(this.application.static_dirs);
130-
}
131-
132-
delStaticDir(i:number):void{
133-
if(this.readOnlyValue) return;
134-
if(this.application.static_dirs.length==1) {
135-
alert("At least one item is required, keep it empty if not required !");
136-
return;
137-
}
138-
this.application.static_dirs.splice(i,1);
139-
console.log(this.application.static_dirs);
140-
}
141-
*/
142-
143125
addDomain():void{
144126
if(this.readOnlyValue) return;
145127
var new_domain: Domain=new Domain();

src/app/applications/applications.component.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,7 @@ export class ApplicationsComponent implements OnInit {
1616
constructor(
1717
public applicationService: ApplicationService,
1818
private router: Router) { }
19-
/*
20-
getApplications(): void {
21-
this.applicationService
22-
.getApplications()
23-
.subscribe((applications) => {
24-
if (applications==null) {
25-
this.router.navigate(['/login']);
26-
} else {
27-
this.applicationService.applications = applications;
28-
}
29-
});
30-
}
31-
*/
19+
3220
ngOnInit(): void {
3321
if (this.applicationService.auth_user.logged==false) {
3422
this.router.navigate(['/']);

0 commit comments

Comments
 (0)