Merge pull request #8150 from AllForNothing/robot-account-helm-ui

UI modification for creating robot account
This commit is contained in:
Will Sun 2019-06-27 13:23:39 +08:00 committed by GitHub
commit 108b9284a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 224 additions and 206 deletions

View File

@ -5,7 +5,7 @@
<div class="modal-body">
<form #robotForm="ngForm">
<section class="form-block">
<div class="form-group">
<div class="form-group padding-left-120">
<label class="col-md-3
form-group-label-override required" for="robot_name">
{{'ROBOT_ACCOUNT.NAME' | translate}}
@ -31,57 +31,56 @@
</label>
<span class="spinner spinner-inline" [hidden]="!checkOnGoing"></span>
</div>
<div class="form-group">
<div class="form-group padding-left-120">
<label class="form-group-label-override">{{'REPLICATION.DESCRIPTION' |
translate}}</label>
<input type="text" size="255" class="input-width"
[(ngModel)]="robot.description"
name="robot_desc" id="robot_desc">
</div>
<div class="form-group">
<div class="clr-row">
<div class="clr-col-3 permission">
<label class="col-md-3">
{{'ROBOT_ACCOUNT.PERMISSIONS' | translate}}
</label>
<label class="clr-col-md-8 no-margin padding-left-0">
<clr-checkbox-wrapper>
<input type="checkbox" clrCheckbox [checked]="true"
[(ngModel)]="robot.access.isPullImage" name="isPullImage"
id="permission-pull" class="clr-checkbox">
<label for="permission-pull" class="clr-control-label">
{{'ROBOT_ACCOUNT.PULL_PERMISSION' | translate}}
</label>
</clr-checkbox-wrapper>
</label>
<label class="clr-col-md-8 no-margin padding-left-0">
<clr-checkbox-wrapper>
<input type="checkbox" clrCheckbox [checked]="true"
[(ngModel)]="robot.access.isPushOrPullImage" name="isPushOrPullImage"
id="permission-push" class="clr-checkbox">
<label for="permission-push" class="clr-control-label">
{{'ROBOT_ACCOUNT.PULL_PUSH_PERMISSION' | translate}}
</label>
</clr-checkbox-wrapper>
</label>
<label class="clr-col-md-8 no-margin padding-left-0">
<clr-checkbox-wrapper>
<input type="checkbox" clrCheckbox [checked]="true"
[(ngModel)]="robot.access.isPushChart" name="isPushChart"
id="permission-push-chart" class="clr-checkbox">
<label for="permission-push-chart" class="clr-control-label">
{{'ROBOT_ACCOUNT.PUSH_CHART_PERMISSION' | translate}}
</label>
</clr-checkbox-wrapper>
</label>
<label class="clr-col-md-8 no-margin padding-left-0">
<clr-checkbox-wrapper>
<input type="checkbox" clrCheckbox [checked]="true"
[(ngModel)]="robot.access.isPullChart" name="isPullChart"
id="permission-pull-chart" class="clr-checkbox">
<label for="permission-pull-chart" class="clr-control-label">
{{'ROBOT_ACCOUNT.PULL_CHART_PERMISSION' | translate}}
</label>
</clr-checkbox-wrapper>
</label>
</div>
<div class="clr-col">
<div class="form-group padding-left-120">
<label>{{'ROBOT_ACCOUNT.PERMISSIONS_IMAGE' | translate}}</label>
<div class="radio-inline">
<input type="radio" name="image-permission"
id="image-permission-pull"
value="pull"
[(ngModel)]="imagePermission">
<label for="image-permission-pull">{{'ROBOT_ACCOUNT.PULL' | translate}}</label>
</div>
<div class="radio-inline">
<input type="radio" name="image-permission"
id="image-permission-push-and-pull"
value="push-and-pull"
[(ngModel)]="imagePermission">
<label for="image-permission-push-and-pull">{{'ROBOT_ACCOUNT.PUSH' | translate}}
& {{'ROBOT_ACCOUNT.PULL' | translate}}</label>
</div>
</div>
<div class="form-group padding-left-120">
<label>{{'ROBOT_ACCOUNT.PERMISSIONS_HELMCHART' | translate}}</label>
<div class="checkbox-inline">
<input type="checkbox" id="helm-permission-push"
[checked]="robot.access.isPushChart"
[(ngModel)]="robot.access.isPushChart"
name="helm-permission">
<label for="helm-permission-push">{{'ROBOT_ACCOUNT.PUSH' | translate}}</label>
</div>
<div class="checkbox-inline">
<input type="checkbox" id="helm-permission-pull"
[checked]="robot.access.isPullChart"
[(ngModel)]="robot.access.isPullChart"
name="helm-permission">
<label for="helm-permission-pull">{{'ROBOT_ACCOUNT.PULL' | translate}}</label>
</div>
</div>
</div>
</div>
</section>
</form>

View File

@ -3,7 +3,7 @@
}
.input-width {
width: 200px;
width: 300px;
}
.copy-token {
@ -35,3 +35,12 @@
.no-margin {
margin: 0;
}
.permission{
padding-top: 5px;
color: #000000;
}
.padding-left-120{
padding-left: 120px;
}

View File

@ -38,6 +38,7 @@ export class AddRobotComponent implements OnInit, OnDestroy {
robotNameChecker: Subject<string> = new Subject<string>();
nameTooltipText = "ROBOT_ACCOUNT.ROBOT_NAME";
robotForm: NgForm;
imagePermission: string = "push-and-pull";
@Input() projectId: number;
@Input() projectName: string;
@Output() create = new EventEmitter<boolean>();
@ -116,6 +117,14 @@ export class AddRobotComponent implements OnInit, OnDestroy {
if (this.isSubmitOnGoing) {
return;
}
// set value to robot.access.isPullImage and robot.access.isPushOrPullImage when submit
if ( this.imagePermission === 'pull' ) {
this.robot.access.isPullImage = true;
this.robot.access.isPushOrPullImage = false;
} else {
this.robot.access.isPullImage = false;
this.robot.access.isPushOrPullImage = true;
}
this.isSubmitOnGoing = true;
this.robotService
.addRobotAccount(

View File

@ -16,7 +16,7 @@ export class Robot {
constructor () {
this.access = <any>{};
// this.access[0].action = true;
this.access.isPullImage = true;
this.access.isPullImage = false;
this.access.isPushOrPullImage = true;
this.access.isPushChart = false;
this.access.isPullChart = false;

View File

@ -310,10 +310,10 @@
"ENABLE_ACCOUNT": "Enable Account",
"DELETE": "Delete",
"CREAT_ROBOT_ACCOUNT": "Creat Robot Account",
"PULL_PERMISSION": "Image pull",
"PULL_PUSH_PERMISSION": "Image pull / push",
"PUSH_CHART_PERMISSION": "Helm chart push",
"PULL_CHART_PERMISSION": "Helm chart pull",
"PERMISSIONS_IMAGE": "Image",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PUSH": "Push",
"PULL": "Pull",
"FILTER_PLACEHOLDER": "Filter Robot Accounts",
"ROBOT_NAME": "Cannot contain special characters(~#$%) and maximum length should be 255 characters.",
"ACCOUNT_EXISTING": "Robot Account is already exists.",

View File

@ -311,10 +311,10 @@
"ENABLE_ACCOUNT": "Enable Account",
"DELETE": "Delete",
"CREAT_ROBOT_ACCOUNT": "Creat Robot Account",
"PULL_PERMISSION": "Image pull",
"PULL_PUSH_PERMISSION": "Image pull / push",
"PUSH_CHART_PERMISSION": "Helm chart push",
"PULL_CHART_PERMISSION": "Helm chart pull",
"PERMISSIONS_IMAGE": "Image",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PUSH": "Push",
"PULL": "Pull",
"FILTER_PLACEHOLDER": "Filter Robot Accounts",
"ROBOT_NAME": "Cannot contain special characters(~#$%) and maximum length should be 255 characters.",
"ACCOUNT_EXISTING": "Robot Account is already exists.",

View File

@ -302,10 +302,11 @@
"ENABLE_ACCOUNT": "permettre à compte ",
"DELETE": "Supprimer",
"CREAT_ROBOT_ACCOUNT": "créat robot compte ",
"PULL_PERMISSION": "Image pull",
"PULL_PUSH_PERMISSION": "Image pull / push",
"PUSH_CHART_PERMISSION": "Helm chart push",
"PULL_CHART_PERMISSION": "Helm chart pull",
"PERMISSIONS_IMAGE": "Image",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PUSH": "Push",
"PULL": "Pull",
"FILTER_PLACEHOLDER": "Filter Robot Accounts",
"ROBOT_NAME": "ne peut pas contenir de caractères spéciaux(~#$%) et la longueur maximale devrait être de 255 caractères.",
"ACCOUNT_EXISTING": "le robot est existe déjà.",

View File

@ -308,10 +308,10 @@
"ENABLE_ACCOUNT": "Ativar conta",
"DELETE": "Remover",
"CREAT_ROBOT_ACCOUNT": "CRIA robô conta",
"PULL_PERMISSION": "Image pull",
"PULL_PUSH_PERMISSION": "Image pull / push",
"PUSH_CHART_PERMISSION": "Helm chart push",
"PULL_CHART_PERMISSION": "Helm chart pull",
"PERMISSIONS_IMAGE": "Image",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PUSH": "Push",
"PULL": "Pull",
"FILTER_PLACEHOLDER": "Filtro robot accounts",
"ROBOT_NAME": "Não Pode conter caracteres especiais(~#$%) e comprimento máximo deveria ser 255 caracteres.",
"ACCOUNT_EXISTING": "Robô conta já existe.",

View File

@ -309,10 +309,10 @@
"ENABLE_ACCOUNT": "启用账户",
"DELETE": "删除",
"CREAT_ROBOT_ACCOUNT": "创建机器人账户",
"PULL_PERMISSION": "Pull 镜像",
"PULL_PUSH_PERMISSION": "Push和Pull 镜像",
"PUSH_CHART_PERMISSION": "推送Chart",
"PULL_CHART_PERMISSION": "拉取Chart",
"PERMISSIONS_IMAGE": "镜像",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PUSH": "推送",
"PULL": "拉取",
"FILTER_PLACEHOLDER": "过滤机器人账户",
"ROBOT_NAME": "不能包含特殊字符(~#$%)且长度不能超过255.",
"ACCOUNT_EXISTING": "机器人账户已经存在.",