Skip to content

Commit 3821fa2

Browse files
committed
feat: save state of the commit hooks
1 parent 115ac8c commit 3821fa2

5 files changed

Lines changed: 12 additions & 5 deletions

File tree

internal/api/dto/application.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ type Env struct {
66
}
77

88
type AppConfigDto struct {
9-
Name string `json:"name"`
10-
EnableTls bool `json:"enableTls"`
11-
Email string `json:"email"`
12-
PathToSource string `json:"pathToSource"`
13-
Envs []Env `json:"envs"`
9+
Name string `json:"name"`
10+
EnableTls bool `json:"enableTls"`
11+
Email string `json:"email"`
12+
PathToSource string `json:"pathToSource"`
13+
Envs []Env `json:"envs"`
14+
DeployOnCommit bool `json:"deployOnCommit"`
1415
}

internal/application/edit-deployement.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ func EditDeployement(deployService *service.DeployService, containerName string,
1111
} else {
1212
deployService.FilesystemAdapter.DeleteGitPostCommitHooks(deployService.DeployConfig.AppConfig.PathToSource)
1313
}
14+
deployService.DeployConfig.AppConfig.DeployOnCommit = editDeployDto.DeployOnCommit
15+
deployService.DatabaseAdapter.SaveState(*deployService.DeployConfig)
1416
}

web/src/components/DeploySuccess.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export default function DeploySuccess({
8787
},
8888
deployConfig.appConfig.name
8989
);
90+
fetchCurrentConfigData();
9091
} catch (e) {
9192
console.error(e);
9293
}
@@ -151,6 +152,7 @@ export default function DeploySuccess({
151152
<Checkbox
152153
id="deploy-on-commit"
153154
name="deploy-on-commit"
155+
checked={deployConfig.appConfig.deployOnCommit}
154156
onCheckedChange={(state) => {
155157
if (typeof state === "boolean") {
156158
onCheckDeployOnCommit(state);

web/src/components/forms/DeployForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export function AppConfigForm({
3838
email: null,
3939
pathToSource: deployConfig.appConfig?.pathToSource || "",
4040
envs: [{ name: "", secret: "" }],
41+
deployOnCommit: deployConfig.appConfig?.deployOnCommit || false,
4142
});
4243

4344
const handleSubmit = async (event: React.FormEvent) => {

web/src/services/postFormDetails.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type PostCreateDeploymentDto = {
1111
email: string | null;
1212
pathToSource: string;
1313
envs: Env[];
14+
deployOnCommit: boolean;
1415
};
1516

1617
export async function postFormDetails(

0 commit comments

Comments
 (0)