Merge pull request #11038 from zhulongcheng/log-db-rm-event
log dashboard removed eventpull/11358/head
commit
1811ed43b4
|
|
@ -21,6 +21,7 @@ var (
|
|||
const (
|
||||
dashboardCreatedEvent = "Dashboard Created"
|
||||
dashboardUpdatedEvent = "Dashboard Updated"
|
||||
dashboardRemovedEvent = "Dashboard Removed"
|
||||
|
||||
dashboardCellsReplacedEvent = "Dashboard Cells Replaced"
|
||||
dashboardCellAddedEvent = "Dashboard Cell Added"
|
||||
|
|
@ -823,7 +824,6 @@ func (c *Client) deleteDashboard(ctx context.Context, tx *bolt.Tx, id platform.I
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(desa): add DeleteKeyValueLog method and use it here.
|
||||
err = c.deleteUserResourceMappings(ctx, tx, platform.UserResourceMappingFilter{
|
||||
ResourceID: id,
|
||||
ResourceType: platform.DashboardsResourceType,
|
||||
|
|
@ -833,6 +833,13 @@ func (c *Client) deleteDashboard(ctx context.Context, tx *bolt.Tx, id platform.I
|
|||
Err: err,
|
||||
}
|
||||
}
|
||||
|
||||
if err := c.appendDashboardEventToLog(ctx, tx, d.ID, dashboardRemovedEvent); err != nil {
|
||||
return &platform.Error{
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package bolt_test
|
|||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
platform "github.com/influxdata/influxdb"
|
||||
"github.com/influxdata/influxdb/bolt"
|
||||
|
|
@ -14,6 +15,11 @@ func initDashboardService(f platformtesting.DashboardFields, t *testing.T) (plat
|
|||
if err != nil {
|
||||
t.Fatalf("failed to create new bolt client: %v", err)
|
||||
}
|
||||
|
||||
if f.NowFn == nil {
|
||||
f.NowFn = time.Now
|
||||
}
|
||||
|
||||
c.IDGenerator = f.IDGenerator
|
||||
c.WithTime(f.NowFn)
|
||||
ctx := context.TODO()
|
||||
|
|
|
|||
Loading…
Reference in New Issue