Skip to content

Commit a06500a

Browse files
authored
Merge pull request #6941 from ProcessMaker/feature/FOUR-15730
feature/FOUR-15730 Pagination
2 parents 0cd8ab8 + 1b2afd6 commit a06500a

14 files changed

Lines changed: 307 additions & 125 deletions

File tree

‎ProcessMaker/Http/Controllers/Api/ProcessController.php‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ProcessController extends Controller
4545
{
4646
const CAROUSEL_TYPES = [
4747
'IMAGE' => 'image',
48-
'EMBED' => 'embed'
48+
'EMBED' => 'embed',
4949
];
5050

5151
/**
@@ -128,6 +128,7 @@ public function index(Request $request)
128128
'id' => $item['id'],
129129
'events'=> $item['start_events']];
130130
});
131+
131132
return new ApiCollection($modifiedCollection);
132133
}
133134

@@ -402,7 +403,7 @@ public function store(Request $request)
402403
* @param Process $process
403404
* @return ResponseFactory|Response
404405
*
405-
* @throws \Throwable
406+
* @throws Throwable
406407
*
407408
* @OA\Put(
408409
* path="/processes/{processId}",
@@ -520,7 +521,7 @@ public function update(Request $request, Process $process)
520521
public function updateBpmn(Request $request, Process $process)
521522
{
522523
$request->validate(Process::rules($process));
523-
524+
524525
// bpmn validation
525526
if ($schemaErrors = $this->validateBpmn($request)) {
526527
$warnings = [];
@@ -557,7 +558,8 @@ public function updateBpmn(Request $request, Process $process)
557558
], 200);
558559
}
559560

560-
private function updateSubprocessElement($parentProcess, $request, $process) {
561+
private function updateSubprocessElement($parentProcess, $request, $process)
562+
{
561563
$definitions = $parentProcess->getDefinitions();
562564
$elements = $definitions->getElementsByTagName('callActivity');
563565
foreach ($elements as $element) {
@@ -584,7 +586,7 @@ private function updateSubprocessElement($parentProcess, $request, $process) {
584586
* @param Process $process
585587
* @return ResponseFactory|Response
586588
*
587-
* @throws \Throwable
589+
* @throws Throwable
588590
*
589591
* @OA\Put(
590592
* path="/processes/{processId}/draft",
@@ -948,7 +950,7 @@ public function startProcesses(Request $request)
948950
* @param Process $process
949951
* @return ResponseFactory|Response
950952
*
951-
* @throws \Throwable
953+
* @throws Throwable
952954
*
953955
* @OA\Put(
954956
* path="/processes/{processId}/restore",
@@ -1294,7 +1296,7 @@ public function import_ready($code)
12941296
*
12951297
* @return resource
12961298
*
1297-
* @throws \Throwable
1299+
* @throws Throwable
12981300
*
12991301
* @OA\Post(
13001302
* path="/processes/{process_id}/import/assignments",
@@ -1440,7 +1442,7 @@ public function importAssignments(Process $process, Request $request)
14401442
* @param Process $process
14411443
* @param Request $request
14421444
*
1443-
* @return \ProcessMaker\Http\Resources\ProcessRequests
1445+
* @return ProcessRequests
14441446
*
14451447
* @OA\Post(
14461448
* path="/process_events/{process_id}",
@@ -1778,7 +1780,7 @@ public function deleteMediaImages(Request $request, Process $process)
17781780
* @param string $uuid
17791781
* @param string $collectionName
17801782
* @return bool
1781-
*/
1783+
*/
17821784
private function deleteImage(Process $process, $uuid, $collectionName)
17831785
{
17841786
// Retrieve the media image by UUID and collection name
@@ -1788,6 +1790,7 @@ private function deleteImage(Process $process, $uuid, $collectionName)
17881790
// If the media image exists, delete it and return true
17891791
if ($mediaImagen) {
17901792
$mediaImagen->delete();
1793+
17911794
return true;
17921795
} else {
17931796
// Otherwise, return false

‎ProcessMaker/Http/Controllers/Auth/LoginController.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ public function loggedOut(Request $request)
277277
* Handle a login request to the application.
278278
* Overrides the original login action.
279279
*
280-
* @param \Illuminate\Http\Request $request
281-
* @param \ProcessMaker\Models\User $user
280+
* @param Request $request
281+
* @param User $user
282282
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Http\JsonResponse
283283
*
284-
* @throws \Illuminate\Validation\ValidationException
284+
* @throws ValidationException
285285
*/
286286
public function login(Request $request, User $user)
287287
{
@@ -340,7 +340,7 @@ public function login(Request $request, User $user)
340340
/**
341341
* Throws locked error message
342342
*
343-
* @throws \Illuminate\Validation\ValidationException
343+
* @throws ValidationException
344344
*/
345345
protected function throwLockedLoginResponse()
346346
{

‎ProcessMaker/Http/Controllers/ProcessController.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function edit(Process $process)
124124
'canEditData',
125125
'addons',
126126
'assignedProjects',
127-
'isDraft'
127+
'isDraft',
128128
]));
129129
}
130130

‎ProcessMaker/Models/ProcessRequest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,11 @@ public function summary()
527527
$result[] = [
528528
'key' => $key,
529529
'value' => $value,
530-
'type' => $type
530+
'type' => $type,
531531
];
532532
}
533533
}
534+
534535
return $result;
535536
}
536537

‎resources/js/components/shared/FilterTableBodyMixin.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export default {
3434
this.page = page;
3535
this.fetch();
3636
},
37-
changePerPage(value) {
37+
changePerPage(value, page) {
38+
this.page = page;
3839
this.perPage = value;
3940
this.fetch();
4041
},
@@ -81,6 +82,6 @@ export default {
8182
if (e.target.offsetWidth >= e.target.scrollWidth) {
8283
e.preventDefault();
8384
}
84-
}
85+
},
8586
},
8687
};

‎resources/js/components/shared/PaginationTable.vue‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ export default {
169169
this.$emit("page-change", page);
170170
},
171171
changePerPage(value) {
172-
this.goToPage(this.defaultPage);
173-
this.$emit("per-page-change", value);
172+
this.$emit("per-page-change", value, this.defaultPage);
174173
},
175174
redirectPage(value) {
176175
this.$emit("page-change", value);
@@ -234,7 +233,6 @@ export default {
234233
font-weight: 700;
235234
}
236235
.pagination-total {
237-
margin-left: 10px;
238236
padding: 0px 8px 0px 8px;
239237
}
240238
.pagination-dropup {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export const ellipsisSortClick = (categoryColumn, context)=>{
2+
context.fields.forEach(column => {
3+
if (column.field !== categoryColumn.field) {
4+
column.direction = "none";
5+
column.filterApplied = false;
6+
}
7+
});
8+
9+
if (categoryColumn.direction === "asc") {
10+
categoryColumn.direction = "desc";
11+
} else if (categoryColumn.direction === "desc") {
12+
categoryColumn.direction = "none";
13+
categoryColumn.filterApplied = false;
14+
} else {
15+
categoryColumn.direction = "asc";
16+
categoryColumn.filterApplied = true;
17+
}
18+
19+
if (categoryColumn.direction !== "none") {
20+
const sortOrder = [
21+
{
22+
sortField: categoryColumn.sortField || categoryColumn.field,
23+
direction: categoryColumn.direction,
24+
},
25+
];
26+
context.dataManager(sortOrder);
27+
} else {
28+
context.fetch();
29+
}
30+
}

‎resources/js/components/shared/index.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import DataLoading from '../../components/common/DataLoading';
5454
import AvatarImage from '../../components/AvatarImage';
5555
import FilterTableBodyMixin from "./FilterTableBodyMixin";
5656
import PaginationTable from "./PaginationTable.vue";
57+
import { ellipsisSortClick } from "./UtilsTable";
5758
import TaskTooltip from "../../tasks/components/TaskTooltip.vue";
5859

5960
export {
@@ -113,5 +114,6 @@ export {
113114
AvatarImage,
114115
FilterTableBodyMixin,
115116
PaginationTable,
117+
ellipsisSortClick,
116118
TaskTooltip,
117119
};

‎resources/js/processes-catalogue/components/RequestTab.vue‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ export default {
132132
this.page = page;
133133
this.queryBuilder();
134134
},
135-
changePerPage(value) {
135+
changePerPage(value, page) {
136+
this.page = page;
136137
this.perPage = value;
137138
this.queryBuilder();
138139
},

‎resources/js/processes-catalogue/components/TaskTab.vue‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ export default {
133133
this.page = page;
134134
this.queryBuilder();
135135
},
136-
changePerPage(value) {
136+
changePerPage(value, page) {
137+
this.page = page;
137138
this.perPage = value;
138139
this.queryBuilder();
139140
},

0 commit comments

Comments
 (0)