Merge dev into master
This commit is contained in:
+15
-2
@@ -27,6 +27,9 @@ app.get('*', (req, res, next) => {
|
|||||||
// Backend-Port fix
|
// Backend-Port fix
|
||||||
const PORT = 4001;
|
const PORT = 4001;
|
||||||
|
|
||||||
|
// Endpoint-ID aus der env
|
||||||
|
const ENDPOINT_ID = Number(process.env.PORTAINER_ENDPOINT_ID);
|
||||||
|
|
||||||
// HTTPS Agent für Self-Signed-Zertifikate
|
// HTTPS Agent für Self-Signed-Zertifikate
|
||||||
const agent = new https.Agent({ rejectUnauthorized: false });
|
const agent = new https.Agent({ rejectUnauthorized: false });
|
||||||
|
|
||||||
@@ -57,19 +60,24 @@ const broadcastRedeployStatus = (stackId, status) => {
|
|||||||
app.get('/api/stacks', async (req, res) => {
|
app.get('/api/stacks', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const stacksRes = await axiosInstance.get('/api/stacks');
|
const stacksRes = await axiosInstance.get('/api/stacks');
|
||||||
|
|
||||||
|
// Filter nach Endpoint-ID
|
||||||
|
const filteredStacks = stacksRes.data.filter(stack => stack.EndpointId === ENDPOINT_ID);
|
||||||
|
|
||||||
const stacksWithStatus = await Promise.all(
|
const stacksWithStatus = await Promise.all(
|
||||||
stacksRes.data.map(async (stack) => {
|
filteredStacks.map(async (stack) => {
|
||||||
try {
|
try {
|
||||||
const statusRes = await axiosInstance.get(
|
const statusRes = await axiosInstance.get(
|
||||||
`/api/stacks/${stack.Id}/images_status?refresh=true`
|
`/api/stacks/${stack.Id}/images_status?refresh=true`
|
||||||
);
|
);
|
||||||
let statusEmoji = statusRes.data.Status === 'outdated' ? '⚠️' : '✅';
|
const statusEmoji = statusRes.data.Status === 'outdated' ? '⚠️' : '✅';
|
||||||
return { ...stack, updateStatus: statusEmoji, redeploying: redeployingStacks[stack.Id] || false };
|
return { ...stack, updateStatus: statusEmoji, redeploying: redeployingStacks[stack.Id] || false };
|
||||||
} catch {
|
} catch {
|
||||||
return { ...stack, updateStatus: '❌', redeploying: redeployingStacks[stack.Id] || false };
|
return { ...stack, updateStatus: '❌', redeploying: redeployingStacks[stack.Id] || false };
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
stacksWithStatus.sort((a, b) => a.Name.localeCompare(b.Name));
|
stacksWithStatus.sort((a, b) => a.Name.localeCompare(b.Name));
|
||||||
res.json(stacksWithStatus);
|
res.json(stacksWithStatus);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -85,6 +93,11 @@ app.put('/api/stacks/:id/redeploy', async (req, res) => {
|
|||||||
const stackRes = await axiosInstance.get(`/api/stacks/${id}`);
|
const stackRes = await axiosInstance.get(`/api/stacks/${id}`);
|
||||||
const stack = stackRes.data;
|
const stack = stackRes.data;
|
||||||
|
|
||||||
|
// Prüfen, ob Stack zum konfigurierten Endpoint gehört
|
||||||
|
if (stack.EndpointId !== ENDPOINT_ID) {
|
||||||
|
throw new Error(`Stack gehört nicht zum Endpoint ${ENDPOINT_ID}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (stack.Type === 1) {
|
if (stack.Type === 1) {
|
||||||
await axiosInstance.put(`/api/stacks/${id}/git/redeploy?endpointId=${stack.EndpointId}`);
|
await axiosInstance.put(`/api/stacks/${id}/git/redeploy?endpointId=${stack.EndpointId}`);
|
||||||
} else if (stack.Type === 2) {
|
} else if (stack.Type === 2) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default defineConfig({
|
|||||||
port: 5173,
|
port: 5173,
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
target: "http://localhost:4001", // dein Backend
|
target: "http://127.0.0.1:4001", // dein Backend
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user