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