Skip to content

Commit

Permalink
Attempt to shrink table row data contents when table gets too small.
Browse files Browse the repository at this point in the history
  • Loading branch information
big213 committed Apr 3, 2021
1 parent 6427e22 commit 6257e87
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
8 changes: 3 additions & 5 deletions backend/functions/src/schema/core/services/normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,8 @@ export class NormalService extends BaseService {
whereObject.fields.push(whereOrObject);
}

// set limit to args.first or args.last
//parse args.first and ensure it is less than 100
const requestedLimit = Number(validatedArgs.first ?? validatedArgs.last);
const limit = Math.min(requestedLimit, 100) || 100;
// set limit to args.first or args.last, one of which must be provided
const limit = Number(validatedArgs.first ?? validatedArgs.last);

// process sort fields
const orderBy: SqlOrderByObject[] = [];
Expand Down Expand Up @@ -584,7 +582,7 @@ export class NormalService extends BaseService {
sqlParams: {
where: whereObject,
orderBy,
limit: limit,
limit,
specialParams: {
currentUserId: req.user?.id,
},
Expand Down
8 changes: 8 additions & 0 deletions backend/functions/src/schema/helpers/typeDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,14 @@ export function generatePaginatorPivotResolverObject(params: {
message: `One of first or last required`,
fieldPath,
});

// args.first or args.before cannot exceed 500
if (Number(args.first ?? args.last) > 500) {
throw new GiraffeqlArgsError({
message: `Cannot request more than 500 results at a time`,
fieldPath,
});
}
},
},
true
Expand Down
1 change: 1 addition & 0 deletions frontend/components/interface/crud/crudRecordInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
v-for="(headerItem, i) in headers"
:key="i"
:class="headerItem.align ? 'text-' + headerItem.align : null"
class="truncate"
>
<div v-if="headerItem.value === null">
<nuxt-link
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/interface/viewPbCardInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
v-for="(headerItem, i) in headers"
:key="i"
:class="headerItem.align ? 'text-' + headerItem.align : null"
class="truncate"
>
<EventColumn
v-if="headerItem.value === 'event.name'"
Expand Down Expand Up @@ -406,7 +407,7 @@ export default {
},
},
__args: {
first: 100,
first: 500, // at most 7*numEvents required
filterBy: filters,
},
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export default {
},
{
icon: 'mdi-timer',
title: 'My PBs',
title: 'My PBs (All)',
to: '/my-pbs',
},
{
Expand Down

0 comments on commit 6257e87

Please sign in to comment.