From 469b6a495b40386abec282562fd4b9abe6fd4440 Mon Sep 17 00:00:00 2001 From: Shijun Sun <30999793+AllForNothing@users.noreply.github.com> Date: Tue, 5 Dec 2023 17:00:17 +0800 Subject: [PATCH 1/4] Update the style for the robot acccount ui (#19663) 1. Fixes #19614 2. Fixes #19617 Signed-off-by: AllForNothing --- .../project-quotas.component.scss | 2 +- .../system-robot-accounts.component.html | 4 +- .../system-robot-accounts.component.scss | 3 ++ .../robot-permissions-panel.component.html | 7 ++- .../robot-permissions-panel.component.scss | 1 + .../robot-permissions-panel.component.ts | 49 ++++++++++--------- src/portal/src/i18n/lang/de-de-lang.json | 3 +- src/portal/src/i18n/lang/en-us-lang.json | 3 +- src/portal/src/i18n/lang/es-es-lang.json | 3 +- src/portal/src/i18n/lang/fr-fr-lang.json | 3 +- src/portal/src/i18n/lang/pt-br-lang.json | 3 +- src/portal/src/i18n/lang/tr-tr-lang.json | 3 +- src/portal/src/i18n/lang/zh-cn-lang.json | 3 +- src/portal/src/i18n/lang/zh-tw-lang.json | 3 +- 14 files changed, 56 insertions(+), 34 deletions(-) diff --git a/src/portal/src/app/base/left-side-nav/project-quotas/project-quotas/project-quotas.component.scss b/src/portal/src/app/base/left-side-nav/project-quotas/project-quotas/project-quotas.component.scss index bdc5addf75d..69182574ec5 100644 --- a/src/portal/src/app/base/left-side-nav/project-quotas/project-quotas/project-quotas.component.scss +++ b/src/portal/src/app/base/left-side-nav/project-quotas/project-quotas/project-quotas.component.scss @@ -90,6 +90,6 @@ :host::ng-deep { .filter-input { - width: 210px; + width: 240px; } } diff --git a/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.html b/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.html index 2f6ba80ce57..6bd715d78cd 100644 --- a/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.html +++ b/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.html @@ -136,8 +136,10 @@

{{ 'SYSTEM_ROBOT.ROBOT_ACCOUNT_NAV' | translate }}

{{ 'ROBOT_ACCOUNT.ENABLED_STATE' | translate }} - System Permissions {{ + 'ROBOT_ACCOUNT.SYSTEM_PERMISSIONS' | translate + }} + {{ 'SYSTEM_ROBOT.PROJECTS' | translate }} {{ diff --git a/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.scss b/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.scss index cb09f7136fa..f4395c93687 100644 --- a/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.scss +++ b/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.scss @@ -39,3 +39,6 @@ margin-top: 3px; } +.projects-col { + min-width: 14rem !important; +} diff --git a/src/portal/src/app/shared/components/robot-permissions-panel/robot-permissions-panel.component.html b/src/portal/src/app/shared/components/robot-permissions-panel/robot-permissions-panel.component.html index 537a75ce3ed..5734008e0fa 100644 --- a/src/portal/src/app/shared/components/robot-permissions-panel/robot-permissions-panel.component.html +++ b/src/portal/src/app/shared/components/robot-permissions-panel/robot-permissions-panel.component.html @@ -47,8 +47,11 @@
diff --git a/src/portal/src/i18n/lang/de-de-lang.json b/src/portal/src/i18n/lang/de-de-lang.json index b675aae3da2..ad9f73963b6 100644 --- a/src/portal/src/i18n/lang/de-de-lang.json +++ b/src/portal/src/i18n/lang/de-de-lang.json @@ -1669,9 +1669,9 @@ "PROJECTS_MODAL_TITLE": "Projekte des Robot-Zugangs", "PROJECTS_MODAL_SUMMARY": "Diese Projekte können mit dem Robot-Zugang verwaltet werden", "CREATE_ROBOT": "Systemweiten Robot-Zugang anlegen", - "CREATE_ROBOT_SUMMARY": "Erstelle einen systemweiten Robot-Zugang, der bestimmte Projekte abdeckt. Wähle \"Alle Projekte\", um den Robot-Zugang für alle existierenden und zukünftigen Projekte zuzulassen", + "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover permissions for the system as well as for specific projects", "EDIT_ROBOT": "Systemweiten Robot-Zugang bearbeiten", - "EDIT_ROBOT_SUMMARY": "Bearbeite einen systemweiten Robot-Zugang. Wähle \"Alle Projekte\", um den Robot-Zugang für alle existierenden und zukünftigen Projekte zuzulassen", + "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account that will cover permissions for the system as well as for specific projects", "EXPIRATION_TIME": "Ablaufzeit", "EXPIRATION_TIME_EXPLAIN": "Die Ablaufzeit (in Tagen, ab Erstellung) des Robot-Zugang-Tokens. Um die Ablaufzeit zu deaktiveren \"-1\" eingeben.", "EXPIRATION_DEFAULT": "Tage(default)", @@ -1681,7 +1681,7 @@ "COVER_ALL": "Alle Projekte", "COVER_ALL_EXPLAIN": "Aktivieren, um den Robot-Zugang für alle existierenden und zukünftigen Projekte zuzulassen", "COVER_ALL_SUMMARY": "Alle aktuellen und zukünftigen Projekte sind ausgewählt.", - "RESET_PERMISSION": "BERECHTIGUNGEN SETZEN", + "RESET_PERMISSION": "RESET ALL PROJECT PERMISSIONS", "PERMISSION_COLUMN": "Berechtigungen", "EXPIRES_AT": "Läuft ab am", "VIEW_SECRET": "SECRET AKTUALISIEREN", @@ -1713,7 +1713,9 @@ "LIST": "Auflisten", "REPOSITORY": "Repository", "EXPIRES_IN": "Läuft ab in", - "EXPIRED": "Abgelaufen" + "EXPIRED": "Abgelaufen", + "SELECT_ALL_PROJECT": "SELECT ALL PROJECTS", + "UNSELECT_ALL_PROJECT": "UNSELECT ALL PROJECTS" }, "ACCESSORY": { "DELETION_TITLE_ACCESSORY": "Bestätige die Löschung des Anhangs", diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index daa6a644738..cef160c1ac9 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -1670,9 +1670,9 @@ "PROJECTS_MODAL_TITLE": "Projects for Robot Account", "PROJECTS_MODAL_SUMMARY": "There are the projects covered by this robot account.", "CREATE_ROBOT": "Create System Robot Account", - "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover specific projects. Choose \"Cover all projects\" to be applied to all existing and future projects", + "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover permissions for the system as well as for specific projects", "EDIT_ROBOT": "Edit System Robot Account", - "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account. Choose \"Cover all projects\" to be applied to all exiting and future projects", + "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account that will cover permissions for the system as well as for specific projects", "EXPIRATION_TIME": "Expiration time", "EXPIRATION_TIME_EXPLAIN": "The expiration time(in days and the starting point is creation time) of the token of the robot account. For being never expired, please enter \"-1\".", "EXPIRATION_DEFAULT": "days(default)", @@ -1682,7 +1682,7 @@ "COVER_ALL": "Cover all projects", "COVER_ALL_EXPLAIN": "Check to be applied to all existing and future projects", "COVER_ALL_SUMMARY": "All current and future projects selected.", - "RESET_PERMISSION": "RESET PERMISSIONS", + "RESET_PERMISSION": "RESET ALL PROJECT PERMISSIONS", "PERMISSION_COLUMN": "Permissions", "EXPIRES_AT": "Expires at", "VIEW_SECRET": "REFRESH SECRET", @@ -1714,7 +1714,9 @@ "LIST": "List", "REPOSITORY": "Repository", "EXPIRES_IN": "Expires in", - "EXPIRED": "Expired" + "EXPIRED": "Expired", + "SELECT_ALL_PROJECT": "SELECT ALL PROJECTS", + "UNSELECT_ALL_PROJECT": "UNSELECT ALL PROJECTS" }, "ACCESSORY": { "DELETION_TITLE_ACCESSORY": "Confirm Accessory Deletion", diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index d6f765fd5f7..e8050d9b519 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -1666,9 +1666,9 @@ "PROJECTS_MODAL_TITLE": "Projects for Robot Account", "PROJECTS_MODAL_SUMMARY": "There are the projects covered by this robot account.", "CREATE_ROBOT": "Create System Robot Account", - "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover specific projects. Choose \"Cover all projects\" to be applied to all existing and future projects", + "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover permissions for the system as well as for specific projects", "EDIT_ROBOT": "Edit System Robot Account", - "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account. Choose \"Cover all projects\" to be applied to all exiting and future projects", + "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account that will cover permissions for the system as well as for specific projects", "EXPIRATION_TIME": "Expiration time", "EXPIRATION_TIME_EXPLAIN": "The expiration time(in days and the starting point is creation time) of the token of the robot account. For being never expired, please enter \"-1\".", "EXPIRATION_DEFAULT": "days(default)", @@ -1678,7 +1678,7 @@ "COVER_ALL": "Cover all projects", "COVER_ALL_EXPLAIN": "Check to be applied to all existing and future projects", "COVER_ALL_SUMMARY": "All current and future projects selected.", - "RESET_PERMISSION": "RESET PERMISSIONS", + "RESET_PERMISSION": "RESET ALL PROJECT PERMISSIONS", "PERMISSION_COLUMN": "Permissions", "EXPIRES_AT": "Expires at", "VIEW_SECRET": "REFRESH SECRET", @@ -1710,7 +1710,9 @@ "LIST": "List", "REPOSITORY": "Repository", "EXPIRES_IN": "Expires in", - "EXPIRED": "Expired" + "EXPIRED": "Expired", + "SELECT_ALL_PROJECT": "SELECT ALL PROJECTS", + "UNSELECT_ALL_PROJECT": "UNSELECT ALL PROJECTS" }, "ACCESSORY": { "DELETION_TITLE_ACCESSORY": "Confirm Accessory Deletion", diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index dbf3df47c7f..1bedcaf1545 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -1641,9 +1641,9 @@ "PROJECTS_MODAL_TITLE": "Projets pour le compte robot", "PROJECTS_MODAL_SUMMARY": "Voici les projets couverts par ce compte robot.", "CREATE_ROBOT": "Créer un compte robot Système", - "CREATE_ROBOT_SUMMARY": "Créez un compte robot système qui couvrira des projets spécifiques. Choisissez \"Couvrir tous les projets\" pour appliquer à tous les projets existants et futurs", + "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover permissions for the system as well as for specific projects", "EDIT_ROBOT": "Éditer un compte robot Système", - "EDIT_ROBOT_SUMMARY": "Éditer un compte robot système. Choisissez \"Couvrir tous les projets\" pour appliquer à tous les projets existants et futurs", + "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account that will cover permissions for the system as well as for specific projects", "EXPIRATION_TIME": "Date/Heure d'Expiration", "EXPIRATION_TIME_EXPLAIN": "L'heure d'expiration (en jours, le point de départ est l'heure de création) du jeton du compte robot. Pour ne jamais expirer, entrer \"-1\".", "EXPIRATION_DEFAULT": "jours (défaut)", @@ -1653,7 +1653,7 @@ "COVER_ALL": "Couvrir tous les projets", "COVER_ALL_EXPLAIN": "Cocher pour appliquer à tous les projets existants et futurs", "COVER_ALL_SUMMARY": "\"Tous les projets existants et futurs\" sélectionné.", - "RESET_PERMISSION": "Réinitialiser les permissions", + "RESET_PERMISSION": "RESET ALL PROJECT PERMISSIONS", "PERMISSION_COLUMN": "Permissions", "EXPIRES_AT": "Expire à", "VIEW_SECRET": "Actualiser le secret", @@ -1685,7 +1685,9 @@ "LIST": "Lister", "REPOSITORY": "Dépôt", "EXPIRES_IN": "Expire dans", - "EXPIRED": "Expiré" + "EXPIRED": "Expiré", + "SELECT_ALL_PROJECT": "SELECT ALL PROJECTS", + "UNSELECT_ALL_PROJECT": "UNSELECT ALL PROJECTS" }, "ACCESSORY": { "DELETION_TITLE_ACCESSORY": "Confirmer la suppression de l'accessoire", diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index 923171e6301..cfc6ff69137 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -1666,9 +1666,9 @@ "PROJECTS_MODAL_TITLE": "Projetos para contas de automação", "PROJECTS_MODAL_SUMMARY": "Alguns projetos são usados por esta conta de automação.", "CREATE_ROBOT": "Criar Conta de Automação", - "CREATE_ROBOT_SUMMARY": "Criando uma conta de sistema para automação de tarefas com permissões específicas. Ao selecionar \"Acesso Completo\", a conta terá acesso a todos os projetos atuais e também a projetos criados futuramente.", + "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover permissions for the system as well as for specific projects", "EDIT_ROBOT": "Editar Conta de Automação", - "EDIT_ROBOT_SUMMARY": "Editando conta de sistema para automação de tarefas com permissões específicas. Ao selecionar \"Acesso Completo\", a conta terá acesso a todos os projetos atuais e também a projetos criados futuramente.", + "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account that will cover permissions for the system as well as for specific projects", "EXPIRATION_TIME": "Validade", "EXPIRATION_TIME_EXPLAIN": "Prazo de validade do acesso desta conta. Para não expirar, informe \"-1\".", "EXPIRATION_DEFAULT": "dias(default)", @@ -1678,7 +1678,7 @@ "COVER_ALL": "Acesso Completo", "COVER_ALL_EXPLAIN": "Marque para conceder acesso a todos os projetos, atuais e futuros.", "COVER_ALL_SUMMARY": "Todos os projetos, atuais e futuros poderão ser acessados.", - "RESET_PERMISSION": "REDEFINIR PERMISSÕES", + "RESET_PERMISSION": "RESET ALL PROJECT PERMISSIONS", "PERMISSION_COLUMN": "Permissões", "EXPIRES_AT": "Expira em", "VIEW_SECRET": "REDEFINIR SEGREDO", @@ -1710,7 +1710,9 @@ "LIST": "Listar", "REPOSITORY": "Repositório", "EXPIRES_IN": "Expires in", - "EXPIRED": "Expired" + "EXPIRED": "Expired", + "SELECT_ALL_PROJECT": "SELECT ALL PROJECTS", + "UNSELECT_ALL_PROJECT": "UNSELECT ALL PROJECTS" }, "ACCESSORY": { "DELETION_TITLE_ACCESSORY": "Confirm Accessory Deletion", diff --git a/src/portal/src/i18n/lang/tr-tr-lang.json b/src/portal/src/i18n/lang/tr-tr-lang.json index b42ed254abe..f1140f5ba3a 100644 --- a/src/portal/src/i18n/lang/tr-tr-lang.json +++ b/src/portal/src/i18n/lang/tr-tr-lang.json @@ -1669,9 +1669,9 @@ "PROJECTS_MODAL_TITLE": "Projects for Robot Account", "PROJECTS_MODAL_SUMMARY": "There are the projects covered by this robot account.", "CREATE_ROBOT": "Create System Robot Account", - "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover specific projects. Choose \"Cover all projects\" to be applied to all existing and future projects", + "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover permissions for the system as well as for specific projects", "EDIT_ROBOT": "Edit System Robot Account", - "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account. Choose \"Cover all projects\" to be applied to all exiting and future projects", + "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account that will cover permissions for the system as well as for specific projects", "EXPIRATION_TIME": "Expiration time", "EXPIRATION_TIME_EXPLAIN": "The expiration time(in days and the starting point is creation time) of the token of the robot account. For being never expired, please enter \"-1\".", "EXPIRATION_DEFAULT": "days(default)", @@ -1681,7 +1681,7 @@ "COVER_ALL": "Cover all projects", "COVER_ALL_EXPLAIN": "Check to be applied to all existing and future projects", "COVER_ALL_SUMMARY": "All current and future projects selected.", - "RESET_PERMISSION": "RESET PERMISSIONS", + "RESET_PERMISSION": "RESET ALL PROJECT PERMISSIONS", "PERMISSION_COLUMN": "Permissions", "EXPIRES_AT": "Expires at", "VIEW_SECRET": "REFRESH SECRET", @@ -1713,7 +1713,9 @@ "LIST": "List", "REPOSITORY": "Repository", "EXPIRES_IN": "Expires in", - "EXPIRED": "Expired" + "EXPIRED": "Expired", + "SELECT_ALL_PROJECT": "SELECT ALL PROJECTS", + "UNSELECT_ALL_PROJECT": "UNSELECT ALL PROJECTS" }, "ACCESSORY": { "DELETION_TITLE_ACCESSORY": "Confirm Accessory Deletion", diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index bfc526ec9b0..206e4e72683 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -1666,9 +1666,9 @@ "PROJECTS_MODAL_TITLE": "当前机器人账户覆盖的项目", "PROJECTS_MODAL_SUMMARY": "以下为当前机器人账户覆盖的项目列表", "CREATE_ROBOT": "创建系统级机器人账户", - "CREATE_ROBOT_SUMMARY": "创建机器人账户。您可以选中\"覆盖全部项目\"项来覆盖当前所有项目以及未来新增的项目", + "CREATE_ROBOT_SUMMARY": "创建一个包含系统级权限和覆盖指定项目的机器人账户", "EDIT_ROBOT": "编辑系统级机器人账户", - "EDIT_ROBOT_SUMMARY": "编辑机器人账户。您可以选中\"覆盖全部项目\"项来覆盖当前所有项目以及未来新增的项目", + "EDIT_ROBOT_SUMMARY": "编辑一个包含系统级权限和覆盖指定项目的机器人账户", "EXPIRATION_TIME": "过期时间", "EXPIRATION_TIME_EXPLAIN": "当前机器人账户的令牌有效时间(单位为天且起始点为创建时间)。如想设置为永不过期, 请输入\"-1\"。", "EXPIRATION_DEFAULT": "天(默认)", @@ -1678,7 +1678,7 @@ "COVER_ALL": "覆盖全部项目", "COVER_ALL_EXPLAIN": "选中此项来覆盖当前所有项目以及未来新增的项目", "COVER_ALL_SUMMARY": "已选中当前所有项目以及未来新增的项目", - "RESET_PERMISSION": "重置初始权限", + "RESET_PERMISSION": "重置所有项目初始权限", "PERMISSION_COLUMN": "权限", "EXPIRES_AT": "有效期至", "VIEW_SECRET": "刷新令牌", @@ -1710,7 +1710,9 @@ "LIST": "查询", "REPOSITORY": "仓库", "EXPIRES_IN": "有效期剩余", - "EXPIRED": "已过期" + "EXPIRED": "已过期", + "SELECT_ALL_PROJECT": "选择全部项目", + "UNSELECT_ALL_PROJECT": "取消选择全部项目" }, "ACCESSORY": { "DELETION_TITLE_ACCESSORY": "删除附件确认", diff --git a/src/portal/src/i18n/lang/zh-tw-lang.json b/src/portal/src/i18n/lang/zh-tw-lang.json index 2704ec89a99..a74cca64887 100644 --- a/src/portal/src/i18n/lang/zh-tw-lang.json +++ b/src/portal/src/i18n/lang/zh-tw-lang.json @@ -1664,9 +1664,9 @@ "PROJECTS_MODAL_TITLE": "機器人帳號的專案", "PROJECTS_MODAL_SUMMARY": "這些是此機器人帳號涵蓋的專案。", "CREATE_ROBOT": "建立系統機器人帳號", - "CREATE_ROBOT_SUMMARY": "建立一個涵蓋特定專案的系統機器人帳號。選擇「涵蓋所有專案」將套用到所有現有和未來的專案", + "CREATE_ROBOT_SUMMARY": "Create a system Robot Account that will cover permissions for the system as well as for specific projects", "EDIT_ROBOT": "編輯系統機器人帳號", - "EDIT_ROBOT_SUMMARY": "編輯一個系統機器人帳號。選擇「涵蓋所有專案」將套用到所有現有和未來的專案", + "EDIT_ROBOT_SUMMARY": "Edit a system Robot Account that will cover permissions for the system as well as for specific projects", "EXPIRATION_TIME": "到期時間", "EXPIRATION_TIME_EXPLAIN": "機器人帳號的權杖到期時間(以建立時間為起點的天數)。要使其永不過期,請輸入「-1」。", "EXPIRATION_DEFAULT": "天(預設)", @@ -1676,7 +1676,7 @@ "COVER_ALL": "涵蓋所有專案", "COVER_ALL_EXPLAIN": "選擇以套用到所有現有和未來的專案", "COVER_ALL_SUMMARY": "選擇了所有現有和未來的專案。", - "RESET_PERMISSION": "重設權限", + "RESET_PERMISSION": "RESET ALL PROJECT PERMISSIONS", "PERMISSION_COLUMN": "權限", "EXPIRES_AT": "到期於", "VIEW_SECRET": "更新密鑰", @@ -1708,7 +1708,9 @@ "LIST": "列表", "REPOSITORY": "儲存庫", "EXPIRES_IN": "到期於", - "EXPIRED": "已過期" + "EXPIRED": "已過期", + "SELECT_ALL_PROJECT": "SELECT ALL PROJECTS", + "UNSELECT_ALL_PROJECT": "UNSELECT ALL PROJECTS" }, "ACCESSORY": { "DELETION_TITLE_ACCESSORY": "確認刪除附件", From ed0a69cf808d3bce2d74e7947b281b6e49902a93 Mon Sep 17 00:00:00 2001 From: Yang Jiao <72076317+YangJiao0817@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:20:11 +0800 Subject: [PATCH 3/4] Add external scanner test case (#19682) Fix #19279 Signed-off-by: Yang Jiao --- tests/resources/Harbor-Pages/Project.robot | 11 ++ .../Harbor-Pages/Vulnerability.robot | 81 ++++++++++++ .../Harbor-Pages/Vulnerability_Elements.robot | 17 ++- tests/robot-cases/Group1-Nightly/Trivy.robot | 120 ++++++++++++++++++ 4 files changed, 228 insertions(+), 1 deletion(-) diff --git a/tests/resources/Harbor-Pages/Project.robot b/tests/resources/Harbor-Pages/Project.robot index 62d5c84208c..adedc655b91 100644 --- a/tests/resources/Harbor-Pages/Project.robot +++ b/tests/resources/Harbor-Pages/Project.robot @@ -293,6 +293,9 @@ Switch To Project Label Switch To Project Repo Retry Element Click xpath=//project-detail//a[contains(.,'Repositories')] +Switch To Project Scanner + Retry Element Click xpath=//project-detail//a[contains(.,'Scanner')] + Add Labels To Tag [Arguments] ${tagName} ${labelName} Retry Element Click xpath=//clr-dg-row[contains(.,'${tagName}')]//label[contains(@class,'clr-control-label')] @@ -434,3 +437,11 @@ Download Latest CVE CSV File Retry Double Keywords When Error Retry Element Click ${latest_download_cve_csv_file_xpath} Retry Wait Until Page Does Not Contains ${csv_file_name} Retry File Should Exist ${csv_file_path} [Return] ${csv_file_path} + +Select Project Scanner + [Arguments] ${scanner_name} ${scanner_count}=${null} + Retry Element Click //*[@id='edit-scanner'] + Run Keyword If '${scanner_count}'!='${null}' Retry Wait Element Count //clr-dg-row ${scanner_count} + Retry Element Click //clr-dg-row[.//clr-dg-cell[text()='${scanner_name}']]//label[contains(@class,'clr-control-label')] + Retry Element Click //*[@id='save-scanner'] + Retry Wait Element Visible //span[@id='scanner-name' and text()='${scanner_name}'] diff --git a/tests/resources/Harbor-Pages/Vulnerability.robot b/tests/resources/Harbor-Pages/Vulnerability.robot index ae5d4ee8624..f5f9d90192b 100644 --- a/tests/resources/Harbor-Pages/Vulnerability.robot +++ b/tests/resources/Harbor-Pages/Vulnerability.robot @@ -105,3 +105,84 @@ Check Scan All Artifact Job Status Is Stopped Wait Until Element Is Visible ${stopped_icon} ${stopped_total}= Get Text ${stopped_icon} Should Be True ${stopped_total} > 0 + +Filter Scanner By Name + [Arguments] ${name} + Retry Button Click (//clr-dg-column//button)[2] + Retry Text Input //input[@name='search'] ${name} + Retry Button Click (//clr-dg-column//button)[2] + +Filter Scanner By Endpoint + [Arguments] ${endpoint} + Retry Button Click (//clr-dg-column//button)[5] + Retry Text Input //input[@name='search'] ${endpoint} + Retry Button Click (//clr-dg-column//button)[5] + +Select Scanner Auth Mode + [Arguments] ${auth} + Retry Element Click ${scanner_auth_select} + Retry Element Click ${scanner_auth_select}//option[contains(text(),'${auth}')] + +Add A New Scanner + [Arguments] ${name} ${endpoint} ${auth} ${desc}=${null} ${skip_cert_cerification}=${false} ${internal_registry_address}=${false} ${username}=${null} ${password}=${null} ${token}=${null} ${api_key}=${null} ${apikey}=${null} + Retry Button Click ${add_scanner_btn} + Retry Text Input ${scanner_name_input} ${name} + Run Keyword If '${desc}'!='${null}' Retry Text Input ${scanner_desc_input} ${desc} + Retry Text Input ${scanner_endpoint_input} ${endpoint} + Select Scanner Auth Mode ${auth} + IF '${auth}'=='Basic' + Retry Text Input ${scanner_username_input} ${username} + Retry Text Input ${scanner_password_input} ${password} + ELSE IF '${auth}'=='Bearer' + Retry Text Input ${scanner_token_input} ${token} + ELSE IF '${auth}'=='APIKey' + Retry Text Input ${scanner_apikey_input} ${apikey} + END + Run Keyword If '${skip_cert_cerification}'==${true} Retry Element Click ${scanner_skip_cert_checkbox} + Run Keyword If '${internal_registry_address}'==${true} Retry Element Click ${add_scanner_internal_registry_checkbox} + Retry Double Keywords When Error Retry Button Click ${scanner_test_connection_btn} Wait Until Page Contains Test passed + Retry Double Keywords When Error Retry Element Click ${scanner_add_btn} Wait Until Page Does Not Contain Element ${scanner_add_btn} + Retry Wait Until Page Contains Element //clr-dg-row[.//span[text()='${name}'] and .//clr-dg-cell[text()='${endpoint}'] and .//span[text()='Healthy'] and .//span[text()='Enabled'] and .//clr-dg-cell[text()='${auth}']] + +Update Scanner + [Arguments] ${origin_name} ${name} ${endpoint} ${auth} ${desc}=${null} ${skip_cert_cerification}=${false} ${internal_registry_address}=${false} ${username}=${null} ${password}=${null} ${token}=${null} ${api_key}=${null} + Filter Scanner By Name ${origin_name} + Retry Element Click //clr-dg-row[.//span[text()='${origin_name}']]//label[contains(@class,'clr-control-label')] + Retry Double Keywords When Error Retry Element Click ${scanner_action_xpath} Retry Element Click ${edit_scanner_action_xpath} + Retry Text Input ${scanner_name_input} ${name} + Run Keyword If '${desc}'!='${null}' Retry Text Input ${scanner_desc_input} ${desc} + Retry Text Input ${scanner_endpoint_input} ${endpoint} + Select Scanner Auth Mode ${auth} + IF '${auth}'=='Basic' + Retry Text Input ${scanner_username_input} ${username} + Retry Text Input ${scanner_password_input} ${password} + ELSE IF '${auth}'=='Bearer' + Retry Text Input ${scanner_token_input} ${token} + ELSE IF '${auth}'=='APIKey' + Retry Text Input ${scanner_apikey_input} ${api_key} + END + Run Keyword If '${skip_cert_cerification}'==${true} Retry Element Click ${scanner_skip_cert_checkbox} + Run Keyword If '${internal_registry_address}'==${true} Retry Element Click ${add_scanner_internal_registry_checkbox} + Retry Double Keywords When Error Retry Element Click ${scanner_save_btn} Wait Until Page Does Not Contain Element ${scanner_save_btn} + Retry Wait Until Page Contains Element //clr-dg-row[.//span[text()='${name}'] and .//clr-dg-cell[text()='${endpoint}'] and .//clr-dg-cell[text()='${auth}']] + +Delete Scanner + [Arguments] ${name} + Filter Scanner By Name ${name} + Retry Double Keywords When Error Retry Element Click //clr-dg-row[.//span[text()='${name}']]//label[contains(@class,'clr-control-label')] Retry Element Click ${scanner_action_xpath} + Retry Double Keywords When Error Retry Element Click ${delete_scanner_action_xpath} Retry Element Click ${delete_scanner_confirm_btn} + Reload Page + Retry Double Keywords When Error Filter Scanner By Name ${name} Retry Wait Until Page Contains Can not find any scanner + +Enable Or Deactivate Scanner + [Arguments] ${name} ${action} + Filter Scanner By Name ${name} + Retry Double Keywords When Error Retry Element Click //clr-dg-row[.//span[text()='${name}']]//label[contains(@class,'clr-control-label')] Retry Element Click ${scanner_action_xpath} + Retry Element Click //clr-dropdown-menu//span[text()='${action}'] + ${action}= Set Variable ${action[0].upper()}${action[1:].lower()}d + Retry Wait Until Page Contains Element //clr-dg-row[.//span[text()='${name}'] and .//span[text()='${action}']] + +Set Scanner As Default + [Arguments] ${name} + Retry Element Click //clr-dg-row[.//span[text()='${name}']]//label[contains(@class,'clr-control-label')] + Retry Double Keywords When Error Retry Element Click ${scanner_set_default_btn} Retry Wait Element Visible //clr-dg-row[.//span[text()='${name}'] and .//span[text()='Default']] diff --git a/tests/resources/Harbor-Pages/Vulnerability_Elements.robot b/tests/resources/Harbor-Pages/Vulnerability_Elements.robot index 9d2bf67d2c3..e64594a8763 100644 --- a/tests/resources/Harbor-Pages/Vulnerability_Elements.robot +++ b/tests/resources/Harbor-Pages/Vulnerability_Elements.robot @@ -26,6 +26,7 @@ ${stop_scan_button} //vulnerability-config//button[contains(.,'Stop Scan')] ${vulnerability_page} //clr-vertical-nav-group-children/a[contains(.,'Vulnerability')] ${set_default_scanner} //button[@id='set-default'] ${scanner_action_xpath} //span[@id='action-scanner'] +${edit_scanner_action_xpath} //span[text()='EDIT'] ${delete_scanner_action_xpath} //span[@id='delete-scanner-action'] ${immutable_trivy_msg_xpath} //span[contains(.,'registration Trivy is not allowed to delete as it is immutable: scanner API: delete')] ${delete_scanner_confirm_btn} xpath=//clr-modal//button[contains(.,'DELETE')] @@ -35,4 +36,18 @@ ${scanner_set_default_success_xpath} //span[contains(.,'Successfully updated')] ${not_scanned_icon} xpath=//span[@class[contains(.,'not-scan')]] ${stopped_icon} //span[@class[contains(.,'badge abort')]] ${view_scanner_icon_xpath} //clr-signpost//cds-icon -${view_scanner_doc_xpath} //clr-signpost-content//a[contains(.,'view documentation')] \ No newline at end of file +${view_scanner_doc_xpath} //clr-signpost-content//a[contains(.,'view documentation')] +${add_scanner_btn} //button[text()=' NEW SCANNER '] +${scanner_name_input} //*[@id='scanner-name'] +${scanner_desc_input} //*[@id='description'] +${scanner_endpoint_input} //*[@id='scanner-endpoint'] +${scanner_skip_cert_checkbox} //label[contains(@class,'clr-control-label') and contains(@for,'scanner-skipCertVerify')] +${scanner_test_connection_btn} //*[@id='button-test'] +${scanner_add_btn} //span[text()=' ADD '] +${scanner_save_btn} //span[text()=' SAVE '] +${scanner_auth_select} //*[@id='scanner-authorization'] +${scanner_username_input} //*[@id='scanner-username'] +${scanner_password_input} //*[@id='scanner-password'] +${scanner_token_input} //*[@id='scanner-token'] +${scanner_apikey_input} //*[@id='scanner-apiKey'] +${scanner_set_default_btn} //*[@id='set-default'] diff --git a/tests/robot-cases/Group1-Nightly/Trivy.robot b/tests/robot-cases/Group1-Nightly/Trivy.robot index b06bdaddbb4..3db9513ed7f 100644 --- a/tests/robot-cases/Group1-Nightly/Trivy.robot +++ b/tests/robot-cases/Group1-Nightly/Trivy.robot @@ -163,3 +163,123 @@ Test Case - Verfiy Project Level CVE Allowlist By Quick Way of Add System Test Case - Stop Scan And Stop Scan All [Tags] stop_scan_job Body Of Stop Scan And Stop Scan All + +Test Case - External Scanner CRUD + [Tags] external_scanner_crud need_scanner_endpoint + ${SCANNER_ENDPOINT_VALUE}= Get Variable Value ${SCANNER_ENDPOINT} ${EMPTY} + Skip If '${SCANNER_ENDPOINT_VALUE}' == '${EMPTY}' + Init Chrome Driver + ${d}= get current date result_format=%m%s + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Switch To Scanners Page + # Add a new scanner + Add A New Scanner scanner${d} ${SCANNER_ENDPOINT} Basic For testing ${true} ${true} scanner_name scanner_password + # Update this scanner + Update Scanner scanner${d} scanner${d}-edit1 ${SCANNER_ENDPOINT}1 Bearer For testing-edit1 ${true} ${true} token=scanner_token + Update Scanner scanner${d}-edit1 scanner${d}-edit2 ${SCANNER_ENDPOINT}2 APIKey For testing-edit2 ${true} ${true} api_key=scanner_api_key + Update Scanner scanner${d}-edit2 scanner${d} ${SCANNER_ENDPOINT} None For testing + # Filter this scanner + Filter Scanner By Name scanner${d} + Filter Scanner By Endpoint ${SCANNER_ENDPOINT} + Retry Wait Element Count //clr-dg-row 1 + Retry Wait Until Page Contains Element //clr-dg-row[.//span[text()='scanner${d}'] and .//clr-dg-cell[text()='${SCANNER_ENDPOINT}'] and .//span[text()='Healthy'] and .//clr-dg-cell[text()='None']] + # Delete this scanner + Delete Scanner scanner${d} + Close Browser + +Test Case - Set External Scanner As Default And Scan + [Tags] external_scanner_scan need_scanner_endpoint + ${SCANNER_ENDPOINT_VALUE}= Get Variable Value ${SCANNER_ENDPOINT} ${EMPTY} + Skip If '${SCANNER_ENDPOINT_VALUE}' == '${EMPTY}' + Init Chrome Driver + ${d}= get current date result_format=%m%s + ${image}= Set Variable hello-world + ${tag}= Set Variable latest + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Create An New Project And Go Into Project project${d} + Switch To Project Scanner + Retry Wait Element Visible //span[@id='scanner-name' and text()='Trivy'] + Switch To Scanners Page + Retry Wait Element Visible //clr-dg-row[.//span[text()='Trivy'] and .//span[text()='Default']] + # Add a new scanner + Add A New Scanner scanner${d} ${SCANNER_ENDPOINT} None For testing + # Set this scanner to default + Set Scanner As Default scanner${d} + Go Into Project project${d} ${false} + Switch To Project Scanner + Retry Wait Element Visible //span[@id='scanner-name' and text()='scanner${d}'] + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} + Go Into Repo project${d} ${image} + Scan Repo ${tag} Succeed + Retry Wait Element Visible //hbr-result-tip-histogram//span[1][text()='10'] + Switch To Scanners Page + Set Scanner As Default Trivy + Go Into Project project${d} + Switch To Project Scanner + Retry Wait Element Visible //span[@id='scanner-name' and text()='Trivy'] + Go into Repo project${d} ${image} + Scan Repo ${tag} Succeed + Retry Wait Element Visible //hbr-result-tip-histogram//div[text()=' No vulnerability '] + Back Project Home project${d} + Switch To Project Scanner + Select Project Scanner scanner${d} 2 + Go Into Repo project${d} ${image} + Retry Wait Element Visible //hbr-result-tip-histogram//span[1][text()='10'] + Scan Repo ${tag} Succeed + Retry Wait Element Visible //hbr-result-tip-histogram//span[1][text()='10'] + Back Project Home project${d} + Switch To Project Scanner + Select Project Scanner Trivy 2 + Go Into Repo project${d} ${image} + Retry Wait Element Visible //hbr-result-tip-histogram//div[text()=' No vulnerability '] + Scan Repo ${tag} Succeed + Retry Wait Element Visible //hbr-result-tip-histogram//div[text()=' No vulnerability '] + Switch To Scanners Page + Delete Scanner scanner${d} + Go Into Project project${d} + Switch To Project Scanner + Retry Element Click //*[@id='edit-scanner'] + Retry Wait Element Count //clr-dg-row 1 + Close Browser + +Test Case - Enable And Deactivate Scanner + [Tags] enable_deactivate_scanner need_scanner_endpoint + ${SCANNER_ENDPOINT_VALUE}= Get Variable Value ${SCANNER_ENDPOINT} ${EMPTY} + Skip If '${SCANNER_ENDPOINT_VALUE}' == '${EMPTY}' + Init Chrome Driver + ${d}= get current date result_format=%m%s + ${image}= Set Variable hello-world + ${tag}= Set Variable latest + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Create An New Project And Go Into Project project${d} + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image} + Switch To Scanners Page + Add A New Scanner scanner${d} ${SCANNER_ENDPOINT} None For testing + Go Into Project project${d} + Switch To Project Scanner + Select Project Scanner scanner${d} + Go into Repo project${d} ${image} + Scan Repo ${tag} Succeed + # Deactivate this scanner + Switch To Scanners Page + Enable Or Deactivate Scanner scanner${d} DEACTIVATE + Go Into Project project${d} + Switch To Project Scanner + Retry Wait Element Visible //scanner//span[text()='Deactivated'] + Go Into Repo project${d} ${image} + Retry Element Click //clr-dg-row[contains(.,'${tag}')]//label[contains(@class,'clr-control-label')] + Retry Wait Element Should Be Disabled //button[@id='scan-btn'] + # Enable this scanner + Switch To Scanners Page + Enable Or Deactivate Scanner scanner${d} ENABLE + Go Into Project project${d} + Switch To Project Scanner + Retry Wait Element Not Visible //scanner//span[text()='Deactivated'] + Go Into Repo project${d} ${image} + Scan Repo ${tag} Succeed + Switch To Scanners Page + Delete Scanner scanner${d} + Go Into Project project${d} + Switch To Project Scanner + Retry Wait Element Visible //span[@id='scanner-name' and text()='Trivy'] + Close Browser From f99a619bc676ba614048c5a84cf0598adc79519f Mon Sep 17 00:00:00 2001 From: Shijun Sun <30999793+AllForNothing@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:37:45 +0800 Subject: [PATCH 4/4] Add min-width to the permission column (#19675) 1. To avoid style confusion Signed-off-by: AllForNothing --- .../system-robot-accounts.component.html | 2 +- .../system-robot-accounts.component.scss | 4 ++++ .../base/project/robot-account/robot-account.component.html | 2 +- .../base/project/robot-account/robot-account.component.scss | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.html b/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.html index 6bd715d78cd..83082a2b4fc 100644 --- a/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.html +++ b/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.html @@ -136,7 +136,7 @@

{{ 'SYSTEM_ROBOT.ROBOT_ACCOUNT_NAV' | translate }}

{{ 'ROBOT_ACCOUNT.ENABLED_STATE' | translate }} - {{ + {{ 'ROBOT_ACCOUNT.SYSTEM_PERMISSIONS' | translate }} {{ diff --git a/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.scss b/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.scss index f4395c93687..5c6f940e588 100644 --- a/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.scss +++ b/src/portal/src/app/base/left-side-nav/system-robot-accounts/system-robot-accounts.component.scss @@ -42,3 +42,7 @@ .projects-col { min-width: 14rem !important; } + +.permission-col { + min-width: 8rem !important; +} diff --git a/src/portal/src/app/base/project/robot-account/robot-account.component.html b/src/portal/src/app/base/project/robot-account/robot-account.component.html index d2bcec72597..eb30ff1136c 100644 --- a/src/portal/src/app/base/project/robot-account/robot-account.component.html +++ b/src/portal/src/app/base/project/robot-account/robot-account.component.html @@ -141,7 +141,7 @@ {{ 'ROBOT_ACCOUNT.ENABLED_STATE' | translate }} - {{ + {{ 'SYSTEM_ROBOT.PERMISSION_COLUMN' | translate }} {{ diff --git a/src/portal/src/app/base/project/robot-account/robot-account.component.scss b/src/portal/src/app/base/project/robot-account/robot-account.component.scss index 55e5765d27f..8214f6677b9 100644 --- a/src/portal/src/app/base/project/robot-account/robot-account.component.scss +++ b/src/portal/src/app/base/project/robot-account/robot-account.component.scss @@ -31,3 +31,7 @@ .icon { margin-top: 3px; } + +.permission-col { + min-width: 8rem !important; +}