Skip to content

Commit 4e243a1

Browse files
committed
display policy as tooltip
1 parent 96e4a93 commit 4e243a1

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

packages/pico-engine/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ <h2>Children</h2>
254254
{{/if}}
255255
</td>
256256
<td>{{name}}</td><td>{{type}}</td>
257-
<td>{{policy_id}}</td><td>{{policy_name}}</td>
257+
<td title="{{policy_text}}">{{policy_id}}</td><td>{{policy_name}}</td>
258258
</tr>
259259
{{/each}}
260260
</table>

packages/pico-engine/public/js/index.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,24 +172,20 @@ $.getJSON("/api/db-dump?legacy=true", function(db_dump){
172172
callback({"pico_id": thePicoInp.id, "eci":eci, "testing":testing});
173173
} else if (label === "Channels") {
174174
var theChannels = [];
175-
var thePolicies = {};
175+
var thePolicies = get(db_dump,["policy"]);
176176
Object.keys(thePicoInp.channel).forEach(function(id){
177177
var aChannel = get(thePicoInp,["channel",id],undefined);
178178
if (aChannel) {
179179
if (aChannel.type!="secret" || aChannel.name!="admin") {
180180
aChannel.canDel = true;
181181
}
182-
var policy_id = aChannel.policy_id;
183-
var policy_name = thePolicies[policy_id];
184-
if (!policy_name) {
185-
policy_name = get(db_dump,["policy",policy_id,"name"]);
186-
thePolicies[policy_id] = policy_name;
187-
}
188-
aChannel.policy_name = policy_name;
182+
var the_policy = thePolicies[aChannel.policy_id];
183+
aChannel.policy_name = the_policy.name;
184+
aChannel.policy_text = JSON.stringify(the_policy,undefined,2);
189185
theChannels.push(aChannel);
190186
}
191187
});
192-
callback({ "pico_id": thePicoInp.id, "id": thePicoInp.id, "eci": thePicoInp.admin_eci, "channel": theChannels, "policy": get(db_dump,["policy"]) });
188+
callback({ "pico_id": thePicoInp.id, "id": thePicoInp.id, "eci": thePicoInp.admin_eci, "channel": theChannels, "policy": thePolicies });
193189
} else if (label == "Subscriptions") {
194190
var theSubscriptions = {};
195191
theSubscriptions.pico_id = thePicoInp.id;

0 commit comments

Comments
 (0)