Skip to content

Commit

Permalink
fix: template fetch in deploy (#14)
Browse files Browse the repository at this point in the history
* chore: template fetch

* chore: fix fetch template

* fix: console.log
  • Loading branch information
HoomanDgtl authored Nov 21, 2024
1 parent 1242954 commit 2e8a193
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FC, useEffect, useState } from "react";
import { useAtomValue } from "jotai";
import { useRouter, useSearchParams } from "next/navigation";

import { USER_TEMPLATE_CODE } from "@src/config/deploy.config";
import { CI_CD_TEMPLATE_ID } from "@src/config/remote-deploy.config";
import { useLocalNotes } from "@src/context/LocalNoteProvider";
import { useSdlBuilder } from "@src/context/SdlBuilderProvider";
Expand All @@ -18,7 +19,6 @@ import { CreateLease } from "./CreateLease";
import { ManifestEdit } from "./ManifestEdit";
import { CustomizedSteppers } from "./Stepper";
import { TemplateList } from "./TemplateList";
import { USER_TEMPLATE_CODE } from "@src/config/deploy.config";

export const NewDeploymentContainer: FC = () => {
const [isGitProviderTemplate, setIsGitProviderTemplate] = useState<boolean>(false);
Expand Down Expand Up @@ -56,17 +56,14 @@ export const NewDeploymentContainer: FC = () => {
})
);
} else {
if (isGitProvider) {
setIsGitProviderTemplate(true);
} else {
setIsGitProviderTemplate(false);
}
setIsGitProviderTemplate(!!isGitProvider);
}
}, [searchParams]);

useEffect(() => {
const templateId = searchParams?.get("templateId");
const isCreating = !!activeStep && activeStep > getStepIndexByParam(RouteStep.chooseTemplate);

if (!templates || (isCreating && !!editedManifest && !!templateId)) return;

const template = getRedeployTemplate() || getGalleryTemplate() || deploySdl;
Expand All @@ -80,7 +77,9 @@ export const NewDeploymentContainer: FC = () => {
if ("config" in template && (template.config?.ssh || (!template.config?.ssh && hasComponent("ssh")))) {
toggleCmp("ssh");
}
const isRemoteYamlImage = isImageInYaml(template?.content as string, getTemplateById(CI_CD_TEMPLATE_ID)?.deploy);

const cicdTemplate = getTemplateById(CI_CD_TEMPLATE_ID);
const isRemoteYamlImage = isImageInYaml(template?.content as string, cicdTemplate?.deploy);
const queryStep = searchParams?.get("step");
if (queryStep !== RouteStep.editDeployment) {
if (isRemoteYamlImage) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2e8a193

Please sign in to comment.