Skip to content

Commit

Permalink
Block the click on clusters button while loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Jyben committed Mar 27, 2020
1 parent 097faed commit 6a219ea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/renderer-process/world-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { ipcRenderer } = require('electron');

let ipList = [];
let spanList = [];
let isLoading = false;
const clusters = ['eu-west', 'eu-east', 'na-west', 'na-east', 'sa', 'oc', 'af', 'as'];

// Mets à jour le ping sur les boutons
Expand Down Expand Up @@ -34,7 +35,8 @@ ipcRenderer.on('update-ip-list', (event, arg) => {
});

ipcRenderer.on('spinner', (event, arg) => {
document.getElementById("loader").style.display = arg[0] === true ? 'block' : 'none';
isLoading = arg[0];
document.getElementById("loader").style.display = isLoading === true ? 'block' : 'none';
});

ipcRenderer.on('reset-worldmap-iplist', (event, arg) => {
Expand All @@ -58,6 +60,10 @@ clusters.forEach(id => {
let clusterBtn = document.getElementById(id);

clusterBtn.addEventListener('click', () => {
if (isLoading) {
return;
}

ipcRenderer.send('add-cluster-in-ip-rules', [id, ipList]);
});
});
Expand Down

0 comments on commit 6a219ea

Please sign in to comment.