fix: [UI] Remove unused All button from galaxy index

pull/6698/head
Jakub Onderka 2020-12-05 14:13:28 +01:00
parent f4ff425c90
commit 1ddf44a06d
3 changed files with 17 additions and 26 deletions

View File

@ -19,11 +19,7 @@ class GalaxiesController extends AppController
public function index()
{
$aclConditions = array();
$filters = $this->IndexFilter->harvestParameters(array('context', 'value'));
$contextConditions = array();
if (empty($filters['context'])) {
$filters['context'] = 'all';
}
$filters = $this->IndexFilter->harvestParameters(array('value'));
$searchConditions = array();
if (empty($filters['value'])) {
$filters['value'] = '';
@ -45,18 +41,16 @@ class GalaxiesController extends AppController
array(
'recursive' => -1,
'conditions' => array(
'AND' => array($contextConditions, $searchConditions, $aclConditions)
'AND' => array($searchConditions, $aclConditions)
)
)
);
return $this->RestResponse->viewData($galaxies, $this->response->type());
} else {
$this->paginate['conditions']['AND'][] = $contextConditions;
$this->paginate['conditions']['AND'][] = $searchConditions;
$this->paginate['conditions']['AND'][] = $aclConditions;
$galaxies = $this->paginate();
$this->set('galaxyList', $galaxies);
$this->set('context', $filters['context']);
$this->set('searchall', $filters['value']);
}
}

View File

@ -5,23 +5,16 @@
'data' => $galaxyList,
'top_bar' => array(
'children' => array(
array(
'type' => 'simple',
'children' => array(
array(
'active' => $context === 'all',
'url' => $baseurl . '/galaxies/index/context:all',
'text' => __('All'),
)
)
),
array(
'type' => 'search',
'button' => __('Filter'),
'placeholder' => __('Enter value to search'),
'data' => '',
'searchKey' => 'value',
'value' => $searchall
'cancel' => array(
'fa-icon' => 'times',
'title' => __('Remove filters'),
'onClick' => 'cancelSearch',
)
)
)
),
@ -78,7 +71,8 @@
),
'postLink' => true,
'postLinkConfirm' => __('Are you sure you want to delete the Galaxy?'),
'icon' => 'trash'
'icon' => 'trash',
'requirement' => $isSiteAdmin,
),
)
)
@ -88,12 +82,9 @@
?>
<script type="text/javascript">
var passedArgsArray = <?php echo $passedArgs; ?>;
if (passedArgsArray['context'] === undefined) {
passedArgsArray['context'] = 'pending';
}
$(document).ready(function() {
$(function() {
$('#quickFilterButton').click(function() {
runIndexQuickFilter('/context:' + passedArgsArray['context']);
runIndexQuickFilter();
});
});
</script>

View File

@ -2206,6 +2206,12 @@ function runIndexFilter(element) {
window.location.href = url;
}
function cancelSearch()
{
$('#quickFilterField').val('');
runIndexQuickFilter();
}
function runIndexQuickFilter(preserveParams, url, target) {
if (typeof passedArgsArray === "undefined") {
var passedArgsArray = [];