-
Notifications
You must be signed in to change notification settings - Fork 87
/
addnewservice.html
58 lines (52 loc) · 1.68 KB
/
addnewservice.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<div class="addnewservice">
<div class="well well-sm noremoteservices">
No remote services
</div>
<table class="table servicesTable initialhide">
<thead>
<tr>
<th>Provider</th>
<th>Name</th>
<th>Description</th>
<th>Actions</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<script>
function AddNewService(cd, main, project, projectPage, callback) {
var o = this;
o.serviceDescriptors = {};
this.loadServices = function(){
Global.bimServerApi.call("NewServicesInterface", "listAllServiceDescriptors", {}, function(data){
$(".addnewservice .servicesTable tbody tr").remove();
data.forEach(function(serviceDescriptor){
o.serviceDescriptors[serviceDescriptor.name] = serviceDescriptor;
o.addServiceDescriptor($(".addnewservice .servicesTable"), serviceDescriptor);
});
});
}
this.addServiceDescriptor = function(table, serviceDescriptor){
cd.find(".noremoteservices").hide();
cd.find(".servicesTable").show();
var tr = $("<tr>");
tr.attr("name", serviceDescriptor.name);
tr.append("<td>" + serviceDescriptor.provider + "</td>");
tr.append("<td>" + serviceDescriptor.name + "</td>");
tr.append("<td>" + serviceDescriptor.description + "</td>");
var addButton = $("<button class=\"btn btn-primary\">Add</button>");
addButton.click(o.addButtonClick);
tr.append($("<td></td>").append(addButton));
table.find("tbody").append(tr);
};
this.addButtonClick = function(){
var name = $(this).parents("tr").attr("name");
var serviceDescriptor = o.serviceDescriptors[name];
load(cd, "addnewservice2.html", function(){
new AddNewService2($(this), project, projectPage, serviceDescriptor);
})
};
o.loadServices();
}
</script>