Thomas Vachuska

GUI -- Added intent state to the tabular view.

Change-Id: Id2ef98b62e92c514965e52c5240e7c30fe1162f0
......@@ -37,6 +37,7 @@ import org.onosproject.ui.table.CellFormatter;
import org.onosproject.ui.table.TableModel;
import org.onosproject.ui.table.TableRequestHandler;
import org.onosproject.ui.table.cell.AppIdFormatter;
import org.onosproject.ui.table.cell.EnumFormatter;
import java.util.Collection;
import java.util.List;
......@@ -55,11 +56,12 @@ public class IntentViewMessageHandler extends UiMessageHandler {
private static final String KEY = "key";
private static final String TYPE = "type";
private static final String PRIORITY = "priority";
private static final String STATE = "state";
private static final String RESOURCES = "resources";
private static final String DETAILS = "details";
private static final String[] COL_IDS = {
APP_ID, KEY, TYPE, PRIORITY, RESOURCES, DETAILS
APP_ID, KEY, TYPE, PRIORITY, STATE, RESOURCES, DETAILS
};
@Override
......@@ -89,6 +91,7 @@ public class IntentViewMessageHandler extends UiMessageHandler {
tm.setFormatter(APP_ID, AppIdFormatter.INSTANCE);
tm.setFormatter(RESOURCES, new ResourcesFormatter());
tm.setFormatter(DETAILS, new DetailsFormatter());
tm.setFormatter(STATE, EnumFormatter.INSTANCE);
return tm;
}
......@@ -96,15 +99,16 @@ public class IntentViewMessageHandler extends UiMessageHandler {
protected void populateTable(TableModel tm, ObjectNode payload) {
IntentService is = get(IntentService.class);
for (Intent intent : is.getIntents()) {
populateRow(tm.addRow(), intent);
populateRow(tm.addRow(), intent, is);
}
}
private void populateRow(TableModel.Row row, Intent intent) {
private void populateRow(TableModel.Row row, Intent intent, IntentService is) {
row.cell(APP_ID, intent.appId())
.cell(KEY, intent.key())
.cell(TYPE, intent.getClass().getSimpleName())
.cell(PRIORITY, intent.priority())
.cell(STATE, is.getIntentState(intent.key()))
.cell(RESOURCES, intent)
.cell(DETAILS, intent);
}
......
......@@ -35,6 +35,7 @@
<td colId="key" sortable>Key </td>
<td colId="type" sortable>Type </td>
<td colId="priority" sortable>Priority </td>
<td colId="state" sortable>State </td>
</tr>
</table>
</div>
......@@ -42,7 +43,7 @@
<div class="table-body">
<table>
<tr ng-hide="tableData.length" class="no-data ignore-width">
<td colspan="4">
<td colspan="5">
No Intents found
</td>
</tr>
......@@ -52,12 +53,13 @@
<td>{{intent.key}}</td>
<td>{{intent.type}}</td>
<td>{{intent.priority}}</td>
<td>{{intent.state}}</td>
</tr>
<tr>
<td class="resources" colspan="4">{{intent.resources}}</td>
<td class="resources" colspan="5">{{intent.resources}}</td>
</tr>
<tr ng-repeat-end ng-repeat-done>
<td class="details" colspan="4">{{intent.details}}</td>
<td class="details" colspan="5">{{intent.details}}</td>
</tr>
</table>
</div>
......