Skip to content

Commit

Permalink
minimum complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfml committed Dec 19, 2022
1 parent d5e2c96 commit fa24e16
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions report-viewer/src/components/FilesContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
:lines="!files.get(file)?.lines ? [] : files.get(file)?.lines"
:matches="!matches.get(file) ? [] : matches.get(file)"
:panel-id="containerId"
:title="convertSubmissionIdToName(file, submissionId).length > 40?
'..' + convertSubmissionIdToName(file, submissionId).substring(file.length - 40, file.length):
convertSubmissionIdToName(file, submissionId)"
:title="convertSubmissionIdToName(file, submissionId)"
@toggle-collapse="$emit('toggle-collapse', file)"
@line-selected="lineSelected"
/>
Expand Down Expand Up @@ -99,13 +97,15 @@ export default defineComponent({
emit("lineSelected", e, index, file, line);
};
/**
* converts the submissionId to the name in the path of file.
* converts the submissionId to the name in the path of file. If the length of path exceeds 40, then the file path displays the abbreviation.
* @param match
* @param submissionId
* @return new path of file
*/
const convertSubmissionIdToName=(file: string, submissionId: string):string => {
return file.replace(submissionId, store.getters.submissionDisplayName(submissionId));
const filePath = file.replace(submissionId, store.getters.submissionDisplayName(submissionId));
const filePathLength = filePath.length;
return filePathLength > 40 ? ".." + filePath.substring(filePathLength - 40, filePathLength) : filePath;
};
return {
lineSelected,
Expand Down

0 comments on commit fa24e16

Please sign in to comment.