Enable the deploy button when LRN is provided

This commit is contained in:
Neeraj 2024-10-18 12:12:28 +05:30 committed by IshaVenikar
parent 1b2d49c2e9
commit f61a447515
3 changed files with 23 additions and 12 deletions

View File

@ -87,6 +87,14 @@ const DeploymentDetailsCard = ({
}
};
const fetchDeploymentLogs = useCallback(async () => {
let url = `${deployment.deployer.deployerApiUrl}/log/${deployment.applicationDeploymentRequestId}`;
const res = await fetch(url);
const logs = await res.text();
setDeploymentLogs(logs);
handleOpenDialog();
}, [deployment.deployer.deployerApiUrl, deployment.applicationDeploymentRequestId, handleOpenDialog]);
const renderDeploymentStatus = useCallback(
(className?: string) => {
return (
@ -95,14 +103,7 @@ const DeploymentDetailsCard = ({
leftIcon={getIconByDeploymentStatus(deployment.status)}
size="xs"
type={STATUS_COLORS[deployment.status] ?? 'neutral'}
onClick={async()=> {
let url = `${deployment.deployer.deployerApiUrl}/log/${deployment.applicationDeploymentRequestId}`
const res = await fetch(url);
const logs = await res.text()
// console.log(">>>>RESPONSE",await res.text())
setDeploymentLogs(logs)
handleOpenDialog()
}}
onClick={fetchDeploymentLogs}
>
{deployment.status}
</Tag>

View File

@ -36,7 +36,11 @@ const deployment: Deployment = {
url: 'https://deploy1.example.com',
environment: Environment.Production,
isCurrent: true,
deployerLrn: 'lrn://example/deployers/webapp-deployer-api.test.com',
deployer: {
deployerApiUrl: 'https://webapp-deployer-api.example.com',
deployerId: 'bafyreicrtgmkir4evvvysxdqxddf2ftdq2wrzuodgvwnxr4rmubi4obdfu',
deployerLrn:'lrn://example/deployers/webapp-deployer-api.example.com'
},
status: DeploymentStatus.Ready,
createdBy: {
id: 'user1',
@ -49,6 +53,7 @@ const deployment: Deployment = {
},
createdAt: '1677676800', // 2023-03-01T12:00:00Z
updatedAt: '1677680400', // 2023-03-01T13:00:00Z
applicationDeploymentRequestId: 'bafyreiaycvq6imoppnpwdve4smj6t6ql5svt5zl3x6rimu4qwyzgjorize',
};
const domains: Domain[] = [

View File

@ -102,7 +102,12 @@ export const deployment0: Deployment = {
domain: domain0,
commitMessage: 'Commit Message',
createdBy: user,
deployerLrn: 'lrn://deployer.apps.snowballtools.com ',
deployer: {
deployerApiUrl: 'https://webapp-deployer-api.example.com',
deployerId: 'bafyreicrtgmkir4evvvysxdqxddf2ftdq2wrzuodgvwnxr4rmubi4obdfu',
deployerLrn:'lrn://deployer.apps.snowballtools.com '
},
applicationDeploymentRequestId: 'bafyreiaycvq6imoppnpwdve4smj6t6ql5svt5zl3x6rimu4qwyzgjorize',
};
export const project: Project = {