mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 08:44:04 +00:00
Compare commits
15 commits
56b0f1784b
...
6d3e1fe1bf
Author | SHA1 | Date | |
---|---|---|---|
|
6d3e1fe1bf | ||
|
4228dd0a29 | ||
|
be83595a19 | ||
|
15d7f5d348 | ||
|
1db6722670 | ||
|
556d98754d | ||
|
449f68e20b | ||
|
be31cbe842 | ||
|
0fbf2f375f | ||
|
5e9d562712 | ||
|
7a4918d493 | ||
|
06a9e47f62 | ||
|
e1d47c56a5 | ||
|
dbaf84fe39 | ||
|
e897a96c17 |
9 changed files with 108 additions and 13 deletions
|
@ -15,6 +15,10 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
use12HourTimeFormat: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -22,7 +26,7 @@ export default {
|
||||||
if (this.dateOnly) {
|
if (this.dateOnly) {
|
||||||
return this.$root.date(this.value);
|
return this.$root.date(this.value);
|
||||||
} else {
|
} else {
|
||||||
return this.$root.datetime(this.value);
|
return this.$root.datetime(this.value, this.use12HourTimeFormat);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -40,6 +40,10 @@ export default {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
use12HourTimeFormat: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -64,6 +68,13 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
chartOptions() {
|
chartOptions() {
|
||||||
|
const hourTimeFormat = this.use12HourTimeFormat ? "hh" : "HH";
|
||||||
|
const minuteTimeFormat = `${hourTimeFormat}:mm${
|
||||||
|
this.use12HourTimeFormat ? " A" : ""
|
||||||
|
}`;
|
||||||
|
const tooltipFormat = `YYYY-MM-DD ${hourTimeFormat}:mm:ss${
|
||||||
|
this.use12HourTimeFormat ? " A" : ""
|
||||||
|
}`;
|
||||||
return {
|
return {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
|
@ -101,10 +112,10 @@ export default {
|
||||||
time: {
|
time: {
|
||||||
minUnit: "minute",
|
minUnit: "minute",
|
||||||
round: "second",
|
round: "second",
|
||||||
tooltipFormat: "YYYY-MM-DD HH:mm:ss",
|
tooltipFormat,
|
||||||
displayFormats: {
|
displayFormats: {
|
||||||
minute: "HH:mm",
|
minute: minuteTimeFormat,
|
||||||
hour: "MM-DD HH:mm",
|
hour: `MM-DD ${minuteTimeFormat}`,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ticks: {
|
ticks: {
|
||||||
|
|
|
@ -37,6 +37,42 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Time Format -->
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label">
|
||||||
|
{{ $t("Time Format") }}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="form-check">
|
||||||
|
<input
|
||||||
|
id="timeFormatIndex12Hour"
|
||||||
|
v-model="settings.use12HourTimeFormat"
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="timeFormatIndex"
|
||||||
|
:value="true"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="timeFormatIndex12Hour">
|
||||||
|
{{ $t("12-hour") }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input
|
||||||
|
id="timeFormatIndex24Hour"
|
||||||
|
v-model="settings.use12HourTimeFormat"
|
||||||
|
class="form-check-input"
|
||||||
|
type="radio"
|
||||||
|
name="timeFormatIndex"
|
||||||
|
:value="false"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<label class="form-check-label" for="timeFormatIndex24Hour">
|
||||||
|
{{ $t("24-hour") }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Search Engine -->
|
<!-- Search Engine -->
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label class="form-label">
|
<label class="form-label">
|
||||||
|
@ -259,6 +295,7 @@ export default {
|
||||||
*/
|
*/
|
||||||
saveGeneral() {
|
saveGeneral() {
|
||||||
localStorage.timezone = this.$root.userTimezone;
|
localStorage.timezone = this.$root.userTimezone;
|
||||||
|
this.$root.use12HourTimeFormat = this.settings.use12HourTimeFormat;
|
||||||
this.saveSettings();
|
this.saveSettings();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -909,6 +909,9 @@
|
||||||
"successEnabled": "Enabled Successfully.",
|
"successEnabled": "Enabled Successfully.",
|
||||||
"tagNotFound": "Tag not found.",
|
"tagNotFound": "Tag not found.",
|
||||||
"foundChromiumVersion": "Found Chromium/Chrome. Version: {0}",
|
"foundChromiumVersion": "Found Chromium/Chrome. Version: {0}",
|
||||||
|
"Time Format": "Time Format",
|
||||||
|
"12-hour": "12 Hour",
|
||||||
|
"24-hour": "24 Hour",
|
||||||
"Remote Browsers": "Remote Browsers",
|
"Remote Browsers": "Remote Browsers",
|
||||||
"Remote Browser": "Remote Browser",
|
"Remote Browser": "Remote Browser",
|
||||||
"Add a Remote Browser": "Add a Remote Browser",
|
"Add a Remote Browser": "Add a Remote Browser",
|
||||||
|
|
|
@ -35,10 +35,16 @@ export default {
|
||||||
/**
|
/**
|
||||||
* Return a given value in the format YYYY-MM-DD HH:mm:ss
|
* Return a given value in the format YYYY-MM-DD HH:mm:ss
|
||||||
* @param {any} value Value to format as date time
|
* @param {any} value Value to format as date time
|
||||||
|
* @param {boolean} use12HourTimeFormat Whether to use 12-hour format
|
||||||
* @returns {string} Formatted string
|
* @returns {string} Formatted string
|
||||||
*/
|
*/
|
||||||
datetime(value) {
|
datetime(value, use12HourTimeFormat = false) {
|
||||||
return this.datetimeFormat(value, "YYYY-MM-DD HH:mm:ss");
|
const hourTimeFormat = use12HourTimeFormat ? "hh" : "HH";
|
||||||
|
const timeFormat =
|
||||||
|
`YYYY-MM-DD ${hourTimeFormat}:mm:ss${
|
||||||
|
use12HourTimeFormat ? " A" : ""
|
||||||
|
}`;
|
||||||
|
return this.datetimeFormat(value, timeFormat);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
<tr v-for="(beat, index) in displayedRecords" :key="index" :class="{ 'shadow-box': $root.windowWidth <= 550}">
|
<tr v-for="(beat, index) in displayedRecords" :key="index" :class="{ 'shadow-box': $root.windowWidth <= 550}">
|
||||||
<td class="name-column"><router-link :to="`/dashboard/${beat.monitorID}`">{{ $root.monitorList[beat.monitorID]?.name }}</router-link></td>
|
<td class="name-column"><router-link :to="`/dashboard/${beat.monitorID}`">{{ $root.monitorList[beat.monitorID]?.name }}</router-link></td>
|
||||||
<td><Status :status="beat.status" /></td>
|
<td><Status :status="beat.status" /></td>
|
||||||
<td :class="{ 'border-0':! beat.msg}"><Datetime :value="beat.time" /></td>
|
<td :class="{ 'border-0':! beat.msg}"><Datetime :value="beat.time" :use12HourTimeFormat="use12HourTimeFormat" /></td>
|
||||||
<td class="border-0">{{ beat.msg }}</td>
|
<td class="border-0">{{ beat.msg }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@ -113,6 +113,7 @@ export default {
|
||||||
},
|
},
|
||||||
importantHeartBeatListLength: 0,
|
importantHeartBeatListLength: 0,
|
||||||
displayedRecords: [],
|
displayedRecords: [],
|
||||||
|
use12HourTimeFormat: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -127,6 +128,10 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.loadSettings();
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getImportantHeartbeatListLength();
|
this.getImportantHeartbeatListLength();
|
||||||
|
|
||||||
|
@ -203,6 +208,16 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves important settings values.
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
loadSettings() {
|
||||||
|
this.$root.getSocket().emit("getSettings", res => {
|
||||||
|
this.use12HourTimeFormat = res.data.use12HourTimeFormat;
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -184,7 +184,7 @@
|
||||||
<div v-if="showPingChartBox" class="shadow-box big-padding text-center ping-chart-wrapper">
|
<div v-if="showPingChartBox" class="shadow-box big-padding text-center ping-chart-wrapper">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<PingChart :monitor-id="monitor.id" />
|
<PingChart :monitor-id="monitor.id" :use12HourTimeFormat="use12HourTimeFormat" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -228,7 +228,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(beat, index) in displayedRecords" :key="index" style="padding: 10px;">
|
<tr v-for="(beat, index) in displayedRecords" :key="index" style="padding: 10px;">
|
||||||
<td><Status :status="beat.status" /></td>
|
<td><Status :status="beat.status" /></td>
|
||||||
<td :class="{ 'border-0':! beat.msg}"><Datetime :value="beat.time" /></td>
|
<td :class="{ 'border-0':! beat.msg}"><Datetime :value="beat.time" :use12HourTimeFormat="use12HourTimeFormat" /></td>
|
||||||
<td class="border-0">{{ beat.msg }}</td>
|
<td class="border-0">{{ beat.msg }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@ -328,6 +328,7 @@ export default {
|
||||||
currentExample: "javascript-fetch",
|
currentExample: "javascript-fetch",
|
||||||
code: "",
|
code: "",
|
||||||
},
|
},
|
||||||
|
use12HourTimeFormat: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -420,6 +421,10 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.loadSettings();
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getImportantHeartbeatListLength();
|
this.getImportantHeartbeatListLength();
|
||||||
|
|
||||||
|
@ -656,7 +661,14 @@ export default {
|
||||||
.replace("https://example.com/api/push/key?status=up&msg=OK&ping=", this.pushURL);
|
.replace("https://example.com/api/push/key?status=up&msg=OK&ping=", this.pushURL);
|
||||||
this.pushMonitor.code = code;
|
this.pushMonitor.code = code;
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
loadSettings() {
|
||||||
|
this.$root.getSocket().emit("getSettings", res => {
|
||||||
|
this.use12HourTimeFormat = res.data.use12HourTimeFormat || false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1443,12 +1443,15 @@ message HealthCheckResponse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set a default timeout if the monitor type has changed or if it's a new monitor
|
||||||
|
if (oldType || this.isAdd) {
|
||||||
if (this.monitor.type === "snmp") {
|
if (this.monitor.type === "snmp") {
|
||||||
// snmp is not expected to be executed via the internet => we can choose a lower default timeout
|
// snmp is not expected to be executed via the internet => we can choose a lower default timeout
|
||||||
this.monitor.timeout = 5;
|
this.monitor.timeout = 5;
|
||||||
} else {
|
} else {
|
||||||
this.monitor.timeout = 48;
|
this.monitor.timeout = 48;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set default SNMP version
|
// Set default SNMP version
|
||||||
if (!this.monitor.snmpVersion) {
|
if (!this.monitor.snmpVersion) {
|
||||||
|
|
|
@ -163,6 +163,10 @@ export default {
|
||||||
this.settings.searchEngineIndex = false;
|
this.settings.searchEngineIndex = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.settings.use12HourTimeFormat === undefined) {
|
||||||
|
this.settings.use12HourTimeFormat = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.settings.entryPage === undefined) {
|
if (this.settings.entryPage === undefined) {
|
||||||
this.settings.entryPage = "dashboard";
|
this.settings.entryPage = "dashboard";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue