Fixed angularjs variable names

This commit is contained in:
utkarshcmu 2016-01-19 23:23:44 -08:00
parent 281ec60085
commit aa1d28835d
4 changed files with 41 additions and 7 deletions

View File

@ -118,5 +118,23 @@ func SearchDashboardSnapshots(c *middleware.Context) Response {
return ApiError(500, "Search failed", err) return ApiError(500, "Search failed", err)
} }
return Json(200, searchQuery.Result) dtos := make([]*m.DashboardSnapshotDTO, len(searchQuery.Result))
for i, snapshot := range searchQuery.Result {
dtos[i] = &m.DashboardSnapshotDTO{
Id: snapshot.Id,
Name: snapshot.Name,
Key: snapshot.Key,
DeleteKey: snapshot.DeleteKey,
OrgId: snapshot.OrgId,
UserId: snapshot.UserId,
External: snapshot.External,
ExternalUrl: snapshot.ExternalUrl,
Expires: snapshot.Expires,
Created: snapshot.Created,
Updated: snapshot.Updated,
}
}
return Json(200, dtos)
//return Json(200, searchQuery.Result)
} }

View File

@ -20,6 +20,22 @@ type DashboardSnapshot struct {
Dashboard map[string]interface{} Dashboard map[string]interface{}
} }
// DashboardSnapshotDTO without dashboard map
type DashboardSnapshotDTO struct {
Id int64 `json:"id"`
Name string `json:"name"`
Key string `json:"key"`
DeleteKey string `json:"deleteKey"`
OrgId int64 `json:"orgId"`
UserId int64 `json:"userId"`
External bool `json:"external"`
ExternalUrl string `json:"externalUrl"`
Expires time.Time `json:"expires"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
// ----------------- // -----------------
// COMMANDS // COMMANDS

View File

@ -16,13 +16,13 @@
<tr ng-repeat="snapshot in snapshots"> <tr ng-repeat="snapshot in snapshots">
<td> <td>
<a href="dashboard/snapshot/{{snapshot.Key}}">{{snapshot.Name}}</a> <a href="dashboard/snapshot/{{snapshot.key}}">{{snapshot.name}}</a>
</td> </td>
<td > <td >
<a href="dashboard/snapshot/{{snapshot.Key}}">dashboard/snapshot/{{snapshot.Key}}</a> <a href="dashboard/snapshot/{{snapshot.key}}">dashboard/snapshot/{{snapshot.key}}</a>
</td> </td>
<td class="text-center"> <td class="text-center">
<a href="dashboard/snapshot/{{snapshot.Key}}" class="btn btn-inverse btn-mini"> <a href="dashboard/snapshot/{{snapshot.key}}" class="btn btn-inverse btn-mini">
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>
View View
</a> </a>

View File

@ -16,7 +16,7 @@ export class SnapshotsCtrl {
$scope.removeSnapshot = function(snapshot) { $scope.removeSnapshot = function(snapshot) {
$scope.appEvent('confirm-modal', { $scope.appEvent('confirm-modal', {
title: 'Confirm delete snapshot', title: 'Confirm delete snapshot',
text: 'Are you sure you want to delete snapshot ' + snapshot.Name + '?', text: 'Are you sure you want to delete snapshot ' + snapshot.name + '?',
yesText: "Delete", yesText: "Delete",
icon: "fa-warning", icon: "fa-warning",
onConfirm: function() { onConfirm: function() {
@ -26,8 +26,8 @@ export class SnapshotsCtrl {
}; };
$scope.removeSnapshotConfirmed = function(snapshot) { $scope.removeSnapshotConfirmed = function(snapshot) {
_.remove($scope.snapshots, {Key: snapshot.Key}); _.remove($scope.snapshots, {key: snapshot.key});
backendSrv.get('/api/snapshots-delete/' + snapshot.DeleteKey) backendSrv.get('/api/snapshots-delete/' + snapshot.deleteKey)
.then(function() { .then(function() {
$scope.appEvent('alert-success', ['Snapshot deleted', '']); $scope.appEvent('alert-success', ['Snapshot deleted', '']);
}, function() { }, function() {