SRVOCF-1046: Improve namespace selection on the create function form - #184
Conversation
System namespace warning on the Create Function form. Refs: SRVOCF-1075 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add an isSystemNamespace helper and show an inline warning on the Create Function form when the entered namespace is a system namespace (openshift-*, kube-*, default, openshift, kube-system, kube-public, kube-node-lease). The warning is advisory and does not block creation. Part of the consolidated namespace UX work. Refs: SRVOCF-1046 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rename and rewrite the plan to cover the merged namespace UX scope (system-ns warning, non-existent-ns handling, role-aware field). Supersedes SRVOCF-1075 and SRVOCF-1076. Refs: SRVOCF-1046 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Render the namespace input based on the user's cluster access: - admin (can create namespaces): free-text input with a system- namespace warning - developer with one accessible namespace: prefilled, disabled input, auto-selected - developer with several: dropdown of accessible namespaces - developer with none: message to contact an administrator Extract the control into a NamespaceField component. Derive the role, the accessible namespaces, and the effective namespace inside useCluster behind a withNamespaceOptions flag, so only the create form pays for the access review and Project watch while the list page skips both. The hook resolves the effective namespace itself, so a single-namespace developer's secrets and config maps are watched without any typed value. A not-found watch error is swallowed so an admin typing a not-yet- created namespace sees no scary error; a failed submit surfaces the raw error rather than guessing which resource was missing. Add an isNotFoundError helper to detect k8s 404/NotFound shapes, and keep the SDK-free NamespaceRole and resolveNamespace beside the hook in common/clients. Issue SRVOCF-1046 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The namespace field derived its behavior from a four-way
NamespaceRole ('admin' | 'developer-none' | 'developer-single' |
'developer-multi'), which coupled the UI to an enum that only ever
encoded two facts: whether the user can create namespaces and how
many they can access. That indirection made the actual rules hard
to see and let a system namespace slip into a developer's choices.
Replace the role with a single canCreateNamespaces boolean and let
the field derive its own UI. A user who cannot create namespaces
never sees a system namespace: those are filtered out both in
useCluster and defensively in the field itself. The sole-namespace
case now shows that namespace instead of the (empty) typed value,
and the empty case shows a generic message rather than wrongly
telling the user to contact an administrator (a self-provisioner
can create their own projects).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The create form gave no feedback for a namespace that does not exist: a not-found watch error was swallowed entirely and a submit-time 404 surfaced the raw 'http code: 404' client message. Report the not-found watch as a dedicated namespaceMissing flag from useCluster and, for a user typing a free-text namespace, show an inline warning that it does not exist (non-blocking, since creation is deferred). On submit, map a k8s 404 to a friendly 'Namespace X does not exist.' message instead of the raw code. Only the free-text branch can hit this; developers pick existing projects from the dropdown. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@Cragsmann: This pull request references SRVOCF-1046 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.1.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Three bugs in the namespace field flow: 1. Input bound to debounced value → typed text reverted mid-keystroke. Now displays live value; only cluster watch is debounced. 2. Developer with one accessible namespace got disabled input but no mechanism to set it, so couldn't submit. Now page derives their namespace from the options. 3. Namespace owned in three places: page, form, and field. Form's copy never read. Collapsed to single source of truth in the page. Also split useNamespaceOptions from useCluster to break dependency cycle: options needed to derive effective namespace before opening a namespace-scoped watch. 235 tests pass, covered by new tests for sole-namespace derivation and debounce contract. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The useCluster hook receives the effective namespace to watch, not the user's typed input. Rename inputNamespace to namespace for clarity since the input is already managed by the caller. Simplify isSystemNamespace to check only prefixes instead of maintaining separate lists of exact names and prefixes. The prefix-based check covers all the same cases more concisely. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
@Cragsmann: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
useClusterbehind awithNamespaceOptionsflag (access review + Project watch) so the function list page does not pay for it, and demote not-found watch errors to a dedicatednamespaceMissingflag rather than the generic error.Fixes SRVOCF-1046
Checklist
docs/ARCHITECTURE.md(if there are relevant changes to our layered architecture)docs/TESTING.md(if there are relevant changes to our testing framework or setup)