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

View File

@ -3,7 +3,7 @@
} }
.input-width { .input-width {
width: 200px; width: 300px;
} }
.copy-token { .copy-token {
@ -35,3 +35,12 @@
.no-margin { .no-margin {
margin: 0; 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>(); robotNameChecker: Subject<string> = new Subject<string>();
nameTooltipText = "ROBOT_ACCOUNT.ROBOT_NAME"; nameTooltipText = "ROBOT_ACCOUNT.ROBOT_NAME";
robotForm: NgForm; robotForm: NgForm;
imagePermission: string = "push-and-pull";
@Input() projectId: number; @Input() projectId: number;
@Input() projectName: string; @Input() projectName: string;
@Output() create = new EventEmitter<boolean>(); @Output() create = new EventEmitter<boolean>();
@ -116,6 +117,14 @@ export class AddRobotComponent implements OnInit, OnDestroy {
if (this.isSubmitOnGoing) { if (this.isSubmitOnGoing) {
return; 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.isSubmitOnGoing = true;
this.robotService this.robotService
.addRobotAccount( .addRobotAccount(

View File

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

View File

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

View File

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

View File

@ -302,10 +302,11 @@
"ENABLE_ACCOUNT": "permettre à compte ", "ENABLE_ACCOUNT": "permettre à compte ",
"DELETE": "Supprimer", "DELETE": "Supprimer",
"CREAT_ROBOT_ACCOUNT": "créat robot compte ", "CREAT_ROBOT_ACCOUNT": "créat robot compte ",
"PULL_PERMISSION": "Image pull", "PERMISSIONS_IMAGE": "Image",
"PULL_PUSH_PERMISSION": "Image pull / push", "PERMISSIONS_HELMCHART": "Helm Chart",
"PUSH_CHART_PERMISSION": "Helm chart push", "PUSH": "Push",
"PULL_CHART_PERMISSION": "Helm chart pull", "PULL": "Pull",
"FILTER_PLACEHOLDER": "Filter Robot Accounts", "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.", "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à.", "ACCOUNT_EXISTING": "le robot est existe déjà.",

View File

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

View File

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