Skip to content

Commit

Permalink
tweak(adminPanel): RN-1427: Remove .CSV from supported file types (#5862
Browse files Browse the repository at this point in the history
)

* Update EditSurveyPage.jsx

* all file uploader updated

* updated

* updates

---------

Co-authored-by: alexd-bes <129009580+alexd-bes@users.noreply.github.com>
  • Loading branch information
hrazasalman and alexd-bes authored Sep 30, 2024
1 parent d046bf8 commit 64356c1
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/admin-panel/src/importExport/ImportModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export const ImportModalComponent = React.memo(
onChange={newFiles => setFiles(newFiles ?? [])}
name="file-upload"
multiple={actionConfig.multiple}
accept={actionConfig.accept}
/>
</>
)}
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-panel/src/pages/StrivePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const importConfig = {
title: 'Import lab results or vector data',
actionConfig: {
importEndpoint: 'striveLabResults',
accept: {
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
},
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ const EditSurveyPageComponent = withConnectedEditor(
accept={{
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
'text/csv': ['.csv'],
}}
fileName={initialFileName}
label="Survey questions"
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-panel/src/routes/entities/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ const IMPORT_CONFIG = {
'Please note that if this is the first time a country is being imported, you will need to restart central-server post-import for it to sync to DHIS2.', // hope to fix one day in https://github.com/beyondessential/central-server/issues/481
actionConfig: {
importEndpoint: ENTITIES_ENDPOINT,
accept: {
'application/geo+json': ['.geojson'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
},
},
queryParameters: [
{
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-panel/src/routes/surveys/dataElements.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const IMPORT_CONFIG = {
title: `Import ${RESOURCE_NAME.singular}`,
actionConfig: {
importEndpoint: 'dataElements',
accept: {
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
},
},
};

Expand Down
4 changes: 4 additions & 0 deletions packages/admin-panel/src/routes/surveys/dataMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ const IMPORT_CONFIG = {
title: `Import ${RESOURCE_NAME.singular}`,
actionConfig: {
importEndpoint: 'dataElementDataServices',
accept: {
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
},
},
};

Expand Down
4 changes: 4 additions & 0 deletions packages/admin-panel/src/routes/surveys/optionSets.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ const IMPORT_CONFIG = {
title: `Import ${getPluralForm(RESOURCE_NAME)}`,
actionConfig: {
importEndpoint: 'optionSets',
accept: {
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
},
},
queryParameters: [
{
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-panel/src/routes/surveys/surveyResponses.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ const IMPORT_CONFIG = {
timeZone: getBrowserTimeZone(),
respondWithEmailTimeout: 10 * 1000, // if an import doesn't finish in 10 seconds, email results
},
accept: {
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
},
},
queryParameters: [
{
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-panel/src/routes/surveys/surveys.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ const SURVEY_FIELDS = {
name: 'surveyQuestions',
labelTooltip:
'Import a questions spreadsheet to update the questions and screens of this survey.',
accept: {
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
},
},
},
};
Expand Down
4 changes: 4 additions & 0 deletions packages/admin-panel/src/routes/users/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ const IMPORT_CONFIG = {
title: `Import user ${getPluralForm(RESOURCE_NAME)}`,
actionConfig: {
importEndpoint: 'userPermissions',
accept: {
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
},
},
};

Expand Down
4 changes: 4 additions & 0 deletions packages/admin-panel/src/routes/users/users.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ const IMPORT_CONFIG = {
title: `Import ${getPluralForm(RESOURCE_NAME)}`,
actionConfig: {
importEndpoint: 'users',
accept: {
'application/vnd.ms-excel': ['.xls'],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['.xlsx'],
},
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ const IMPORT_CONFIG = {
actionConfig: {
importEndpoint: 'dashboardVisualisations',
multiple: true,
accept: {
'application/json': ['.json'],
},
},
getFinishedMessage: response => (
<>
Expand Down
3 changes: 3 additions & 0 deletions packages/admin-panel/src/routes/visualisations/dataTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ const IMPORT_CONFIG = {
actionConfig: {
importEndpoint: 'dataTables',
multiple: true,
accept: {
'application/json': ['.json'],
},
},
};
const EDITOR_CONFIG = { displayUsedBy: true };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ const IMPORT_CONFIG = {
actionConfig: {
importEndpoint: 'mapOverlayVisualisations',
multiple: true,
accept: {
'application/json': ['.json'],
},
},
getFinishedMessage: response => (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ export const registerInputFields = () => {
<FileUploadField
name={props.name}
label={props.label}
accept={props.accept}
required={props.required}
onChange={({ fileName, file }) => props.onSetFormFile(props.inputKey, { fileName, file })}
/>
Expand Down

0 comments on commit 64356c1

Please sign in to comment.