## What this PR does
backup-utils.ts (in the in-tree console dashboard) had no test file at
all, despite sibling files in the same directory
(dynamic-options.test.ts, crd-option-sources.test.ts,
immutable-paths.test.ts) establishing that convention. Adds
backup-utils.test.ts covering enrichSchemaWithEnums: the non-object
passthrough, a path with no match in the enum map, a top-level enum
attach, a nested one, and that the caller's path array is not mutated
(verified by reading the function, it builds a new array via spread on
every recursive call rather than mutating the one it receives).
Test-only change, no production code touched. Verified with vitest run
src/lib/backup-utils.test.ts (5 tests pass) and tsc --noEmit (no new
errors).
### Screenshots
N/A, test-only change, no UI impact.
### Downstream repositories
Walked the trigger map in docs/agents/contributing.md against the diff.
This is a single new test file for a pure function, no production code,
schema, API, CRD, annotation, or naming changed.
- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:
### Release note
```release-note
NONE
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Tests**
- Added coverage for schema enum enrichment, including top-level and
nested paths.
- Verified that unrelated schemas remain unchanged.
- Confirmed unmatched paths and caller-provided path arrays are handled
safely.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
The nginx config baked into the console image kept the nginx defaults for
client_header_buffer_size (1k) and large_client_header_buffers (4 8k). An
OIDC access token carrying many group claims arrives as a single Cookie
header of several kilobytes, which no longer fits into one buffer, so
nginx answered 400 "request header or cookie too large" before the
request reached the /apis, /api or /k8s/ upstream.
Raise both to 16k, at the top level of that config rather than inside the
server block: a header field read before the Host header has selected the
virtual server is measured against the default server's buffers, so the
same lines inside a server block cover that server only while it stays
the default one. Measured against the pinned nginx base image, a 12 KB
cookie gets 400 on the old config and 200 on the new one. The ceiling
moves rather than disappears: a 20 KB cookie is still rejected.
This is the console hop alone. The platform ingress-nginx controller in
front of it runs on the same defaults, so where the dashboard is published
through an Ingress a token large enough to exceed them is still rejected
at the edge; where it is published through the gateway, whose edge has no
per-header ceiling of this kind, the console was the hop returning the
400. Raising the controller is a separate change in a separate package.
The accompanying check extracts the config from the Containerfile heredoc
and fails if either directive is missing, below 16k, or no longer ahead of
the first server block: the config lives inside an image build, where no
chart template and no helm-unittest case can reach it.
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
## What this PR does
Part of #4217. The SPA fetched its branding (title, logo) only by
reading the `cozy-dashboard-console-config` ConfigMap through the
kube-api. That read already works for any signed-in user —
`console-rbac.yaml` binds `get` on it to `system:authenticated` — but it
still depends on the kube-api being reachable and on the apiserver
authenticating the session's token. A dashboard login whose token the
apiserver rejects (an OIDC session the kube-api does not accept) gets no
branding at all. (The unauthenticated login page is a separate surface,
branded in #4255.)
This mounts that ConfigMap read-only under the nginx web root and serves
it at `/branding/config.json`, and reads that static asset first in
`loadConfig`, falling back to the kube-api ConfigMap for charts that
predate the mount (their static path serves the SPA `index.html`, whose
non-JSON body trips the fallback). Branding then resolves with no
kube-api call at all, so it renders regardless of whether the apiserver
authenticates the session and without the `console-config-reader` RBAC.
Because `config.json` is now a static asset reachable by anyone past the
proxy, it is restricted to the documented white-labeling keys: the
branding map also carries Keycloak-only keys, including
`loginThemeImage`, which can point at a private registry. Keycloak reads
those from `_cluster.branding` directly. The mount uses an `items`
selector so only `config.json` is exposed under the web root.
Verified with `pnpm typecheck`, `pnpm test` (7 `loadConfig` cases),
`eslint`, and `helm unittest` (mount + `items`, the `config.json` key
the mount serves, white-label keys kept incl. `tenantText`,
Keycloak-only keys absent). Also validated live on a dev cluster:
`console-rbac.yaml` binds the ConfigMap read to `system:authenticated`
(`kubectl auth can-i get` this CM as an unbound user → yes; another CM →
no), and a throwaway pod on the real console image serving the mounted
ConfigMap returns `200 application/json` at `/branding/config.json`
while an `items`-excluded key falls through to `index.html`.
### Screenshots
No visual regression to show in a static render: this changes where the
branding config is fetched from, not how it is displayed.
### Downstream repositories
The diff touches only `packages/system/dashboard` (the in-repo console
image and its chart). No app is added, renamed or removed, no
`values.schema.json` / enum / default changes, no CRD or namespace
changes, and the branding keys the SPA reads are unchanged — only the
transport (static asset vs kube-api) and a narrowing of which keys are
served. Nothing in the trigger map applies.
- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:
### Release note
```release-note
feat(dashboard): the console serves its branding as a static asset (`/branding/config.json`) read with no kube-api call, so branding renders even when the apiserver does not authenticate the session and without the console-config-reader RBAC; the served file is narrowed to the documented white-labeling keys.
```
backup-utils.ts had no test file despite sibling lib files
establishing that convention. Covers the non-object passthrough,
no-match case, a top-level enum attach, a nested one, and that the
caller's path array is not mutated.
Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
The window this had been measuring started before the paste did. noVNC
arms its timer on the keydown, and the modifier is delivered once — by
that timer or by the next keyup, whichever comes first, and the V keyup
is not intercepted. Both land within 100 ms of the keydown, which at the
default pace is somewhere inside the opening releases.
Counting from the end of those releases therefore started the clock
again and let three characters through while the guest still held Ctrl,
where an m is Return. The second release now waits out whatever is left
of the window, measured from the keydown itself, and happens before any
character goes in.
The test that was written for this pinned the wrong placement: it handed
the modifier over after the first character, later than noVNC can, and
the fake's method was the immediate one under a second name. The fake
now delivers on its own schedule, partway through the opening releases,
so a test cannot choose the moment.
The component's own typing pace had no test at all once every existing
one passed its own value, so setting the default to zero left the suite
green. One test renders without the prop and holds it.
The lifecycle tests key on characters typed rather than on a count of
sleeps, which is what let them drift past their code when the opening
releases changed shape.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
Windows is the platform where noVNC holds the modifier back: the first
Ctrl keydown tells the guest nothing, arms AltGr detection and starts a
100 ms timer, and Ctrl reaches the guest when that timer fires. Taking
the shortcut on the capture phase hides the V from noVNC, so the timer
is what delivers — after the paste released a modifier the guest had not
yet been told about. Everything typed between the two goes in as chords.
The release is now sent a second time, once the pacing has covered that
window. It happens once rather than per character, and it leaves Shift
alone, because that one is held deliberately for capitals.
Two tests had drifted past the code they are named for. Both dropped the
session on the first sleep, which since the prelude lands before
anything is pressed, so they held whatever the typing loop did: removing
the session check from the loop left them green. They drop it after a
character now, and a third covers the closing release, which no test
reached at all.
The fake learns the Windows path it could not express, and decodes
function keysyms: Enter is 0xff0d, and treating it as a Unicode offset
produced a negative code point, so the first test to paste a newline
would have thrown instead of failing an assertion.
The typing pace is injectable, so tests no longer run at the speed of a
real keyboard and stop crowding their neighbours out on timeouts.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
The tab pulled xterm through a dynamic import inside its own effect,
which split the chunk but left the stylesheet on a fragile path: the dev
server failed to fetch it once after a dependency rebuild, and the tab
came up with the terminal missing.
Splitting at the route instead is what the YAML editor next door already
does. The imports go back to plain ones, React.lazy gives the tab its
own chunk, and the stylesheet travels with it rather than through an
import() of a CSS file.
The entry chunk every dashboard page loads ends up smaller than before
this branch: 935.91 KB at the merge base, 895.99 KB here, with the tab
and xterm in a 347 KB chunk fetched when a console is opened.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
Three defects on the same surface, all of them where this code meets
noVNC, the platform and the guest — and all of them invisible to every
test here, because the fake had no keyboard.
A paste began while the user was still holding the chord. noVNC tells
the guest a modifier is down the moment it is pressed and releases it
only on keyup, so the pasted text arrived as chords: under Ctrl an m is
Return, and on macOS, where noVNC maps Cmd to Alt, the same under Alt.
The host's modifiers are now released before the first character.
A character the keymap cannot produce was dropped and the rest was typed
anyway, newline included, with the notice arriving after the line had
run: rm -rf /srv/данные became rm -rf /srv. Nothing is sent now unless
the whole paste can be typed.
The shortcut was taken on every platform, so the guest lost a key it has
its own use for — visual block in vim, its own clipboard on Windows —
and on macOS gained nothing, because no browser pastes on Ctrl+V there.
Each platform's own chord only.
The fake now models the guest's keyboard: which modifiers it believes
are down, and what it received with chords marked. That is what makes
the first defect expressible as a test rather than something only a
person at a keyboard could notice.
Also pins three behaviours the suite was not holding: a frame arriving
after cleanup, a real close reason behind a synthetic 1006, and the
25 ms pacing the description calls measured.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
Reaching a console is why people open a virtual machine, so the two
consoles now sit directly after Overview instead of below the resource
tabs. Serial leads and is labelled Console: text goes in and out of it
directly, at a speed the emulated-keyboard path cannot reach.
VNC keeps its place beside it, because the serial port does not reach a
desktop session, a bootloader, or a Windows guest — and Windows guests
are a supported case here, with their own scheduling in the VM charts.
The order is pinned by a test: it was ordinary prose in a push() call
before, so the next edit to this list could reorder it in silence.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
xterm turns Ctrl with a letter into a control byte and cancels the
keydown, so on Windows and Linux Ctrl+V never reached the browser's
paste and the guest received SYN (0x16) instead. Cmd+V and Shift+Insert
were unaffected, which is why testing on a Mac missed it: reproduced on
a real terminal, where the shortcut put a single 0x16 byte on the wire
and nothing else.
The key handler now returns the event to the browser, at the cost of the
terminal's quoted-insert on that chord — the same trade the VNC console
already makes for the same shortcut. The test stub keeps the handler now
instead of dropping it, so the chord is reachable from a test at all.
Three smaller repairs in the same paths:
A frame arriving after cleanup was written into a disposed terminal,
because the message handler never consulted the stream's own state.
onerror synthesised a 1006 and the real onclose behind it was swallowed
by the already-closed latch, so a close carrying 1008 Forbidden reached
the user as connection error. The error is recorded and the close
reports what the server actually said.
navigator.clipboard is SecureContext-only and absent over plain http,
which the console's own URL builder supports; copying threw there
instead of falling back to the selection the user can copy by hand.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
Three behaviours the code promises had no test: the refusal of a second
paste while one is still typing, the focus-restore timer, and the serial
console's copy chord. The chord was untestable by construction — the
Terminal stub accepted the handler and dropped it, so nothing could ever
call it. The stub keeps it now.
Each test was checked by reverting the behaviour it covers and watching
that one test, and only that one, go red.
The VNC paste also acts on how typeKeystrokes ended instead of
discarding it. A paste cut short by a dropped session used to leave the
toolbar reading as though the text had all arrived.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
Five repairs, all on state that outlives a single interaction.
The serial stream marked itself writable before the socket opened, so a
keystroke typed while the pill still said Connecting reached
WebSocket.send() during CONNECTING, which throws. Input is now held and
flushed on open, and discarded if the socket closes first.
A paste in the VNC console outlived the tab. The effect cleanup dropped
the RFB reference but not the sender, and noVNC's disconnect event
arrives too late to clear it, so the typing loop kept running against a
dead session. Cleanup now aborts the paste and clears the sender.
Clipboard blocked had a renderer and no producer: the state survived the
move from the panel to the shortcut, while the only thing that used to
set it did not. The sink timeout sets it now, which is the case the
message was written for — an empty or refused clipboard raises no paste
event at all.
The shortcut matched the physical KeyV position only, so on Dvorak
Ctrl+V reached noVNC instead and was cancelled there.
A clean server-side close left the status pill on amber Connecting,
because the tab tracked a boolean where it needed three states.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
The layout was never selectable — the tab picks one and nothing offers
the others — so the German, French and Russian tables, and the AltGr
handling that only they needed, were data and code with no reader.
What remains states its assumption plainly: US, the layout a default
cloud image boots with. A guest in another layout is the case the serial
console answers, where text travels as bytes and no layout is involved.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
The graphical console still matters for guests the serial port cannot
reach — a desktop session, a bootloader, Windows. There a paste has to
be typed, so this maps the clipboard text to key presses for the layout
the guest has active and paces them: without the pacing the guest drops
and reorders characters, which was measured rather than assumed.
The shortcut is taken before noVNC sees it. noVNC calls preventDefault()
on keydown, which would cancel the browser's own paste and hand the
guest a Ctrl+V it cannot use; instead the focus moves to a hidden field
and the browser pastes into it. Reading the clipboard through
navigator.clipboard would have put a permission prompt in front of every
paste. The focus returns to the console even when no paste follows.
Nothing is added to the interface: the toolbar's existing status line
reports progress while the text is typed.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
The VNC console carries pixels and key events, so moving text through it
means emulating a keypress per character: measured at 57 seconds for a
1000-character paste, and the text corrupts if the pacing is dropped.
KubeVirt also exposes the guest's serial port as a websocket, and that
one carries text. The same 1000 characters land in under a second, the
guest's output is real text the user can select and copy, and tabs,
newlines and non-Latin characters travel as bytes instead of depending
on the keyboard layout the guest happens to have active.
virt-api negotiates the plain.kubevirt.io subprotocol and reads binary
frames only — a text frame is accepted by the socket and then dropped,
which is indistinguishable from a dead console, so the stream is kept
deliberately narrow and tested on its own.
Copy stays on the terminal's own chord (Ctrl+Shift+C, or Cmd+C) so a
plain Ctrl+C still interrupts the foreground process.
Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
The SPA fetched its branding (title, logo) only by reading the
cozy-dashboard-console-config ConfigMap through the kube-api. That read
already works for any signed-in user — console-rbac.yaml binds get on
that ConfigMap to system:authenticated — but it still depends on the
kube-api being reachable and on the apiserver authenticating the
session's token. A dashboard login whose token the apiserver rejects (an
OIDC session the kube-api does not accept) gets no branding at all.
Mount that ConfigMap read-only under the nginx web root and serve it at
/branding/config.json, and read that static asset first in loadConfig,
falling back to the kube-api ConfigMap for charts that predate the mount
(their static path serves the SPA index.html, whose non-JSON body trips
the fallback). Branding then resolves with no kube-api call at all, so it
renders regardless of whether the apiserver authenticates the session and
without the console-config-reader RBAC.
Because config.json is now a static asset reachable by anyone past the
proxy, restrict it to the documented white-labeling keys: the branding
map also carries Keycloak-only keys, including loginThemeImage, which can
point at a private registry. Keycloak reads those from _cluster.branding
directly. The mount uses an items selector so only config.json, not any
other key the ConfigMap may grow, is exposed under the web root.
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
main took migration 57 and moved migrations.targetVersion to 58 while this
branch was open, so that line is the one conflict: 57 at the merge base, 58
on main, 59 here. Resolved as 59, which is what this branch's migration 58
requires, since run-migrations.sh loops up to targetVersion - 1.
Merged rather than rebased because the branch carries commits that are not
mine to rewrite.
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
Connecting an External-Apps repository creates a cluster-scoped Tap and
runs its charts in the management cluster. That is an operator action,
not something a tenant does while browsing the catalog, so the entry
belongs next to the other cluster-wide areas in the Admin portal rather
than in the Marketplace sidebar.
The page moves to /admin/taps under Administration. /marketplace/taps
redirects there, since the :appName catch-all would otherwise render an
order page for an application called "taps".
Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The dashboard no longer registers a brand icon for the kind, and the
ServicesTab fixture moves to TCPBalancer, which the catalog still ships.
An instance that survives the removal still renders, on the generic
sidebar icon.
api/apps/v1alpha1/httpcache goes too. types.go is generated by
values-gen out of packages/apps/http-cache, which is gone, so the file
could never be regenerated, and no Go file in this repository imports
it. Surviving instances do not depend on it: the aggregated API serves
the schema recorded in the in-cluster ApplicationDefinition. The
terraform provider's cozystack_httpcache resource is hand-written and
does not import it either; only its per-kind schema-guard test does,
and that goes away with the resource.
Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
Hidora's customers are leaving VMware now, and a tenant has to be able to
import their own machines without a platform administrator. The chart
approach could not express that: a tenant can neither create the Secret
holding vCenter credentials nor name the VDDK image, so both had to come
from somewhere they cannot reach.
Two CRDs in a new `forklift.cozystack.io` group, split by lifecycle. A
VMImportSource is a long-lived connection -- type, endpoint, credentials,
readiness -- and a VMImportTask is the one-shot operation that names
machines and produces VMDisks and VMInstances. The outputs carry no owner
reference back to the task, so deleting a finished import leaves the
machines alone. Konveyor Forklift does the transfer underneath; the
controller renders its objects, mirrors its verdicts, and hands each
finished volume into a VMDisk without copying it.
What a live vCenter migration forced out, and no amount of source reading
would have:
- A guest copied verbatim keeps the drivers it had under VMware and no
virtio, so on a virtio disk it does not fail the import -- it succeeds
and then does not boot. Imported disks go on SATA.
- VDDK connects straight to the ESXi host at the address vCenter
advertises, which is routinely unreachable, and on the first cluster
collided with the Service CIDR. `spec.hosts` redirects per host.
- Firmware must be carried across or a UEFI guest imports as BIOS and
never boots (stacked on #3002).
- Deleting a task mid-transfer orphaned its DataVolume; a finalizer now
removes the engine's volumes and leaves the outputs.
The console gains a Migration section: connections are editable, and the
VM field is a picker built from a machine list the controller publishes,
since the aggregated API cannot reach the inventory and should not hold a
source's credentials to try. Two general mechanisms fall out of that --
an option source may take an argument, and one named in a CRD annotation
may reference a sibling field.
Design: cozystack/community#62. Docs: cozystack/website#673.
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
deriveTapName now yields the tap source id (tap-<org>-<repo>) that the server
assigns, and the community-prefix constant is gone. The Repositories view
labels a tapped source "external" rather than "community"; it already renders
a pending or blocked tap's message, which the server now returns for taps with
no materialized PackageSource yet.
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
From @kvaps's review of the untrusted-artifact path:
- Refuse to silently retarget: two repositories that share an org/repo path on
different registry hosts derive the same tap name. The API and CLI now reject
a connect when an existing source points at a different spec.url, instead of
blindly repointing the first at the second.
- Fail closed on integrity: verifyAndExtract now errors on an absent digest
(not just a mismatch), and the reconciler waits for status.artifact.digest,
so a tap artifact is never materialized without a verified digest.
- Centralize the load-bearing community. prefix in internal/marketplace/tapconst
(removing two duplicate consts and several literals across the CLI, API,
materializer, and dashboard) so the disconnect guard, the community badge, and
the anti-shadowing guarantee cannot drift.
- Split multi-document YAML with the apimachinery reader so a PackageSource
whose values contain a separator-looking line is not fractured.
(The short-name version-pin drop was already fixed in an earlier commit.)
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
Add a search box that filters connected repositories and their packages by
name, kind, description, category, or tag, and a trust notice stating that
connecting a repository runs its charts in the management cluster and that
signatures are verified by the index at publication time, not at connect time.
Both close gaps the design-conformance review found against #18/#23.
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
Add a Repositories view to the console marketplace that lists connected
External-Apps repositories from the taps.core.cozystack.io resource, showing
each tap's source, community/official and ready status, and the packages it
exposes with a privileged badge. Operators can connect a repository by oci://
reference (with an optional pull secret for private repositories) and
disconnect community taps, backed by create and delete on the Tap resource;
installed packages are left in place on disconnect. The view reuses the
existing k8s-client list/watch and mutation hooks, so it updates live, and adds
a Repositories entry to the marketplace sidebar.
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
Four of the five findings share one root cause: a node in the tenant
tree can attach to its nearest *visible* ancestor when its real parent
is inaccessible, and per-row actions then derived their target from
that bridged ancestor.
The Edit action on a bridged tenant row pointed at a Tenant CR that
does not exist. The CR lives in the real parent's namespace, so the
target now comes from realParentNamespace — and Edit is offered only
when that namespace is readable, because otherwise there is no CR the
user could open and the button could only ever dead-end. The test that
asserted two Edit buttons had frozen the broken target as expected
behaviour; it now names the rows it expects, and the Edit button gained
a title so that assertion means something.
An inherited module chip is rendered only when the providing tenant is
NOT visible, yet it was a live button: clicking it denied the instance
GET and switched the active tenant to a namespace outside the visible
set, which the selector then bounced to an arbitrary fallback. It is
now an inert badge that states where the module comes from.
InfoRedirect's missing-definition branch hardcoded /console, throwing an
admin out of the portal its own docstring promises to preserve.
The sidebar's alsoMatch used a bare startsWith, so /admin/apps would
light up for /admin/apps-v2. It now matches whole path segments.
And SecretsTab let a rejected clipboard write escape as an unhandled
rejection, leaving the button silent — a denied permission or an
insecure context was indistinguishable from a no-op. It now reports the
failure.
Declined: CodeRabbit asked to split `import { useK8sList, type K8sResource }`
into a separate `import type`. The inline modifier is valid under
verbatimModuleSyntax and is what 26 other imports in this console use,
so the change would make the file the odd one out.
Reported-by: Ivan Okhotnikov <ivan.okhotnikov@aenix.io>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
Opening the dashboard without a path sent the user to the catalog, and
the header gave Marketplace the primary emphasis. The Console is the
better entry point: it shows what the tenant already runs, which is
what someone opening the dashboard almost always came for. The
Marketplace stays one click away for when the intent is to add
something new.
The landing path becomes a named constant beside the portal helper, so
the redirect and the tab emphasis cannot drift apart, and the library's
own default tab set is reordered to match rather than contradict its
only consumer.
Assisted-By: Claude
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
Copying a secret key required revealing it on screen first, and the
button gave no sign that anything reached the clipboard. The value the
list already carries is enough to copy, so the button works while the
key stays masked, and it briefly turns into a check mark to confirm.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
Detail pages offered a fixed tab set, so Info showed Workloads, Services
and Ingresses tabs it never fills; tabs now appear only for resource
groups the instance actually owns. The probes reuse the tabs' own list
refs and label selector, so they share one cache entry and one watch.
Back and the sidebar followed the plural instead of the entry point: a
module page sent the user to a one-item list and lit nothing in the
sidebar. Module pages now return to Modules and keep it highlighted,
while Info returns to Tenants and highlights that, matching the trees
they are reached from.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
The page showed LoadBalancer services of the selected tenant only, so an
operator had to switch tenants one by one to find an address. It now
lists them for every visible TenantNamespace in a single table with a
Namespace column. A namespace whose services the user cannot list
contributes no rows instead of failing the page.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
The Modules page listed the selected tenant's modules as Enabled or
Disabled cards, so a module a parent tenant provides looked disabled and
clicking it led to a Tenant CR that does not exist in the child's
namespace — an endless spinner.
It now covers every tenant the user can access, as the same hierarchy
tree the Tenants page draws, with each tenant's modules as chips
carrying the module icon, the namespace running it and its readiness.
Availability comes from the `namespace.cozystack.io/<module>` label on
each TenantNamespace, which names the providing namespace: the tenant
itself for a local module, an ancestor for an inherited one. An
inherited chip appears only when that ancestor is out of the user's
reach, since otherwise its own chip already shows the module. Clicking
any chip opens the module in whichever tenant runs it.
Tenants whose whole subtree has no modules collapse into a
"+ N tenants" branch, and the Info module is left out entirely as every
tenant carries it.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
The flat table becomes a tree built from TenantNamespaces, whose
`tenant.cozystack.io/<ancestor-ns>` labels carry the full ancestry. A
tenant whose parent is not accessible attaches to its nearest visible
ancestor instead of disappearing, and rows are labelled relative to that
parent, so a sub-tenant reads as `crpjxhwm` rather than
`whmcs-crpjxhwm`. Subtrees collapse from the row itself.
Each row also carries its own actions: Info opens that tenant's Info
page, and Create Tenant orders a sub-tenant at any level of the tree.
Editing a tenant switches to the namespace holding its Tenant CR — the
parent's, or its own for the hierarchy root.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
Administration (Tenants, Modules, External IPs, per-tenant Info) leaves
the Console sidebar for Admin, which is now always visible: those pages
need no special permission. The two cluster-wide operator areas keep
their own gates, so Capacity and Backup Classes still appear only for
users who can open them.
Resource routes become portal-aware through a shared base-path helper,
so a detail, edit or order page opened from Admin stays under /admin
instead of jumping back to /console.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
Open the grouped application list right away instead of the
"Choose a product to deploy" page and its Show-all-apps button.
Category links keep filtering to a single category.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
In the four backup create pages (Backup, BackupJob, BackupPlan, BackupRestoreJob), run the RJSF SchemaForm.validate() call right after the name check and before the page-level required-field alerts. The submit button lives outside RJSF and bypasses its validation, so each page triggers validate() explicitly; it previously ran only after the manual alert checks, so a schema-required field left empty exited via an alert without RJSF ever rendering its inline errors. Validating first makes inline errors show consistently; the page-level alerts then cover only page-only requirements.
Re-applied from cozystack/cozystack-ui#26 onto the in-tree console after the UI was vendored (#2963); the source repo is being archived. Scope is the validation-ordering change only — the original PR's VMDisk/StorageClass parts were obsoleted by the DynamicOptionsWidget refactor (#30) already in the vendored snapshot. Includes the original per-page tests.
Co-authored-by: Aleksei Sviridkin <1366514+lexfrei@users.noreply.github.com>
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
The console bakes VITE_APP_VERSION into its bundle at build time, so a
promote-by-retag image (which is retagged, never rebuilt) would keep
reporting the rc version in the UI after promotion to stable.
Inject the version at deploy time instead: the chart derives it from the
console image tag (build-stamped vX.Y.Z, rewritten rc->stable on promotion
by promote-rc.yaml) and writes it into the existing console config.json
ConfigMap, which the SPA already fetches. App.tsx now prefers
config.version and falls back to the baked VITE_APP_VERSION when absent
(dev / non-version tags like :latest).
Assisted-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
The per-app Services tab queried Services with a spec-only type, so it
never read status.loadBalancer.ingress and showed only the cluster-internal
IP for external: true (type: LoadBalancer) services. This regressed the
pre-1.4.0 behaviour (cozystack/cozystack#2789).
Add a ServiceStatus type to the useK8sList query and surface an
"External IP" column (ip / hostname / Pending for LoadBalancer, — otherwise),
mirroring what ExternalIpsPage already does.
Fixes#3111
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Алексей Артамонов <alexeyartamonov1987@gmail.com>
## What this PR does
Two console pages ordered their loading guard ahead of the terminal
state, making the latter unreachable. Both are pre-existing upstream
behaviors carried in by the cozystack-ui vendoring (#2963) and flagged
as non-blocking findings in that PR's review.
- **`ApplicationDetailPage`** checked `isLoading || !instance || !ad`
before `if (error)`. On a failed GET (403/404/5xx) `isLoading` is false
and `instance` stays undefined, so the page rendered the loading spinner
forever and never reached the "not found" branch. The error branch now
runs first.
- **`ApplicationListPage`**'s `defsLoading || (!ad && plural)` guard
stayed true for any unrecognized `plural` once definitions had loaded,
so the "Unknown application type." branch was unreachable. The guard now
only spins while definitions are loading.
## Verification
- Added co-located regression tests for the failed-GET (detail) and
unknown-plural (list) paths.
- `pnpm typecheck` clean; full console suite green (`pnpm test`: 317
passed, +4 new).
```release-note
fix(dashboard): the console now shows a not-found message on a failed application GET and an unknown-type message for an unrecognized resource, instead of spinning forever
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved loading and error handling on application pages so users see
the correct message at the right time.
* “Unknown application type” now appears only after application
definitions finish loading, instead of being masked by a loading state.
* Application detail pages now show a “not found” message when the
requested app can’t be loaded, rather than continuing to display a
spinner.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
The console Containerfile ran `corepack prepare pnpm@latest`, so the image build could drift to a newer pnpm major than the `pnpm@11.1.2` pinned in package.json and used by CI. `--frozen-lockfile` guards the lockfile, but pinning the builder makes the image build reproducible and consistent with CI.
Also repoints docs/storage-immutability.md off the now-vendored cozystack-ui#6 link to the in-tree console path (follow-up from #2963).
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Two console pages ordered their loading guard ahead of the terminal state, making the latter unreachable:
- ApplicationDetailPage checked `isLoading || !instance || !ad` before `if (error)`. On a failed GET, isLoading is false and instance stays undefined, so the page spun forever and never showed the not-found message. The error branch now runs first.
- ApplicationListPage's `defsLoading || (!ad && plural)` guard stayed true for any unrecognized plural once definitions had loaded, so 'Unknown application type.' was unreachable. The guard now only spins while definitions are loading.
Both are pre-existing upstream behaviors carried in by the cozystack-ui vendoring (#2963). Adds co-located regression tests for the failed-GET and unknown-plural paths.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Address review feedback from gemini-code-assist on SecretsTab.tsx: guard the
copy button on navigator.clipboard so it is disabled and a no-op when the API
is unavailable (plain-HTTP contexts), instead of throwing a TypeError.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Address review feedback from gemini-code-assist on ResourceQuotasField.tsx:
parseSize coerces val to a string first so a numeric quota from user-authored
YAML (e.g. cpu: 10) no longer crashes the edit form with "val.endsWith is not
a function".
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Address review feedback from gemini-code-assist on ExternalIpsPage.tsx: add
enabled: !!tenantNamespace to the services useK8sList so it does not issue a
cluster-wide /api/v1/services request (403 for non-admin tenants) before the
tenant namespace is known.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Address review feedback from gemini-code-assist on DynamicOptionsWidget.tsx:
gate the useK8sList options query with enabled: !!tenantNamespace so it does
not fire a cluster-wide request to core.cozystack.io options (403 for
non-admin tenants) while the tenant namespace is still resolving.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Move the console SPA source into the monorepo at
packages/system/dashboard/images/console so the UI versions and ships in
lockstep with the platform, removing the cross-repo digest-bump PRs and the
version drift between the two repositories.
Snapshot of cozystack/cozystack-ui main at 8ef45a4; full history remains in
that repository (to be archived). The Makefile now builds the console image
from this in-tree context instead of cloning the external repo at build time:
dropped clone-console/clean-console and the CONSOLE_REPO/CONSOLE_BRANCH
variables; the built digest is still pinned into values.yaml by
update-values-console. .helmignore already excludes images/*/* so the source
never enters the Helm chart.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>