1 lawrence.luo 1.1.2.3 /*!LICENSE
2 *
3 * Licensed to The Open Group (TOG) under one or more contributor license
4 * agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 * this work for additional information regarding copyright ownership.
6 * Each contributor licenses this file to you under the OpenPegasus Open
7 * Source License; you may not use this file except in compliance with the
8 * License.
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 lawrence.luo 1.1.2.3 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 *
28 */
|
29 lawrence.luo 1.1.2.1
30 //base url which is identical for all requests
31 baseURL = "http://"+window.location.hostname+":"+window.location.port+"/cimrs/";
32 host = "http://"+window.location.hostname+":"+window.location.port+"/";
33 configURL = "root%2FPG_InterOp/enum?class=PG_ProviderModule";
34 currentElement = null;
35
36 function insertProviderRow(name, location, vendor, version, interfacetype, state, ref) {
37 var t_rows = document.getElementById('providerTable').rows;
38
39
40 var x=1;
41
42 for (x=1; x < t_rows.length; x++) {
43 var celValue = t_rows[x].cells[0].textContent;
44 if (name < celValue) {
45 break;
46 }
47 }
48
49
50 lawrence.luo 1.1.2.1 var t_row = document.getElementById('providerTable').insertRow(x);
51 t_row.id = "row_" + ref;
52 var t_name =t_row.insertCell(0);
53 var t_location = t_row.insertCell(1);
54 var t_vendor =t_row.insertCell(2);
55 var t_version =t_row.insertCell(3);
56 var t_interfacetype =t_row.insertCell(4);
57 var t_state = t_row.insertCell(5);
58
59
60
61 refArray[name] = ref;
62
63 t_name.innerHTML=name;
64 t_location.innerHTML=location;
65 t_vendor.innerHTML=vendor;
66 t_version.innerHTML = version;
67 t_interfacetype.innerHTML = interfacetype;
68 t_state.innerHTML = state;
69 }
70
71 lawrence.luo 1.1.2.1
72 /**
73 * Writes received content on page.
74 */
75 function writeContent(data) {
76 //define a global variable to store property names and corresponding $ref values
77 refArray = new Array();
78
79 var responseArray = JSON.parse(data);
80 var providerList=responseArray.instances;
81 var i=0;
82 for (i=0; i < providerList.length; i++) {
|
83 lawrence.luo 1.1.2.2 insertProviderRow(decodeURIComponent(providerList[i].properties.Name),
84 decodeURIComponent(providerList[i].properties.Location),
85 decodeURIComponent(providerList[i].properties.Vendor),
86 decodeURIComponent(providerList[i].properties.Version),
87 decodeURIComponent(providerList[i].properties.InterfaceType),
88 decodeURIComponent(providerList[i].properties.OperationalStatus));
|
96 lawrence.luo 1.1.2.1 }
97
98
99 }
100
101 /**function to delete all rows of a table except the head row
102 * afterwards a new request is send to get the lastet data and the table can be rebuilt
103 */
104 function reloadTable(table)
105 {
106 var rows = table.rows;
107 var rowCount = rows.length;
108 for (var i = rowCount-1; i > 0; i--)
109 {
110 table.deleteRow(i);
111 }
112 //default case, change it to redraw another table
113 genericRequest('root%2FPG_InterOp/enum?class=PG_ProviderModule', writeContent, true);
114
115 }
116
117 lawrence.luo 1.1.2.1
|