-
Notifications
You must be signed in to change notification settings - Fork 87
/
plugins.html
110 lines (102 loc) · 3.65 KB
/
plugins.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
<div class="plugins">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Version</th>
<th>Enabled</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<script>
function Plugins(main, serversettings) {
var othis = this;
this.show = function(){};
this.changeEnabled = function(){
var name = $(this).attr("name");
if ($(this).is(":checked")) {
Global.bimServerApi.callWithFullIndication("AdminInterface", "enablePlugin", {name: name}, function(){});
} else {
Global.bimServerApi.callWithFullIndication("AdminInterface", "disablePlugin", {name: name}, function(){});
}
};
this.showPlugin = function(event){
if (!$(event.target).is("input")) {
var plugin = $(this).data("plugin");
pushHistory({page: "ServerSettings", subpage: "Plugins", plugin: plugin.oid}, "Server Settings");
$(".plugins").load("plugin.html", function(){
new Plugin($(this), plugin);
});
}
};
this.addPlugin = function(plugin){
var tr = $("<tr>");
tr.data("plugin", plugin);
tr.append("<td>" + plugin.simpleName + "</td>");
tr.append("<td>" + plugin.description + "</td>");
tr.append("<td>" + plugin.version + "</td>");
tr.append("<td><input type=\"checkbox\"/></td>");
if (plugin.enabled) {
tr.find("input").attr("checked", "checked");
}
tr.click(othis.showPlugin);
tr.find("input").attr("name", plugin.pluginClassName);
tr.find("input").change(othis.changeEnabled);
$(".plugins table tbody").append(tr);
};
this.addHeader = function(pluginInterfaceClassName){
var tr = $("<tr>");
var name = pluginInterfaceClassName;
if (pluginInterfaceClassName == "org.bimserver.plugins.schema.SchemaPlugin") {
name = "Schemas";
} else if (pluginInterfaceClassName == "org.bimserver.plugins.queryengine.QueryEnginePlugin") {
name = "Query Engines";
} else if (pluginInterfaceClassName == "org.bimserver.plugins.web.WebModulePlugin") {
name = "Web Modules";
} else if (pluginInterfaceClassName == "org.bimserver.plugins.serializers.SerializerPlugin") {
name = "Serializers";
} else if (pluginInterfaceClassName == "org.bimserver.plugins.modelcompare.ModelComparePlugin") {
name = "Model Compare";
} else if (pluginInterfaceClassName == "org.bimserver.plugins.modelchecker.ModelCheckerPlugin") {
name = "Model Checker";
} else if (pluginInterfaceClassName == "org.bimserver.plugins.deserializers.DeserializerPlugin") {
name = "Deserializers";
} else if (pluginInterfaceClassName == "org.bimserver.plugins.modelmerger.ModelMergerPlugin") {
name = "Model Mergers";
} else if (pluginInterfaceClassName == "org.bimserver.plugins.renderengine.RenderEnginePlugin") {
name = "Render Engines";
} else if (pluginInterfaceClassName == "org.bimserver.plugins.services.ServicePlugin") {
name = "Services";
}
tr.append("<td colspan=\"3\" class=\"header\">" + name + "</td>");
$(".plugins table tbody").append(tr);
};
this.loadPlugins = function(){
Global.bimServerApi.call("AdminInterface", "getAllPlugins", {}, function(plugins){
var lastType = null;
plugins.forEach(function(plugin){
if (lastType == null || lastType != plugin.pluginInterfaceClassName) {
othis.addHeader(plugin.pluginInterfaceClassName);
lastType = plugin.pluginInterfaceClassName;
}
othis.addPlugin(plugin);
});
});
};
this.close = function(){
};
var history = History.getState().data;
if (history.plugin != null) {
Global.bimServerApi.call("PluginInterface", "getPluginDescriptor", {oid: history.plugin}, function(plugin){
$(".plugins").load("plugin.html", function(){
new Plugin($(this), plugin);
});
});
} else {
othis.loadPlugins();
}
}
</script>