Skip to content

Commit

Permalink
Merge pull request #144 from BennieMeng/namespace-nocluster-prompt
Browse files Browse the repository at this point in the history
Prompt the user background to assign Namespace machine room
  • Loading branch information
wilhelmguo authored Dec 14, 2018
2 parents 9998e6a + 302131f commit 6519fd2
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 7 deletions.
9 changes: 9 additions & 0 deletions src/frontend/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,18 @@ if (process.argv[2] === 'format') {
}
if (process.argv[3] === 'zh-Hans') {
const filePath = path.resolve(__dirname, 'src/assets/i18n', 'zh-Hans.json');
const enSet = new Set([]);
const zhSet = new Set([]);
const matchSet = new Set(['CPU使用']);
const result = JSON.stringify(defaultValue, null, 2).replace(/([\u4e00-\u9fa5]+)([a-zA-Z]+)/g, function (match, $1, $2) {
if (matchSet.has(match) || zhSet.has($1) || enSet.has($2)) {
return match
}
return $1 + ' ' + $2;
}).replace(/([a-zA-Z]+)([\u4e00-\u9fa5]+)/g, function (match, $1, $2) {
if (matchSet.has(match) || zhSet.has($2) || enSet.has($1)) {
return match;
}
return $1 + ' ' + $2;
});
fs.writeFile(filePath, result, err => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ <h3 class="header-title">{{'CONFIGMAP.CREATE_TMP' | translate}}</h3>
<section class="form-block wrap">
<div *ngIf="clusters" formArrayName="clusters" class="form-group form-group-padding">
<label class="col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'CONFIGMAP.CREATE_EDIT_TMP.CLUSTER_MESSAGE' | translate}}</span>
<div *ngFor="let cluster of clusters;let i=index"
style="padding-right: 15px" class="checkbox-inline"
[formGroupName]="i">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ <h3 class="modal-title">{{title}}</h3>
</div>
<div class="form-group" style="padding-left: 135px;">
<label class="col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'CRONJOB.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
<div *ngFor="let cluster of clusters" class="checkbox-inline">
<div class="checkbox">
<input [(ngModel)]="clusterMetas[cluster.name].checked"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ <h3 class="modal-title">{{title | translate}}</h3>
</div>
<div class="form-group" style="padding-left: 135px;">
<label class="col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'DAEMONSET.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
<div *ngFor="let cluster of clusters" style="padding-right: 15px" class="checkbox-inline">
<input [(ngModel)]="cluster['checked']"
type="checkbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ <h3 class="modal-title">{{title}}</h3>
</div>
<div class="form-group" style="padding-left: 135px;">
<label class="col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'DEPLOYMENT.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
<div *ngFor="let cluster of clusters" class="checkbox-inline">
<div class="checkbox">
<input [(ngModel)]="clusterMetas[cluster.name].checked"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ <h3 class="modal-title">{{title}}</h3>
</div>
<div class="form-group" style="padding-left: 135px;">
<label class="col-md-3 form-group-label-override required">机房</label>
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'INGRESS.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
<div *ngFor="let cluster of clusters" style="padding-right: 15px" class="checkbox-inline">
<input [(ngModel)]="cluster['checked']"
type="checkbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ <h3 class="header-title">{{'PVC.CREATE_TMP' | translate}}</h3>
<section class="form-block wrap">
<div *ngIf="clusters" formArrayName="clusters" class="form-group form-group-padding">
<label class="col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'PVC.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
<div *ngFor="let cluster of clusters;let i=index"
style="padding-right: 15px" class="checkbox-inline"
[formGroupName]="i">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ <h3 class="header-title">{{'SECRET.CREATE_TMP' | translate}}</h3>
<section class="form-block wrap">
<div *ngIf="clusters" formArrayName="clusters" class="form-group form-group-padding">
<label class="col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'SECRET.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
<div *ngFor="let cluster of clusters;let i=index"
style="padding-right: 15px" class="checkbox-inline"
[formGroupName]="i">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ <h3 class="modal-title">{{title}}</h3>
</div>
<div class="form-group" style="padding-left: 135px;">
<label class="col-md-3 form-group-label-override required">{{'TITLE.CLUSTER' | translate}}</label>
<span class="warning-text" *ngIf="!clusters || clusters && clusters.length === 0">{{'STATEFULSET.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}</span>
<div *ngFor="let cluster of clusters" class="checkbox-inline">
<div class="checkbox">
<input [(ngModel)]="clusterMetas[cluster.name].checked"
Expand Down
40 changes: 33 additions & 7 deletions src/frontend/src/assets/i18n/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"CREATE_APP": "创建项目",
"DEPARTMENT_NAME": "部门名称",
"CREATE_TIME": "创建时间",
"CPU_USAGE": "CPU 使用(核)",
"CPU_USAGE": "CPU使用(核)",
"CPU_USAGE_SHORT": "CPU使用(核)",
"MEMORY_USAGE": "内存使用(G)",
"MEMORY_USAGE_SHORT": "内存使用(G)",
Expand Down Expand Up @@ -339,26 +339,38 @@
"CREATE_TMP": "创建部署模板",
"EDIT": "编辑部署",
"DELETE": "删除部署",
"NUM": "部署份数"
"NUM": "部署份数",
"CREATE_EDIT": {
"CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建部署"
}
},
"STATEFULSET": {
"TITLE": "状态副本集",
"CREATE": "创建状态副本集",
"CREATE_TMP": "创建状态副本集模板",
"EDIT": "编辑状态副本集",
"DELETE": "删除状态副本集"
"DELETE": "删除状态副本集",
"CREATE_EDIT": {
"CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建状态副本集"
}
},
"DAEMONSET": {
"CREATE": "创建守护进程集",
"CREATE_TMP": "创建守护进程集模板",
"EDIT": "编辑守护进程集",
"DELETE": "删除守护进程集"
"DELETE": "删除守护进程集",
"CREATE_EDIT": {
"CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建守护进程集"
}
},
"CRONJOB": {
"CREATE": "创建计划任务",
"CREATE_TMP": "创建计划任务模板",
"EDIT": "编辑计划任务",
"DELETE": "删除计划任务",
"CREATE_EDIT": {
"CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建计划任务"
},
"LIST": "计划任务列表",
"DELETE_LIST": "已删除计划任务列表",
"CONFIG": "计划任务配置",
Expand All @@ -377,17 +389,28 @@
"GROUP": "所属集群",
"FAIL_REASON": "失败原因"
},
"INGRESS": {
"CREATE_EDIT": {
"CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建 Ingress"
}
},
"CONFIGMAP": {
"CREATE": "创建配置集",
"CREATE_TMP": "创建配置集模板",
"EDIT": "编辑配置集",
"DELETE": "删除配置集"
"DELETE": "删除配置集",
"CREATE_EDIT_TMP": {
"CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建配置集"
}
},
"SECRET": {
"CREATE": "创建加密字典",
"CREATE_TMP": "创建加密字典模板",
"EDIT": "编辑加密字典",
"DELETE": "删除加密字典"
"DELETE": "删除加密字典",
"CREATE_EDIT_TMP": {
"CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建加密字典"
}
},
"PVC": {
"CREATE": "创建 PVC",
Expand All @@ -414,7 +437,10 @@
"SIZE": "大小",
"DELETE_SNAPSHOOT": "删除快照",
"ROLLBACK_SNAPSHOOT": "回滚快照",
"RECORD": "共{{value}}条快照记录"
"RECORD": "共{{value}}条快照记录",
"CREATE_EDIT_TMP": {
"CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建 PVC"
}
},
"WEBHOOK": {
"TITLE": "{{ value }}列表",
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ textarea {
resize: auto !important;
}

.warning-text{
color: red;
}

/* 设置滚动条的样式 */
::-webkit-scrollbar {
width: 8px;
Expand Down

0 comments on commit 6519fd2

Please sign in to comment.