Update for new design

This commit is contained in:
Arik Fraimovich
2016-05-07 22:20:06 +03:00
parent f07e7273c1
commit aa837ed09b
10 changed files with 58 additions and 53 deletions

View File

@@ -52,7 +52,7 @@ if __name__ == '__main__':
hipchat = NotificationDestination.create(
org=1,
user=1,
name="Hipchat",
name="HipChat",
type="hipchat",
options=options
)

View File

@@ -7,7 +7,7 @@
};
var DataSourceCtrl = function ($scope, $routeParams, $http, $location, Events, DataSource) {
var DataSourceCtrl = function ($scope, $routeParams, $http, $location, growl, Events, DataSource) {
Events.record(currentUser, "view", "page", "admin/data_source");
$scope.$parent.pageTitle = "Data Sources";
@@ -24,9 +24,21 @@
$location.path('/data_sources/' + id).replace();
}
});
$scope.delete = function () {
Events.record(currentUser, "delete", "datasource", $scope.dataSource.id);
$scope.dataSource.$delete(function (resource) {
growl.addSuccessMessage("Data source deleted successfully.");
$location.path('/data_sources/');
}.bind(this), function (httpResponse) {
console.log("Failed to delete data source: ", httpResponse.status, httpResponse.statusText, httpResponse.data);
growl.addErrorMessage("Failed to delete data source.");
});
}
};
angular.module('redash.controllers')
.controller('DataSourcesCtrl', ['$scope', '$location', 'growl', 'Events', 'DataSource', DataSourcesCtrl])
.controller('DataSourceCtrl', ['$scope', '$routeParams', '$http', '$location', 'Events', 'DataSource', DataSourceCtrl])
.controller('DataSourceCtrl', ['$scope', '$routeParams', '$http', '$location', 'growl', 'Events', 'DataSource', DataSourceCtrl])
})();

View File

@@ -5,24 +5,9 @@
$scope.destinations = Destination.query();
$scope.openDestination = function(destination) {
$location.path('/destinations/' + destination.id);
};
$scope.deleteDestination = function(event, destination) {
event.stopPropagation();
Events.record(currentUser, "delete", "destination", destination.id);
destination.$delete(function(resource) {
growl.addSuccessMessage("Destination deleted successfully.");
this.$parent.destinations = _.without(this.destinations, resource);
}.bind(this), function(httpResponse) {
console.log("Failed to delete destination: ", httpResponse.status, httpResponse.statusText, httpResponse.data);
growl.addErrorMessage("Failed to delete destination.");
});
}
};
var DestinationCtrl = function ($scope, $routeParams, $http, $location, Events, Destination) {
var DestinationCtrl = function ($scope, $routeParams, $http, $location, growl, Events, Destination) {
Events.record(currentUser, "view", "page", "admin/destination");
$scope.$parent.pageTitle = "Destinations";
@@ -39,9 +24,21 @@
$location.path('/destinations/' + id).replace();
}
});
$scope.delete = function() {
Events.record(currentUser, "delete", "destination", $scope.destination.id);
$scope.destination.$delete(function(resource) {
growl.addSuccessMessage("Destination deleted successfully.");
$location.path('/destinations/');
}.bind(this), function(httpResponse) {
console.log("Failed to delete destination: ", httpResponse.status, httpResponse.statusText, httpResponse.data);
growl.addErrorMessage("Failed to delete destination.");
});
}
};
angular.module('redash.controllers')
.controller('DestinationsCtrl', ['$scope', '$location', 'growl', 'Events', 'Destination', DestinationsCtrl])
.controller('DestinationCtrl', ['$scope', '$routeParams', '$http', '$location', 'Events', 'Destination', DestinationCtrl])
.controller('DestinationCtrl', ['$scope', '$routeParams', '$http', '$location', 'growl', 'Events', 'Destination', DestinationCtrl])
})();

View File

@@ -389,9 +389,8 @@
return {
restrict: 'E',
replace: 'true',
templateUrl: function(elem, attr) {
return '/views/' + attr.type+ '/form.html';
},
transclude: true,
templateUrl: '/views/directives/dynamic_form.html',
scope: {
'target': '=',
'type': '@type'
@@ -487,10 +486,12 @@
scope.usersPage = _.string.startsWith($location.path(), '/users');
scope.groupsPage = _.string.startsWith($location.path(), '/groups');
scope.dsPage = _.string.startsWith($location.path(), '/data_sources');
scope.destinationsPage = _.string.startsWith($location.path(), '/destinations');
scope.showGroupsLink = currentUser.hasPermission('list_users');
scope.showUsersLink = currentUser.hasPermission('list_users');
scope.showDsLink = currentUser.hasPermission('admin');
scope.showDestinationsLink = currentUser.hasPermission('admin');
}
}
}]);

View File

@@ -566,7 +566,6 @@ div.table-name:hover {
padding-right: 5px;
}
<<<<<<< HEAD
.modal-xl {
position: fixed;
top: 0;

View File

@@ -20,7 +20,6 @@
</ui-select>
</div>
<<<<<<< HEAD
<div class="form-group" ng-show="selectedQuery">
<label>Name</label>
<input type="string" placeholder="{{getDefaultName()}}" class="form-control" ng-model="alert.name">

View File

@@ -1,7 +1,9 @@
<settings-screen>
<div class="row">
<div class="col-md-8">
<dynamic-form target="dataSource" type="data_sources" />
<dynamic-form target="dataSource" type="data_sources">
<button class="btn btn-danger" ng-if="dataSource.id" ng-click="delete()">Delete</button>
</dynamic-form>
</div>
</div>
</settings-screen>

View File

@@ -1,11 +1,11 @@
<div class="container">
<ol class="breadcrumb">
<li><a href="destinations">Destinations</a></li>
<li class="active">{{destination.name || "New"}}</li>
</ol>
<div class="row">
<div class="col-md-8">
<dynamic-form target="destination" type="destinations" />
</div>
<settings-screen>
<div class="row voffset1">
<div class="col-md-6">
<dynamic-form target="destination" type="destinations">
<button class="btn btn-danger" ng-if="destination.id" ng-click="delete()">Delete</button>
</dynamic-form>
</div>
</div>
</div>
</settings-screen>

View File

@@ -1,18 +1,12 @@
<div class="container">
<ol class="breadcrumb">
<li class="active">Destinations</li>
</ol>
<div class="row">
<div class="col-md-4">
<div class="list-group">
<div class="list-group-item clickable" ng-repeat="destination in destinations" ng-click="openDestination(destination)">
<i class="fa {{destination.icon}}"></i> {{destination.name}}
<button class="btn btn-xs btn-danger pull-right" ng-click="deleteDestination($event, destination)">Delete</button>
</div>
<a ng-href="destinations/new" class="list-group-item">
<i class="fa fa-plus"></i> Add Destination
</a>
</div>
</div>
<settings-screen>
<div class="row voffset1">
<div class="col-md-4">
<p>
<a href="destinations/new" class="btn btn-default"><i class="fa fa-plus"></i> New Notification Destination</a>
</p>
<div class="list-group">
<a ng-href="destinations/{{destination.id}}" class="list-group-item" ng-repeat="destination in destinations"><i class="fa {{destination.icon}}"></i> {{destination.name}}</a>
</div>
</div>
</div>
</div>
</settings-screen>

View File

@@ -7,6 +7,7 @@
<li ng-class="{'active': dsPage }" ng-if="showDsLink"><a href="data_sources">Data Sources</a></li>
<li ng-class="{'active': usersPage }" ng-if="showUsersLink"><a href="users">Users</a></li>
<li ng-class="{'active': groupsPage }" ng-if="showGroupsLink"><a href="groups">Groups</a></li>
<li ng-class="{'active': destinationsPage }" ng-if="showDestinationsLink"><a href="destinations">Notification Destinations</a></li>
</ul>
<div ng-transclude>