-
-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
441 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { DockgeServer } from "../dockge-server"; | ||
import { log } from "../log"; | ||
import { Router } from "../router"; | ||
import express, { Express, Router as ExpressRouter } from "express"; | ||
import { Stack } from "../stack"; | ||
|
||
export class WebhookRouter extends Router { | ||
create(app: Express, server: DockgeServer): ExpressRouter { | ||
const router = express.Router(); | ||
|
||
router.get("/webhook/update/:stackname", async (req, res, _next) => { | ||
try { | ||
const stackname = req.params.stackname; | ||
|
||
log.info("router", `Webhook received for stack: ${stackname}`); | ||
const stack = await Stack.getStack(server, stackname); | ||
if (!stack) { | ||
log.error("router", `Stack not found: ${stackname}`); | ||
res.status(404).json({ message: `Stack not found: ${stackname}` }); | ||
return; | ||
} | ||
await stack.update(undefined); | ||
|
||
// Send a response | ||
res.json({ message: `Updated stack: ${stackname}` }); | ||
|
||
} catch (error) { | ||
_next(error); | ||
} | ||
}); | ||
|
||
return router; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<div> | ||
<form class="my-4" autocomplete="off" @submit.prevent="saveGitOps"> | ||
<!-- Enable Auto Updates --> | ||
<div class="mb-4"> | ||
<label class="form-label" for="gitAutoUpdate"> | ||
{{ $t("gitAutoUpdate") }} | ||
</label> | ||
|
||
<div class="form-check form-switch my-3"> | ||
<input id="git-auto-update" v-model="settings.gitAutoUpdate" class="form-check-input" type="checkbox"> | ||
<label class="form-check-label"> | ||
{{ $t("enableAutoUpdate") }} | ||
</label> | ||
</div> | ||
|
||
<div class="form-text"></div> | ||
</div> | ||
|
||
<!-- Save Button --> | ||
<div> | ||
<button class="btn btn-primary" type="submit"> | ||
{{ $t("Save") }} | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data() { | ||
return {}; | ||
}, | ||
computed: { | ||
settings() { | ||
return this.$parent.$parent.$parent.settings; | ||
}, | ||
saveSettings() { | ||
return this.$parent.$parent.$parent.saveSettings; | ||
} | ||
}, | ||
methods: { | ||
/** Save the settings */ | ||
saveGitOps() { | ||
this.saveSettings(); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
<style scoped lang="scss"> | ||
@import "../../styles/vars.scss"; | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.