mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added UI , DB settings
This commit is contained in:
parent
78fe588330
commit
e0ffcda32e
@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -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"`
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
}))
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
</div>
|
||||
|
||||
<div ng-model="editor.index" bs-tabs style="text-transform:capitalize;">
|
||||
<div ng-repeat="tab in ['General', 'Rows', 'Links', 'Time picker']" data-title="{{tab}}">
|
||||
<div ng-repeat="tab in ['General', 'Rows', 'Links', 'Time picker', 'Metadata']" data-title="{{tab}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -114,6 +114,58 @@
|
||||
<gf-time-picker-settings dashboard="dashboard"></gf-time-picker-settings>
|
||||
</div>
|
||||
|
||||
<div ng-if="editor.index == 4">
|
||||
<div class="editor-row">
|
||||
<div class="tight-form-section">
|
||||
<h5>Info</h5>
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 120px">
|
||||
Last updated at:
|
||||
</li>
|
||||
<li class="tight-form-item" style="width: 180px">
|
||||
{{formatDate(dashboardMeta.updated)}}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="tight-form">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 120px">
|
||||
Last updated by:
|
||||
</li>
|
||||
<li class="tight-form-item" style="width: 180px">
|
||||
{{dashboardMeta.updatedBy}}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="tight-form last">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 120px">
|
||||
Created at:
|
||||
</li>
|
||||
<li class="tight-form-item" style="width: 180px">
|
||||
{{formatDate(dashboardMeta.created)}}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="tight-form last">
|
||||
<ul class="tight-form-list">
|
||||
<li class="tight-form-item" style="width: 120px">
|
||||
Created by:
|
||||
</li>
|
||||
<li class="tight-form-item" style="width: 180px">
|
||||
{{dashboardMeta.createdBy}}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
Loading…
Reference in New Issue
Block a user