Skip to content

Commit

Permalink
New "Delete Agents" button in Web UI
Browse files Browse the repository at this point in the history
  • Loading branch information
sriniketh923 authored and jhunt committed Dec 17, 2019
1 parent 0427ce0 commit 7391134
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
27 changes: 25 additions & 2 deletions web/htdocs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2662,7 +2662,7 @@ <h2>[[ if (_.store) { ]]Edit[[ } else { ]]New[[ } ]] Storage System</h2>
<h2>Delete The <em>[[= h(_.store.name) ]]</em> Cloud Storage System?</h2>

<p>You have requested that SHIELD remove the configuration for
the cloud storage system "[[= h(_.store.name) ]]". <em>This is a
the cloud storage system "[[= h(_.store.name) ]]". <em>This is an
irreversible action; it cannot be undone.</em></p>

<p class="q">Are you sure you want to delete <em>[[= h(_.store.name) ]]</em>?</p>
Expand Down Expand Up @@ -2962,7 +2962,8 @@ <h2>[[= _.heading ]]</h2>
<td>[[ if (agent.hidden) { ]]no[[ } else { ]]yes[[ } ]]</td>
<td>[[ if (agent.hidden) { ]]<a href="#" rel="show">show</a>
[[ } else { ]]<a href="#" rel="hide">hide</a>[[ } ]]
| <a href="#" rel="resync">resync</a></td>
| <a href="#" rel="resync">resync</a>
| <a href="#" rel="delete">delete</a></td>
</tr>
[[ if (problems.length != 0 || agent.last_error != '') { ]]
<tr class="note fail">
Expand All @@ -2981,6 +2982,28 @@ <h2>[[= _.heading ]]</h2>
</table>
[[ } ]]
<!-- }}} --></script>
<script type="text/html" id="template:agents-delete"><!-- {{{ -->
[[#
{agents-delete}

A modal interaction screen that requires the operator to acknowledge
that what they are about to do will result in the destruction of
configuration data.
]]
<div class="confirm">
<h2>Delete The <em>[[= h(_.agent.name) ]]</em> Agent?</h2>

<p>You have requested that SHIELD remove the configuration for
the agent "[[= h(_.agent.name) ]]". <em>This is an
irreversible action; it cannot be undone.</em></p>

<p class="q">Are you sure you want to delete <em>[[= h(_.agent.name) ]]</em>?</p>
<div class="a">
<button class="safe" rel="close">No, Keep It</button>
<button class="danger" rel="yes">Yes, Delete It</button>
</div>
</div>
<!-- }}} --></script>
<script type="text/html" id="template:auth-providers"><!-- {{{ -->
[[#
{auth-providers} template
Expand Down
22 changes: 22 additions & 0 deletions web/htdocs/js/shield.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,28 @@ function dispatch(page) {
banner("Resynchronization of agent underway");
}
});
} else if (action == 'delete') {
var agent_uuid = $(event.target).extract('agent-uuid');
modal($($.template('agents-delete', { agent: data.agents[0] }))
.on('click', '[rel="yes"]', function (event) {
event.preventDefault();
api({
type: 'DELETE',
url: '/v2/agents/'+agent_uuid,
error: "Unable to delete agent",
complete: function () {
modal(true);
},
success: function (event) {
goto('#!/admin/agents');
}
});
})
.on('click', '[rel="close"]', function (event) {
modal(true);
goto('#!/admin/agents');
})
);
}
}));
}
Expand Down

0 comments on commit 7391134

Please sign in to comment.