Skip to content

Commit 22ff28b

Browse files
committed
allow Agent UI to remove router
1 parent 856d9fe commit 22ff28b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

packages/pico-engine/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ <h2>{{ui.name}}</h2>
569569
</td>
570570
</tr></table>
571571
</form>
572-
<h3>Inbound router: {{#if ui.routerUI}}<span title="{{ui.routerUI.routerHost}} {{ui.routerUI.routerRequestECI}}">{{ui.routerUI.routerName}}</span>{{else}}<a href="#" onclick="$(this).parent().next('form').toggle()" style="font-size:75%">not configured</a>{{/if}}</h3>
572+
<h3>Inbound router: {{#if ui.routerUI}}<span title="{{ui.routerUI.routerHost}} {{ui.routerUI.routerRequestECI}}">{{ui.routerUI.routerName}}</span> {{#if ui.routerUI.unused}}<a class="js-ajax-link" href="/sky/event/{{eci}}/remove-router/edge/router_removal_requested">del</a>{{/if}}{{else}}<a href="#" onclick="$(this).parent().next('form').toggle()" style="font-size:75%">not configured</a>{{/if}}</h3>
573573
{{#unless ui.routerUI.routerName}}
574574
<form class="js-ajax-form" action="/sky/event/{{eci}}/add-ruleset/wrangler/install_rulesets_requested?rids=org.sovrin.edge" style="display:none">
575575
<input name="host" placeholder="router host">

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,14 +515,19 @@ $(document).ready(function () {
515515
d = theDB.pico_id + '-Policies'
516516
location.hash = d
517517
} else if (tabName === 'agent') {
518-
if (theDB.ui && theDB.ui.routerUI && theDB.ui.routerUI.routerName && theDB.ui.connections) {
519-
var toSuffix = " to " + theDB.ui.name
520-
for (var ic=0; ic < theDB.ui.connections.length; ++ic) {
521-
var rConnName = theDB.ui.connections[ic].label + toSuffix
522-
if (theDB.ui.routerUI.routerConnections && theDB.ui.routerUI.routerConnections[rConnName]) {
523-
theDB.ui.connections[ic].routerName = theDB.ui.routerUI.routerName
518+
var routerUsedCount = 0
519+
if (theDB.ui && theDB.ui.routerUI) {
520+
if (theDB.ui.routerUI.routerName && theDB.ui.connections) {
521+
var toSuffix = " to " + theDB.ui.name
522+
for (var ic=0; ic < theDB.ui.connections.length; ++ic) {
523+
var rConnName = theDB.ui.connections[ic].label + toSuffix
524+
if (theDB.ui.routerUI.routerConnections && theDB.ui.routerUI.routerConnections[rConnName]) {
525+
theDB.ui.connections[ic].routerName = theDB.ui.routerUI.routerName
526+
++routerUsedCount
527+
}
524528
}
525529
}
530+
theDB.ui.routerUI.unused = routerUsedCount == 0
526531
}
527532
theDB.text = JSON.stringify(theDB.ui, undefined, 2)
528533
$theSection.html(agentTemplate(theDB))

0 commit comments

Comments
 (0)