Commit e0ffcda3 by utkarshcmu

Added UI , DB settings

parent 78fe5883
...@@ -59,6 +59,8 @@ func GetDashboard(c *middleware.Context) { ...@@ -59,6 +59,8 @@ func GetDashboard(c *middleware.Context) {
CanEdit: canEditDashboard(c.OrgRole), CanEdit: canEditDashboard(c.OrgRole),
Created: dash.Created, Created: dash.Created,
Updated: dash.Updated, Updated: dash.Updated,
CreatedBy: dash.CreatedBy,
UpdatedBy: dash.UpdatedBy,
}, },
} }
......
...@@ -41,6 +41,8 @@ type DashboardMeta struct { ...@@ -41,6 +41,8 @@ type DashboardMeta struct {
Expires time.Time `json:"expires"` Expires time.Time `json:"expires"`
Created time.Time `json:"created"` Created time.Time `json:"created"`
Updated time.Time `json:"updated"` Updated time.Time `json:"updated"`
CreatedBy string `json:"createdBy"`
UpdatedBy string `json:"updatedBy"`
} }
type DashboardFullWithMeta struct { type DashboardFullWithMeta struct {
...@@ -61,6 +63,7 @@ type DataSource struct { ...@@ -61,6 +63,7 @@ type DataSource struct {
BasicAuth bool `json:"basicAuth"` BasicAuth bool `json:"basicAuth"`
BasicAuthUser string `json:"basicAuthUser"` BasicAuthUser string `json:"basicAuthUser"`
BasicAuthPassword string `json:"basicAuthPassword"` BasicAuthPassword string `json:"basicAuthPassword"`
WithCredentials bool `json:"withCredentials"`
IsDefault bool `json:"isDefault"` IsDefault bool `json:"isDefault"`
JsonData map[string]interface{} `json:"jsonData"` JsonData map[string]interface{} `json:"jsonData"`
} }
......
...@@ -33,6 +33,9 @@ type Dashboard struct { ...@@ -33,6 +33,9 @@ type Dashboard struct {
Created time.Time Created time.Time
Updated time.Time Updated time.Time
CreatedBy string
UpdatedBy string
Title string Title string
Data map[string]interface{} Data map[string]interface{}
} }
...@@ -45,6 +48,8 @@ func NewDashboard(title string) *Dashboard { ...@@ -45,6 +48,8 @@ func NewDashboard(title string) *Dashboard {
dash.Title = title dash.Title = title
dash.Created = time.Now() dash.Created = time.Now()
dash.Updated = time.Now() dash.Updated = time.Now()
// TODO:dash.CreatedBy = "Creator"
// TODO:dash.UpdatedBy = "Creator"
dash.UpdateSlug() dash.UpdateSlug()
return dash return dash
} }
...@@ -76,11 +81,14 @@ func NewDashboardFromJson(data map[string]interface{}) *Dashboard { ...@@ -76,11 +81,14 @@ func NewDashboardFromJson(data map[string]interface{}) *Dashboard {
if dash.Data["version"] != nil { if dash.Data["version"] != nil {
dash.Version = int(dash.Data["version"].(float64)) dash.Version = int(dash.Data["version"].(float64))
dash.Updated = time.Now() dash.Updated = time.Now()
// TODO:dash.UpdatedBy = "Updater"
} }
} else { } else {
dash.Data["version"] = 0 dash.Data["version"] = 0
dash.Created = time.Now() dash.Created = time.Now()
dash.Updated = time.Now() dash.Updated = time.Now()
// TODO:dash.CreatedBy = "Creator"
// TODO:dash.UpdatedBy = "Creator"
} }
return dash return dash
......
...@@ -94,12 +94,12 @@ func addDashboardMigration(mg *Migrator) { ...@@ -94,12 +94,12 @@ func addDashboardMigration(mg *Migrator) {
Mysql("ALTER TABLE dashboard MODIFY data MEDIUMTEXT;")) Mysql("ALTER TABLE dashboard MODIFY data MEDIUMTEXT;"))
// add column to store creator of a dashboard // add column to store creator of a dashboard
mg.AddMigration("Add column created_by", NewAddColumnMigration(dashboardV2, &Column{ mg.AddMigration("Add column created_by in dashboard - v2", NewAddColumnMigration(dashboardV2, &Column{
Name: "created_by", Type: DB_BigInt, Nullable: true, Name: "created_by", Type: DB_NVarchar, Length: 255, Nullable: false, Default: "Anonymous",
})) }))
// add column to store updater of a dashboard // add column to store updater of a dashboard
mg.AddMigration("Add column updated_by", NewAddColumnMigration(dashboardV2, &Column{ mg.AddMigration("Add column updated_by in dashboard - v2", NewAddColumnMigration(dashboardV2, &Column{
Name: "updated_by", Type: DB_BigInt, Nullable: true, Name: "updated_by", Type: DB_NVarchar, Length: 255, Nullable: false, Default: "Anonymous",
})) }))
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</div> </div>
<div ng-model="editor.index" bs-tabs style="text-transform:capitalize;"> <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>
</div> </div>
...@@ -114,6 +114,58 @@ ...@@ -114,6 +114,58 @@
<gf-time-picker-settings dashboard="dashboard"></gf-time-picker-settings> <gf-time-picker-settings dashboard="dashboard"></gf-time-picker-settings>
</div> </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>
<div class="clearfix"></div> <div class="clearfix"></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment