Thomas Vachuska

GUI -- Added intent state to the tabular view.

Change-Id: Id2ef98b62e92c514965e52c5240e7c30fe1162f0
...@@ -37,6 +37,7 @@ import org.onosproject.ui.table.CellFormatter; ...@@ -37,6 +37,7 @@ import org.onosproject.ui.table.CellFormatter;
37 import org.onosproject.ui.table.TableModel; 37 import org.onosproject.ui.table.TableModel;
38 import org.onosproject.ui.table.TableRequestHandler; 38 import org.onosproject.ui.table.TableRequestHandler;
39 import org.onosproject.ui.table.cell.AppIdFormatter; 39 import org.onosproject.ui.table.cell.AppIdFormatter;
40 +import org.onosproject.ui.table.cell.EnumFormatter;
40 41
41 import java.util.Collection; 42 import java.util.Collection;
42 import java.util.List; 43 import java.util.List;
...@@ -55,11 +56,12 @@ public class IntentViewMessageHandler extends UiMessageHandler { ...@@ -55,11 +56,12 @@ public class IntentViewMessageHandler extends UiMessageHandler {
55 private static final String KEY = "key"; 56 private static final String KEY = "key";
56 private static final String TYPE = "type"; 57 private static final String TYPE = "type";
57 private static final String PRIORITY = "priority"; 58 private static final String PRIORITY = "priority";
59 + private static final String STATE = "state";
58 private static final String RESOURCES = "resources"; 60 private static final String RESOURCES = "resources";
59 private static final String DETAILS = "details"; 61 private static final String DETAILS = "details";
60 62
61 private static final String[] COL_IDS = { 63 private static final String[] COL_IDS = {
62 - APP_ID, KEY, TYPE, PRIORITY, RESOURCES, DETAILS 64 + APP_ID, KEY, TYPE, PRIORITY, STATE, RESOURCES, DETAILS
63 }; 65 };
64 66
65 @Override 67 @Override
...@@ -89,6 +91,7 @@ public class IntentViewMessageHandler extends UiMessageHandler { ...@@ -89,6 +91,7 @@ public class IntentViewMessageHandler extends UiMessageHandler {
89 tm.setFormatter(APP_ID, AppIdFormatter.INSTANCE); 91 tm.setFormatter(APP_ID, AppIdFormatter.INSTANCE);
90 tm.setFormatter(RESOURCES, new ResourcesFormatter()); 92 tm.setFormatter(RESOURCES, new ResourcesFormatter());
91 tm.setFormatter(DETAILS, new DetailsFormatter()); 93 tm.setFormatter(DETAILS, new DetailsFormatter());
94 + tm.setFormatter(STATE, EnumFormatter.INSTANCE);
92 return tm; 95 return tm;
93 } 96 }
94 97
...@@ -96,15 +99,16 @@ public class IntentViewMessageHandler extends UiMessageHandler { ...@@ -96,15 +99,16 @@ public class IntentViewMessageHandler extends UiMessageHandler {
96 protected void populateTable(TableModel tm, ObjectNode payload) { 99 protected void populateTable(TableModel tm, ObjectNode payload) {
97 IntentService is = get(IntentService.class); 100 IntentService is = get(IntentService.class);
98 for (Intent intent : is.getIntents()) { 101 for (Intent intent : is.getIntents()) {
99 - populateRow(tm.addRow(), intent); 102 + populateRow(tm.addRow(), intent, is);
100 } 103 }
101 } 104 }
102 105
103 - private void populateRow(TableModel.Row row, Intent intent) { 106 + private void populateRow(TableModel.Row row, Intent intent, IntentService is) {
104 row.cell(APP_ID, intent.appId()) 107 row.cell(APP_ID, intent.appId())
105 .cell(KEY, intent.key()) 108 .cell(KEY, intent.key())
106 .cell(TYPE, intent.getClass().getSimpleName()) 109 .cell(TYPE, intent.getClass().getSimpleName())
107 .cell(PRIORITY, intent.priority()) 110 .cell(PRIORITY, intent.priority())
111 + .cell(STATE, is.getIntentState(intent.key()))
108 .cell(RESOURCES, intent) 112 .cell(RESOURCES, intent)
109 .cell(DETAILS, intent); 113 .cell(DETAILS, intent);
110 } 114 }
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
35 <td colId="key" sortable>Key </td> 35 <td colId="key" sortable>Key </td>
36 <td colId="type" sortable>Type </td> 36 <td colId="type" sortable>Type </td>
37 <td colId="priority" sortable>Priority </td> 37 <td colId="priority" sortable>Priority </td>
38 + <td colId="state" sortable>State </td>
38 </tr> 39 </tr>
39 </table> 40 </table>
40 </div> 41 </div>
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
42 <div class="table-body"> 43 <div class="table-body">
43 <table> 44 <table>
44 <tr ng-hide="tableData.length" class="no-data ignore-width"> 45 <tr ng-hide="tableData.length" class="no-data ignore-width">
45 - <td colspan="4"> 46 + <td colspan="5">
46 No Intents found 47 No Intents found
47 </td> 48 </td>
48 </tr> 49 </tr>
...@@ -52,12 +53,13 @@ ...@@ -52,12 +53,13 @@
52 <td>{{intent.key}}</td> 53 <td>{{intent.key}}</td>
53 <td>{{intent.type}}</td> 54 <td>{{intent.type}}</td>
54 <td>{{intent.priority}}</td> 55 <td>{{intent.priority}}</td>
56 + <td>{{intent.state}}</td>
55 </tr> 57 </tr>
56 <tr> 58 <tr>
57 - <td class="resources" colspan="4">{{intent.resources}}</td> 59 + <td class="resources" colspan="5">{{intent.resources}}</td>
58 </tr> 60 </tr>
59 <tr ng-repeat-end ng-repeat-done> 61 <tr ng-repeat-end ng-repeat-done>
60 - <td class="details" colspan="4">{{intent.details}}</td> 62 + <td class="details" colspan="5">{{intent.details}}</td>
61 </tr> 63 </tr>
62 </table> 64 </table>
63 </div> 65 </div>
......