-
{selectedChart.name}
-
- {selectedChart.repo}
-
+
+
+
+
+
+
+
+
{selectedChart.name}
+
+ {selectedChart.repo}
-
{selectedChart.description}
-
-
-
-
-
+
{selectedChart.description}
-
-
handleSubmit(values)}
- >
- {({ values, setFieldValue }) => (
-
- )}
-
- >
+
+
+
+
+
+
+
);
}
diff --git a/app/react/kubernetes/helm/HelmTemplates/queries/useHelmChartInstall.ts b/app/react/kubernetes/helm/HelmTemplates/queries/useHelmChartInstall.ts
deleted file mode 100644
index e6664a317..000000000
--- a/app/react/kubernetes/helm/HelmTemplates/queries/useHelmChartInstall.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { useMutation } from '@tanstack/react-query';
-
-import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
-import axios, { parseAxiosError } from '@/portainer/services/axios';
-import { EnvironmentId } from '@/react/portainer/environments/types';
-import {
- queryClient,
- withGlobalError,
- withInvalidate,
-} from '@/react-tools/react-query';
-import { queryKeys } from '@/react/kubernetes/applications/queries/query-keys';
-
-import { InstallChartPayload } from '../../types';
-
-async function installHelmChart(
- payload: InstallChartPayload,
- environmentId: EnvironmentId
-) {
- try {
- const response = await axios.post(
- `endpoints/${environmentId}/kubernetes/helm`,
- payload
- );
- return response.data;
- } catch (err) {
- throw parseAxiosError(err as Error, 'Installation error');
- }
-}
-
-export function useHelmChartInstall() {
- const environmentId = useEnvironmentId();
-
- return useMutation(
- (values: InstallChartPayload) => installHelmChart(values, environmentId),
- {
- ...withGlobalError('Unable to install Helm chart'),
- ...withInvalidate(queryClient, [queryKeys.applications(environmentId)]),
- }
- );
-}
diff --git a/app/react/kubernetes/helm/HelmTemplates/types.ts b/app/react/kubernetes/helm/HelmTemplates/types.ts
new file mode 100644
index 000000000..df0b09374
--- /dev/null
+++ b/app/react/kubernetes/helm/HelmTemplates/types.ts
@@ -0,0 +1,4 @@
+export type HelmInstallFormValues = {
+ values: string;
+ version: string;
+};
diff --git a/app/react/kubernetes/helm/components/HelmValuesInput.tsx b/app/react/kubernetes/helm/components/HelmValuesInput.tsx
new file mode 100644
index 000000000..3295b8d6e
--- /dev/null
+++ b/app/react/kubernetes/helm/components/HelmValuesInput.tsx
@@ -0,0 +1,80 @@
+import { FormControl } from '@@/form-components/FormControl';
+import { CodeEditor } from '@@/CodeEditor';
+import { ShortcutsTooltip } from '@@/CodeEditor/ShortcutsTooltip';
+
+type Props = {
+ values: string;
+ setValues: (values: string) => void;
+ valuesRef: string;
+ isValuesRefLoading: boolean;
+};
+
+export function HelmValuesInput({
+ values,
+ setValues,
+ valuesRef,
+ isValuesRefLoading,
+}: Props) {
+ return (
+
+
+ User-defined values will override the default chart values.
+
+ You can get more information about the Helm values file format in
+ the{' '}
+
+ official documentation
+
+ .
+ >
+ }
+ >
+
+
+
+ Values reference (read-only)
+
+
+ }
+ inputId="values-reference"
+ size="vertical"
+ isLoading={isValuesRefLoading}
+ loadingText="Loading values..."
+ className="[&>label]:w-full [&>label]:!mb-1 !mx-0"
+ >
+
+
+
+ );
+}
diff --git a/app/react/kubernetes/helm/HelmTemplates/queries/useHelmChartValues.ts b/app/react/kubernetes/helm/queries/useHelmChartValues.ts
similarity index 54%
rename from app/react/kubernetes/helm/HelmTemplates/queries/useHelmChartValues.ts
rename to app/react/kubernetes/helm/queries/useHelmChartValues.ts
index 29ec6e45a..2c1a95995 100644
--- a/app/react/kubernetes/helm/HelmTemplates/queries/useHelmChartValues.ts
+++ b/app/react/kubernetes/helm/queries/useHelmChartValues.ts
@@ -3,15 +3,16 @@ import { useQuery } from '@tanstack/react-query';
import axios, { parseAxiosError } from '@/portainer/services/axios';
import { withGlobalError } from '@/react-tools/react-query';
-import { Chart } from '../../types';
+type Params = {
+ chart: string;
+ repo: string;
+ version?: string;
+};
-async function getHelmChartValues(chart: string, repo: string) {
+async function getHelmChartValues(params: Params) {
try {
const response = await axios.get