Jian Li
Committed by Thomas Vachuska

[ONOS-3635] Implement detail panel view for extended app properties

This commit implements detail panel view of application.
Current implementation adds id, state, category, version, origin,
role and url properties to detail panel view.
List of features and required applications will be added in a
separated commit.

Change-Id: Id5cd7ed128b3d69225153aca990c91b462e5a677
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
15 */ 15 */
16 package org.onosproject.ui.impl; 16 package org.onosproject.ui.impl;
17 17
18 +import com.fasterxml.jackson.databind.node.ArrayNode;
18 import com.fasterxml.jackson.databind.node.ObjectNode; 19 import com.fasterxml.jackson.databind.node.ObjectNode;
19 import com.google.common.collect.ImmutableSet; 20 import com.google.common.collect.ImmutableSet;
20 import org.onosproject.app.ApplicationAdminService; 21 import org.onosproject.app.ApplicationAdminService;
...@@ -42,6 +43,10 @@ public class ApplicationViewMessageHandler extends UiMessageHandler { ...@@ -42,6 +43,10 @@ public class ApplicationViewMessageHandler extends UiMessageHandler {
42 43
43 private static final String APP_MGMT_REQ = "appManagementRequest"; 44 private static final String APP_MGMT_REQ = "appManagementRequest";
44 45
46 + private static final String APP_DETAILS_REQ = "appDetailsRequest";
47 + private static final String APP_DETAILS_RESP = "appDetailsResponse";
48 + private static final String DETAILS = "details";
49 +
45 private static final String STATE = "state"; 50 private static final String STATE = "state";
46 private static final String STATE_IID = "_iconid_state"; 51 private static final String STATE_IID = "_iconid_state";
47 private static final String ID = "id"; 52 private static final String ID = "id";
...@@ -51,19 +56,25 @@ public class ApplicationViewMessageHandler extends UiMessageHandler { ...@@ -51,19 +56,25 @@ public class ApplicationViewMessageHandler extends UiMessageHandler {
51 private static final String ORIGIN = "origin"; 56 private static final String ORIGIN = "origin";
52 private static final String DESC = "desc"; 57 private static final String DESC = "desc";
53 private static final String URL = "url"; 58 private static final String URL = "url";
59 + private static final String README = "readme";
60 + private static final String ROLE = "role";
61 + private static final String REQUIRED_APPS = "_required_apps";
62 + private static final String FEATURES = "features";
54 63
55 private static final String ICON_ID_ACTIVE = "active"; 64 private static final String ICON_ID_ACTIVE = "active";
56 private static final String ICON_ID_INACTIVE = "appInactive"; 65 private static final String ICON_ID_INACTIVE = "appInactive";
57 66
58 private static final String[] COL_IDS = { 67 private static final String[] COL_IDS = {
59 - STATE, STATE_IID, ID, ICON, VERSION, CATEGORY, ORIGIN, DESC, URL 68 + STATE, STATE_IID, ID, ICON, VERSION, CATEGORY, ORIGIN, DESC,
69 + URL, README, ROLE, REQUIRED_APPS, FEATURES
60 }; 70 };
61 71
62 @Override 72 @Override
63 protected Collection<RequestHandler> createRequestHandlers() { 73 protected Collection<RequestHandler> createRequestHandlers() {
64 return ImmutableSet.of( 74 return ImmutableSet.of(
65 new AppDataRequest(), 75 new AppDataRequest(),
66 - new AppMgmtRequest() 76 + new AppMgmtRequest(),
77 + new DetailRequestHandler()
67 ); 78 );
68 } 79 }
69 80
...@@ -135,4 +146,46 @@ public class ApplicationViewMessageHandler extends UiMessageHandler { ...@@ -135,4 +146,46 @@ public class ApplicationViewMessageHandler extends UiMessageHandler {
135 } 146 }
136 } 147 }
137 } 148 }
149 +
150 + // handler for selected application detail requests
151 + private final class DetailRequestHandler extends RequestHandler {
152 + private DetailRequestHandler() {
153 + super(APP_DETAILS_REQ);
154 + }
155 +
156 + @Override
157 + public void process(long sid, ObjectNode payload) {
158 + String id = string(payload, ID);
159 + ApplicationService as = get(ApplicationService.class);
160 + ApplicationId appId = as.getId(id);
161 + ApplicationState state = as.getState(appId);
162 + Application app = as.getApplication(appId);
163 + ObjectNode data = objectNode();
164 +
165 + data.put(STATE, state.toString());
166 + data.put(ID, appId.name());
167 + data.put(VERSION, app.version().toString());
168 + data.put(ROLE, app.role().toString());
169 + data.put(CATEGORY, app.category());
170 + data.put(ORIGIN, app.origin());
171 + data.put(README, app.readme());
172 + data.put(URL, app.url());
173 +
174 + // process required applications
175 + ArrayNode requiredApps = arrayNode();
176 + app.requiredApps().forEach(s -> requiredApps.add(s));
177 +
178 + data.set(REQUIRED_APPS, requiredApps);
179 +
180 + // process features
181 + ArrayNode features = arrayNode();
182 + app.features().forEach(f -> features.add(f));
183 +
184 + data.set(FEATURES, features);
185 +
186 + ObjectNode rootNode = objectNode();
187 + rootNode.set(DETAILS, data);
188 + sendMessage(APP_DETAILS_RESP, 0, rootNode);
189 + }
190 + }
138 } 191 }
......
1 /* 1 /*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015-2016 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -60,3 +60,118 @@ ...@@ -60,3 +60,118 @@
60 .dark #app-dialog.floatpanel.dialog { 60 .dark #app-dialog.floatpanel.dialog {
61 background-color: #444; 61 background-color: #444;
62 } 62 }
63 +
64 +#application-details-panel.floatpanel {
65 + -moz-border-radius: 0;
66 + border-radius: 0;
67 + z-index: 0;
68 +}
69 +
70 +.light #application-details-panel.floatpanel {
71 + background-color: rgb(229, 234, 237);
72 +}
73 +.dark #application-details-panel.floatpanel {
74 + background-color: #3A4042;
75 +}
76 +
77 +#application-details-panel .container {
78 + padding: 0 12px;
79 +}
80 +
81 +#application-details-panel .close-btn {
82 + position: absolute;
83 + right: 10px;
84 + top: 0;
85 + cursor: pointer;
86 +}
87 +.light .close-btn svg.embeddedIcon .icon.plus .glyph {
88 + fill: #aaa;
89 +}
90 +.dark .close-btn svg.embeddedIcon .icon.plus .glyph {
91 + fill: #ccc;
92 +}
93 +
94 +#application-details-panel .dev-icon {
95 + display: inline-block;
96 + padding: 0 6px 0 0;
97 + vertical-align: middle;
98 +}
99 +.light .dev-icon svg.embeddedIcon .glyph {
100 + fill: rgb(0, 172, 229);
101 +}
102 +.dark .dev-icon svg.embeddedIcon .glyph {
103 + fill: #486D91;
104 +}
105 +
106 +#application-details-panel h2 {
107 + display: inline-block;
108 + margin: 8px 0;
109 +}
110 +
111 +#application-details-panel .top div.left {
112 + float: left;
113 + padding: 0 18px 0 0;
114 +}
115 +#application-details-panel .top div.right {
116 + display: inline-block;
117 +}
118 +
119 +#application-details-panel td.label {
120 + font-style: italic;
121 + padding-right: 12px;
122 + /* works for both light and dark themes ... */
123 + color: #777;
124 +}
125 +
126 +#application-details-panel .actionBtns div {
127 + padding: 12px 6px;
128 +}
129 +
130 +#application-details-panel .top hr {
131 + width: 95%;
132 + margin: 0 auto;
133 +}
134 +
135 +.light #application-details-panel hr {
136 + opacity: .5;
137 + border-color: #FFF;
138 +}
139 +.dark #application-details-panel hr {
140 + border-color: #666;
141 +}
142 +
143 +#application-details-panel .bottom table {
144 + border-spacing: 0;
145 +}
146 +
147 +#application-details-panel .bottom th {
148 + letter-spacing: 0.02em;
149 +}
150 +
151 +.light #application-details-panel .bottom th {
152 + background-color: #CCC;
153 + /* default text color */
154 +}
155 +.dark #application-details-panel .bottom th {
156 + background-color: #131313;
157 + color: #ccc;
158 +}
159 +
160 +#application-details-panel .bottom th,
161 +#application-details-panel .bottom td {
162 + padding: 6px 12px;
163 + text-align: center;
164 +}
165 +
166 +.light #application-details-panel .bottom tr:nth-child(odd) {
167 + background-color: #f9f9f9;
168 +}
169 +.light #application-details-panel .bottom tr:nth-child(even) {
170 + background-color: #EBEDF2;
171 +}
172 +.dark #application-details-panel .bottom tr:nth-child(odd) {
173 + background-color: #333;
174 +}
175 +.dark #application-details-panel .bottom tr:nth-child(even) {
176 + background-color: #555;
177 +}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
67 <td class="table-icon"> 67 <td class="table-icon">
68 <div icon icon-id="{{app._iconid_state}}"></div> 68 <div icon icon-id="{{app._iconid_state}}"></div>
69 </td> 69 </td>
70 - <td><img data-ng-src="./rs/applications/{{app.icon}}/icon" height="28px" width="28px" /></td> 70 + <td><img data-ng-src="./rs/applications/{{app.icon}}/icon"
71 + height="28px" width="28px" /></td>
71 <td>{{app.id}}</td> 72 <td>{{app.id}}</td>
72 <td>{{app.version}}</td> 73 <td>{{app.version}}</td>
73 <td>{{app.category}}</td> 74 <td>{{app.category}}</td>
...@@ -80,4 +81,6 @@ ...@@ -80,4 +81,6 @@
80 81
81 </div> 82 </div>
82 83
84 + <application-details-panel></application-details-panel>
85 +
83 </div> 86 </div>
......
This diff is collapsed. Click to expand it.