Skip to content

Commit

Permalink
Merge pull request #21 from PilatusDevs/hotfix/refactoring-and-prepar…
Browse files Browse the repository at this point in the history
…e-for-release

Hotfix/refactoring and prepare for release
  • Loading branch information
Jelmerro authored Jul 6, 2018
2 parents ebd3040 + 7cd1f38 commit 7c135f7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions components/monitoring/os/os.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
margin-left: auto;
font-size: 25px;
color: #777;
cursor: not-allowed;
animation: spin 1s infinite;
}
#loading {
Expand Down
17 changes: 10 additions & 7 deletions components/monitoring/os/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@ let osData = si.osInfo();
let versionData = si.versions();
let userData = si.users();
let programData = plistr.getProgs();
let isRefreshing = true;
let isLoading = true;

function updateAndRefreshData() {
if (isRefreshing) {
function refreshData() {
if (isLoading) {
return;
}
document.querySelector("#search-field").value = "";
searchPrograms();
isRefreshing = true;
isLoading = true;
const refreshButton = document.querySelector("#os-program-refresh-button");
refreshButton.style.color = "";
refreshButton.style.animation = "";
refreshButton.style.cursor = "";
document.querySelector("#table-head").style.display = "none";
$("#programs-container").empty();
$("#loading").show();
Expand All @@ -55,7 +56,7 @@ function initOs() {
insertData();
const refreshButton = document.querySelector("#os-program-refresh-button");
refreshButton.onclick = () => {
updateAndRefreshData();
refreshData();
};
const searchField = document.querySelector("#search-field");
searchField.onkeyup = () => {
Expand Down Expand Up @@ -85,15 +86,17 @@ function insertData() {
$("#programs-container").html(programHtml(data));
refreshButton.style.color = "#000";
refreshButton.style.animation = "none";
isRefreshing = false;
refreshButton.style.cursor = "pointer";
isLoading = false;
})
.catch(error => {
$("#loading").hide();
document.querySelector("#table-head").style.display = "";
$("#programs-container").html(error);
refreshButton.style.color = "#000";
refreshButton.style.animation = "none";
isRefreshing = false;
refreshButton.style.cursor = "pointer";
isLoading = false;
});
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "statuspilatus",
"version": "0.1.0",
"version": "0.2.0",
"description": "Monitor your PC like never before!",
"main": "app/index.js",
"build": {
Expand Down

0 comments on commit 7c135f7

Please sign in to comment.