-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLODIC-GUI.js
68 lines (63 loc) · 1.85 KB
/
LODIC-GUI.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* JavaScript Document */
/** This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* @author jmacura 2020 */
/**
* Displays button for a following action.
*
*/
function showNextButton() {
if ($('#button-query').css('visibility') === 'hidden') {
$('#button-query').css('visibility', 'visible')
} else if ($('#button-save').css('visibility') === 'hidden') {
$('#filename').css('visibility', 'visible')
$('#button-save').css('visibility', 'visible')
}
}
/**
* Adds an info text to the log.
*
* @param {String} infoMsg Information which should be displayed to the user
*/
function showInfo(infoMsg) {
showMessage(infoMsg, 'info');
}
/**
* Adds a warning text to the log.
*
* @param {String} warnMsg Warning which should be displayed to the user
*/
function showWarning(warnMsg) {
showMessage(warnMsg, 'warn');
}
/**
* Adds an error text to the log.
*
* @param {String} errorMsg Error message which should be displayed to the user
*/
function showError(errorMsg) {
showMessage(errorMsg, 'error');
}
/**
* Private function to be used by specific logging functions.
* Updates information block element.
*
* @private
* @param {String} message Message which should be appended to the log
* @param {String} type One of 'error', 'warn', 'info'
*/
function showMessage(message, type) {
var color;
switch (type) {
case 'info': color = '#11dd11'; break;
case 'warn': color = '#eeee99'; break;
case 'error': color = '#ee1111'; break;
default: break;
}
var $msg = $(`<p> ${message}</p>`).css('border-color', color);
var infoBlock = $('#info-block');
//infoBlock.empty(); //remove existing information
infoBlock.find('p').css('border-color', '#777777');
infoBlock.prepend($msg); //add new information
}