Skip to content

Commit

Permalink
Added loader. Fixed duplicates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Mar 13, 2024
1 parent 7b67a56 commit 819f2ef
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/src/Controller/ApiV2Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ public function index() {
// Construct the Query
$query = $this->getIndexQuery($pickerMode);

// This magically makes REST calls paginated... can use eg direction=,
if(method_exists($table, 'findIndexed')) {
$query = $table->findIndexed($query);
}
// This magically makes REST calls paginated... can use eg direction=,
// sort=, limit=, page=
$this->set($this->tableName, $this->paginate($query));

Expand Down
5 changes: 5 additions & 0 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,11 @@ public function index() {
$tableName = $table->getTable();
// Construct the Query
$query = $this->getIndexQuery();

if(method_exists($table, 'findIndexed')) {
$query = $table->findIndexed($query);
}

// Fetch the data and paginate
$resultSet = $this->paginate($query);

Expand Down
5 changes: 2 additions & 3 deletions app/src/Model/Table/PeopleTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,11 @@ public function beforeDelete(\Cake\Event\Event $event, $entity, \ArrayObject $op
* Customized finder for the Index Population View
*
* @param Query $query Cake ORM Query
* @param array $options Cake ORM Query options
*
* @return CakeORMQuery Cake ORM Query
* @return Query Cake ORM Query
* @since COmanage Registry v5.0.0
*/
public function findIndexed(Query $query, array $options): Query {
public function findIndexed(Query $query): Query {
return $query->select([
'People.id',
'PrimaryName.given',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export default {
:minLength="this.options.minLength"
:placeholder="this.txt['autocomplete.people.placeholder']"
:delay="500"
loadingIcon=null
forceSelection
@item-select="setPerson">
<template #option="slotProps">
Expand Down
46 changes: 46 additions & 0 deletions app/webroot/js/comanage/components/common/mini-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* COmanage Registry MVEA Vue.js Component / Card
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

export default {
props: {
isLoading: {
type: Boolean,
default: false
},
classes: {
type: String,
default: "d-inline" // by default mimic a span
}
},
template: `
<!-- Wrapping inside a dive in order to have better stylish handling -->
<div :class="classes">
<span v-show="isLoading" class="co-loading-mini" role="status">
<span></span><span></span><span></span>
</span>
</div>
`
}

0 comments on commit 819f2ef

Please sign in to comment.