Thomas Vachuska
Committed by Gerrit Code Review

GUI -- Added Settings view

Change-Id: Icdabb361bff3ccc3e4d12cb889dd77e62c1519e0
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.ui.impl;
17 +
18 +import com.fasterxml.jackson.databind.node.ObjectNode;
19 +import com.google.common.collect.ImmutableSet;
20 +import org.onosproject.cfg.ComponentConfigService;
21 +import org.onosproject.cfg.ConfigProperty;
22 +import org.onosproject.ui.RequestHandler;
23 +import org.onosproject.ui.UiMessageHandler;
24 +import org.onosproject.ui.table.TableModel;
25 +import org.onosproject.ui.table.TableRequestHandler;
26 +
27 +import java.util.Collection;
28 +
29 +/**
30 + * Message handler for component configuration view related messages.
31 + */
32 +public class SettingsViewMessageHandler extends UiMessageHandler {
33 +
34 + private static final String DATA_REQUEST = "settingDataRequest";
35 + private static final String DATA_RESPONSE = "settingDataResponse";
36 + private static final String SETTINGS = "settings";
37 +
38 + private static final String COMPONENT = "component";
39 + private static final String ID = "id";
40 + private static final String TYPE = "type";
41 + private static final String VALUE = "value";
42 + private static final String DEFAULT = "defValue";
43 + private static final String DESC = "desc";
44 +
45 + private static final String[] COL_IDS = {
46 + COMPONENT, ID, TYPE, VALUE, DEFAULT, DESC
47 + };
48 +
49 + @Override
50 + protected Collection<RequestHandler> createRequestHandlers() {
51 + return ImmutableSet.of(new SettingsRequest());
52 + }
53 +
54 + // handler for host table requests
55 + private final class SettingsRequest extends TableRequestHandler {
56 + private SettingsRequest() {
57 + super(DATA_REQUEST, DATA_RESPONSE, SETTINGS);
58 + }
59 +
60 + @Override
61 + protected String[] getColumnIds() {
62 + return COL_IDS;
63 + }
64 +
65 + @Override
66 + protected String defaultColumnId() {
67 + return COMPONENT;
68 + }
69 +
70 + @Override
71 + protected TableModel createTableModel() {
72 + TableModel tm = super.createTableModel();
73 + return tm;
74 + }
75 +
76 + @Override
77 + protected void populateTable(TableModel tm, ObjectNode payload) {
78 + ComponentConfigService ccs = get(ComponentConfigService.class);
79 + for (String component : ccs.getComponentNames()) {
80 + for (ConfigProperty prop : ccs.getProperties(component)) {
81 + populateRow(tm.addRow(), component, prop);
82 + }
83 + }
84 + }
85 +
86 + private void populateRow(TableModel.Row row, String component, ConfigProperty prop) {
87 + row.cell(COMPONENT, component)
88 + .cell(ID, prop.name())
89 + .cell(TYPE, prop.type().toString().toLowerCase())
90 + .cell(VALUE, prop.value())
91 + .cell(DEFAULT, prop.defaultValue())
92 + .cell(DESC, prop.description());
93 + }
94 + }
95 +}
...@@ -71,6 +71,7 @@ public class UiExtensionManager ...@@ -71,6 +71,7 @@ public class UiExtensionManager
71 private UiExtension createCoreExtension() { 71 private UiExtension createCoreExtension() {
72 List<UiView> coreViews = of( 72 List<UiView> coreViews = of(
73 new UiView(PLATFORM, "app", "Applications", "nav_apps"), 73 new UiView(PLATFORM, "app", "Applications", "nav_apps"),
74 + new UiView(PLATFORM, "settings", "Settings", "nav_settings"),
74 new UiView(PLATFORM, "cluster", "Cluster Nodes", "nav_cluster"), 75 new UiView(PLATFORM, "cluster", "Cluster Nodes", "nav_cluster"),
75 new UiView(NETWORK, "topo", "Topology", "nav_topo"), 76 new UiView(NETWORK, "topo", "Topology", "nav_topo"),
76 new UiView(NETWORK, "device", "Devices", "nav_devs"), 77 new UiView(NETWORK, "device", "Devices", "nav_devs"),
...@@ -94,6 +95,7 @@ public class UiExtensionManager ...@@ -94,6 +95,7 @@ public class UiExtensionManager
94 new GroupViewMessageHandler(), 95 new GroupViewMessageHandler(),
95 new IntentViewMessageHandler(), 96 new IntentViewMessageHandler(),
96 new ApplicationViewMessageHandler(), 97 new ApplicationViewMessageHandler(),
98 + new SettingsViewMessageHandler(),
97 new ClusterViewMessageHandler() 99 new ClusterViewMessageHandler()
98 ); 100 );
99 101
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
53 hostIcon_bgpSpeaker: 'bgpSpeaker', 53 hostIcon_bgpSpeaker: 'bgpSpeaker',
54 54
55 nav_apps: 'bird', 55 nav_apps: 'bird',
56 + nav_settings: 'chain',
56 nav_cluster: 'node', 57 nav_cluster: 'node',
57 nav_topo: 'topo', 58 nav_topo: 'topo',
58 nav_devs: 'switch', 59 nav_devs: 'switch',
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/*
18 + ONOS GUI -- Settings View -- CSS file
19 + */
20 +
21 +#ov-settings h2 {
22 + display: inline-block;
23 +}
24 +
25 +#ov-settings div.ctrl-btns {
26 + width: 45px;
27 +}
1 +<!-- settings partial HTML -->
2 +<div id="ov-settings">
3 + <div class="tabular-header">
4 + <h2>Component Settings ({{tableData.length}} total)</h2>
5 + <div class="ctrl-btns">
6 + <div class="refresh active"
7 + icon icon-size="36" icon-id="refresh"
8 + ng-click="refresh()"></div>
9 + </div>
10 + </div>
11 +
12 + <div class="summary-list" onos-fixed-header>
13 +
14 + <div class="table-header"
15 + onos-sortable-header sort-callback="sortCallback(requestParams)">
16 + <table>
17 + <tr>
18 + <td colId="component" sortable col-width="400px">Component </td>
19 + <td colId="id" sortable>Property </td>
20 + <td colId="type" sortable col-width="70px">Type </td>
21 + <td colId="value" sortable>Value </td>
22 + <td colId="defValue" sortable>Default </td>
23 + <td colId="desc" col-width="520px">Description </td>
24 + </tr>
25 + </table>
26 + </div>
27 +
28 + <div class="table-body">
29 + <table>
30 + <tr ng-hide="tableData.length" class="no-data ignore-width">
31 + <td colspan="6">
32 + No Settings found
33 + </td>
34 + </tr>
35 +
36 + <tr ng-repeat="prop in tableData"
37 + ng-repeat-done>
38 + <td>{{prop.component}}</td>
39 + <td>{{prop.id}}</td>
40 + <td>{{prop.type}}</td>
41 + <td>{{prop.value}}</td>
42 + <td>{{prop.defValue}}</td>
43 + <td>{{prop.desc}}</td>
44 + </tr>
45 + </table>
46 + </div>
47 +
48 + </div>
49 +
50 +</div>
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/*
18 + ONOS GUI -- Component Settings View Module
19 + */
20 +
21 +(function () {
22 + 'use strict';
23 +
24 + angular.module('ovSettings', [])
25 + .controller('OvSettingsCtrl',
26 + ['$log', '$scope', 'TableBuilderService',
27 +
28 + function ($log, $scope, tbs) {
29 + tbs.buildTable({
30 + scope: $scope,
31 + tag: 'setting'
32 + });
33 +
34 + $log.log('OvSettingsCtrl has been created');
35 + }]);
36 +}());
...@@ -116,8 +116,9 @@ ...@@ -116,8 +116,9 @@
116 <script src="app/view/link/link.js"></script> 116 <script src="app/view/link/link.js"></script>
117 <script src="app/view/host/host.js"></script> 117 <script src="app/view/host/host.js"></script>
118 <script src="app/view/intent/intent.js"></script> 118 <script src="app/view/intent/intent.js"></script>
119 - <script src="app/view/cluster/cluster.js"></script>
120 <script src="app/view/app/app.js"></script> 119 <script src="app/view/app/app.js"></script>
120 + <script src="app/view/settings/settings.js"></script>
121 + <script src="app/view/cluster/cluster.js"></script>
121 122
122 <!-- This is where contributed javascript will get injected --> 123 <!-- This is where contributed javascript will get injected -->
123 <!-- {INJECTED-JAVASCRIPT-START} --> 124 <!-- {INJECTED-JAVASCRIPT-START} -->
...@@ -133,6 +134,7 @@ ...@@ -133,6 +134,7 @@
133 <link rel="stylesheet" href="app/view/host/host.css"> 134 <link rel="stylesheet" href="app/view/host/host.css">
134 <link rel="stylesheet" href="app/view/intent/intent.css"> 135 <link rel="stylesheet" href="app/view/intent/intent.css">
135 <link rel="stylesheet" href="app/view/app/app.css"> 136 <link rel="stylesheet" href="app/view/app/app.css">
137 + <link rel="stylesheet" href="app/view/settings/settings.css">
136 <link rel="stylesheet" href="app/view/cluster/cluster.css"> 138 <link rel="stylesheet" href="app/view/cluster/cluster.css">
137 139
138 <!-- This is where contributed stylesheets will get injected --> 140 <!-- This is where contributed stylesheets will get injected -->
......