Add Dashboards (#41)

This commit is contained in:
Jonas Plum
2022-03-14 00:23:29 +01:00
committed by GitHub
parent 18a4dc54e7
commit 02c7da91da
30 changed files with 2824 additions and 279 deletions

View File

@@ -78,6 +78,27 @@ func SetupTestData(ctx context.Context, db *database.Database) error {
return err
}
if _, err := db.DashboardCreate(ctx, &model.Dashboard{
Name: "Simple",
Widgets: []*model.Widget{
{
Name: "open_tickets_per_user",
Type: model.WidgetTypeBar,
Aggregation: "owner",
Filter: pointer.String(`status == "open"`),
Width: 4,
},
{
Name: "tickets_per_week",
Type: model.WidgetTypeLine,
Aggregation: `CONCAT(DATE_YEAR(created), "-", DATE_ISOWEEK(created) < 10 ? "0" : "", DATE_ISOWEEK(created))`,
Width: 8,
},
},
}); err != nil {
return err
}
return nil
}

View File

@@ -84,7 +84,7 @@ func Index(t *testing.T) (*index.Index, func(), error) {
if err != nil {
return nil, nil, err
}
return catalystIndex, func() { os.RemoveAll(dir) }, nil
return catalystIndex, func() { catalystIndex.Close(); os.RemoveAll(dir) }, nil
}
func Bus(t *testing.T) (context.Context, *catalyst.Config, *bus.Bus, error) {