Skip to content

Commit

Permalink
fix(deployment): git template fetch in deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
HoomanDgtl authored Nov 21, 2024
1 parent 8cfa399 commit 094aaf4
Showing 1 changed file with 6 additions and 7 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

0 comments on commit 094aaf4

Please sign in to comment.