diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/projectpage.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/projectpage.js | 66 |
1 files changed, 2 insertions, 64 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/projectpage.js b/bitbake/lib/toaster/toastergui/static/js/projectpage.js index 7f19c0d7aa..4536703649 100644 --- a/bitbake/lib/toaster/toastergui/static/js/projectpage.js +++ b/bitbake/lib/toaster/toastergui/static/js/projectpage.js | |||
@@ -50,70 +50,8 @@ function projectPageInit(ctx) { | |||
50 | $("#delete-project-modal .project-name").text(prjInfo.name); | 50 | $("#delete-project-modal .project-name").text(prjInfo.name); |
51 | }); | 51 | }); |
52 | 52 | ||
53 | (function notificationRequest(){ | 53 | if (urlParams.hasOwnProperty('notify') && urlParams.notify === 'new-project'){ |
54 | 54 | $("#project-created-notification").show(); | |
55 | if (urlParams.hasOwnProperty('notify')){ | ||
56 | switch (urlParams.notify){ | ||
57 | case 'new-project': | ||
58 | $("#project-created-notification").show(); | ||
59 | break; | ||
60 | case 'layer-imported': | ||
61 | layerImportedNotification(); | ||
62 | break; | ||
63 | case 'layer-deleted': | ||
64 | layerDeletedNotification(); | ||
65 | default: | ||
66 | break; | ||
67 | } | ||
68 | } | ||
69 | })(); | ||
70 | |||
71 | /* Layer deleted notification */ | ||
72 | function layerDeletedNotification(){ | ||
73 | var layer = $.cookie("layer-deleted"); | ||
74 | |||
75 | if (!layer) | ||
76 | return; | ||
77 | |||
78 | var message = "You have deleted <strong>1</strong> layer from your "; | ||
79 | message += "project: <strong>" + layer + "</strong>"; | ||
80 | |||
81 | libtoaster.showChangeNotification(message); | ||
82 | |||
83 | $.removeCookie("layer-deleted", { path: "/"}); | ||
84 | } | ||
85 | |||
86 | |||
87 | /* Layer imported notification */ | ||
88 | function layerImportedNotification(){ | ||
89 | var imported = $.cookie("layer-imported-alert"); | ||
90 | var message = "Layer imported"; | ||
91 | |||
92 | if (!imported) | ||
93 | return; | ||
94 | else | ||
95 | imported = JSON.parse(imported); | ||
96 | |||
97 | if (imported.deps_added.length === 0) { | ||
98 | message = "You have imported <strong><a class=\"alert-link\" href=\""+imported.imported_layer.layerdetailurl+"\">"+imported.imported_layer.name+"</a></strong> and added it to your project."; | ||
99 | } else { | ||
100 | |||
101 | var links = "<a href=\""+imported.imported_layer.layerdetailurl+"\">"+imported.imported_layer.name+"</a>, "; | ||
102 | |||
103 | imported.deps_added.map (function(item, index){ | ||
104 | links +='<a href="'+item.layerdetailurl+'">'+item.name+'</a>'; | ||
105 | /*If we're at the last element we don't want the trailing comma */ | ||
106 | if (imported.deps_added[index+1] !== undefined) | ||
107 | links += ', '; | ||
108 | }); | ||
109 | |||
110 | /* Length + 1 here to do deps + the imported layer */ | ||
111 | message = 'You have imported <strong><a href="'+imported.imported_layer.layerdetailurl+'">'+imported.imported_layer.name+'</a></strong> and added <strong>'+(imported.deps_added.length+1)+'</strong> layers to your project: <strong>'+links+'</strong>'; | ||
112 | } | ||
113 | |||
114 | libtoaster.showChangeNotification(message); | ||
115 | |||
116 | $.removeCookie("layer-imported-alert", { path: "/"}); | ||
117 | } | 55 | } |
118 | 56 | ||
119 | /* Add/Rm layer functionality */ | 57 | /* Add/Rm layer functionality */ |