Skip to content

Commit 30558cd

Browse files
author
wilhelmguo
authored
Merge pull request #354 from BennieMeng/toggle
Template edit form support Toggle info
2 parents fa3c385 + 4330ad1 commit 30558cd

File tree

20 files changed

+1189
-1127
lines changed

20 files changed

+1189
-1127
lines changed
Lines changed: 68 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,78 @@
1-
<div class="clr-row" style="padding-left: 5%">
2-
<div class="clr-row flex-items-xs-between flex-items-xs-top" style="padding-left: 15px; padding-right: 15px;">
3-
<h3 class="header-title">{{'HPA.CREATE_TEMPLATE' | translate}}</h3>
4-
</div>
5-
<form #ngForm="ngForm" style="padding-right: 30px;width: 100%">
6-
<section class="form-block wrap">
7-
<label class="label-level1">{{'TEMPLATE.RELEASE_MESSAGE' | translate}}</label>
8-
<div class="form-group form-group-padding">
9-
<label class="clr-col-md-3 form-group-label-override required">{{'TEMPLATE.RELEASE_EXPLAIN' | translate}}</label>
10-
<textarea name="description"
11-
[(ngModel)]="template.description"
12-
required
13-
rows="3"
14-
style="width: 700px;">
15-
</textarea>
16-
</div>
17-
</section>
18-
<section class="form-block wrap" style="overflow:hidden">
19-
<div style="float: left;width: 60%">
20-
<label class="label-level1">{{'TEMPLATE.RESOURCE_CONFIG' | translate}}</label>
21-
<div class="form-group form-group-padding" >
22-
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.TYPE' | translate}}</label>
23-
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
24-
<input readonly type="text"
25-
[ngModelOptions]="{standalone: true}"
26-
[(ngModel)]="kubeResource.spec.scaleTargetRef.kind">
27-
</label>
28-
</div>
29-
<div class="form-group form-group-padding" >
30-
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.NAME' | translate}}</label>
31-
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
32-
<wayne-select inputable name="deploy_name" [(ngModel)]="kubeResource.spec.scaleTargetRef.name"
33-
searchable
34-
[placeholder]="'PLACEHOLDER.CHOOSE' | translate">
35-
<wayne-option *ngFor="let deploy of deploys" [value]="deploy.name">{{deploy.name}}</wayne-option>
36-
</wayne-select>
37-
</label>
1+
<wayne-box>
2+
<div class="clr-row" style="padding-left: 5%">
3+
<div class="clr-row flex-items-xs-between flex-items-xs-top" style="padding-left: 15px; padding-right: 15px;">
4+
<h3 class="header-title">{{'HPA.CREATE_TEMPLATE' | translate}}</h3>
5+
</div>
6+
<form #ngForm="ngForm" style="padding-right: 30px;width: 100%">
7+
<section class="form-block wrap">
8+
<label class="label-level1">{{'TEMPLATE.RELEASE_MESSAGE' | translate}}</label>
9+
<div class="form-group form-group-padding">
10+
<label class="clr-col-md-3 form-group-label-override required">{{'TEMPLATE.RELEASE_EXPLAIN' | translate}}</label>
11+
<textarea name="description"
12+
[(ngModel)]="template.description"
13+
required
14+
rows="3"
15+
style="width: 700px;">
16+
</textarea>
3817
</div>
39-
40-
<label class="label-level1">{{'TEMPLATE.SCHEDULING_CONFIG' | translate}}</label>
18+
</section>
19+
<section class="form-block wrap" style="overflow:hidden">
20+
<div style="float: left;width: 60%">
21+
<label class="label-level1">{{'TEMPLATE.RESOURCE_CONFIG' | translate}}</label>
22+
<div class="form-group form-group-padding" >
23+
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.TYPE' | translate}}</label>
24+
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
25+
<input readonly type="text"
26+
[ngModelOptions]="{standalone: true}"
27+
[(ngModel)]="kubeResource.spec.scaleTargetRef.kind">
28+
</label>
29+
</div>
30+
<div class="form-group form-group-padding" >
31+
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.NAME' | translate}}</label>
32+
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
33+
<wayne-select inputable name="deploy_name" [(ngModel)]="kubeResource.spec.scaleTargetRef.name"
34+
searchable
35+
[placeholder]="'PLACEHOLDER.CHOOSE' | translate">
36+
<wayne-option *ngFor="let deploy of deploys" [value]="deploy.name">{{deploy.name}}</wayne-option>
37+
</wayne-select>
38+
</label>
39+
</div>
40+
41+
<label class="label-level1">{{'TEMPLATE.SCHEDULING_CONFIG' | translate}}</label>
42+
<div class="form-group form-group-padding" >
43+
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.MIN_REPLICAS' | translate}}</label>
44+
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
45+
<input type="number"
46+
[ngModelOptions]="{standalone: true}"
47+
[(ngModel)]="kubeResource.spec.minReplicas">
48+
</label>
49+
</div>
4150
<div class="form-group form-group-padding" >
42-
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.MIN_REPLICAS' | translate}}</label>
51+
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.MAX_REPLICAS' | translate}}</label>
4352
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
4453
<input type="number"
4554
[ngModelOptions]="{standalone: true}"
46-
[(ngModel)]="kubeResource.spec.minReplicas">
55+
[(ngModel)]="kubeResource.spec.maxReplicas">
4756
</label>
4857
</div>
49-
<div class="form-group form-group-padding" >
50-
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.MAX_REPLICAS' | translate}}</label>
51-
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
52-
<input type="number"
53-
[ngModelOptions]="{standalone: true}"
54-
[(ngModel)]="kubeResource.spec.maxReplicas">
55-
</label>
56-
</div>
57-
<div class="form-group form-group-padding" >
58-
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.CPU_THRESHOLD' | translate}}</label>
59-
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
60-
<input type="number"
61-
[ngModelOptions]="{standalone: true}"
62-
[(ngModel)]="kubeResource.spec.targetCPUUtilizationPercentage">
63-
</label>
58+
<div class="form-group form-group-padding" >
59+
<label class="clr-col-md-4 form-group-label-override required">{{'TEMPLATE.CPU_THRESHOLD' | translate}}</label>
60+
<label aria-haspopup="true" role="tooltip" class="tooltip tooltip-validation tooltip-md tooltip-bottom-left">
61+
<input type="number"
62+
[ngModelOptions]="{standalone: true}"
63+
[(ngModel)]="kubeResource.spec.targetCPUUtilizationPercentage">
64+
</label>
65+
</div>
66+
67+
6468
</div>
65-
66-
69+
</section>
70+
<div class="clr-wizard-footer-buttons" style="padding-top: 30px">
71+
<button type="button" class="btn btn-outline" (click)="onCancel()">{{ 'BUTTON.CANCEL' | translate}}</button>
72+
<button type="button" class="btn btn-primary" (click)="onOpenModal()">{{'BUTTON.ADVANCED_CONFIG' | translate}}</button>
73+
<button type="button" class="btn btn-primary" [disabled]="!isValid" (click)="onSubmit()">{{ 'BUTTON.SUBMIT' | translate}}</button>
6774
</div>
68-
</section>
69-
<div class="clr-wizard-footer-buttons" style="padding-top: 30px">
70-
<button type="button" class="btn btn-outline" (click)="onCancel()">{{ 'BUTTON.CANCEL' | translate}}</button>
71-
<button type="button" class="btn btn-primary" (click)="onOpenModal()">{{'BUTTON.ADVANCED_CONFIG' | translate}}</button>
72-
<button type="button" class="btn btn-primary" [disabled]="!isValid" (click)="onSubmit()">{{ 'BUTTON.SUBMIT' | translate}}</button>
73-
</div>
74-
</form>
75-
</div>
75+
</form>
76+
</div>
77+
</wayne-box>
7678
<wayne-ace-editor (outputObj)="saveResourceTemplate($event)"></wayne-ace-editor>

src/frontend/src/app/portal/base/base.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="content-area" style="position: relative;padding: .75rem .75rem .75rem .75rem;">
2-
<wayne-box style="padding: 15px;">
2+
<wayne-box [disabled]="!showBox" [ngStyle]="{padding: showBox ? '15px' : 0}">
33
<router-outlet></router-outlet>
44
</wayne-box>
55
</div>

src/frontend/src/app/portal/base/base.component.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Component, OnInit, HostBinding } from '@angular/core';
1+
import { Component, OnInit, HostBinding, OnDestroy } from '@angular/core';
22
import 'rxjs/add/operator/debounceTime';
33
import 'rxjs/add/operator/distinctUntilChanged';
4-
import { ActivatedRoute, Router } from '@angular/router';
4+
import { Subscription } from 'rxjs';
5+
import { ActivatedRoute, Router, NavigationStart } from '@angular/router';
56
import { AuthService } from '../../shared/auth/auth.service';
67
import { App } from '../../shared/model/v1/app';
78
import { AppService } from '../../shared/client/v1/app.service';
@@ -12,9 +13,10 @@ import { CacheService } from '../../shared/auth/cache.service';
1213
templateUrl: 'base.component.html',
1314
styleUrls: ['base.scss']
1415
})
15-
export class BaseComponent implements OnInit {
16+
export class BaseComponent implements OnInit, OnDestroy {
1617
appId: number;
17-
18+
showBox = false;
19+
routerEvent: Subscription;
1820
@HostBinding('class.content-container') field = true;
1921

2022
constructor(public authService: AuthService,
@@ -52,7 +54,21 @@ export class BaseComponent implements OnInit {
5254
}
5355

5456
ngOnInit() {
57+
this.showBox = /tpl/g.test(this.router.url) ? false : true;
5558
this.authService.setAppPermissionById(this.appId);
59+
this.routerEvent = this.router.events.subscribe(events => {
60+
if (events instanceof NavigationStart) {
61+
if (/tpl/g.test(events.url)) {
62+
this.showBox = false;
63+
} else {
64+
this.showBox = true;
65+
}
66+
}
67+
});
68+
}
69+
70+
ngOnDestroy() {
71+
this.routerEvent.unsubscribe();
5672
}
5773

5874
appBetaMode(metaData: string) {

src/frontend/src/app/portal/configmap/create-edit-configmaptpl/create-edit-configmaptpl.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<div class="clr-row" style="padding-left: 5%;">
1+
<div class="clr-row" style="padding-left: 20px">
22
<div class="clr-row flex-items-xs-between flex-items-xs-top" style="padding-left: 15px; padding-right: 15px;">
33
<h3 class="header-title">{{'CONFIGMAP.CREATE_TMP' | translate}}</h3>
44
</div>
55
<form [formGroup]="currentForm" style="padding-right: 30px;width: 100%">
6-
<section class="form-block wrap">
6+
<wayne-box class="form-block wrap">
77
<div *ngIf="clusters" formArrayName="clusters" class="form-group form-group-padding">
88
<label class="clr-col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
99
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'CONFIGMAP.CREATE_EDIT_TMP.CLUSTER_MESSAGE' | translate}}</span>
@@ -52,7 +52,7 @@ <h3 class="header-title">{{'CONFIGMAP.CREATE_TMP' | translate}}</h3>
5252
</div>
5353
</div>
5454
</div>
55-
</section>
55+
</wayne-box>
5656
</form>
5757
</div>
5858
<div class="clr-wizard-footer-buttons tpl-bottom" [style.top.px]="top">

0 commit comments

Comments
 (0)