Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
frontend:more ingress info insert(TLS,etc)
  • Loading branch information
chengyumeng committed Dec 24, 2018
commit f208f68f902d45c5335ca6e43886391bf8df1aac
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h3 class="header-title">创建 Ingress 模版</h3>
<div class="form-group form-group-padding" >
<label class="col-md-4 form-group-label-override required">域名</label>
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
<input type="text" style="width: 217px"
<input type="text"
[ngModelOptions]="{standalone: true}"
[(ngModel)]="kubeResource.spec.rules[i].host">
</label>
Expand All @@ -33,12 +33,29 @@ <h3 class="header-title">创建 Ingress 模版</h3>
<label class="col-md-3 form-group-label-override required">负载均衡名称</label>
<input type="text" class="col-md-2" [ngModelOptions]="{standalone: true}" [(ngModel)]="kubeResource.spec.rules[i].http.paths[j].backend.serviceName">
<label class="col-md-2 form-group-label-override required">端口</label>
<input type="number" class="col-md-2" [ngModelOptions]="{standalone: true}" [(ngModel)]="kubeResource.spec.rules[i].http.paths[j].backend.servicePort">
<input type="number" class="col-md-1" [ngModelOptions]="{standalone: true}" [(ngModel)]="kubeResource.spec.rules[i].http.paths[j].backend.servicePort">
<label class="col-md-2 form-group-label-override required">路由</label>
<input type="text" class="col-md-2" [ngModelOptions]="{standalone: true}" [(ngModel)]="kubeResource.spec.rules[i].http.paths[j].path">
<a href="javascript:void(0)" *ngIf="kubeResource.spec.rules[i].http.paths.length > 1"><clr-icon (click)="onDeletePath(i, j)" shape="trash" title="删除路由" class="is-solid clr-icon"></clr-icon></a>
<a href="javascript:void(0)" *ngIf="j === kubeResource.spec.rules[i].http.paths.length - 1"><clr-icon (click)="onAddPath(i)" shape="plus-circle" title="添加路由" class="is-solid clr-icon"></clr-icon></a>
</div>
</div>
<a href="javascript:void(0)"><clr-icon (click)="onAddPath(i)" shape="plus-circle" title="添加路由" class="is-solid clr-icon"></clr-icon></a>
</div>
</div>
</div>
</section>
<section class="form-block wrap" style="overflow:hidden">
<div style="float: left;width: 60%">
<label class="label-level1">TLS 配置</label>
<button class="btn btn-sm btn-link" (click)="onAddTLS()" href="javascript:void(0)" *ngIf="kubeResource.spec.tls.length === 0"><clr-icon shape="add"></clr-icon>添加</button>
<div *ngFor="let tls of kubeResource.spec.tls; let i = index">
<div class="form-group form-group-padding" >
<label class="col-md-2 form-group-label-override">主机</label>
<input class="col-md-3" type="text" [ngModelOptions]="{standalone: true}" [(ngModel)]="kubeResource.spec.tls[i].hosts[0]">
<label class="col-md-2 form-group-label-override">秘密名字</label>
<input class="col-md-3" type="text" [ngModelOptions]="{standalone: true}" [(ngModel)]="kubeResource.spec.tls[i].secretName">
<a href="javascript:void(0)" *ngIf="kubeResource.spec.tls.length > 0"><clr-icon (click)="onDeleteTLS(i)" shape="trash" title="删除 TLS" class="is-solid clr-icon"></clr-icon></a>
<a href="javascript:void(0)" *ngIf=" i === kubeResource.spec.tls.length - 1"><clr-icon (click)="onAddTLS()" shape="plus-circle" title="添加 TLS" class="is-solid clr-icon"></clr-icon></a>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class CreateEditIngressTplComponent extends CreateEditResourceTemplate im
if (tpl) {
this.template = tpl.data;
this.template.description = null;
this.saveResourceTemplate();
this.saveResourceTemplate(JSON.parse(this.template.template));
}
},
error => {
Expand Down Expand Up @@ -150,7 +150,16 @@ export class CreateEditIngressTplComponent extends CreateEditResourceTemplate im
}

onAddPath(idx: number) {
this.kubeResource.spec.rules[idx].http.paths.push(new IngressPath());
this.kubeResource.spec.rules[idx].http.paths.push({ backend: { serviceName: '', servicePort: 80}, path: '/'});
}
onDeletePath(i: number, j: number) {
this.kubeResource.spec.rules[i].http.paths.splice(j, 1);
}
onAddTLS() {
this.kubeResource.spec.tls.push({hosts: [''], secretName: ''});
}
onDeleteTLS(i: number) {
this.kubeResource.spec.tls.splice(i, 1);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.form-group-label-override {
font-size: 14px;
font-weight: 400;
}

.access-level-label {
font-size: 14px;
font-weight: 400;
margin-left: -4px;
margin-right: 12px;
top: -6px;
position: relative;
}

.label-level1 {
font-size: 20px;
color: #1e58ab
}

.label-level2 {
font-size: 16px;
color: #007cbb;
}

.form-group-padding {
margin-top: 10px;
padding-left: 110px;
}

.clr-icon {
margin-left: 20px;
}

body {
font-size: 11px;
font-family: 'Open Sans', sans-serif;
color: #4A4A4A;
text-align: center;
}

.wrap {
background: #fff;
margin: 0;
display: block;
width: 95%;
}

p {
margin-top: 15px;
text-align: justify;
}

input:read-only, input:disabled {
border-bottom: 1px dashed #696161;
background-color: #dcdada;
}
6 changes: 6 additions & 0 deletions src/frontend/src/app/shared/default-models/ingress.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ export const defaultIngress = `{
},
"spec": {
"tls": [
{
"hosts": [
""
],
"secretName": ""
}
],
"rules": [
{
Expand Down