X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=testing-scheduler%2Fui%2Fsrc%2Fcomponents%2Fmessage%2FshowMessage.js;fp=testing-scheduler%2Fui%2Fsrc%2Fcomponents%2Fmessage%2FshowMessage.js;h=39cc32bf2c54d88f2150538894d573ca1f3ea454;hb=26b13e50c888bc0ca03c0f68731f7c5abff0c6b6;hp=0000000000000000000000000000000000000000;hpb=ad12a6561be8c67f6da09c38c4e1c0e88eb9a6de;p=bottlenecks.git
diff --git a/testing-scheduler/ui/src/components/message/showMessage.js b/testing-scheduler/ui/src/components/message/showMessage.js
new file mode 100644
index 00000000..39cc32bf
--- /dev/null
+++ b/testing-scheduler/ui/src/components/message/showMessage.js
@@ -0,0 +1,30 @@
+import toastr from '../../assets/js/toastr.min.js'
+export default function(type, title, info, detail="") {
+ if(typeof type == "number") {
+ if(200 <= type && type < 300) {
+ type = "success";
+ } else if (300 <= type && type < 500) {
+ type = "warning";
+ } else if (500 <= type) {
+ type = "error";
+ } else {
+ type = "info";
+ }
+ }
+ if(detail != "") {
+ detail = "* detail: " + detail;
+ }
+ var content = "
* " + info + "
" + detail;
+ if(type == "success"){
+ toastr.success(content, title);
+ }
+ else if(type == "info") {
+ toastr.info(content, title);
+ }
+ else if(type == "error"){
+ toastr.error(content, title);
+ }
+ else {
+ toastr.warning(content, title);
+ }
+}
\ No newline at end of file