Fix require-v-for-key, remove unused declarations and double spaces

This commit is contained in:
Adam Stachowicz 2021-07-18 03:10:15 +02:00
parent 78f5d2cd8b
commit d94894b7e0
10 changed files with 26 additions and 31 deletions

View file

@ -3,8 +3,6 @@ const utc = require('dayjs/plugin/utc')
var timezone = require('dayjs/plugin/timezone')
dayjs.extend(utc)
dayjs.extend(timezone)
const axios = require("axios");
const {R} = require("redbean-node");
const {BeanModel} = require("redbean-node/dist/bean-model");

View file

@ -58,7 +58,7 @@ class Notification {
finalData = data;
}
let res = await axios.post(notification.webhookURL, finalData, config)
await axios.post(notification.webhookURL, finalData, config)
return true;
} catch (error) {
console.log(error)
@ -102,7 +102,8 @@ class Notification {
]
}]
}
let res = await axios.post(notification.discordWebhookUrl, data)
await axios.post(notification.discordWebhookUrl, data)
return true;
} catch(error) {
console.log(error)
@ -118,7 +119,7 @@ class Notification {
};
let config = {};
let res = await axios.post(notification.signalURL, data, config)
await axios.post(notification.signalURL, data, config)
return true;
} catch (error) {
console.log(error)
@ -129,7 +130,7 @@ class Notification {
try {
if (heartbeatJSON == null) {
let data = {'text': "Uptime Kuma Slack testing successful."}
let res = await axios.post(notification.slackwebhookURL, data)
await axios.post(notification.slackwebhookURL, data)
return true;
}
@ -170,7 +171,7 @@ class Notification {
}
]
}
let res = await axios.post(notification.slackwebhookURL, data)
await axios.post(notification.slackwebhookURL, data)
return true;
} catch (error) {
console.log(error)
@ -231,7 +232,7 @@ class Notification {
});
// send mail with defined transport object
let info = await transporter.sendMail({
await transporter.sendMail({
from: `"Uptime Kuma" <${notification.smtpFrom}>`,
to: notification.smtpTo,
subject: msg,

View file

@ -162,10 +162,6 @@ let needSetup = false;
msg: e.message
});
}
});
// Auth Only API

View file

@ -13,7 +13,7 @@
No Monitors, please <router-link to="/add">add one</router-link>.
</div>
<router-link :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }" v-for="item in sortedMonitorList" @click="$root.cancelActiveList">
<router-link :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }" v-for="(item, index) in sortedMonitorList" @click="$root.cancelActiveList" :key="index">
<div class="row">
<div class="col-6 col-md-8 small-padding">

View file

@ -61,7 +61,7 @@
<h2>Notifications</h2>
<p v-if="$root.notificationList.length === 0">Not available, please setup.</p>
<div class="form-check form-switch mb-3" v-for="notification in $root.notificationList">
<div class="form-check form-switch mb-3" v-for="(notification, index) in $root.notificationList" :key="index">
<input class="form-check-input" type="checkbox" :id=" 'notification' + notification.id" v-model="monitor.notificationIDList[notification.id]">
<label class="form-check-label" :for=" 'notification' + notification.id">

View file

@ -11,7 +11,7 @@
<label for="timezone" class="form-label">Timezone</label>
<select class="form-select" id="timezone" v-model="$root.userTimezone">
<option value="auto">Auto: {{ guessTimezone }}</option>
<option v-for="timezone in timezoneList" :value="timezone.value">{{ timezone.name }}</option>
<option v-for="(timezone, index) in timezoneList" :value="timezone.value" :key="index">{{ timezone.name }}</option>
</select>
</div>
@ -59,7 +59,7 @@
<p v-else>Please assign the notification to monitor(s) to get it works.</p>
<ul class="list-group mb-3" style="border-radius: 1rem;">
<li class="list-group-item" v-for="notification in $root.notificationList">
<li class="list-group-item" v-for="(notification, index) in $root.notificationList" :key="index">
{{ notification.name }}<br />
<a href="#" @click="$refs.notificationDialog.show(notification.id)">Edit</a>
</li>

View file

@ -29,6 +29,7 @@ function getTimezoneOffset(timeZone) {
}
// From: https://stackoverflow.com/questions/38399465/how-to-get-list-of-all-timezones-in-javascript
// TODO: Move to separate file
const aryIannaTimeZones = [
'Europe/Andorra',
'Asia/Dubai',
@ -412,4 +413,3 @@ export function timezoneList() {
return result;
};