From 3e5b90343a064ad2f8777ced990f97184a3ac419 Mon Sep 17 00:00:00 2001
From: hashicc <191911133+hashicc@users.noreply.github.com>
Date: Mon, 17 Nov 2025 12:04:02 -0500
Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=F0=9F=A4=96=20use=20statically=20?=
=?UTF-8?q?referenced=20components=20for=20host=20form?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ui/admin/app/components/form/host/index.hbs | 27 +++++++---------
ui/admin/app/components/form/host/index.js | 35 +++++++++++++++++++++
2 files changed, 47 insertions(+), 15 deletions(-)
create mode 100644 ui/admin/app/components/form/host/index.js
diff --git a/ui/admin/app/components/form/host/index.hbs b/ui/admin/app/components/form/host/index.hbs
index fcd7595bed..11505c8da6 100644
--- a/ui/admin/app/components/form/host/index.hbs
+++ b/ui/admin/app/components/form/host/index.hbs
@@ -4,20 +4,17 @@
}}
{{#if @model.compositeType}}
- {{component
- (concat 'form/host/' @model.compositeType)
- model=@model
- submit=@submit
- cancel=@cancel
- }}
+
{{else}}
- {{! create-and-add-host cancel route doesn't
-have a model and this else part is required to prevent
-erroring out here. This has been noted in the tech debt doc to further investigate }}
- {{component
- (concat 'form/host/' 'static')
- model=@model
- submit=@submit
- cancel=@cancel
- }}
+ {{! create-and-add-host cancel route doesn't have a model and this else part is required
+ to prevent erroring out here. This has been noted in the tech debt doc to further investigate }}
+
{{/if}}
\ No newline at end of file
diff --git a/ui/admin/app/components/form/host/index.js b/ui/admin/app/components/form/host/index.js
new file mode 100644
index 0000000000..cb864310b0
--- /dev/null
+++ b/ui/admin/app/components/form/host/index.js
@@ -0,0 +1,35 @@
+import Component from '@glimmer/component';
+import { assert } from '@ember/debug';
+import {
+ TYPE_HOST_CATALOG_PLUGIN_AWS,
+ TYPE_HOST_CATALOG_PLUGIN_AZURE,
+ TYPE_HOST_CATALOG_PLUGIN_GCP,
+ TYPE_HOST_CATALOG_STATIC,
+} from 'api/models/host-catalog';
+import awsHostFormComponent from './aws';
+import azureHostFormComponent from './azure';
+import gcpHostFormComponent from './gcp';
+import staticHostFormComponent from './static';
+
+const modelCompositeTypeToComponent = {
+ [TYPE_HOST_CATALOG_PLUGIN_AWS]: awsHostFormComponent,
+ [TYPE_HOST_CATALOG_PLUGIN_AZURE]: azureHostFormComponent,
+ [TYPE_HOST_CATALOG_PLUGIN_GCP]: gcpHostFormComponent,
+ [TYPE_HOST_CATALOG_STATIC]: staticHostFormComponent,
+};
+
+export default class FormHostIndex extends Component {
+ /**
+ * Returns the host form component associated with the model's composite type
+ * @type {Component}
+ */
+ get hostFormComponent() {
+ const component =
+ modelCompositeTypeToComponent[this.args.model.compositeType];
+ assert(
+ `Mapped component must exist for host composite type: ${this.args.model.compositeType}`,
+ component,
+ );
+ return component;
+ }
+}
From d925462f704e63205e9fcc76115ad79ba240441f Mon Sep 17 00:00:00 2001
From: hashicc <191911133+hashicc@users.noreply.github.com>
Date: Mon, 17 Nov 2025 17:18:59 +0000
Subject: [PATCH 2/2] Add missing copyright headers
---
ui/admin/app/components/form/host/index.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ui/admin/app/components/form/host/index.js b/ui/admin/app/components/form/host/index.js
index cb864310b0..e03b7e9707 100644
--- a/ui/admin/app/components/form/host/index.js
+++ b/ui/admin/app/components/form/host/index.js
@@ -1,3 +1,8 @@
+/**
+ * Copyright (c) HashiCorp, Inc.
+ * SPDX-License-Identifier: BUSL-1.1
+ */
+
import Component from '@glimmer/component';
import { assert } from '@ember/debug';
import {