Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web-UI delete agents button #668

Merged
merged 3 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions web/htdocs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,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 @@ -2961,7 +2961,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 @@ -2980,6 +2981,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