Skip to content

Commit af3dba5

Browse files
committed
prop pagination
1 parent cf76d48 commit af3dba5

File tree

4 files changed

+15
-72
lines changed

4 files changed

+15
-72
lines changed

components/clicktime/actions/create-job/create-job.mjs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,10 @@ export default {
5454
description: "Additional information related to the job",
5555
optional: true,
5656
},
57-
limit: {
58-
propDefinition: [
59-
app,
60-
"limit",
61-
],
62-
optional: true,
63-
},
64-
offset: {
65-
propDefinition: [
66-
app,
67-
"offset",
68-
],
69-
optional: true,
70-
},
7157
clientId: {
7258
propDefinition: [
7359
app,
7460
"clientId",
75-
(c) => ({
76-
offset: c.offset,
77-
limit: c.limit,
78-
}),
7961
],
8062
},
8163
includeInRm: {

components/clicktime/actions/create-user/create-user.mjs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,10 @@ export default {
5959
"email",
6060
],
6161
},
62-
limit: {
63-
propDefinition: [
64-
app,
65-
"limit",
66-
],
67-
optional: true,
68-
},
69-
offset: {
70-
propDefinition: [
71-
app,
72-
"offset",
73-
],
74-
optional: true,
75-
},
7662
employmentTypeId: {
7763
propDefinition: [
7864
app,
7965
"employmentTypeId",
80-
(c) => ({
81-
offset: c.offset,
82-
limit: c.limit,
83-
}),
8466
],
8567
optional: true,
8668
},

components/clicktime/clicktime.app.mjs

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ export default {
4949
type: "string",
5050
label: "Client ID",
5151
description: "Unique identifier of the client associated with a job",
52-
async options({
53-
limit, offset,
54-
}) {
52+
async options({ page }) {
53+
const limit = constants.DEFAULT_LIMIT;
5554
const response = await this.getClients({
56-
limit,
57-
offset,
55+
params: {
56+
limit,
57+
offset: page * limit,
58+
},
5859
});
5960
const clientIds = response.data;
6061
return clientIds.map(({
@@ -65,18 +66,6 @@ export default {
6566
}));
6667
},
6768
},
68-
limit: {
69-
type: "integer",
70-
label: "Limit",
71-
description: "The number of records to return",
72-
optional: true,
73-
},
74-
offset: {
75-
type: "integer",
76-
label: "Offset",
77-
description: "The number of records to skip",
78-
optional: true,
79-
},
8069
endDate: {
8170
type: "string",
8271
label: "End Date",
@@ -132,12 +121,13 @@ export default {
132121
type: "string",
133122
label: "Employment Type ID",
134123
description: "Unique identifier for the user's employment type",
135-
async options({
136-
limit, offset,
137-
}) {
124+
async options({ page }) {
125+
const limit = constants.DEFAULT_LIMIT;
138126
const response = await this.getEmploymentTypes({
139-
limit,
140-
offset,
127+
params: {
128+
limit,
129+
offset: page * limit,
130+
},
141131
});
142132
const employmentTypeIds = response.data;
143133
return employmentTypeIds.map(({
@@ -195,27 +185,15 @@ export default {
195185
...args,
196186
});
197187
},
198-
async getClients({
199-
limit, offset, ...args
200-
}) {
188+
async getClients(args = {}) {
201189
return this._makeRequest({
202190
path: "/Clients",
203-
params: {
204-
limit,
205-
offset,
206-
},
207191
...args,
208192
});
209193
},
210-
async getEmploymentTypes({
211-
limit, offset, ...args
212-
}) {
194+
async getEmploymentTypes(args = {}) {
213195
return this._makeRequest({
214196
path: "/EmploymentTypes",
215-
params: {
216-
limit,
217-
offset,
218-
},
219197
...args,
220198
});
221199
},

components/clicktime/common/constants.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ export default {
33
"Hourly",
44
"Salary",
55
],
6+
DEFAULT_LIMIT: 20,
67
};

0 commit comments

Comments
 (0)