Skip to content

Commit 2e2ee0c

Browse files
committed
feat: add configuration page
1 parent 831c6ef commit 2e2ee0c

File tree

11 files changed

+186
-2
lines changed

11 files changed

+186
-2
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
* http://www.apache.org/licenses/LICENSE-2.0
6+
* Unless required by applicable law or agreed to in writing, software
7+
* distributed under the License is distributed on an "AS IS" BASIS,
8+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
* See the License for the specific language governing permissions and
10+
* limitations under the License.
11+
*/
12+
import { NgModule } from '@angular/core';
13+
import { RouterModule, Routes } from '@angular/router';
14+
import { ConfigurationComponent } from './configuration.component';
15+
16+
const routes: Routes = [
17+
{
18+
path: '',
19+
component: ConfigurationComponent
20+
}
21+
];
22+
23+
@NgModule({
24+
imports: [RouterModule.forChild(routes)],
25+
exports: [RouterModule]
26+
})
27+
export class ConfigurationRoutingModule {}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!--
2+
~ Licensed under the Apache License, Version 2.0 (the "License");
3+
~ you may not use this file except in compliance with the License.
4+
~ You may obtain a copy of the License at
5+
~ http://www.apache.org/licenses/LICENSE-2.0
6+
~ Unless required by applicable law or agreed to in writing, software
7+
~ distributed under the License is distributed on an "AS IS" BASIS,
8+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
~ See the License for the specific language governing permissions and
10+
~ limitations under the License.
11+
-->
12+
13+
<zeppelin-page-header [description]="configDesc" title="Configurations"></zeppelin-page-header>
14+
<ng-template #configDesc>
15+
Shows current configurations for Zeppelin Server.
16+
<br>
17+
Note: For security reasons, some key/value pairs including passwords would not be shown.
18+
</ng-template>
19+
<div class="content">
20+
<nz-table nzSize="small"
21+
[nzData]="configEntries"
22+
[nzFrontPagination]="false"
23+
[nzShowPagination]="false">
24+
<thead>
25+
<tr>
26+
<th>Name</th>
27+
<th>Value</th>
28+
</tr>
29+
</thead>
30+
<tbody>
31+
<tr *ngFor="let data of configEntries">
32+
<td>{{data[0]}}</td>
33+
<td>{{data[1]}}</td>
34+
</tr>
35+
</tbody>
36+
</nz-table>
37+
</div>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
* http://www.apache.org/licenses/LICENSE-2.0
6+
* Unless required by applicable law or agreed to in writing, software
7+
* distributed under the License is distributed on an "AS IS" BASIS,
8+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
* See the License for the specific language governing permissions and
10+
* limitations under the License.
11+
*/
12+
13+
@import 'theme-mixin';
14+
15+
.themeMixin({
16+
.content {
17+
padding: @card-padding-base / 2;
18+
nz-table {
19+
background: @card-background;
20+
}
21+
}
22+
});
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
* http://www.apache.org/licenses/LICENSE-2.0
6+
* Unless required by applicable law or agreed to in writing, software
7+
* distributed under the License is distributed on an "AS IS" BASIS,
8+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
* See the License for the specific language governing permissions and
10+
* limitations under the License.
11+
*/
12+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
13+
import { ConfigurationService } from '@zeppelin/services';
14+
15+
@Component({
16+
selector: 'zeppelin-configuration',
17+
templateUrl: './configuration.component.html',
18+
styleUrls: ['./configuration.component.less'],
19+
changeDetection: ChangeDetectionStrategy.OnPush
20+
})
21+
export class ConfigurationComponent implements OnInit {
22+
configEntries: Array<[string, string]> = [];
23+
24+
constructor(private configurationService: ConfigurationService, private cdr: ChangeDetectorRef) {}
25+
26+
ngOnInit() {
27+
this.getAllConfig();
28+
}
29+
30+
getAllConfig(): void {
31+
this.configurationService.getAll().subscribe(data => {
32+
this.configEntries = [...Object.entries<string>(data)];
33+
this.cdr.markForCheck();
34+
});
35+
}
36+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
* http://www.apache.org/licenses/LICENSE-2.0
6+
* Unless required by applicable law or agreed to in writing, software
7+
* distributed under the License is distributed on an "AS IS" BASIS,
8+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
* See the License for the specific language governing permissions and
10+
* limitations under the License.
11+
*/
12+
import { CommonModule } from '@angular/common';
13+
import { NgModule } from '@angular/core';
14+
15+
import { ShareModule } from '@zeppelin/share';
16+
import { NzTableModule } from 'ng-zorro-antd';
17+
import { ConfigurationRoutingModule } from './configuration-routing.module';
18+
import { ConfigurationComponent } from './configuration.component';
19+
20+
@NgModule({
21+
declarations: [ConfigurationComponent],
22+
imports: [CommonModule, ShareModule, NzTableModule, ConfigurationRoutingModule]
23+
})
24+
export class ConfigurationModule {}

zeppelin-web-angular/src/app/pages/workspace/workspace-routing.module.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ const routes: Routes = [
3939
path: 'interpreter',
4040
loadChildren: () =>
4141
import('@zeppelin/pages/workspace/interpreter/interpreter.module').then(m => m.InterpreterModule)
42+
},
43+
{
44+
path: 'configuration',
45+
loadChildren: () =>
46+
import('@zeppelin/pages/workspace/configuration/configuration.module').then(m => m.ConfigurationModule)
4247
}
4348
]
4449
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
* http://www.apache.org/licenses/LICENSE-2.0
6+
* Unless required by applicable law or agreed to in writing, software
7+
* distributed under the License is distributed on an "AS IS" BASIS,
8+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
* See the License for the specific language governing permissions and
10+
* limitations under the License.
11+
*/
12+
13+
import { HttpClient } from '@angular/common/http';
14+
import { Injectable } from '@angular/core';
15+
16+
import { BaseRest } from './base-rest';
17+
import { BaseUrlService } from './base-url.service';
18+
19+
@Injectable({
20+
providedIn: 'root'
21+
})
22+
export class ConfigurationService extends BaseRest {
23+
constructor(baseUrlService: BaseUrlService, private http: HttpClient) {
24+
super(baseUrlService);
25+
}
26+
27+
getAll() {
28+
return this.http.get<{ [key: string]: string }>(this.restUrl`/configurations/all`);
29+
}
30+
}

zeppelin-web-angular/src/app/services/public-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ export * from './array-ordering.service';
2727
export * from './note-list.service';
2828
export * from './runtime-compiler.service';
2929
export * from './shortcut.service';
30+
export * from './configuration.service';

zeppelin-web-angular/src/app/share/page-header/page-header.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<nz-card class="header">
1414
<h2>{{title}} <span class="header-extra"><ng-container [ngTemplateOutlet]="extra"></ng-container></span></h2>
15-
<p>{{description}}</p>
15+
<p><ng-container *nzStringTemplateOutlet="description">{{description}}</ng-container></p>
1616
<nz-divider *ngIf="divider" nzType="horizontal"></nz-divider>
1717
<ng-content></ng-content>
1818
</nz-card>

zeppelin-web-angular/src/app/share/page-header/page-header.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { InputBoolean } from 'ng-zorro-antd';
2121
})
2222
export class PageHeaderComponent implements OnInit {
2323
@Input() title: string;
24-
@Input() description: string;
24+
@Input() description: string | TemplateRef<void>;
2525
@Input() @InputBoolean() divider = false;
2626
@Input() extra: TemplateRef<void>;
2727

0 commit comments

Comments
 (0)