Update method for deleting deployment
This commit is contained in:
parent
bf75dc8acc
commit
55e238d0b9
@ -465,8 +465,6 @@ export class Database {
|
||||
id: organizationId
|
||||
});
|
||||
|
||||
newProject.subDomain = `${newProject.name}.${this.projectDomain}`;
|
||||
|
||||
return projectRepository.save(newProject);
|
||||
}
|
||||
|
||||
|
@ -138,6 +138,9 @@ export class Deployment {
|
||||
@Column('boolean', { default: false })
|
||||
isCurrent!: boolean;
|
||||
|
||||
@Column('varchar', { nullable: true })
|
||||
baseDomain!: string | null;
|
||||
|
||||
@Column({
|
||||
enum: DeploymentStatus
|
||||
})
|
||||
|
@ -67,8 +67,8 @@ export class Project {
|
||||
@Column('varchar')
|
||||
icon!: string;
|
||||
|
||||
@Column('varchar')
|
||||
subDomain!: string;
|
||||
@Column('varchar', { nullable: true })
|
||||
baseDomains!: string[] | null;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt!: Date;
|
||||
|
@ -194,7 +194,6 @@ export class Registry {
|
||||
})
|
||||
).data.html_url;
|
||||
|
||||
// TODO: Set environment variables for each deployment (environment variables can't be set in application record)
|
||||
const { applicationRecordId } =
|
||||
await this.createApplicationRecord({
|
||||
appName: repo,
|
||||
@ -421,6 +420,7 @@ export class Registry {
|
||||
|
||||
async createApplicationDeploymentRemovalRequest (data: {
|
||||
deploymentId: string;
|
||||
deployerLrn: string;
|
||||
}): Promise<{
|
||||
applicationDeploymentRemovalRequestId: string;
|
||||
applicationDeploymentRemovalRequestData: ApplicationDeploymentRemovalRequest;
|
||||
@ -428,7 +428,8 @@ export class Registry {
|
||||
const applicationDeploymentRemovalRequest = {
|
||||
type: APP_DEPLOYMENT_REMOVAL_REQUEST_TYPE,
|
||||
version: '1.0.0',
|
||||
deployment: data.deploymentId
|
||||
deployment: data.deploymentId,
|
||||
deployer: data.deployerLrn
|
||||
};
|
||||
|
||||
const fee = parseGasAndFees(this.registryConfig.fee.gas, this.registryConfig.fee.fees);
|
||||
|
@ -83,7 +83,7 @@ type Project {
|
||||
updatedAt: String!
|
||||
organization: Organization!
|
||||
icon: String
|
||||
subDomain: String
|
||||
baseDomains: [String!]
|
||||
}
|
||||
|
||||
type ProjectMember {
|
||||
@ -105,6 +105,7 @@ type Deployment {
|
||||
environment: Environment!
|
||||
deployerLrn: String
|
||||
isCurrent: Boolean!
|
||||
baseDomain: String
|
||||
status: DeploymentStatus!
|
||||
createdAt: String!
|
||||
updatedAt: String!
|
||||
|
@ -210,10 +210,21 @@ export class Service {
|
||||
applicationDeploymentRecordId: record.id,
|
||||
applicationDeploymentRecordData: record.attributes,
|
||||
url: record.attributes.url,
|
||||
baseDomain,
|
||||
status: DeploymentStatus.Ready,
|
||||
isCurrent: deployment.environment === Environment.Production,
|
||||
});
|
||||
|
||||
const baseDomains = project.baseDomains || [];
|
||||
|
||||
if (!baseDomains.includes(baseDomain)) {
|
||||
baseDomains.push(baseDomain);
|
||||
}
|
||||
|
||||
await this.db.updateProjectById(project.id, {
|
||||
baseDomains
|
||||
})
|
||||
|
||||
log(
|
||||
`Updated deployment ${deployment.id} with URL ${record.attributes.url}`,
|
||||
);
|
||||
@ -1113,7 +1124,7 @@ export class Service {
|
||||
if (deployment && deployment.applicationDeploymentRecordId) {
|
||||
// If deployment is current, remove deployment for project subdomain as well
|
||||
if (deployment.isCurrent) {
|
||||
const currentDeploymentURL = `https://${deployment.project.subDomain}`;
|
||||
const currentDeploymentURL = `https://${(deployment.project.name).toLowerCase()}.${deployment.baseDomain}`;
|
||||
|
||||
const deploymentRecords =
|
||||
await this.registry.getDeploymentRecordsByFilter({
|
||||
@ -1131,12 +1142,14 @@ export class Service {
|
||||
|
||||
await this.registry.createApplicationDeploymentRemovalRequest({
|
||||
deploymentId: deploymentRecords[0].id,
|
||||
deployerLrn: deployment.deployerLrn
|
||||
});
|
||||
}
|
||||
|
||||
const result =
|
||||
await this.registry.createApplicationDeploymentRemovalRequest({
|
||||
deploymentId: deployment.applicationDeploymentRecordId,
|
||||
deployerLrn: deployment.deployerLrn
|
||||
});
|
||||
|
||||
await this.db.updateDeploymentById(deployment.id, {
|
||||
|
@ -73,7 +73,7 @@ async function main() {
|
||||
|
||||
// Remove deployment for project subdomain if deployment is for production environment
|
||||
if (deployment.environment === Environment.Production) {
|
||||
applicationDeploymentRecord.url = `https://${deployment.project.subDomain}`
|
||||
applicationDeploymentRecord.url = `https://${deployment.project.name}.${deployment.baseDomain}`;
|
||||
|
||||
await registry.setRecord(
|
||||
{
|
||||
|
@ -5,7 +5,6 @@ import { Badge } from 'components/shared/Badge';
|
||||
import { Button } from 'components/shared/Button';
|
||||
import {
|
||||
ArrowLeftCircleFilledIcon,
|
||||
LinkChainIcon,
|
||||
QuestionMarkRoundFilledIcon,
|
||||
} from 'components/shared/CustomIcon';
|
||||
import { Heading } from 'components/shared/Heading';
|
||||
@ -55,22 +54,6 @@ const Id = () => {
|
||||
<Heading as="h3" className="font-medium text-xl">
|
||||
{isAuction? 'Project created successfully.' : 'Project deployed successfully.'}
|
||||
</Heading>
|
||||
{!isAuction && (
|
||||
<p className="flex flex-col items-center lg:flex-row font-sans gap-0.5 lg:gap-2 text-sm text-elements-high-em">
|
||||
Your project has been deployed at{' '}
|
||||
<Button
|
||||
className="no-underline text-elements-link"
|
||||
// TODO: use dynamic value
|
||||
href={project ? `https://${project.subDomain}` : ''}
|
||||
as="a"
|
||||
variant="link-emphasized"
|
||||
external
|
||||
leftIcon={<LinkChainIcon />}
|
||||
>
|
||||
{project.subDomain}
|
||||
</Button>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Card */}
|
||||
|
@ -129,12 +129,15 @@ const OverviewTabPanel = () => {
|
||||
<Heading className="text-lg leading-6 font-medium truncate">
|
||||
{project.name}
|
||||
</Heading>
|
||||
{project.baseDomains && project.baseDomains.length > 0 && project.baseDomains.map((baseDomain, index) => (
|
||||
<a
|
||||
href={`https://${project.subDomain}`}
|
||||
key={index}
|
||||
href={`https://${project.name}.${baseDomain}`}
|
||||
className="text-sm text-elements-low-em tracking-tight truncate"
|
||||
>
|
||||
{project.subDomain}
|
||||
{baseDomain}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<OverviewInfo label="Domain" icon={<GlobeIcon />}>
|
||||
|
@ -102,7 +102,7 @@ export const deployment0: Deployment = {
|
||||
domain: domain0,
|
||||
commitMessage: 'Commit Message',
|
||||
createdBy: user,
|
||||
deployerLrn: 'lrn://deepstack-test4/deployers/webapp-deployer-api.test4.wireitin.com',
|
||||
deployerLrn: 'lrn://deployer.apps.snowballtools.com ',
|
||||
};
|
||||
|
||||
export const project: Project = {
|
||||
@ -121,8 +121,8 @@ export const project: Project = {
|
||||
template: 'Template',
|
||||
members: [member],
|
||||
auctionId: '7553538436710373822151221341b43f577e07b0525d083cc9b2de98890138a1',
|
||||
deployerLrns: ['lrn://deepstack-test4/deployers/webapp-deployer-api.test4.wireitin.com', 'lrn://wireitin/deployers/webapp-deployer-api.wireitin.com'],
|
||||
deployerLrns: ['lrn://deployer.apps.snowballtools.com '],
|
||||
webhooks: ['beepboop'],
|
||||
icon: 'Icon',
|
||||
subDomain: 'SubDomain',
|
||||
baseDomains: ['baseDomain'],
|
||||
};
|
||||
|
3
packages/gql-client/dist/index.d.mts
vendored
3
packages/gql-client/dist/index.d.mts
vendored
@ -94,6 +94,7 @@ type Deployment = {
|
||||
deployerLrn: string;
|
||||
environment: Environment;
|
||||
isCurrent: boolean;
|
||||
baseDomain?: string;
|
||||
status: DeploymentStatus;
|
||||
createdBy: User;
|
||||
createdAt: string;
|
||||
@ -158,7 +159,7 @@ type Project = {
|
||||
updatedAt: string;
|
||||
organization: Organization;
|
||||
icon: string;
|
||||
subDomain: string;
|
||||
baseDomains?: string[] | null;
|
||||
};
|
||||
type GetProjectMembersResponse = {
|
||||
projectMembers: ProjectMember[];
|
||||
|
3
packages/gql-client/dist/index.d.ts
vendored
3
packages/gql-client/dist/index.d.ts
vendored
@ -94,6 +94,7 @@ type Deployment = {
|
||||
deployerLrn: string;
|
||||
environment: Environment;
|
||||
isCurrent: boolean;
|
||||
baseDomain?: string;
|
||||
status: DeploymentStatus;
|
||||
createdBy: User;
|
||||
createdAt: string;
|
||||
@ -158,7 +159,7 @@ type Project = {
|
||||
updatedAt: string;
|
||||
organization: Organization;
|
||||
icon: string;
|
||||
subDomain: string;
|
||||
baseDomains?: string[] | null;
|
||||
};
|
||||
type GetProjectMembersResponse = {
|
||||
projectMembers: ProjectMember[];
|
||||
|
7
packages/gql-client/dist/index.js
vendored
7
packages/gql-client/dist/index.js
vendored
@ -83,7 +83,7 @@ query ($projectId: String!) {
|
||||
repository
|
||||
webhooks
|
||||
icon
|
||||
subDomain
|
||||
baseDomains
|
||||
organization {
|
||||
id
|
||||
name
|
||||
@ -97,6 +97,7 @@ query ($projectId: String!) {
|
||||
id
|
||||
branch
|
||||
isCurrent
|
||||
baseDomain
|
||||
status
|
||||
updatedAt
|
||||
commitHash
|
||||
@ -133,11 +134,12 @@ query ($organizationSlug: String!) {
|
||||
repository
|
||||
updatedAt
|
||||
icon
|
||||
subDomain
|
||||
baseDomains
|
||||
deployments {
|
||||
id
|
||||
branch
|
||||
isCurrent
|
||||
baseDomain
|
||||
status
|
||||
updatedAt
|
||||
commitHash
|
||||
@ -186,6 +188,7 @@ query ($projectId: String!) {
|
||||
deployerLrn
|
||||
environment
|
||||
isCurrent
|
||||
baseDomain
|
||||
status
|
||||
createdAt
|
||||
updatedAt
|
||||
|
2
packages/gql-client/dist/index.js.map
vendored
2
packages/gql-client/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
7
packages/gql-client/dist/index.mjs
vendored
7
packages/gql-client/dist/index.mjs
vendored
@ -55,7 +55,7 @@ query ($projectId: String!) {
|
||||
repository
|
||||
webhooks
|
||||
icon
|
||||
subDomain
|
||||
baseDomains
|
||||
organization {
|
||||
id
|
||||
name
|
||||
@ -69,6 +69,7 @@ query ($projectId: String!) {
|
||||
id
|
||||
branch
|
||||
isCurrent
|
||||
baseDomain
|
||||
status
|
||||
updatedAt
|
||||
commitHash
|
||||
@ -105,11 +106,12 @@ query ($organizationSlug: String!) {
|
||||
repository
|
||||
updatedAt
|
||||
icon
|
||||
subDomain
|
||||
baseDomains
|
||||
deployments {
|
||||
id
|
||||
branch
|
||||
isCurrent
|
||||
baseDomain
|
||||
status
|
||||
updatedAt
|
||||
commitHash
|
||||
@ -158,6 +160,7 @@ query ($projectId: String!) {
|
||||
deployerLrn
|
||||
environment
|
||||
isCurrent
|
||||
baseDomain
|
||||
status
|
||||
createdAt
|
||||
updatedAt
|
||||
|
2
packages/gql-client/dist/index.mjs.map
vendored
2
packages/gql-client/dist/index.mjs.map
vendored
File diff suppressed because one or more lines are too long
@ -29,7 +29,7 @@ query ($projectId: String!) {
|
||||
repository
|
||||
webhooks
|
||||
icon
|
||||
subDomain
|
||||
baseDomains
|
||||
organization {
|
||||
id
|
||||
name
|
||||
@ -43,6 +43,7 @@ query ($projectId: String!) {
|
||||
id
|
||||
branch
|
||||
isCurrent
|
||||
baseDomain
|
||||
status
|
||||
updatedAt
|
||||
commitHash
|
||||
@ -80,11 +81,12 @@ query ($organizationSlug: String!) {
|
||||
repository
|
||||
updatedAt
|
||||
icon
|
||||
subDomain
|
||||
baseDomains
|
||||
deployments {
|
||||
id
|
||||
branch
|
||||
isCurrent
|
||||
baseDomain
|
||||
status
|
||||
updatedAt
|
||||
commitHash
|
||||
@ -135,6 +137,7 @@ query ($projectId: String!) {
|
||||
deployerLrn
|
||||
environment
|
||||
isCurrent
|
||||
baseDomain
|
||||
status
|
||||
createdAt
|
||||
updatedAt
|
||||
|
@ -108,6 +108,7 @@ export type Deployment = {
|
||||
deployerLrn: string;
|
||||
environment: Environment;
|
||||
isCurrent: boolean;
|
||||
baseDomain?: string;
|
||||
status: DeploymentStatus;
|
||||
createdBy: User;
|
||||
createdAt: string;
|
||||
@ -177,7 +178,7 @@ export type Project = {
|
||||
updatedAt: string;
|
||||
organization: Organization;
|
||||
icon: string;
|
||||
subDomain: string;
|
||||
baseDomains?: string[] | null;
|
||||
};
|
||||
|
||||
export type GetProjectMembersResponse = {
|
||||
|
Loading…
Reference in New Issue
Block a user