Skip to content

Commit

Permalink
Merge pull request ClickHouse#51744 from ArctypeZach/master
Browse files Browse the repository at this point in the history
Dashboard behavior fixes
  • Loading branch information
nikitamikhaylov authored Jul 5, 2023
2 parents 537c0d6 + 8fd7ae8 commit 9d7209c
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions programs/server/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
--chart-background: white;
--shadow-color: rgba(0, 0, 0, 0.25);
--input-shadow-color: rgba(0, 255, 0, 1);
--error-color: white;
--error-color: red;
--auth-error-color: white;
--legend-background: rgba(255, 255, 255, 0.75);
--title-color: #666;
--text-color: black;
Expand Down Expand Up @@ -258,7 +259,7 @@
width: 60%;
padding: .5rem;

color: var(--error-color);
color: var(--auth-error-color);

display: flex;
flex-flow: row nowrap;
Expand Down Expand Up @@ -906,9 +907,9 @@

if (error) {
const errorMatch = errorMessages.find(({ regex }) => error.match(regex))
if (errorMatch) {
const match = error.match(errorMatch.regex)
const message = errorMatch.messageFunc(match)
const match = error.match(errorMatch.regex)
const message = errorMatch.messageFunc(match)
if (message) {
const authError = new Error(message)
throw authError
}
Expand All @@ -930,7 +931,7 @@
let title_div = chart.querySelector('.title');
if (error) {
error_div.firstChild.data = error;
title_div.style.display = 'none';
title_div.style.display = 'none';
error_div.style.display = 'block';
return false;
} else {
Expand Down Expand Up @@ -1019,13 +1020,15 @@
firstLoad = false;
} else {
enableReloadButton();
enableRunButton();
}
if (!results.includes(false)) {
if (results.includes(true)) {
const element = document.querySelector('.inputs');
element.classList.remove('unconnected');
const add = document.querySelector('#add');
add.style.display = 'block';
} else {
}
else {
const charts = document.querySelector('#charts')
charts.style.height = '0px';
}
Expand All @@ -1050,18 +1053,33 @@
reloadButton.classList.add('disabled')
}

function disableRunButton() {
const runButton = document.getElementById('run')
runButton.value = 'Reloading...'
runButton.disabled = true
runButton.classList.add('disabled')
}

function enableReloadButton() {
const reloadButton = document.getElementById('reload')
reloadButton.value = 'Reload'
reloadButton.disabled = false
reloadButton.classList.remove('disabled')
}

function enableRunButton() {
const runButton = document.getElementById('run')
runButton.value = 'Ok'
runButton.disabled = false
runButton.classList.remove('disabled')
}

function reloadAll() {
updateParams();
drawAll();
saveState();
disableReloadButton()
disableReloadButton();
disableRunButton();
}

document.getElementById('params').onsubmit = function(event) {
Expand Down

0 comments on commit 9d7209c

Please sign in to comment.