Merge dev

This commit is contained in:
Alex Ling 2022-08-19 12:12:45 +00:00
parent f8c569f204
commit 5bdeca94fe

View File

@ -13,7 +13,7 @@ const component = () => {
if (!data.success) throw new Error(data.error);
this.plugins = data.plugins;
let pid = localStorage.getItem("plugin");
let pid = localStorage.getItem('plugin');
if (!pid || !this.plugins.find((p) => p.id === pid)) {
pid = this.plugins[0].id;
}
@ -22,27 +22,22 @@ const component = () => {
this.list(pid);
})
.catch((e) => {
alert(
"danger",
`Failed to list the available plugins. Error: ${e}`
);
alert('danger', `Failed to list the available plugins. Error: ${e}`);
});
},
pluginChanged() {
localStorage.setItem("plugin", this.pid);
localStorage.setItem('plugin', this.pid);
this.list(this.pid);
},
list(pid) {
if (!pid) return;
fetch(
`${base_url}api/admin/plugin/subscriptions?${new URLSearchParams(
{
`${base_url}api/admin/plugin/subscriptions?${new URLSearchParams({
plugin: pid,
}
)}`,
})}`,
{
method: "GET",
}
method: 'GET',
},
)
.then((response) => response.json())
.then((data) => {
@ -50,10 +45,7 @@ const component = () => {
this.subscriptions = data.subscriptions;
})
.catch((e) => {
alert(
"danger",
`Failed to list subscriptions. Error: ${e}`
);
alert('danger', `Failed to list subscriptions. Error: ${e}`);
});
},
renderStrCell(str) {
@ -61,7 +53,7 @@ const component = () => {
if (str.length > maxLength)
return `<td><span>${str.substring(
0,
maxLength
maxLength,
)}...</span><div uk-dropdown>${str}</div></td>`;
return `<td>${str}</td>`;
},
@ -71,7 +63,7 @@ const component = () => {
.humanize(true)}</td>`;
},
selected(event, modal) {
const id = event.currentTarget.getAttribute("sid");
const id = event.currentTarget.getAttribute('sid');
this.subscription = this.subscriptions.find((s) => s.id === id);
UIkit.modal(modal).show();
},
@ -79,17 +71,17 @@ const component = () => {
const key = ft.key;
let type = ft.type;
switch (type) {
case "number-min":
type = "number (minimum value)";
case 'number-min':
type = 'number (minimum value)';
break;
case "number-max":
type = "number (maximum value)";
case 'number-max':
type = 'number (maximum value)';
break;
case "date-min":
type = "minimum date";
case 'date-min':
type = 'minimum date';
break;
case "date-max":
type = "maximum date";
case 'date-max':
type = 'maximum date';
break;
}
let value = ft.value;