mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
interface for deleting duplicates
This commit is contained in:
@@ -1204,6 +1204,34 @@ function($scope, $state, $stateParams, $dialog, AdminUsersService) {
|
||||
};
|
||||
}]);
|
||||
|
||||
module.controller('ManageDuplicateFeedsCtrl', [
|
||||
'$scope', 'AdminCleanupService',
|
||||
function($scope, AdminCleanupService) {
|
||||
|
||||
$scope.limit = 10;
|
||||
$scope.page = 0;
|
||||
$scope.mergeData = {};
|
||||
$scope.refreshData = function() {
|
||||
AdminCleanupService.findDuplicateFeeds({
|
||||
limit : $scope.limit,
|
||||
page : $scope.page
|
||||
}, function(data) {
|
||||
$scope.counts = data;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.focus = function(count) {
|
||||
$scope.current = count;
|
||||
};
|
||||
|
||||
$scope.merge = function() {
|
||||
AdminCleanupService.mergeFeeds($scope.mergeData, function() {
|
||||
alert('done!');
|
||||
});
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
module.controller('SettingsCtrl', ['$scope', '$location', 'SettingsService', 'AnalyticsService', 'ServerService',
|
||||
function($scope, $location, SettingsService, AnalyticsService, ServerService) {
|
||||
|
||||
|
||||
@@ -91,6 +91,11 @@ app.config([ '$routeProvider', '$stateProvider', '$urlRouterProvider', '$httpPro
|
||||
templateUrl : 'templates/admin.useredit.html',
|
||||
controller : 'ManageUserCtrl'
|
||||
});
|
||||
$stateProvider.state('admin.duplicate_feeds', {
|
||||
url : '/feeds/duplicates/',
|
||||
templateUrl : 'templates/admin.duplicate_feeds.html',
|
||||
controller : 'ManageDuplicateFeedsCtrl'
|
||||
});
|
||||
$stateProvider.state('admin.settings', {
|
||||
url : '/settings',
|
||||
templateUrl : 'templates/admin.settings.html',
|
||||
|
||||
@@ -272,6 +272,26 @@ module.factory('AdminSettingsService', ['$resource', function($resource) {
|
||||
return res;
|
||||
}]);
|
||||
|
||||
module.factory('AdminCleanupService', ['$resource', function($resource) {
|
||||
var actions = {
|
||||
findDuplicateFeeds : {
|
||||
method : 'GET',
|
||||
isArray: true,
|
||||
params : {
|
||||
_method : 'findDuplicateFeeds'
|
||||
}
|
||||
},
|
||||
mergeFeeds : {
|
||||
method : 'POST',
|
||||
params : {
|
||||
_method : 'merge'
|
||||
}
|
||||
},
|
||||
};
|
||||
var res = $resource('rest/admin/cleanup/:_method', {}, actions);
|
||||
return res;
|
||||
}]);
|
||||
|
||||
module.factory('ServerService', ['$resource', function($resource) {
|
||||
var res = $resource('rest/server/get');
|
||||
return res;
|
||||
|
||||
34
src/main/webapp/templates/admin.duplicate_feeds.html
Normal file
34
src/main/webapp/templates/admin.duplicate_feeds.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="row">
|
||||
|
||||
Limit <input type="number" ng-model="limit" />
|
||||
Page <input type="number" ng-model="page" />
|
||||
<input type="button" class="btn" ng-click="refreshData()" value="Refresh" />
|
||||
<table class="table table-condensed table-hover" ui-if="counts">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>url</th>
|
||||
<th>count</h>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="count in counts" ng-click="focus(count)" class="pointer">
|
||||
<td>{{count.normalizedUrlHash}}</td>
|
||||
<td>{{count.feeds.length}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div ui-if="current">
|
||||
<div>
|
||||
Merge
|
||||
<select ng-model="mergeData.feedIds" size="15" multiple="multiple"
|
||||
ng-options="feed.id as feed.url for feed in current.feeds">
|
||||
</select>
|
||||
|
||||
Into
|
||||
<select ng-model="mergeData.intoFeedId" ng-options="feed.id as feed.url for feed in current.feeds">
|
||||
</select>
|
||||
</div>
|
||||
<input type="button" class="btn" ng-click="merge()" value="Merge" />
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user