-
Notifications
You must be signed in to change notification settings - Fork 87
/
service.html
170 lines (159 loc) · 6.46 KB
/
service.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<div class="service">
<a class="backToServicesList">back</a>
<h1>Service</h1>
<table class="table pluginTable">
<thead></thead>
<tbody></tbody>
</table>
<h3>Rights</h3>
<div class="well well-sm norights">
No rights required
</div>
<table class="table rightsTable">
<thead></thead>
<tbody></tbody>
</table>
<h3>Profile</h3>
<table class="table profileTable">
<thead></thead>
<tbody></tbody>
</table>
<h3>Model Checkers</h3>
<div class="well well-sm nomodelcheckers">
No model checkers
</div>
<table class="table modelCheckersTable">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Status</th>
</tr>
</thead>
<tbody></tbody>
</table>
<a class="technicalDetailsLink">Technical details</a>
<div class="technicalDetails initialhide">
<h3>Technical details</h3>
<table class="table technicalDetailsTable">
<thead></thead>
<tbody></tbody>
</table>
</div>
</div>
<script>
function Service(main, service, projectPage) {
var othis = this;
othis.service = service;
this.loadProjects = function(targetElement, selectedOid) {
Global.bimServerApi.call("ServiceInterface", "getAllProjects", {onlyTopLevel: false, onlyActive: true}, function(data){
targetElement.empty();
targetElement.append("<option value=\"[SELECT_A_PROJECT]\">[Select a project]</option>");
data.forEach(function(project){
var option = $("<option value=\"" + project.oid + "\">" + project.name + "</option>");
if (project.oid == selectedOid) {
option.attr("selected", "selected");
}
targetElement.append(option);
});
});
};
$(".service .pluginTable tbody").append("<tr><td>Provider</td><td>" + service.providerName + "</td></tr>");
$(".service .pluginTable tbody").append("<tr><td>Name</td><td>" + service.name + "</td></tr>");
$(".service .pluginTable tbody").append("<tr><td>Description</td><td>" + service.description + "</td></tr>");
$(".service .pluginTable tbody").append("<tr><td>Trigger</td><td>" + formatTrigger(service.trigger) + "</td></tr>");
if (service.readRevision || service.writeRevision || service.readExtendedData != null || service.writeExtendedData != null) {
$(".service .rightsTable").show();
$(".service .norights").hide();
} else {
$(".service .rightsTable").hide();
$(".service .norights").show();
}
if (service.readRevision) {
$(".service .rightsTable tbody").append("<tr><td>Read Revision</td><td><input disabled=\"disabled\" checked=\"checked\" type=\"checkbox\"/></td></tr>");
}
if (service.writeRevisionId != -1) {
var form = $("<form class=\"form-inline\">");
var select = $("<select class=\"projectSelect\"></select>");
select.change(othis.canAdd);
othis.loadProjects(select, service.writeRevisionId);
var tr = $("<tr><td>Write Revision</td></tr>");
var label = $("<label>To project </label>");
var td = $("<td></td>");
td.append(form);
form.append(label);
label.append(select);
tr.append(td);
$(".service .rightsTable tbody").append(tr);
}
if (service.readExtendedDataId != -1) {
var tr1 = $("<tr><td>Read Extended Data</td></tr>");
var td1 = $("<td></td>");
tr1.append(td1);
$(".service .rightsTable tbody").append(tr1);
Global.bimServerApi.call("ServiceInterface", "getExtendedDataSchemaById", {naoidmespace: service.readExtendedDataId}, function(data){
td.append(main.createExtendedDataSchemaLink(data));
othis.readExtendedDataOid = data.oid;
}, function(){
tr1.addClass("error");
td1.append("<br/>Missing extended data schema");
});
}
if (service.writeExtendedDataId != -1) {
var tr2 = $("<tr><td>Write Extended Data</td></tr>");
var td2 = $("<td></td>");
tr2.append(td2);
$(".service .rightsTable tbody").append(tr2);
Global.bimServerApi.call("ServiceInterface", "getExtendedDataSchemaById", {oid: service.writeExtendedDataId}, function(data){
td2.append(main.createExtendedDataSchemaLink(data));
othis.writeExtendedDataOid = data.oid;
}, function(){
tr2.addClass("error");
td2.append("<br/>Missing extended data schema");
Global.bimServerApi.call("ServiceInterface", "getExtendedDataSchemaFromRepository", {namespace: service.writeExtendedData}, function(data){
var exs = data;
main.showServerSettings(null, function(){
main.current.showAddNewExtendedDataSchema(exs);
});
})
});
}
service.modelCheckers.forEach(function(modelCheckerOid){
Global.bimServerApi.call("ServiceInterface", "getModelCheckerInstance", {mcioid: modelCheckerOid}, function(modelChecker){
$(".service .nomodelcheckers").hide();
var tr = $("<tr></tr>");
tr.append("<td>" + modelChecker.name + "</td>");
tr.append("<td>" + modelChecker.description + "</td>");
tr.append("<td>" + modelChecker.valid + "</td>");
$(".service .modelCheckersTable tbody").append(tr);
});
});
$(".service .profileTable tbody").append("<tr><td>Name</td><td>" + service.profileName + "</td></tr>");
$(".service .profileTable tbody").append("<tr><td>Description</td><td>" + service.profileDescription + "</td></tr>");
$(".service .profileTable tbody").append("<tr><td>Public</td><td>" + service.profilePublic + "</td></tr>");
$(".service .technicalDetailsTable tbody").append("<tr><td>URL</td><td>" + (service.url == null ? "No URL (Internal)" : service.url) + "</td></tr>");
$(".service .technicalDetailsTable tbody").append("<tr><td>Notification Protocol</td><td>" + service.notificationProtocol + "</td></tr>");
$(".service .technicalDetailsTable tbody").append("<tr><td>Service Identifier</td><td>" + service.serviceIdentifier + "</td></tr>");
$(".service .technicalDetailsTable tbody").append("<tr><td>Profile Identifier</td><td>" + service.profileIdentifier + "</td></tr>");
this.addProfileDescriptor = function(profileDescriptor) {
var tr = $("<tr class=\"" + (profileDescriptor.publicProfile ? "public" : "private") + "profiledescriptor\"></tr>");
tr.data("profiledescriptor", profileDescriptor);
tr.append("<td>" + profileDescriptor.name + "</td>");
tr.append("<td>" + profileDescriptor.description + "</td>");
tr.append("<td>" + profileDescriptor.publicProfile + "</td>");
var radio = $("<input type=\"radio\" name=\"profile\" class=\"profileRadio\"/>");
radio.change(othis.canAdd);
tr.append($("<td></td>").append(radio));
$(".service .profilesTable tbody").append(tr);
};
this.close = function() {
};
$(".service .backToServicesList").click(function(){
projectPage.loadServices();
});
$(".service .technicalDetailsLink").click(function(){
$(".service .technicalDetails").show();
$(".service .technicalDetailsLink").hide();
});
}
</script>