diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/machines.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/machines.js | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/machines.js b/bitbake/lib/toaster/toastergui/static/js/machines.js deleted file mode 100644 index fbcafc26b5..0000000000 --- a/bitbake/lib/toaster/toastergui/static/js/machines.js +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | "use strict" | ||
2 | |||
3 | function machinesPageInit (ctx) { | ||
4 | |||
5 | |||
6 | function setLayerInCurrentPrj(addLayerBtn, depsList){ | ||
7 | var alertMsg = $("#alert-msg"); | ||
8 | |||
9 | $(".select-or-add").each(function(){ | ||
10 | /* If we have added a layer it may also enable other machines so search | ||
11 | * for other machines that have that layer and enable them */ | ||
12 | var selectMachineBtn = $(this).children(".select-machine-btn"); | ||
13 | var otherAddLayerBtns = $(this).children(".add-layer"); | ||
14 | |||
15 | if (addLayerBtn.data('layer-version-id') == selectMachineBtn.data('layer-version-id')) { | ||
16 | otherAddLayerBtns.fadeOut(function(){ | ||
17 | selectMachineBtn.fadeIn(); | ||
18 | }); | ||
19 | } | ||
20 | }); | ||
21 | |||
22 | /* Reset alert message */ | ||
23 | alertMsg.text(""); | ||
24 | |||
25 | /* If we have added layer dependencies */ | ||
26 | if (depsList) { | ||
27 | alertMsg.append("You have added <strong>"+(depsList.length+1)+"</strong> layers to <a id=\"project-affected-name\"></a>: <span id=\"layer-affected-name\"></span> and its dependencies "); | ||
28 | |||
29 | /* Build the layer deps list */ | ||
30 | depsList.map(function(layer, i){ | ||
31 | var link = $("<a></a>"); | ||
32 | |||
33 | link.attr("href", layer.layerdetailurl); | ||
34 | link.text(layer.name); | ||
35 | link.tooltip({title: layer.tooltip}); | ||
36 | |||
37 | if (i != 0) | ||
38 | alertMsg.append(", "); | ||
39 | |||
40 | alertMsg.append(link); | ||
41 | }); | ||
42 | } else { | ||
43 | alertMsg.append("You have added <strong>1</strong> layer to <a id=\"project-affected-name\"></a>: <strong id=\"layer-affected-name\"></strong>"); | ||
44 | } | ||
45 | |||
46 | var layerName = addLayerBtn.data('layer-name'); | ||
47 | alertMsg.children("#layer-affected-name").text(layerName); | ||
48 | alertMsg.children("#project-affected-name").text(libtoaster.ctx.projectName).attr('href', libtoaster.ctx.projectPageUrl); | ||
49 | |||
50 | $("#alert-area").show(); | ||
51 | } | ||
52 | |||
53 | $("#dismiss-alert").click(function(){ $(this).parent().hide() }); | ||
54 | |||
55 | /* Add or remove this layer from the project */ | ||
56 | $(".add-layer").click(function() { | ||
57 | var btn = $(this); | ||
58 | /* If adding get the deps for this layer */ | ||
59 | var layer = { | ||
60 | id : $(this).data('layer-version-id'), | ||
61 | name : $(this).data('layer-name'), | ||
62 | }; | ||
63 | |||
64 | libtoaster.getLayerDepsForProject(libtoaster.ctx.projectId, layer.id, function (data) { | ||
65 | /* got result for dependencies */ | ||
66 | if (data.list.length == 0){ | ||
67 | var editData = { layerAdd : layer.id }; | ||
68 | libtoaster.editCurrentProject(editData, function() { | ||
69 | setLayerInCurrentPrj(btn); | ||
70 | }); | ||
71 | return; | ||
72 | } else { | ||
73 | /* The add deps will include this layer so no need to add it | ||
74 | * separately. | ||
75 | */ | ||
76 | show_layer_deps_modal(ctx.projectId, layer, data.list, null, null, true, function () { | ||
77 | /* Success add deps and layer */ | ||
78 | setLayerInCurrentPrj(btn, data.list); | ||
79 | }); | ||
80 | } | ||
81 | }, null); | ||
82 | }); | ||
83 | |||
84 | $(".select-machine-btn").click(function(){ | ||
85 | var data = { machineName : $(this).data('machine-name') }; | ||
86 | libtoaster.editCurrentProject(data, function (){ | ||
87 | window.location.replace(libtoaster.ctx.projectPageUrl+"#/machineselected"); | ||
88 | }, null); | ||
89 | }); | ||
90 | |||
91 | $("#show-all-btn").click(function(){ | ||
92 | $("#search").val("") | ||
93 | $("#searchform").submit(); | ||
94 | }); | ||
95 | } | ||