Repository navigation
feat(ui): support advanced proxy cache configurations in UI - #23536
Conversation
f3feca3 to
1184f00
Compare
There was a problem hiding this comment.
Pull request overview
Adds UI controls and localization for proxy-cache repository filters and permission-aware proxy settings.
Changes:
- Adds repository filter pattern/kind controls.
- Serializes filter metadata during project creation and updates.
- Updates proxy-cache permissions, layout, models, and translations.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/portal/src/i18n/lang/zh-tw-lang.json |
Adds Traditional Chinese filter strings. |
src/portal/src/i18n/lang/zh-cn-lang.json |
Adds Simplified Chinese filter strings. |
src/portal/src/i18n/lang/tr-tr-lang.json |
Adds Turkish filter strings. |
src/portal/src/i18n/lang/ru-ru-lang.json |
Adds Russian filter strings. |
src/portal/src/i18n/lang/pt-br-lang.json |
Adds Brazilian Portuguese filter strings. |
src/portal/src/i18n/lang/ko-kr-lang.json |
Adds Korean filter strings. |
src/portal/src/i18n/lang/fr-fr-lang.json |
Adds French filter strings. |
src/portal/src/i18n/lang/es-es-lang.json |
Adds Spanish filter strings. |
src/portal/src/i18n/lang/en-us-lang.json |
Adds English filter strings. |
src/portal/src/i18n/lang/de-de-lang.json |
Adds German filter strings. |
src/portal/src/app/shared/services/project.service.ts |
Serializes filter metadata on updates. |
src/portal/src/app/base/project/project.ts |
Extends project metadata and filter constants. |
src/portal/src/app/base/project/project-config/project-policy-config/project.ts |
Extends configuration metadata types. |
src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.ts |
Loads filter settings and updates permissions. |
src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.scss |
Adds filter-control styling. |
src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.html |
Adds filter controls and checkbox permission handling. |
src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.ts |
Includes filters in project creation. |
src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.html |
Adds creation-form filter controls. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #23536 +/- ##
=======================================
Coverage 66.41% 66.42%
=======================================
Files 1077 1078 +1
Lines 118037 118112 +75
Branches 2965 2985 +20
=======================================
+ Hits 78392 78452 +60
- Misses 35334 35352 +18
+ Partials 4311 4308 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Comparing this against the merged proposal (goharbor/community#280) and the backend implementation (#23527), a few deviations: 1. Client-side validation is missing The proposal's UI section requires: "Validation should happen both client-side and server-side." Neither the filter input in 2. Tooltip describes anchoring semantics the backend doesn't have
3. The proxy cache checkbox changes from hardcoded Related: sibling controls in the same section now gate on three different signals — the filter input/select on 4. Dead component state
5. Scope beyond the proposal The proposal's UI section only asks for the Repository filter (label, kind selector, pattern input) in the create view. This PR additionally reworks the referrer API checkbox layout and permission gating, switches the proxy-cache section gating to Minor: |
|
behavior changes for existing users:
|
|
can you give a screenshot for this change? |
|
The UI Unit Tests are clearly failing and its the authors duty to fix and make sure ci is passing |
bupd
left a comment
There was a problem hiding this comment.
@stonezdj Thanks for your contribution
suggestion: Please fix the lint issues given below
08:05:18 + npm run lint
08:05:18
08:05:18 > harbor@2.15.0 lint
08:05:18 > ng lint
08:05:18
08:05:19
08:05:19 Linting "harbor-portal"...
08:05:32
08:05:32 /home/ubuntu/_work/harbor/harbor/src/github.com/goharbor/harbor/src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.html
08:05:32 214:35 error Replace `·class="clr-control-label·endpoint·required">{{` with `⏎································class="clr-control-label·endpoint·required"` prettier/prettier
08:05:32 215:33 error Replace `'PROJECT.ENDPOINT'·|·translate` with `>{{·'PROJECT.ENDPOINT'·|·translate·}}</label` prettier/prettier
08:05:32 216:29 error Delete `}}</label` prettier/prettier
08:05:32
08:05:32 /home/ubuntu/_work/harbor/harbor/src/github.com/goharbor/harbor/src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.ts
08:05:32 401:54 error Delete `⏎················` prettier/prettier
08:05:32
08:05:32 ✖ 4 problems (4 errors, 0 warnings)
08:05:32 4 errors and 0 warnings potentially fixable with the `--fix` option.
08:05:32
08:05:32 Lint errors found in the listed files.
08:05:32
Error: Process completed with exit code 1.
fixing lint might probably fix failing ci workflow https://github.com/goharbor/harbor/actions/runs/29078451168/job/86315411475
This PR is currently a work in progress, so errors are bound to happen. Outside of open source, I have other full-time commitments. This is an open and inclusive community, so please keep comments respectful and constructive! @wy65701436 @bupd @Vad1mo |
1184f00 to
d2507dd
Compare
|
cc @AllForNothing could you please help to review?thanks. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.
Suppressed comments (4)
src/portal/src/app/shared/services/project.service.ts:188
- The update path has the same contract gap:
ProjectMetadatainapi/v2.0/swagger.yaml:7480-7535does not declare either filter property, and the backend has no corresponding metadata constants or handling. The PUT request therefore discards these values, so saving appears successful but reloading loses the filter.
metadata.proxy_cache_filter_pattern =
projectPolicy.ProxyCacheFilterPattern;
metadata.proxy_cache_filter_kind =
projectPolicy.ProxyCacheFilterKind || 'doublestar';
src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.ts:475
- These fields are not part of the server's
ProjectMetadatacontract (api/v2.0/swagger.yaml:7480-7535) or its project metadata constants/handlers, so the generated Go request model drops both JSON properties and the new filter is never persisted on project creation. Add the repository-filter fields and validation/consumption to the API and backend before sending them from the UI.
metadata.proxy_cache_filter_pattern =
this.project.metadata.proxy_cache_filter_pattern;
metadata.proxy_cache_filter_kind =
this.project.metadata.proxy_cache_filter_kind ||
REPOSITORY_FILTER_KIND_DOUBLESTAR;
src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.html:212
- This system-admin guard still hides both checkboxes from project admins even though project admins have
configuration:updatepermission (src/common/rbac/project/rbac_role.go:25,71-72). That contradicts the intended permission-based editability: users withhasChangeConfigRolecannot see or edit the controls. Show this block for proxy-cache projects and let each control's existing[disabled]="!hasChangeConfigRole"enforce editability.
} @if (isSystemAdmin && projectPolicy.ProxyCacheEnabled) {
src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.ts:438
- Repository-filter validation runs even when proxy cache is disabled. If a user enters an invalid filter and then turns proxy cache off, the hidden value/error remain;
isValidkeeps the OK button disabled, and this unconditional check would also reject submission. Gate this validation onenableProxyCacheand clear the error when proxy cache is turned off so a normal project can still be created.
this.validateRepositoryFilter();
if (this.repositoryFilterError) {
this.inlineAlert.showInlineError(this.repositoryFilterError);
return;
}
Signed-off-by: stonezdj <stone.zhang@broadcom.com>
6cc4c02 to
3f9898a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated no new comments.
Suppressed comments (4)
src/portal/src/app/shared/services/project.service.ts:188
- The update payload cannot persist either filter field:
ProjectMetadatainapi/v2.0/swagger.yamlhas no matching properties, and the backend has no metadata constants/handling for these keys, so unmarshalling the typed request drops them. The request can report success while a reload loses the filter. Backend/API support and generated models need to be added with this UI change.
metadata.proxy_cache_filter_pattern =
projectPolicy.ProxyCacheFilterPattern;
metadata.proxy_cache_filter_kind =
projectPolicy.ProxyCacheFilterKind || 'doublestar';
src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.ts:436
- The create flow sends metadata keys that the current
ProjectMetadataAPI schema/backend does not define, so they are discarded when the request is unmarshalled and the newly created project has no repository filter. Add the backend/API contract and generated model support before submitting these fields.
metadata.proxy_cache_filter_pattern =
this.project.metadata.proxy_cache_filter_pattern;
metadata.proxy_cache_filter_kind =
this.project.metadata.proxy_cache_filter_kind ||
REPOSITORY_FILTER_KIND_DOUBLESTAR;
src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.ts:399
- Repository-filter validation runs even after proxy cache is turned off. If a user enters an invalid pattern and then disables proxy cache, the hidden field leaves
repositoryFilterErrorset, the OK button remains disabled, and the user cannot create a normal project without re-enabling proxy cache to repair the hidden value. Validate/count this error only whenenableProxyCacheis true, or clear it when the toggle is disabled.
this.validateRepositoryFilter();
if (this.repositoryFilterError) {
this.inlineAlert.showInlineError(this.repositoryFilterError);
return;
}
src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.html:212
- This system-admin guard prevents project users who have configuration UPDATE permission from ever reaching either checkbox, so their editability is still determined by the global role rather than
hasChangeConfigRole. Show this block for proxy-cache projects and let the existing[disabled]="!hasChangeConfigRole"bindings enforce the permission.
} @if (isSystemAdmin && projectPolicy.ProxyCacheEnabled) {
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated no new comments.
Suppressed comments (5)
src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.ts:436
- These metadata keys are not part of the
ProjectMetadataAPI model (api/v2.0/swagger.yaml:7480-7535) or the server metadata keys (src/pkg/project/models/pro_meta.go:18-31). The generated request decoder therefore drops them, so creating a project appears successful but the repository filter is never persisted or enforced. Add the API/server-side model, persistence, validation, and proxy behavior (or make this PR depend on the backend change) before sending these fields.
metadata.proxy_cache_filter_pattern =
this.project.metadata.proxy_cache_filter_pattern;
metadata.proxy_cache_filter_kind =
this.project.metadata.proxy_cache_filter_kind ||
REPOSITORY_FILTER_KIND_DOUBLESTAR;
src/portal/src/app/shared/services/project.service.ts:188
- The update path has the same contract gap as creation:
proxy_cache_filter_patternandproxy_cache_filter_kindare absent fromProjectMetadatainapi/v2.0/swagger.yaml:7480-7535and from the server metadata definitions, so the backend cannot deserialize or return these values. Updating the UI will report success without persisting the filter until the API and backend are extended.
metadata.proxy_cache_filter_pattern =
projectPolicy.ProxyCacheFilterPattern;
metadata.proxy_cache_filter_kind =
projectPolicy.ProxyCacheFilterKind || 'doublestar';
src/portal/src/app/base/project/project-config/project-policy-config/project-policy-config.component.html:212
- This system-admin guard prevents project admins who have the project configuration update permission from seeing either checkbox, so their editability is still not controlled solely by
hasChangeConfigRoleas intended. Show this block for proxy-cache projects and retain the existing[disabled]="!hasChangeConfigRole"checks to enforce edit permission.
} @if (isSystemAdmin && projectPolicy.ProxyCacheEnabled) {
src/portal/src/app/base/left-side-nav/projects/create-project/create-project.component.ts:399
- The repository-filter controls are only hidden with CSS when proxy cache is toggled off, so an invalid pattern remains in the model. This unconditional validation blocks creating an ordinary project, while
repositoryFilterErroralso keeps the OK button disabled. Gate both this validation and theisValiderror check onenableProxyCache, or clear the filter error when proxy cache is disabled.
this.validateRepositoryFilter();
if (this.repositoryFilterError) {
this.inlineAlert.showInlineError(this.repositoryFilterError);
return;
}
src/portal/src/app/shared/units/repository-filter.util.ts:32
- Balanced brackets/braces are not sufficient doublestar validation. For example,
[](currently asserted as valid in the new test) and a trailing backslash pass this function, butgithub.com/bmatcuk/doublestarv1.3.4 treats them as malformed patterns. Validate against the backend's full doublestar grammar so the UI does not accept filters that later fail matching.
} else if (kind === 'doublestar') {
if (!checkBalancedChars(pattern)) {
return 'PROJECT.REPOSITORY_FILTER_DOUBLESTAR_INVALID';
}
Dismiss the request change since the CI is passed now. Bupd, feel free to reach out to me if any concern.
…goharbor/harbor#23536) * feat(ui): support advanced proxy cache configurations in UI - Support repository filter configuration (pattern and kind) for proxy cache projects. - Ensure the local on not found and proxy referrer API checkbox editability is controlled by project configuration update permissions. Signed-off-by: stonezdj <stone.zhang@broadcom.com> * Remove unused translation key in ru-ru-lang.json Signed-off-by: stonezdj <stone.zhang@broadcom.com> --------- Signed-off-by: stonezdj <stone.zhang@broadcom.com> Co-authored-by: Wang Yan <wangyan_0219@hotmail.com> (cherry picked from commit 907173f) Upstream-Commit: 907173f Upstream-PR: goharbor/harbor#23536 Upstream-Author: @stonezdj Cherry-Pick-Status: conflicted Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…goharbor/harbor#23536) * feat(ui): support advanced proxy cache configurations in UI - Support repository filter configuration (pattern and kind) for proxy cache projects. - Ensure the local on not found and proxy referrer API checkbox editability is controlled by project configuration update permissions. Signed-off-by: stonezdj <stone.zhang@broadcom.com> * Remove unused translation key in ru-ru-lang.json Signed-off-by: stonezdj <stone.zhang@broadcom.com> --------- Signed-off-by: stonezdj <stone.zhang@broadcom.com> Co-authored-by: Wang Yan <wangyan_0219@hotmail.com> (cherry picked from commit 907173f) Resolved conflicts against the harbor-next Angular 16 portal: - Translated upstream @if/@for control-flow blocks to *ngIf/*ngFor (Angular 17+ syntax is not supported by the portal toolchain). - Kept harbor-next permission gating (hasChangeConfigRole and allowUpdateProxyCacheConfiguration) and the editable proxy cache checkbox/registry select instead of upstream isSystemAdmin gating. - Ported the repository filter (pattern + kind) UI with validation, max upstream connection validation, read-only filter view, and the CVE allowlist null-guards into the existing template layout. Upstream-Commit: 907173f Upstream-PR: goharbor/harbor#23536 Upstream-Author: @stonezdj Cherry-Pick-Status: resolved Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Prasanth Baskar <prasanth@8gears.com>
…goharbor/harbor#23536) * feat(ui): support advanced proxy cache configurations in UI - Support repository filter configuration (pattern and kind) for proxy cache projects. - Ensure the local on not found and proxy referrer API checkbox editability is controlled by project configuration update permissions. Signed-off-by: stonezdj <stone.zhang@broadcom.com> * Remove unused translation key in ru-ru-lang.json Signed-off-by: stonezdj <stone.zhang@broadcom.com> --------- Signed-off-by: stonezdj <stone.zhang@broadcom.com> Co-authored-by: Wang Yan <wangyan_0219@hotmail.com> (cherry picked from commit 907173f) Resolved conflicts against the harbor-next Angular 16 portal: - Translated upstream @if/@for control-flow blocks to *ngIf/*ngFor (Angular 17+ syntax is not supported by the portal toolchain). - Kept harbor-next permission gating (hasChangeConfigRole and allowUpdateProxyCacheConfiguration) and the editable proxy cache checkbox/registry select instead of upstream isSystemAdmin gating. - Ported the repository filter (pattern + kind) UI with validation, max upstream connection validation, read-only filter view, and the CVE allowlist null-guards into the existing template layout. Upstream-Commit: 907173f Upstream-PR: goharbor/harbor#23536 Upstream-Author: @stonezdj Cherry-Pick-Status: resolved Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Prasanth Baskar <prasanth@8gears.com>
…goharbor/harbor#23536) * feat(ui): support advanced proxy cache configurations in UI - Support repository filter configuration (pattern and kind) for proxy cache projects. - Ensure the local on not found and proxy referrer API checkbox editability is controlled by project configuration update permissions. Signed-off-by: stonezdj <stone.zhang@broadcom.com> * Remove unused translation key in ru-ru-lang.json Signed-off-by: stonezdj <stone.zhang@broadcom.com> --------- Signed-off-by: stonezdj <stone.zhang@broadcom.com> Co-authored-by: Wang Yan <wangyan_0219@hotmail.com> (cherry picked from commit 907173f) (cherry picked from commit 38749c9) Backport of #570 to release-2.15. Resolved conflicts against the release-2.15 portal, which does not carry the proxy referrer API UI: - Dropped all proxy_referrer_api / ProxyReferrerAPI additions (metadata fields, defaults, form checkboxes, en/fr translation keys) to keep the release-2.15 referrer-less baseline. - Kept the repository filter (pattern + kind) UI, validation util, max upstream connection handling, and permission gating as merged on main. Upstream-Commit: 907173f Upstream-PR: goharbor/harbor#23536 Upstream-Author: @stonezdj Cherry-Pick-Status: resolved Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Prasanth Baskar <prasanth@8gears.com>


Thank you for contributing to Harbor!
Comprehensive Summary of your change
Issue being fixed
Fixes #(issue)
Please indicate you've done the following: