mirror of
https://github.com/grafana/grafana.git
synced 2025-01-09 23:53:25 -06:00
feat(admin): Deleting org from orgs list now works, will permanently delete dashboards, data sources, etc, closes #2457
This commit is contained in:
parent
7370af9a82
commit
8fcaa4997d
@ -113,6 +113,7 @@ func Register(r *macaron.Macaron) {
|
||||
r.Group("/orgs/:orgId", func() {
|
||||
r.Get("/", wrap(GetOrgById))
|
||||
r.Put("/", bind(m.UpdateOrgCommand{}), wrap(UpdateOrg))
|
||||
r.Delete("/", wrap(DeleteOrgById))
|
||||
r.Get("/users", wrap(GetOrgUsers))
|
||||
r.Post("/users", bind(m.AddOrgUserCommand{}), wrap(AddOrgUser))
|
||||
r.Patch("/users/:userId", bind(m.UpdateOrgUserCommand{}), wrap(UpdateOrgUser))
|
||||
|
@ -77,6 +77,14 @@ func updateOrgHelper(cmd m.UpdateOrgCommand) Response {
|
||||
return ApiSuccess("Organization updated")
|
||||
}
|
||||
|
||||
// GET /api/orgs/:orgId
|
||||
func DeleteOrgById(c *middleware.Context) Response {
|
||||
if err := bus.Dispatch(&m.DeleteOrgCommand{Id: c.ParamsInt64(":orgId")}); err != nil {
|
||||
return ApiError(500, "Failed to update organization", err)
|
||||
}
|
||||
return ApiSuccess("Organization deleted")
|
||||
}
|
||||
|
||||
func SearchOrgs(c *middleware.Context) Response {
|
||||
query := m.SearchOrgsQuery{
|
||||
Query: c.Query("query"),
|
||||
|
@ -130,6 +130,7 @@ func DeleteOrg(cmd *m.DeleteOrgCommand) error {
|
||||
"DELETE FROM data_source WHERE org_id = ?",
|
||||
"DELETE FROM org_user WHERE org_id = ?",
|
||||
"DELETE FROM org WHERE id = ?",
|
||||
"DELETE FROM temp_user WHERE org_id = ?",
|
||||
}
|
||||
|
||||
for _, sql := range deletes {
|
||||
|
@ -21,6 +21,7 @@ function (angular) {
|
||||
$scope.deleteOrg = function(org) {
|
||||
$scope.appEvent('confirm-modal', {
|
||||
title: 'Do you want to delete organization ' + org.name + '?',
|
||||
text: 'All dashboards for this organization will be removed!',
|
||||
icon: 'fa-trash',
|
||||
yesText: 'Delete',
|
||||
onConfirm: function() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<topnav icon="fa fa-fw fa-user" title="Global Users" subnav="true">
|
||||
<ul class="nav">
|
||||
<li class="active"><a href="admin/users">Overview</a></li>
|
||||
<li class="active"><a href="admin/users">List</a></li>
|
||||
<li><a href="admin/users/create">Create user</a></li>
|
||||
</ul>
|
||||
</topnav>
|
||||
|
Loading…
Reference in New Issue
Block a user