Skip to content

Commit

Permalink
ccfri-4027 - code fix for some minor bugs in AFS and RFI
Browse files Browse the repository at this point in the history
  • Loading branch information
vietle-cgi committed Dec 5, 2024
1 parent 93cc118 commit 5b4770d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions frontend/src/components/RFI/RFIDocumentUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
:rules="rules.fileRules"
prepend-icon="mdi-file-upload"
:clearable="false"
class="pt-0"
class="mt-4"
:accept="FILE_TYPES_ACCEPT"
:disabled="false"
placeholder="Select your file"
Expand All @@ -67,10 +67,10 @@
v-else
v-model="item.description"
placeholder="Enter a description (Optional)"
density="compact"
clearable
:rules="[rules.maxLength(255)]"
max-length="255"
class="mt-4"
@change="descriptionChanged(item)"
/>
</template>
Expand All @@ -84,6 +84,9 @@
</template>
<script>
import { mapState } from 'pinia';
import AppButton from '@/components/guiComponents/AppButton.vue';
import { useApplicationStore } from '@/store/application.js';
import { useNavBarStore } from '@/store/navBar.js';
import { useReportChangesStore } from '@/store/reportChanges.js';
Expand All @@ -95,7 +98,7 @@ import { deepCloneObject } from '@/utils/common.js';
import { CHANGE_TYPES, FILE_REQUIREMENTS_TEXT, FILE_TYPES_ACCEPT } from '@/utils/constants.js';
export default {
components: {},
components: { AppButton },
mixins: [alertMixin],
props: {
currentFacility: {
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/components/util/AppDocumentUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
</template>
<script>
import { uuid } from 'vue-uuid';
import { isEmpty } from 'lodash';
import AppButton from '@/components/guiComponents/AppButton.vue';
import alertMixin from '@/mixins/alertMixin.js';
Expand Down Expand Up @@ -129,6 +128,10 @@ export default {
?.filter((document) => document.isValidFile && document.file)
?.map(async (item) => {
const convertedFile = await readFile(item.file);
// XXX (vietle-cgi) - We need this part because the field names differ between the legacy code and AFS, and I want to avoid making too many changes to the legacy code.
convertedFile.fileName = convertedFile.filename;
convertedFile.fileSize = convertedFile.filesize;
convertedFile.documentBody = convertedFile.documentbody;
return { ...item, ...convertedFile };
}),
);
Expand Down Expand Up @@ -181,7 +184,7 @@ export default {
validateFile(updatedItemId) {
const document = this.documents.find((item) => item.id === updatedItemId);
document.isValidFile = isEmpty(document?.file) || isValidFile(document?.file);
document.isValidFile = isValidFile(document?.file);
},
resetDocuments() {
Expand Down

0 comments on commit 5b4770d

Please sign in to comment.