GUI -- Added intent state to the tabular view.

Change-Id: Id2ef98b62e92c514965e52c5240e7c30fe1162f0
This commit is contained in:
Thomas Vachuska 2015-05-27 16:56:45 -07:00
parent d050a4bb63
commit d8b0789afa
2 changed files with 12 additions and 6 deletions

View File

@ -37,6 +37,7 @@ import org.onosproject.ui.table.CellFormatter;
import org.onosproject.ui.table.TableModel; import org.onosproject.ui.table.TableModel;
import org.onosproject.ui.table.TableRequestHandler; import org.onosproject.ui.table.TableRequestHandler;
import org.onosproject.ui.table.cell.AppIdFormatter; import org.onosproject.ui.table.cell.AppIdFormatter;
import org.onosproject.ui.table.cell.EnumFormatter;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -55,11 +56,12 @@ public class IntentViewMessageHandler extends UiMessageHandler {
private static final String KEY = "key"; private static final String KEY = "key";
private static final String TYPE = "type"; private static final String TYPE = "type";
private static final String PRIORITY = "priority"; private static final String PRIORITY = "priority";
private static final String STATE = "state";
private static final String RESOURCES = "resources"; private static final String RESOURCES = "resources";
private static final String DETAILS = "details"; private static final String DETAILS = "details";
private static final String[] COL_IDS = { private static final String[] COL_IDS = {
APP_ID, KEY, TYPE, PRIORITY, RESOURCES, DETAILS APP_ID, KEY, TYPE, PRIORITY, STATE, RESOURCES, DETAILS
}; };
@Override @Override
@ -89,6 +91,7 @@ public class IntentViewMessageHandler extends UiMessageHandler {
tm.setFormatter(APP_ID, AppIdFormatter.INSTANCE); tm.setFormatter(APP_ID, AppIdFormatter.INSTANCE);
tm.setFormatter(RESOURCES, new ResourcesFormatter()); tm.setFormatter(RESOURCES, new ResourcesFormatter());
tm.setFormatter(DETAILS, new DetailsFormatter()); tm.setFormatter(DETAILS, new DetailsFormatter());
tm.setFormatter(STATE, EnumFormatter.INSTANCE);
return tm; return tm;
} }
@ -96,15 +99,16 @@ public class IntentViewMessageHandler extends UiMessageHandler {
protected void populateTable(TableModel tm, ObjectNode payload) { protected void populateTable(TableModel tm, ObjectNode payload) {
IntentService is = get(IntentService.class); IntentService is = get(IntentService.class);
for (Intent intent : is.getIntents()) { 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()) row.cell(APP_ID, intent.appId())
.cell(KEY, intent.key()) .cell(KEY, intent.key())
.cell(TYPE, intent.getClass().getSimpleName()) .cell(TYPE, intent.getClass().getSimpleName())
.cell(PRIORITY, intent.priority()) .cell(PRIORITY, intent.priority())
.cell(STATE, is.getIntentState(intent.key()))
.cell(RESOURCES, intent) .cell(RESOURCES, intent)
.cell(DETAILS, intent); .cell(DETAILS, intent);
} }

View File

@ -35,6 +35,7 @@
<td colId="key" sortable>Key </td> <td colId="key" sortable>Key </td>
<td colId="type" sortable>Type </td> <td colId="type" sortable>Type </td>
<td colId="priority" sortable>Priority </td> <td colId="priority" sortable>Priority </td>
<td colId="state" sortable>State </td>
</tr> </tr>
</table> </table>
</div> </div>
@ -42,7 +43,7 @@
<div class="table-body"> <div class="table-body">
<table> <table>
<tr ng-hide="tableData.length" class="no-data ignore-width"> <tr ng-hide="tableData.length" class="no-data ignore-width">
<td colspan="4"> <td colspan="5">
No Intents found No Intents found
</td> </td>
</tr> </tr>
@ -52,12 +53,13 @@
<td>{{intent.key}}</td> <td>{{intent.key}}</td>
<td>{{intent.type}}</td> <td>{{intent.type}}</td>
<td>{{intent.priority}}</td> <td>{{intent.priority}}</td>
<td>{{intent.state}}</td>
</tr> </tr>
<tr> <tr>
<td class="resources" colspan="4">{{intent.resources}}</td> <td class="resources" colspan="5">{{intent.resources}}</td>
</tr> </tr>
<tr ng-repeat-end ng-repeat-done> <tr ng-repeat-end ng-repeat-done>
<td class="details" colspan="4">{{intent.details}}</td> <td class="details" colspan="5">{{intent.details}}</td>
</tr> </tr>
</table> </table>
</div> </div>