Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/FOUR-15730 Pagination #6941

Merged
merged 6 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions ProcessMaker/Http/Controllers/Api/ProcessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ProcessController extends Controller
{
const CAROUSEL_TYPES = [
'IMAGE' => 'image',
'EMBED' => 'embed'
'EMBED' => 'embed',
];

/**
Expand Down Expand Up @@ -128,6 +128,7 @@ public function index(Request $request)
'id' => $item['id'],
'events'=> $item['start_events']];
});

return new ApiCollection($modifiedCollection);
}

Expand Down Expand Up @@ -402,7 +403,7 @@ public function store(Request $request)
* @param Process $process
* @return ResponseFactory|Response
*
* @throws \Throwable
* @throws Throwable
*
* @OA\Put(
* path="/processes/{processId}",
Expand Down Expand Up @@ -520,7 +521,7 @@ public function update(Request $request, Process $process)
public function updateBpmn(Request $request, Process $process)
{
$request->validate(Process::rules($process));

// bpmn validation
if ($schemaErrors = $this->validateBpmn($request)) {
$warnings = [];
Expand Down Expand Up @@ -557,7 +558,8 @@ public function updateBpmn(Request $request, Process $process)
], 200);
}

private function updateSubprocessElement($parentProcess, $request, $process) {
private function updateSubprocessElement($parentProcess, $request, $process)
{
$definitions = $parentProcess->getDefinitions();
$elements = $definitions->getElementsByTagName('callActivity');
foreach ($elements as $element) {
Expand All @@ -584,7 +586,7 @@ private function updateSubprocessElement($parentProcess, $request, $process) {
* @param Process $process
* @return ResponseFactory|Response
*
* @throws \Throwable
* @throws Throwable
*
* @OA\Put(
* path="/processes/{processId}/draft",
Expand Down Expand Up @@ -948,7 +950,7 @@ public function startProcesses(Request $request)
* @param Process $process
* @return ResponseFactory|Response
*
* @throws \Throwable
* @throws Throwable
*
* @OA\Put(
* path="/processes/{processId}/restore",
Expand Down Expand Up @@ -1294,7 +1296,7 @@ public function import_ready($code)
*
* @return resource
*
* @throws \Throwable
* @throws Throwable
*
* @OA\Post(
* path="/processes/{process_id}/import/assignments",
Expand Down Expand Up @@ -1440,7 +1442,7 @@ public function importAssignments(Process $process, Request $request)
* @param Process $process
* @param Request $request
*
* @return \ProcessMaker\Http\Resources\ProcessRequests
* @return ProcessRequests
*
* @OA\Post(
* path="/process_events/{process_id}",
Expand Down Expand Up @@ -1778,7 +1780,7 @@ public function deleteMediaImages(Request $request, Process $process)
* @param string $uuid
* @param string $collectionName
* @return bool
*/
*/
private function deleteImage(Process $process, $uuid, $collectionName)
{
// Retrieve the media image by UUID and collection name
Expand All @@ -1788,6 +1790,7 @@ private function deleteImage(Process $process, $uuid, $collectionName)
// If the media image exists, delete it and return true
if ($mediaImagen) {
$mediaImagen->delete();

return true;
} else {
// Otherwise, return false
Expand Down
8 changes: 4 additions & 4 deletions ProcessMaker/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ public function loggedOut(Request $request)
* Handle a login request to the application.
* Overrides the original login action.
*
* @param \Illuminate\Http\Request $request
* @param \ProcessMaker\Models\User $user
* @param Request $request
* @param User $user
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
* @throws \Illuminate\Validation\ValidationException
* @throws ValidationException
*/
public function login(Request $request, User $user)
{
Expand Down Expand Up @@ -340,7 +340,7 @@ public function login(Request $request, User $user)
/**
* Throws locked error message
*
* @throws \Illuminate\Validation\ValidationException
* @throws ValidationException
*/
protected function throwLockedLoginResponse()
{
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Http/Controllers/ProcessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function edit(Process $process)
'canEditData',
'addons',
'assignedProjects',
'isDraft'
'isDraft',
]));
}

Expand Down
3 changes: 2 additions & 1 deletion ProcessMaker/Models/ProcessRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,11 @@ public function summary()
$result[] = [
'key' => $key,
'value' => $value,
'type' => $type
'type' => $type,
];
}
}

return $result;
}

Expand Down
5 changes: 3 additions & 2 deletions resources/js/components/shared/FilterTableBodyMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default {
this.page = page;
this.fetch();
},
changePerPage(value) {
changePerPage(value, page) {
this.page = page;
this.perPage = value;
this.fetch();
},
Expand Down Expand Up @@ -81,6 +82,6 @@ export default {
if (e.target.offsetWidth >= e.target.scrollWidth) {
e.preventDefault();
}
}
},
},
};
4 changes: 1 addition & 3 deletions resources/js/components/shared/PaginationTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ export default {
this.$emit("page-change", page);
},
changePerPage(value) {
this.goToPage(this.defaultPage);
this.$emit("per-page-change", value);
this.$emit("per-page-change", value, this.defaultPage);
},
redirectPage(value) {
this.$emit("page-change", value);
Expand Down Expand Up @@ -234,7 +233,6 @@ export default {
font-weight: 700;
}
.pagination-total {
margin-left: 10px;
padding: 0px 8px 0px 8px;
}
.pagination-dropup {
Expand Down
30 changes: 30 additions & 0 deletions resources/js/components/shared/UtilsTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export const ellipsisSortClick = (categoryColumn, context)=>{
context.fields.forEach(column => {
if (column.field !== categoryColumn.field) {
column.direction = "none";
column.filterApplied = false;
}
});

if (categoryColumn.direction === "asc") {
categoryColumn.direction = "desc";
} else if (categoryColumn.direction === "desc") {
categoryColumn.direction = "none";
categoryColumn.filterApplied = false;
} else {
categoryColumn.direction = "asc";
categoryColumn.filterApplied = true;
}

if (categoryColumn.direction !== "none") {
const sortOrder = [
{
sortField: categoryColumn.sortField || categoryColumn.field,
direction: categoryColumn.direction,
},
];
context.dataManager(sortOrder);
} else {
context.fetch();
}
}
2 changes: 2 additions & 0 deletions resources/js/components/shared/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import DataLoading from '../../components/common/DataLoading';
import AvatarImage from '../../components/AvatarImage';
import FilterTableBodyMixin from "./FilterTableBodyMixin";
import PaginationTable from "./PaginationTable.vue";
import { ellipsisSortClick } from "./UtilsTable";
import TaskTooltip from "../../tasks/components/TaskTooltip.vue";

export {
Expand Down Expand Up @@ -113,5 +114,6 @@ export {
AvatarImage,
FilterTableBodyMixin,
PaginationTable,
ellipsisSortClick,
TaskTooltip,
};
3 changes: 2 additions & 1 deletion resources/js/processes-catalogue/components/RequestTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ export default {
this.page = page;
this.queryBuilder();
},
changePerPage(value) {
changePerPage(value, page) {
this.page = page;
this.perPage = value;
this.queryBuilder();
},
Expand Down
3 changes: 2 additions & 1 deletion resources/js/processes-catalogue/components/TaskTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ export default {
this.page = page;
this.queryBuilder();
},
changePerPage(value) {
changePerPage(value, page) {
this.page = page;
this.perPage = value;
this.queryBuilder();
},
Expand Down
35 changes: 5 additions & 30 deletions resources/js/processes/categories/components/CategoriesListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div
v-if="column.sortable"
:key="index"
@click="handleEllipsisClick(column)"
@click="onClickEllipsis(column)"
>
<i
:class="['fas', {
Expand Down Expand Up @@ -112,6 +112,8 @@
import EllipsisMenu from "../../../components/shared/EllipsisMenu.vue";
import paginationTable from "../../../components/shared/PaginationTable.vue";
import FilterTableBodyMixin from "../../../components/shared/FilterTableBodyMixin";
import { ellipsisSortClick } from "../../../components/shared/UtilsTable";

const uniqIdsMixin = createUniqIdsMixin();

export default {
Expand Down Expand Up @@ -292,35 +294,8 @@
};
return bubbleColor[status];
},
handleEllipsisClick(categoryColumn) {
this.fields.forEach(column => {
if (column.field !== categoryColumn.field) {
column.direction = "none";
column.filterApplied = false;
}
});

if (categoryColumn.direction === "asc") {
categoryColumn.direction = "desc";
} else if (categoryColumn.direction === "desc") {
categoryColumn.direction = "none";
categoryColumn.filterApplied = false;
} else {
categoryColumn.direction = "asc";
categoryColumn.filterApplied = true;
}

if (categoryColumn.direction !== "none") {
const sortOrder = [
{
sortField: categoryColumn.sortField || categoryColumn.field,
direction: categoryColumn.direction,
},
];
this.dataManager(sortOrder);
} else {
this.fetch();
}
onClickEllipsis(column) {
ellipsisSortClick(column, this);
},
}
};
Expand Down
Loading
Loading