diff --git a/pkg/api/dashboard.go b/pkg/api/dashboard.go index 6490a118861..77309a24560 100644 --- a/pkg/api/dashboard.go +++ b/pkg/api/dashboard.go @@ -59,6 +59,8 @@ func GetDashboard(c *middleware.Context) { CanEdit: canEditDashboard(c.OrgRole), Created: dash.Created, Updated: dash.Updated, + CreatedBy: dash.CreatedBy, + UpdatedBy: dash.UpdatedBy, }, } diff --git a/pkg/api/dtos/models.go b/pkg/api/dtos/models.go index 7af4c84f56d..a63a45d6695 100644 --- a/pkg/api/dtos/models.go +++ b/pkg/api/dtos/models.go @@ -41,6 +41,8 @@ type DashboardMeta struct { Expires time.Time `json:"expires"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` + CreatedBy string `json:"createdBy"` + UpdatedBy string `json:"updatedBy"` } type DashboardFullWithMeta struct { @@ -61,6 +63,7 @@ type DataSource struct { BasicAuth bool `json:"basicAuth"` BasicAuthUser string `json:"basicAuthUser"` BasicAuthPassword string `json:"basicAuthPassword"` + WithCredentials bool `json:"withCredentials"` IsDefault bool `json:"isDefault"` JsonData map[string]interface{} `json:"jsonData"` } diff --git a/pkg/models/dashboards.go b/pkg/models/dashboards.go index 5b926c3e314..9c2350bb7dd 100644 --- a/pkg/models/dashboards.go +++ b/pkg/models/dashboards.go @@ -33,6 +33,9 @@ type Dashboard struct { Created time.Time Updated time.Time + CreatedBy string + UpdatedBy string + Title string Data map[string]interface{} } @@ -45,6 +48,8 @@ func NewDashboard(title string) *Dashboard { dash.Title = title dash.Created = time.Now() dash.Updated = time.Now() + // TODO:dash.CreatedBy = "Creator" + // TODO:dash.UpdatedBy = "Creator" dash.UpdateSlug() return dash } @@ -76,11 +81,14 @@ func NewDashboardFromJson(data map[string]interface{}) *Dashboard { if dash.Data["version"] != nil { dash.Version = int(dash.Data["version"].(float64)) dash.Updated = time.Now() + // TODO:dash.UpdatedBy = "Updater" } } else { dash.Data["version"] = 0 dash.Created = time.Now() dash.Updated = time.Now() + // TODO:dash.CreatedBy = "Creator" + // TODO:dash.UpdatedBy = "Creator" } return dash diff --git a/pkg/services/sqlstore/migrations/dashboard_mig.go b/pkg/services/sqlstore/migrations/dashboard_mig.go index 331dbf0ef2f..4994cb0a234 100644 --- a/pkg/services/sqlstore/migrations/dashboard_mig.go +++ b/pkg/services/sqlstore/migrations/dashboard_mig.go @@ -94,12 +94,12 @@ func addDashboardMigration(mg *Migrator) { Mysql("ALTER TABLE dashboard MODIFY data MEDIUMTEXT;")) // add column to store creator of a dashboard - mg.AddMigration("Add column created_by", NewAddColumnMigration(dashboardV2, &Column{ - Name: "created_by", Type: DB_BigInt, Nullable: true, + mg.AddMigration("Add column created_by in dashboard - v2", NewAddColumnMigration(dashboardV2, &Column{ + Name: "created_by", Type: DB_NVarchar, Length: 255, Nullable: false, Default: "Anonymous", })) // add column to store updater of a dashboard - mg.AddMigration("Add column updated_by", NewAddColumnMigration(dashboardV2, &Column{ - Name: "updated_by", Type: DB_BigInt, Nullable: true, + mg.AddMigration("Add column updated_by in dashboard - v2", NewAddColumnMigration(dashboardV2, &Column{ + Name: "updated_by", Type: DB_NVarchar, Length: 255, Nullable: false, Default: "Anonymous", })) } diff --git a/public/app/features/dashboard/partials/settings.html b/public/app/features/dashboard/partials/settings.html index 541ef45e9ab..36223f152a0 100644 --- a/public/app/features/dashboard/partials/settings.html +++ b/public/app/features/dashboard/partials/settings.html @@ -5,7 +5,7 @@