mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-03-04 08:25:57 +00:00
added all functionallity for incident history
This commit is contained in:
parent
1a5a1a6e5d
commit
407468ff14
6 changed files with 103 additions and 2 deletions
BIN
db/kuma.db
BIN
db/kuma.db
Binary file not shown.
|
@ -49,7 +49,7 @@
|
||||||
"build-docker-nightly-local": "npm run build && docker build -f docker/dockerfile -t louislam/uptime-kuma:nightly2 --target nightly .",
|
"build-docker-nightly-local": "npm run build && docker build -f docker/dockerfile -t louislam/uptime-kuma:nightly2 --target nightly .",
|
||||||
"build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test2 --target pr-test2 . --push",
|
"build-docker-pr-test": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64 -t louislam/uptime-kuma:pr-test2 --target pr-test2 . --push",
|
||||||
"upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain",
|
"upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain",
|
||||||
"setup": "git checkout 1.23.13 && npm ci --production && npm run download-dist",
|
"setup": "npm ci --production && npm run download-dist",
|
||||||
"download-dist": "node extra/download-dist.js",
|
"download-dist": "node extra/download-dist.js",
|
||||||
"mark-as-nightly": "node extra/mark-as-nightly.js",
|
"mark-as-nightly": "node extra/mark-as-nightly.js",
|
||||||
"reset-password": "node extra/reset-password.js",
|
"reset-password": "node extra/reset-password.js",
|
||||||
|
|
|
@ -283,6 +283,16 @@ let needSetup = false;
|
||||||
const statusPageRouter = require("./routers/status-page-router");
|
const statusPageRouter = require("./routers/status-page-router");
|
||||||
app.use(statusPageRouter);
|
app.use(statusPageRouter);
|
||||||
|
|
||||||
|
app.get("/api/incident-reports", async (req, res) => {
|
||||||
|
try {
|
||||||
|
const incidentReports = await R.findAll("incident");
|
||||||
|
res.json(incidentReports);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
res.status(500).json({ error: "Failed to fetch incident reports" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Universal Route Handler, must be at the end of all express routes.
|
// Universal Route Handler, must be at the end of all express routes.
|
||||||
app.get("*", async (_request, response) => {
|
app.get("*", async (_request, response) => {
|
||||||
if (_request.originalUrl.startsWith("/upload/")) {
|
if (_request.originalUrl.startsWith("/upload/")) {
|
||||||
|
@ -358,7 +368,6 @@ let needSetup = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("login", async (data, callback) => {
|
socket.on("login", async (data, callback) => {
|
||||||
const clientIP = await server.getClientIP(socket);
|
const clientIP = await server.getClientIP(socket);
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,12 @@
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<router-link to="/incident-history" class="dropdown-item" :class="{ active: $route.path.includes('manage-incident-history') }">
|
||||||
|
<font-awesome-icon icon="bullhorn" /> {{ $t("Incident History") }}
|
||||||
|
</router-link>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<router-link to="/settings/general" class="dropdown-item" :class="{ active: $route.path.includes('settings') }">
|
<router-link to="/settings/general" class="dropdown-item" :class="{ active: $route.path.includes('settings') }">
|
||||||
<font-awesome-icon icon="cog" /> {{ $t("Settings") }}
|
<font-awesome-icon icon="cog" /> {{ $t("Settings") }}
|
||||||
|
|
81
src/pages/ListIncidents.vue
Normal file
81
src/pages/ListIncidents.vue
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h1>Incident Reports</h1>
|
||||||
|
<div v-if="isLoading">Loading...</div>
|
||||||
|
<div v-else-if="incidentReports.length">
|
||||||
|
<div v-for="report in incidentReports" :key="report._id">
|
||||||
|
|
||||||
|
<h3>{{ formatDate(report._createdDate) }}</h3>
|
||||||
|
<hr>
|
||||||
|
<h4>{{ report._title }}</h4>
|
||||||
|
<p>{{ report._content }}</p>
|
||||||
|
<hr><br><br>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p v-else>No incident reports found or an error occurred.</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
incidentReports: [],
|
||||||
|
isLoading: false,
|
||||||
|
error: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.fetchIncidentReports();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async fetchIncidentReports() {
|
||||||
|
this.isLoading = true;
|
||||||
|
try {
|
||||||
|
const response = await fetch("/api/incident-reports"); // Replace with your API endpoint
|
||||||
|
const data = await response.json();
|
||||||
|
this.incidentReports = data;
|
||||||
|
console.log(data);
|
||||||
|
} catch (error) {
|
||||||
|
this.error = error;
|
||||||
|
console.error("Error fetching incident reports:", error);
|
||||||
|
} finally {
|
||||||
|
this.isLoading = false;
|
||||||
|
this.filteredReports = this.incidentReports.slice(-25); // Get the last 25 reports
|
||||||
|
}
|
||||||
|
},
|
||||||
|
formatDate(dateString) { const date = new Date(dateString); return date.toLocaleDateString('en-US', { year: 'numeric',month: 'long',day: 'numeric' });
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
filteredReports() {
|
||||||
|
// You can implement additional filtering/sorting logic here
|
||||||
|
return this.incidentReports.slice(-25);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.incident-report-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px; /* Adjust gap between boxes */
|
||||||
|
}
|
||||||
|
|
||||||
|
.incident-report {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
.jumbotron {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 20px;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||||
|
margin-bottom: 20px; /* Add spacing between jumbotrons */
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
|
@ -7,6 +7,7 @@ import DashboardHome from "./pages/DashboardHome.vue";
|
||||||
import Details from "./pages/Details.vue";
|
import Details from "./pages/Details.vue";
|
||||||
import EditMonitor from "./pages/EditMonitor.vue";
|
import EditMonitor from "./pages/EditMonitor.vue";
|
||||||
import EditMaintenance from "./pages/EditMaintenance.vue";
|
import EditMaintenance from "./pages/EditMaintenance.vue";
|
||||||
|
import ListIncidents from "./pages/ListIncidents.vue";
|
||||||
import List from "./pages/List.vue";
|
import List from "./pages/List.vue";
|
||||||
const Settings = () => import("./pages/Settings.vue");
|
const Settings = () => import("./pages/Settings.vue");
|
||||||
import Setup from "./pages/Setup.vue";
|
import Setup from "./pages/Setup.vue";
|
||||||
|
@ -160,6 +161,10 @@ const routes = [
|
||||||
path: "/maintenance/edit/:id",
|
path: "/maintenance/edit/:id",
|
||||||
component: EditMaintenance,
|
component: EditMaintenance,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/incident-history",
|
||||||
|
component: ListIncidents,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Reference in a new issue