mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-29 12:07:56 +01:00
Merge pull request #13752 from AllForNothing/improve-robot
Improve refresh secret page for robot account UI
This commit is contained in:
commit
90f9bea965
@ -18,7 +18,7 @@
|
||||
type="text" id="name"
|
||||
[(ngModel)]="systemRobot.name"
|
||||
required
|
||||
pattern='[^" ~#$%]+'
|
||||
pattern='^[a-z0-9]+(?:[._-][a-z0-9]+)*$'
|
||||
maxLengthExt="255"
|
||||
autocomplete="off"
|
||||
size="30" name="name" #name="ngModel" (input)="inputName()">
|
||||
@ -27,7 +27,7 @@
|
||||
</div>
|
||||
<clr-control-error *ngIf="((name.dirty || name.touched) && name.invalid) || isNameExisting">
|
||||
<span *ngIf="!((name.dirty || name.touched) && name.invalid) && isNameExisting">{{'ROBOT_ACCOUNT.ACCOUNT_EXISTING' | translate}}</span>
|
||||
<span *ngIf="(name.dirty || name.touched) && name.invalid">{{ 'ROBOT_ACCOUNT.ROBOT_NAME' | translate }}</span>
|
||||
<span *ngIf="(name.dirty || name.touched) && name.invalid">{{ 'SYSTEM_ROBOT.NAME_TOOLTIP' | translate }}</span>
|
||||
</clr-control-error>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -250,7 +250,7 @@ export class AddRobotComponent implements OnInit, OnDestroy {
|
||||
opeMessage.name = "SYSTEM_ROBOT.ADD_ROBOT";
|
||||
opeMessage.data.id = robot.id;
|
||||
opeMessage.state = OperationState.progressing;
|
||||
opeMessage.data.name = robot.name;
|
||||
opeMessage.data.name = `${this.projectName}+${robot.name}`;
|
||||
this.operationService.publishInfo(opeMessage);
|
||||
this.robotService.CreateRobot({
|
||||
robot: robot
|
||||
|
@ -34,7 +34,7 @@
|
||||
</button>
|
||||
<button *ngIf="selectedRows && selectedRows.length === 1 && selectedRows[0].disable" type="button" class="btn btn-secondary"
|
||||
(click)="disableOrEnable()"
|
||||
[disabled]="!hasRobotUpdatePermission ||!(selectedRows && selectedRows.length === 1 && selectedRows[0].disable) || !selectedRows[0].editable">
|
||||
[disabled]="!hasRobotUpdatePermission ||!(selectedRows && selectedRows.length === 1 && selectedRows[0].disable)">
|
||||
<clr-icon size="16" shape="success-standard"></clr-icon>
|
||||
<span id="distribution-enable">{{'WEBHOOK.ENABLED_BUTTON' | translate}}</span>
|
||||
</button>
|
||||
@ -42,7 +42,7 @@
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
(click)="disableOrEnable()"
|
||||
[disabled]="!hasRobotUpdatePermission ||!(selectedRows && selectedRows.length === 1 && !selectedRows[0].disable) || !selectedRows[0].editable">
|
||||
[disabled]="!hasRobotUpdatePermission ||!(selectedRows && selectedRows.length === 1 && !selectedRows[0].disable)">
|
||||
<clr-icon size="16" shape="ban"></clr-icon>
|
||||
<span id="distribution-disable">{{'WEBHOOK.DISABLED_BUTTON' | translate}}</span>
|
||||
</button>
|
||||
@ -106,4 +106,4 @@
|
||||
</div>
|
||||
</div>
|
||||
<add-robot [projectId]="projectId" [projectName]="projectName" (addSuccess)="addSuccess($event)"></add-robot>
|
||||
<view-token (refreshSuccess)="refresh()"></view-token>
|
||||
<view-token (refreshSuccess)="refresh()"></view-token>
|
||||
|
@ -18,7 +18,7 @@
|
||||
type="text" id="name"
|
||||
[(ngModel)]="systemRobot.name"
|
||||
required
|
||||
pattern='[^" ~#$%]+'
|
||||
pattern='^[a-z0-9]+(?:[._-][a-z0-9]+)*$'
|
||||
maxLengthExt="255"
|
||||
autocomplete="off"
|
||||
size="30" name="name" #name="ngModel" (input)="inputName()">
|
||||
@ -27,7 +27,7 @@
|
||||
</div>
|
||||
<clr-control-error *ngIf="((name.dirty || name.touched) && name.invalid) || isNameExisting">
|
||||
<span *ngIf="!((name.dirty || name.touched) && name.invalid) && isNameExisting">{{'ROBOT_ACCOUNT.ACCOUNT_EXISTING' | translate}}</span>
|
||||
<span *ngIf="(name.dirty || name.touched) && name.invalid">{{ 'ROBOT_ACCOUNT.ROBOT_NAME' | translate }}</span>
|
||||
<span *ngIf="(name.dirty || name.touched) && name.invalid">{{ 'SYSTEM_ROBOT.NAME_TOOLTIP' | translate }}</span>
|
||||
</clr-control-error>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -7,10 +7,15 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<inline-alert class="modal-title"></inline-alert>
|
||||
<p class="mt-0">{{"SYSTEM_ROBOT.REFRESH_SECRET_SUMMARY" | translate}}</p>
|
||||
<p class="mt-0 mb-1">{{"SYSTEM_ROBOT.REFRESH_SECRET_SUMMARY" | translate}}</p>
|
||||
<section class="form-block show-info">
|
||||
<form #secretForm="ngForm" class="clr-form clr-form-horizontal">
|
||||
<div class="clr-form-control">
|
||||
<clr-toggle-wrapper class="mt-02">
|
||||
<input (change)="changeEnableNewSecret()" type="checkbox" clrToggle name="enableNewSecret" id="enable-new-secret"
|
||||
[(ngModel)]="enableNewSecret"/>
|
||||
<label for="enable-new-secret">{{"SYSTEM_ROBOT.ENABLE_NEW_SECRET" | translate}}</label>
|
||||
</clr-toggle-wrapper>
|
||||
<div class="clr-form-control" [style.visibility]="enableNewSecret ? 'visible' : 'hidden'">
|
||||
<label for="new-token" class="clr-control-label">{{"SYSTEM_ROBOT.NEW_TOKEN" | translate}}</label>
|
||||
<div class="clr-control-container" [class.clr-error]="(newToken.dirty || newToken.touched) && newToken.invalid">
|
||||
<div class="clr-input-wrapper">
|
||||
@ -28,7 +33,7 @@
|
||||
</clr-control-error>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clr-form-control">
|
||||
<div class="clr-form-control" [style.visibility]="enableNewSecret ? 'visible' : 'hidden'">
|
||||
<label for="confirm-token" class="clr-control-label">{{"SYSTEM_ROBOT.CONFIRM_SECRET" | translate}}</label>
|
||||
<div class="clr-control-container" [class.clr-error]="notSame() || (confirmToken.dirty || confirmToken.touched) && confirmToken.invalid">
|
||||
<div class="clr-input-wrapper">
|
||||
@ -90,4 +95,4 @@
|
||||
<a [href]="downLoadHref" [download]="downLoadFileName"><button class="btn mr-0" (click)="closeModal()">{{'ROBOT_ACCOUNT.EXPORT_TO_FILE' | translate}}</button></a>
|
||||
</section>
|
||||
</div>
|
||||
</clr-modal>
|
||||
</clr-modal>
|
||||
|
@ -47,3 +47,6 @@
|
||||
.align-center {
|
||||
align-items: center;
|
||||
}
|
||||
.clr-form {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ export class ViewTokenComponent implements OnInit {
|
||||
createSuccess: string;
|
||||
downLoadFileName: string = '';
|
||||
downLoadHref: SafeUrl = '';
|
||||
enableNewSecret: boolean = false;
|
||||
constructor(private robotService: RobotService,
|
||||
private operationService: OperationService,
|
||||
private msgHandler: MessageHandlerService,
|
||||
@ -96,6 +97,9 @@ export class ViewTokenComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
canRefresh() {
|
||||
if (this.enableNewSecret && !this.newSecret && !this.confirmSecret) {
|
||||
return false;
|
||||
}
|
||||
if (!this.newSecret && !this.confirmSecret) {
|
||||
return true;
|
||||
}
|
||||
@ -119,4 +123,9 @@ export class ViewTokenComponent implements OnInit {
|
||||
notSame(): boolean {
|
||||
return this.secretForm.valid && this.newSecret && this.confirmSecret && this.newSecret !== this.confirmSecret;
|
||||
}
|
||||
changeEnableNewSecret() {
|
||||
this.secretForm.reset({
|
||||
enableNewSecret: this.enableNewSecret
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1618,7 +1618,7 @@
|
||||
"PROJECTS": "Projects",
|
||||
"ALL_PROJECTS": "All projects with",
|
||||
"PERMISSIONS": "PERMISSION(S)",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the secret for this robot account",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the robot account secret automatically, or optionally open the details to manually specify a new secret",
|
||||
"TOKEN": "Secret",
|
||||
"NEW_TOKEN": "New Secret",
|
||||
"REFRESH": "REFRESH",
|
||||
@ -1653,6 +1653,8 @@
|
||||
"COVERED_PROJECTS": "PROJECT(S)",
|
||||
"CONFIRM_SECRET": "Confirm Secret",
|
||||
"SECRET_AGAIN": "Input secret again",
|
||||
"INCONSISTENT": "Two secrets are inconsistent"
|
||||
"INCONSISTENT": "Two secrets are inconsistent",
|
||||
"NAME_TOOLTIP": "Robot name should be 1~255 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||
"ENABLE_NEW_SECRET": "Enable this option to manually specify a new secret"
|
||||
}
|
||||
}
|
||||
|
@ -359,7 +359,7 @@
|
||||
"ACCOUNT_EXISTING": "Robot Account is already exists.",
|
||||
"ALERT_TEXT": "This is the only time to copy this secret.You won't have another opportunity",
|
||||
"CREATED_SUCCESS": "Created '{{param}}' successfully.",
|
||||
"COPY_SUCCESS": "Copy token successfully of '{{param}}'",
|
||||
"COPY_SUCCESS": "Copy secret successfully of '{{param}}'",
|
||||
"DELETION_TITLE": "Confirm removal of robot accounts",
|
||||
"DELETION_SUMMARY": "Do you want to delete robot accounts {{param}}?",
|
||||
"PULL_IS_MUST": "Pull permission is checked by default and can not be modified.",
|
||||
@ -1618,7 +1618,7 @@
|
||||
"PROJECTS": "Projects",
|
||||
"ALL_PROJECTS": "All projects with",
|
||||
"PERMISSIONS": "PERMISSION(S)",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the secret for this robot account",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the robot account secret automatically, or optionally open the details to manually specify a new secret",
|
||||
"TOKEN": "Secret",
|
||||
"NEW_TOKEN": "New Secret",
|
||||
"REFRESH": "REFRESH",
|
||||
@ -1653,6 +1653,8 @@
|
||||
"COVERED_PROJECTS": "PROJECT(S)",
|
||||
"CONFIRM_SECRET": "Confirm Secret",
|
||||
"SECRET_AGAIN": "Input secret again",
|
||||
"INCONSISTENT": "Two secrets are inconsistent"
|
||||
"INCONSISTENT": "Two secrets are inconsistent",
|
||||
"NAME_TOOLTIP": "Robot name should be 1~255 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||
"ENABLE_NEW_SECRET": "Enable this option to manually specify a new secret"
|
||||
}
|
||||
}
|
||||
|
@ -360,7 +360,7 @@
|
||||
"ACCOUNT_EXISTING": "Robot Account is already exists.",
|
||||
"ALERT_TEXT": "This is the only time to copy this secret.You won't have another opportunity",
|
||||
"CREATED_SUCCESS": "Created '{{param}}' successfully.",
|
||||
"COPY_SUCCESS": "Copy token successfully of '{{param}}'",
|
||||
"COPY_SUCCESS": "Copy secret successfully of '{{param}}'",
|
||||
"DELETION_TITLE": "Confirm removal of robot accounts",
|
||||
"DELETION_SUMMARY": "Do you want to delete robot accounts {{param}}?",
|
||||
"PULL_IS_MUST": "Pull permission is checked by default and can not be modified.",
|
||||
@ -1616,7 +1616,7 @@
|
||||
"PROJECTS": "Projects",
|
||||
"ALL_PROJECTS": "All projects with",
|
||||
"PERMISSIONS": "PERMISSION(S)",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the secret for this robot account",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the robot account secret automatically, or optionally open the details to manually specify a new secret",
|
||||
"TOKEN": "Secret",
|
||||
"NEW_TOKEN": "New Secret",
|
||||
"REFRESH": "REFRESH",
|
||||
@ -1651,6 +1651,8 @@
|
||||
"COVERED_PROJECTS": "PROJECT(S)",
|
||||
"CONFIRM_SECRET": "Confirm Secret",
|
||||
"SECRET_AGAIN": "Input secret again",
|
||||
"INCONSISTENT": "Two secrets are inconsistent"
|
||||
"INCONSISTENT": "Two secrets are inconsistent",
|
||||
"NAME_TOOLTIP": "Robot name should be 1~255 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||
"ENABLE_NEW_SECRET": "Enable this option to manually specify a new secret"
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +351,7 @@
|
||||
"ACCOUNT_EXISTING": "le robot est existe déjà.",
|
||||
"ALERT_TEXT": "This is the only time to copy this secret.You won't have another opportunity",
|
||||
"CREATED_SUCCESS": "Created '{{param}}' successfully.",
|
||||
"COPY_SUCCESS": "Copy token successfully of '{{param}}'",
|
||||
"COPY_SUCCESS": "Copy secret successfully of '{{param}}'",
|
||||
"DELETION_TITLE": "confirmer l'enlèvement des comptes du robot ",
|
||||
"DELETION_SUMMARY": "Voulez-vous supprimer la règle {{param}}?",
|
||||
"PULL_IS_MUST": "Pull permission is checked by default and can not be modified.",
|
||||
@ -1586,7 +1586,7 @@
|
||||
"PROJECTS": "Projects",
|
||||
"ALL_PROJECTS": "All projects with",
|
||||
"PERMISSIONS": "PERMISSION(S)",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the secret for this robot account",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the robot account secret automatically, or optionally open the details to manually specify a new secret",
|
||||
"TOKEN": "Secret",
|
||||
"NEW_TOKEN": "New Secret",
|
||||
"REFRESH": "REFRESH",
|
||||
@ -1621,6 +1621,8 @@
|
||||
"COVERED_PROJECTS": "PROJECT(S)",
|
||||
"CONFIRM_SECRET": "Confirm Secret",
|
||||
"SECRET_AGAIN": "Input secret again",
|
||||
"INCONSISTENT": "Two secrets are inconsistent"
|
||||
"INCONSISTENT": "Two secrets are inconsistent",
|
||||
"NAME_TOOLTIP": "Robot name should be 1~255 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||
"ENABLE_NEW_SECRET": "Enable this option to manually specify a new secret"
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +357,7 @@
|
||||
"ACCOUNT_EXISTING": "Robô conta já existe.",
|
||||
"ALERT_TEXT": "É só copiar o token de acesso Pessoal não VAI ter outra oportunidade.",
|
||||
"CREATED_SUCCESS": "Created '{{param}}' successfully.",
|
||||
"COPY_SUCCESS": "Copy token successfully of '{{param}}'",
|
||||
"COPY_SUCCESS": "Copy secret successfully of '{{param}}'",
|
||||
"DELETION_TITLE": "Confirmar a remoção do robô Contas",
|
||||
"DELETION_SUMMARY": "Você quer remover a regra {{param}}?",
|
||||
"PULL_IS_MUST": "Pull permission is checked by default and can not be modified.",
|
||||
@ -1614,7 +1614,7 @@
|
||||
"PROJECTS": "Projects",
|
||||
"ALL_PROJECTS": "All projects with",
|
||||
"PERMISSIONS": "PERMISSION(S)",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the secret for this robot account",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the robot account secret automatically, or optionally open the details to manually specify a new secret",
|
||||
"TOKEN": "Secret",
|
||||
"NEW_TOKEN": "New Secret",
|
||||
"REFRESH": "REFRESH",
|
||||
@ -1649,7 +1649,9 @@
|
||||
"COVERED_PROJECTS": "PROJECT(S)",
|
||||
"CONFIRM_SECRET": "Confirm Secret",
|
||||
"SECRET_AGAIN": "Input secret again",
|
||||
"INCONSISTENT": "Two secrets are inconsistent"
|
||||
"INCONSISTENT": "Two secrets are inconsistent",
|
||||
"NAME_TOOLTIP": "Robot name should be 1~255 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||
"ENABLE_NEW_SECRET": "Enable this option to manually specify a new secret"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1618,7 +1618,7 @@
|
||||
"PROJECTS": "Projects",
|
||||
"ALL_PROJECTS": "All projects with",
|
||||
"PERMISSIONS": "PERMISSION(S)",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the secret for this robot account",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the robot account secret automatically, or optionally open the details to manually specify a new secret",
|
||||
"TOKEN": "Secret",
|
||||
"NEW_TOKEN": "New Secret",
|
||||
"REFRESH": "REFRESH",
|
||||
@ -1653,6 +1653,8 @@
|
||||
"COVERED_PROJECTS": "PROJECT(S)",
|
||||
"CONFIRM_SECRET": "Confirm Secret",
|
||||
"SECRET_AGAIN": "Input secret again",
|
||||
"INCONSISTENT": "Two secrets are inconsistent"
|
||||
"INCONSISTENT": "Two secrets are inconsistent",
|
||||
"NAME_TOOLTIP": "Robot name should be 1~255 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||
"ENABLE_NEW_SECRET": "Enable this option to manually specify a new secret"
|
||||
}
|
||||
}
|
||||
|
@ -1615,7 +1615,7 @@
|
||||
"PROJECTS": "覆盖项目数",
|
||||
"ALL_PROJECTS": "全部项目且具有",
|
||||
"PERMISSIONS": "项权限",
|
||||
"REFRESH_SECRET_SUMMARY": "刷新当前机器人账户令牌",
|
||||
"REFRESH_SECRET_SUMMARY": "您可以直接点击刷新按钮来随机生成新的令牌,或者手动为其指定一个新的令牌",
|
||||
"TOKEN": "令牌",
|
||||
"NEW_TOKEN": "新令牌",
|
||||
"REFRESH": "刷新",
|
||||
@ -1650,6 +1650,8 @@
|
||||
"COVERED_PROJECTS": "个项目",
|
||||
"CONFIRM_SECRET": "确认令牌",
|
||||
"SECRET_AGAIN": "请再次输入令牌",
|
||||
"INCONSISTENT": "两次输入不一致"
|
||||
"INCONSISTENT": "两次输入不一致",
|
||||
"NAME_TOOLTIP": "机器人名称由小写字符、数字和._-组成且至少1个字符并以字符或者数字开头。",
|
||||
"ENABLE_NEW_SECRET": "开启此项以便手动指定新令牌"
|
||||
}
|
||||
}
|
||||
|
@ -1602,7 +1602,7 @@
|
||||
"PROJECTS": "Projects",
|
||||
"ALL_PROJECTS": "All projects with",
|
||||
"PERMISSIONS": "PERMISSION(S)",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the secret for this robot account",
|
||||
"REFRESH_SECRET_SUMMARY": "Refresh the robot account secret automatically, or optionally open the details to manually specify a new secret",
|
||||
"TOKEN": "Secret",
|
||||
"NEW_TOKEN": "New Secret",
|
||||
"REFRESH": "REFRESH",
|
||||
@ -1637,6 +1637,8 @@
|
||||
"COVERED_PROJECTS": "PROJECT(S)",
|
||||
"CONFIRM_SECRET": "Confirm Secret",
|
||||
"SECRET_AGAIN": "Input secret again",
|
||||
"INCONSISTENT": "Two secrets are inconsistent"
|
||||
"INCONSISTENT": "Two secrets are inconsistent",
|
||||
"NAME_TOOLTIP": "Robot name should be 1~255 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
|
||||
"ENABLE_NEW_SECRET": "Enable this option to manually specify a new secret"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user