Adding ability to view YANG source in the details pane.
Still requires to add scrolling and to clean-up the hacky ID scheme.
Change-Id: I70e397310ee36bea9d01019ca0e21f4bb5ffb0c9
diff --git a/apps/yang-gui/src/main/java/org/onosproject/yang/gui/YangModelMessageHandler.java b/apps/yang-gui/src/main/java/org/onosproject/yang/gui/YangModelMessageHandler.java
index 3be5dd2..d6bd67e 100644
--- a/apps/yang-gui/src/main/java/org/onosproject/yang/gui/YangModelMessageHandler.java
+++ b/apps/yang-gui/src/main/java/org/onosproject/yang/gui/YangModelMessageHandler.java
@@ -36,9 +36,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.net.URLEncoder;
import java.util.Collection;
-import java.util.Set;
/**
* ONOS UI YANG Models message handler.
@@ -55,6 +53,7 @@
// Table Column IDs
private static final String ID = "id";
+ private static final String MODEL_ID = "modelId";
private static final String MODULE = "module";
private static final String REVISION = "revision";
// TODO: fill out table columns as needed
@@ -62,7 +61,7 @@
private static final String SOURCE = "source";
private static final String[] COL_IDS = {
- ID, MODULE, REVISION
+ ID, MODULE, REVISION, MODEL_ID
};
private static final String UTF8 = "UTF-8";
@@ -122,9 +121,10 @@
}
private void populateRow(TableModel.Row row, int modelId, YangModuleId moduleId) {
- row.cell(ID, "YM" + modelId)
+ row.cell(ID, "EM" + moduleId.hashCode())
.cell(MODULE, moduleId.moduleName())
- .cell(REVISION, moduleId.revision());
+ .cell(REVISION, moduleId.revision())
+ .cell(MODEL_ID, "YM" + modelId);
}
}
@@ -137,7 +137,7 @@
@Override
public void process(ObjectNode payload) {
- String id = string(payload, ID);
+ String id = string(payload, MODEL_ID);
String name = string(payload, MODULE);
YangModule module = getModule(id, name);
diff --git a/apps/yang-gui/src/main/resources/app/view/yangModel/yangModel.html b/apps/yang-gui/src/main/resources/app/view/yangModel/yangModel.html
index b83f3ce..12b267c 100644
--- a/apps/yang-gui/src/main/resources/app/view/yangModel/yangModel.html
+++ b/apps/yang-gui/src/main/resources/app/view/yangModel/yangModel.html
@@ -15,9 +15,10 @@
<div class="table-header" onos-sortable-header>
<table>
<tr>
+ <td colId="id" col-width="130px" sortable>ID</td>
<td colId="module" sortable>Module</td>
<td colId="revision" sortable>Revision</td>
- <td colId="id" col-width="130px" sortable>Model ID</td>
+ <td colId="modelId" col-width="130px" sortable>Model ID</td>
<!-- TODO: More columns to be added -->
</tr>
</table>
@@ -36,9 +37,10 @@
ng-click="selectCallback($event, ymodel)"
ng-class="{selected: ymodel.id === selId}"
ng-repeat-complete row-id="{{ymodel.id}}">
+ <td>{{ymodel.id}}</td>
<td>{{ymodel.module}}</td>
<td>{{ymodel.revision}}</td>
- <td>{{ymodel.id}}</td>
+ <td>{{ymodel.modelId}}</td>
<!-- TODO: add more columns here -->
</tr>
</table>
diff --git a/apps/yang-gui/src/main/resources/app/view/yangModel/yangModel.js b/apps/yang-gui/src/main/resources/app/view/yangModel/yangModel.js
index 7de8c2c..a106138 100644
--- a/apps/yang-gui/src/main/resources/app/view/yangModel/yangModel.js
+++ b/apps/yang-gui/src/main/resources/app/view/yangModel/yangModel.js
@@ -179,7 +179,7 @@
// row selection callback
function selCb($event, row) {
if ($scope.selId) {
- wss.sendEvent(detailsReq, { id: row.id, module: row.module });
+ wss.sendEvent(detailsReq, { modelId: row.modelId, module: row.module });
} else {
$scope.hidePanel();
}