Change naming and veriy test-scheduler function
[bottlenecks.git] / test-scheduler / ui / src / components / message / showMessage.js
1 import toastr from '../../assets/js/toastr.min.js'
2 export default function(type, title, info, detail="") {
3     if(typeof type == "number") {
4         if(200 <= type && type < 300) {
5             type = "success";
6         } else if (300 <= type && type < 500) {
7             type = "warning";
8         } else if (500 <= type) {
9             type = "error";
10         } else {
11             type = "info";
12         }
13     }
14     if(detail != "") {
15         detail = "* <strong>detail:</strong>  " + detail;
16     }
17     var content = "<br>* " + info + "<br><br>" + detail;
18     if(type == "success"){
19         toastr.success(content, title);
20     }
21     else if(type == "info") {
22         toastr.info(content, title);
23     }
24     else if(type == "error"){
25         toastr.error(content, title);
26     }
27     else {
28         toastr.warning(content, title);
29     }
30 }