- {{#if @hvdManagedNamespace}}
+ {{#if this.flags.hvdManagedNamespaceRoot}}
Namespace
{{else}}
{
+ @service declare readonly api: ApiService;
+ @service declare readonly flags: FlagsService;
+
+ get namespaceInput() {
+ const namespaceQueryParam = this.args.namespaceQueryParam;
+ if (this.flags.hvdManagedNamespaceRoot) {
+ // When managed, the user isn't allowed to edit the prefix `admin/`
+ // so prefill just the relative path in the namespace input
+ const path = getRelativePath(namespaceQueryParam, this.flags.hvdManagedNamespaceRoot);
+ return path ? `/${path}` : '';
+ }
+ return namespaceQueryParam;
+ }
+
+ @action
+ async handleInput(event: HTMLElementEvent) {
+ // user has typed something, so input should be refocused
+ const value = event.target.value;
+ this.updateNamespace.perform(value);
+ }
+
+ updateNamespace = restartableTask(async (namespace) => {
+ await timeout(500);
+ await this.args.handleNamespaceUpdate(namespace);
+ });
+
+ @action
+ maybeRefocus(element: HTMLElement) {
+ if (this.args.shouldRefocusNamespaceInput) {
+ element.focus();
+ }
+ }
+}
diff --git a/ui/app/components/auth/page.hbs b/ui/app/components/auth/page.hbs
index 174478ac19..73ffae56b1 100644
--- a/ui/app/components/auth/page.hbs
+++ b/ui/app/components/auth/page.hbs
@@ -53,13 +53,20 @@
@alternateView={{this.formViews.alternateView}}
@cluster={{@cluster}}
@defaultView={{this.formViews.defaultView}}
- @handleNamespaceUpdate={{@onNamespaceUpdate}}
@initialFormState={{this.initialFormState}}
- @namespaceQueryParam={{@namespaceQueryParam}}
- @oidcProviderQueryParam={{@oidcProviderQueryParam}}
@onSuccess={{this.onAuthResponse}}
@visibleMountTypes={{this.visibleMountTypes}}
- />
+ >
+ {{! yielded for accessibility so namespace submits as an input of the