Resolve LMS upload.

This commit is contained in:
Patrick Fic
2025-10-31 10:58:53 -07:00
parent beb1145f98
commit ffcaf5d536
5 changed files with 37 additions and 23 deletions

View File

@@ -6,7 +6,7 @@
"scheme": "imex-mobile-scheme",
"userInterfaceStyle": "automatic",
"extra": {
"expover": "8",
"expover": "15",
"eas": {
"projectId": "ffe01f3a-d507-4698-82cd-da1f1cad450b"
}

View File

@@ -66,7 +66,7 @@ function Tab({ bodyshop, currentUser, signOutStart }) {
};
return (
<SafeAreaView style={{ flex: 1 }}>
<SafeAreaView style={{ flex: 1, paddingBottom: 48 }}>
<Text variant="headlineMedium" style={styles.title}>
{t("settings.titles.settings")}
</Text>

View File

@@ -69,16 +69,20 @@ export function UploadProgress({
<Text variant="titleLarge" style={styles.title}>
{t("general.labels.upload")}
</Text>
<Text variant="labelLarge">
{`${t("general.labels.uploadprogress")} ${Math.round(
completion * 100
)}%`}
</Text>
<ProgressBar
progress={completion}
style={styles.progress}
color={completion === 1 ? "green" : "blue"}
/>
{!photoUploadProgress["Bulk"] && (
<>
<Text variant="labelLarge">
{`${t("general.labels.uploadprogress")} ${Math.round(
completion * 100
)}%`}
</Text>
<ProgressBar
progress={completion}
style={styles.progress}
color={completion === 1 ? "green" : "blue"}
/>
</>
)}
<Divider style={{ marginVertical: 12 }} />
{Object.keys(photoUploadProgress).map((key) => (
<View key={key} style={styles.progressItem}>

View File

@@ -45,7 +45,7 @@ const photosReducer = (state = INITIAL_STATE, action) => {
case PhotosActionTypes.MEDIA_UPLOAD_PROGRESS_UPDATE_BULK:
return {
...state,
progress: { Upload: action.payload }
progress: { Upload: { fileName: "Bulk", ...action.payload } }
};
case PhotosActionTypes.MEDIA_UPLOAD_COMPLETED:
return {

View File

@@ -203,15 +203,6 @@ function* uploadSinglePhoto(photo, bodyshop, index, jobid) {
function* uploadToLocalMediaServer(photos, bodyshop, jobid) {
try {
const options = {
headers: {
"Content-Type": "multipart/form-data",
ims_token: bodyshop.localmediatoken,
},
onUploadProgress: (e) => {
put(mediaUploadProgressBulk({ progress: e.loaded / e.total, loaded: e.loaded, total: e.total }));
},
};
const formData = new FormData();
formData.append("jobid", jobid);
@@ -227,11 +218,30 @@ function* uploadToLocalMediaServer(photos, bodyshop, jobid) {
formData.append("skip_thumbnail", true);
try {
const startTime = new Date();
const handleUploadProgress = (e) => {
console.log("progress", e)
store.dispatch(mediaUploadProgressBulk({ progress: e.loaded / e.total, loaded: e.loaded, total: e.total, startTime }));
};
const controller = new AbortController();
yield put(addUploadCancelTask({ assetId: "Bulk", cancelTask: () => controller.abort() }));
const imexMediaServerResponse = yield call(axios.post,
`${bodyshop.localmediaserverhttp}/jobs/upload`,
formData,
options
{
headers: {
"Content-Type": "multipart/form-data",
ims_token: bodyshop.localmediatoken,
},
onUploadProgress: handleUploadProgress,
signal: controller.signal
}
);
if (imexMediaServerResponse.status !== 200) {
console.log("Error uploading documents:", JSON.stringify(imexMediaServerResponse, null, 2));
} else {