forked from o19s/quepid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor search engine into own endpoint (o19s#788)
You can now reuse/archive/share a search endpoint across multiple tries/cases/teams. Set it up once, forget it after that!
- Loading branch information
Showing
160 changed files
with
3,791 additions
and
1,260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions
16
app/assets/javascripts/components/archive_search_endpoint/_modal.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div class="modal-header"> | ||
<button type="button" class="close" ng-click="ctrl.cancel()" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h3 class="modal-title">Archive This Search Endpoint for Later?</h3> | ||
</div> | ||
<div class="modal-body"> | ||
<p ng-show="ctrl.canDelete">You're about to put this search endpoint into deep freeze. You'll be able to unarchive it later through the "Archived Search Endpoints" filter in the Search Endpoint Listings.</p> | ||
<p ng-hide="ctrl.canDelete">You do not have delete (and archive) permissions for search endpoints.</p> | ||
<p ng-show="ctrl.canDelete && ctrl.notOwner()"> | ||
<div class="alert alert-warning" role="alert" ng-if="ctrl.canDelete && !ctrl.isOwnerOfSearchEndpoint()"> | ||
Only the owner of a search endpoint can restore it. You will take over ownership of this search endpoint from <i>{{ ctrl.theSearchEndpoint.ownerName}}</i> by archiving it. | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-danger" ng-show="ctrl.canDelete" ng-click="ctrl.ok()">Archive</button> | ||
<button class="btn btn-default" ng-click="ctrl.cancel()">Cancel</button> | ||
</div> |
8 changes: 8 additions & 0 deletions
8
app/assets/javascripts/components/archive_search_endpoint/archive_search_endpoint.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<a class="action-icon" ng-click="ctrl.openArchiveModal()"> | ||
<i | ||
class="fa fa-archive" | ||
aria-hidden="true" | ||
title="Archive" | ||
alt="Archive" | ||
></i> | ||
</a> |
54 changes: 54 additions & 0 deletions
54
...sets/javascripts/components/archive_search_endpoint/archive_search_endpoint_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use strict'; | ||
|
||
/*jshint latedef:false*/ | ||
|
||
angular.module('QuepidApp') | ||
.controller('ArchiveSearchEndpointCtrl', [ | ||
'$scope', | ||
'$uibModal', | ||
'flash', | ||
'searchEndpointSvc', | ||
function ( | ||
$scope, | ||
$uibModal, | ||
flash, | ||
searchEndpointSvc | ||
) { | ||
var ctrl = this; | ||
|
||
ctrl.thisSearchEndpoint = $scope.thisSearchEndpoint; | ||
ctrl.archiveSearchEndpoint = archiveSearchEndpoint; | ||
ctrl.openArchiveModal = openArchiveModal; | ||
|
||
function archiveSearchEndpoint() { | ||
searchEndpointSvc.archiveSearchEndpoint(ctrl.thisSearchEndpoint).then( | ||
function () { | ||
flash.success = 'Search endpoint archived successfully.'; | ||
}, function (data) { | ||
var message = 'Oooops! Could not archive the search endpoint. '; | ||
message += data.message; | ||
flash.error = message; | ||
} | ||
); | ||
} | ||
|
||
function openArchiveModal() { | ||
var modalInstance = $uibModal.open({ | ||
templateUrl: 'archive_search_endpoint/_modal.html', | ||
controller: 'ArchiveSearchEndpointModalInstanceCtrl', | ||
controllerAs: 'ctrl', | ||
resolve: { | ||
theSearchEndpoint: function() { | ||
return ctrl.thisSearchEndpoint; | ||
} | ||
} | ||
}); | ||
|
||
modalInstance.result.then(function (archiveClicked) { | ||
if( archiveClicked ){ | ||
ctrl.archiveSearchEndpoint(); | ||
} | ||
}); | ||
} | ||
} | ||
]); |
19 changes: 19 additions & 0 deletions
19
...ssets/javascripts/components/archive_search_endpoint/archive_search_endpoint_directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
angular.module('QuepidApp') | ||
.directive('archiveSearchEndpoint', [ | ||
function () { | ||
return { | ||
restrict: 'E', | ||
controller: 'ArchiveSearchEndpointCtrl', | ||
controllerAs: 'ctrl', | ||
templateUrl: 'archive_search_endpoint/archive_search_endpoint.html', | ||
scope: { | ||
thisSearchEndpoint: '=', | ||
}, | ||
bindings: { | ||
thisSearchEndpoint: '<', | ||
} | ||
}; | ||
} | ||
]); |
34 changes: 34 additions & 0 deletions
34
...s/components/archive_search_endpoint/archive_search_endpoint_modal_instance_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
angular.module('QuepidApp') | ||
.controller('ArchiveSearchEndpointModalInstanceCtrl', [ | ||
'$rootScope', | ||
'$uibModalInstance', | ||
'theSearchEndpoint', | ||
function ($rootScope, $uibModalInstance, theSearchEndpoint) { | ||
var ctrl = this; | ||
|
||
ctrl.theSearchEndpoint = theSearchEndpoint; | ||
//ctrl.canDelete = false; | ||
ctrl.canDelete = true; // hard code that anyone can delete ;-( | ||
|
||
//$rootScope.$watch('currentUser', function() { | ||
// if ( $rootScope.currentUser ) { | ||
// ctrl.canDelete = $rootScope.currentUser.permissions.search_endpoint.delete; | ||
// } | ||
//}); | ||
|
||
ctrl.isOwnerOfSearchEndpoint = function() { | ||
return ($rootScope.currentUser.id === ctrl.theSearchEndpoint.ownerId); | ||
}; | ||
|
||
ctrl.ok = function () { | ||
$uibModalInstance.close(true); | ||
}; | ||
|
||
ctrl.cancel = function () { | ||
$uibModalInstance.close(false); | ||
}; | ||
|
||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app/assets/javascripts/components/search_endpoint_listing/search_endpoint_listing.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<div class="item-box row"> | ||
<div class="col-xs-4"> | ||
<span class="search-endpoints-title"> | ||
<a ng-href="search_endpoints/{{ctrl.searchEndpoint.id}}" target="_self" class="action-icon"> | ||
{{ ctrl.searchEndpoint.name }} | ||
</a> | ||
</span> | ||
|
||
<span class="item-actions"> | ||
|
||
<a ng-href="search_endpoints/{{ctrl.searchEndpoint.id}}/edit" target="_self" class="action-icon"> | ||
<i | ||
class="fa fa-edit" | ||
aria-hidden="true" | ||
title="Edit" | ||
alt="Edit" | ||
></i> | ||
</a> | ||
<archive-search-endpoint this-search-endpoint="ctrl.searchEndpoint"></archive-search-endpoint> | ||
</span> | ||
</div> | ||
|
||
<div class="col-xs-4"> | ||
<img ng-if="ctrl.searchEndpoint.searchEngine" ng-src="images/{{ ctrl.searchEndpoint.searchEngine }}-icon.png" width="32px" /> | ||
{{ ctrl.searchEndpoint.searchEngine }} | ||
</div> | ||
|
||
<div class="col-xs-4"> | ||
<i>Not Yet Implemented</i> | ||
</div> | ||
</div> |
18 changes: 18 additions & 0 deletions
18
...sets/javascripts/components/search_endpoint_listing/search_endpoint_listing_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
/*jslint latedef:false*/ | ||
|
||
angular.module('QuepidApp') | ||
.controller('SearchEndpointListingCtrl', [ | ||
'$scope', | ||
function ( | ||
$scope | ||
) { | ||
var ctrl = this; | ||
ctrl.searchEndpoint = $scope.searchEndpoint; | ||
ctrl.team = $scope.team; | ||
|
||
// Functions | ||
|
||
} | ||
]); |
17 changes: 17 additions & 0 deletions
17
...ssets/javascripts/components/search_endpoint_listing/search_endpoint_listing_directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
angular.module('QuepidApp') | ||
.directive('searchEndpointListing', [ | ||
function () { | ||
return { | ||
restrict: 'E', | ||
controller: 'SearchEndpointListingCtrl', | ||
controllerAs: 'ctrl', | ||
templateUrl: 'search_endpoint_listing/search_endpoint_listing.html', | ||
scope: { | ||
searchEndpoint: '=', | ||
team: '=', | ||
}, | ||
}; | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.