Skip to content

Commit

Permalink
fileset pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
SodhiA1 committed Nov 20, 2024
1 parent 1d4a636 commit c3f116c
Show file tree
Hide file tree
Showing 5 changed files with 194 additions and 111 deletions.
33 changes: 30 additions & 3 deletions backend/src/components/grad.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ async function uploadFile(req, res) {
return handleExceptionResponse(e, res);
}
}

async function getFileProgress(req, res) {
try {
const token = getAccessToken(req);
Expand All @@ -40,6 +39,33 @@ async function getFileProgress(req, res) {
}
}

async function getFilesetsPaginated(req, res) {
try {
const search = [];
if(req.params.schoolID) {
search.push({
condition: null,
searchCriteriaList: [{ key: 'schoolID', value: req.params.schoolID, operation: FILTER_OPERATION.EQUAL, valueType: VALUE_TYPE.UUID }]
});
}

const params = {
params: {
pageNumber: req.query.pageNumber,
pageSize: req.query.pageSize,
sort: JSON.stringify(req.query.sort),
searchCriteriaList: JSON.stringify(search),
}
};
const token = getAccessToken(req);
let data = await getDataWithParams(token, `${config.get('grad:filesetURL')}/paginated`, params, req.session?.correlationID);
return res.status(HttpStatus.OK).json(data);
} catch (e) {
log.error('Error getting error fileset student paginated list', e.stack);
return handleExceptionResponse(e, res);
}
}

async function getErrorFilesetStudentPaginated(req, res) {
try {
const search = [];
Expand All @@ -66,7 +92,7 @@ async function getErrorFilesetStudentPaginated(req, res) {
}
};
const token = getAccessToken(req);
let data = await getDataWithParams(token, `${config.get('grad:filesetURL')}/paginated`, params, req.session?.correlationID);
let data = await getDataWithParams(token, `${config.get('grad:errorFilesetURL')}/paginated`, params, req.session?.correlationID);

data.content = data?.content.map(error => toTableRow(error));
return res.status(HttpStatus.OK).json(data);
Expand Down Expand Up @@ -162,5 +188,6 @@ function createMultiFieldNameSearchCriteria(nameString) {
module.exports = {
uploadFile,
getFileProgress,
getErrorFilesetStudentPaginated
getErrorFilesetStudentPaginated,
getFilesetsPaginated
};
3 changes: 2 additions & 1 deletion backend/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ nconf.defaults({
},
grad: {
rootURL: process.env.GRAD_API_ENDPOINT,
filesetURL: process.env.GRAD_API_ENDPOINT + '/error-fileset',
errorFilesetURL: process.env.GRAD_API_ENDPOINT + '/error-fileset',
validationIssueTypeCodesURL: process.env.GRAD_API_ENDPOINT + '/validation-issue-type-codes',
filesetURL: process.env.GRAD_API_ENDPOINT + '/fileset',
},
frontendConfig: {
bannerEnvironment: process.env.BANNER_ENVIRONMENT,
Expand Down
6 changes: 5 additions & 1 deletion backend/src/routes/grad.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const auth = require('../components/auth');
const isValidBackendToken = auth.isValidBackendToken();
const { validateAccessToken, checkEdxUserPermission} = require('../components/permissionUtils');
const { scanFilePayload } = require('../components/fileUtils');
const { uploadFile, getFileProgress, getErrorFilesetStudentPaginated} = require('../components/grad');
const { uploadFile, getFileProgress, getErrorFilesetStudentPaginated, getFilesetsPaginated} = require('../components/grad');
const { PERMISSION } = require('../util/Permission');
const validate = require('../components/validator');
const {getCachedGradCollectionData} = require('../components/gdc-cache');
Expand All @@ -25,5 +25,9 @@ router.get('/filesetErrors/:schoolID/paginated', passport.authenticate('jwt', {s
checkEdxUserPermission(PERMISSION.GRAD_SCH_EDIT), validate(gradErrorFilesetStudentPaginatedSchema),
getErrorFilesetStudentPaginated);

router.get('/fileset/:schoolID/paginated', passport.authenticate('jwt', {session: false}, undefined), isValidBackendToken, validateAccessToken,
checkEdxUserPermission(PERMISSION.GRAD_SCH_EDIT), validate(gradErrorFilesetStudentPaginatedSchema),
getFilesetsPaginated);


module.exports = router;
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@
</template>
<template #item="props">
<tr
class="mt-2"
@click="rowclicked(props.item)"
>
<td
v-for="column in headers"
:key="column.key"
class="row-text"
class="pt-2 row-text"
>
<span v-if="column.key === 'details' && column.hasOwnProperty('subHeader')">
<span v-for="(error, index) in props.item['errorFilesetStudentValidationIssues']" :key="index">
Expand All @@ -60,7 +61,12 @@
<v-col
v-if="column.subHeader[1].key === 'errors'"
cols="3"
>{{ formatText(error?.validationIssueSeverityCode) }}</v-col>

>
<v-chip class="status-chip" :color="getStatusColor(error?.validationIssueSeverityCode)">
{{ formatText(error?.validationIssueSeverityCode) }}
</v-chip>
</v-col>
<v-col v-if="column.subHeader[2].key === 'desc'">{{ error?.validationIssueCodeDesc }}</v-col>
</v-row>
</span>
Expand Down Expand Up @@ -139,7 +145,31 @@ export default {
},
formatText(text) {
return capitalize(text);
}
},
getStatusColor(status) {
if (status === 'WARNING') {
return '#ff9800';
}
else if (status === 'ERROR') {
return '#d90606';
}
},
getStatusTextColor(status) {
if (status === 'WARNING') {
return 'warning-text';
}
else if (status === 'ERROR') {
return 'error-text';
}
},
getIssueIcon(status) {
if (status === 'WARNING') {
return 'mdi-alert-outline';
}
else if (status === 'ERROR') {
return 'mdi-alert-circle-outline';
}
},
}
};
Expand All @@ -161,6 +191,11 @@ export default {
.row-text {
vertical-align: text-top;
}
.status-chip {
margin-top: 2px;
margin-bottom: 2px;
}
</style>


Loading

0 comments on commit c3f116c

Please sign in to comment.