Add reload button to service context menu
This commit is contained in:
parent
37931f7351
commit
6615f59af7
@ -43,7 +43,7 @@
|
|||||||
const icons = [];
|
const icons = [];
|
||||||
|
|
||||||
let services = [];
|
let services = [];
|
||||||
let selectedService = 0;
|
let selectedService = null;
|
||||||
let forwardButton;
|
let forwardButton;
|
||||||
let backButton;
|
let backButton;
|
||||||
let addButton;
|
let addButton;
|
||||||
@ -51,6 +51,11 @@
|
|||||||
|
|
||||||
// Service context menu
|
// Service context menu
|
||||||
const serviceContextMenu = new Menu();
|
const serviceContextMenu = new Menu();
|
||||||
|
serviceContextMenu.append(new MenuItem({
|
||||||
|
label: 'Reload', click: () => {
|
||||||
|
reloadService(serviceContextMenu.serviceId);
|
||||||
|
}
|
||||||
|
}));
|
||||||
serviceContextMenu.append(new MenuItem({
|
serviceContextMenu.append(new MenuItem({
|
||||||
label: 'Close', click: () => {
|
label: 'Close', click: () => {
|
||||||
unloadService(serviceContextMenu.serviceId);
|
unloadService(serviceContextMenu.serviceId);
|
||||||
@ -267,6 +272,10 @@
|
|||||||
updateNavigation();
|
updateNavigation();
|
||||||
service.li.classList.add('loaded');
|
service.li.classList.add('loaded');
|
||||||
service.viewReady = true;
|
service.viewReady = true;
|
||||||
|
|
||||||
|
if (selectedService === null) {
|
||||||
|
setActiveService(serviceId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load favicon
|
// Load favicon
|
||||||
@ -311,6 +320,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reloadService(serviceId) {
|
||||||
|
const service = services[serviceId];
|
||||||
|
if (service.view && service.viewReady) {
|
||||||
|
document.querySelector('#services > .loader').classList.remove('hidden');
|
||||||
|
service.view.reload();
|
||||||
|
} else if (!service.view && !service.viewReady) {
|
||||||
|
loadService(serviceId, service);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateNavigation() {
|
function updateNavigation() {
|
||||||
console.debug('Updating navigation');
|
console.debug('Updating navigation');
|
||||||
// Update active list element
|
// Update active list element
|
||||||
|
Loading…
Reference in New Issue
Block a user