Skip to content

Commit

Permalink
feat(dcellar-web-ui): replace object update object meta
Browse files Browse the repository at this point in the history
  • Loading branch information
aiden-cao authored and devinxl committed May 6, 2024
1 parent c2c9b6a commit 3db1167
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/dcellar-web-ui/src/store/slices/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ export const uploadQueueAndRefresh =
folders: task.prefixFolders,
name: task.waitObject.name,
objectStatus: 1,
contentType: task.waitObject.type,
payloadSize: task.waitObject.size,
}),
);
});
Expand Down
8 changes: 7 additions & 1 deletion apps/dcellar-web-ui/src/store/slices/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,25 @@ export const objectSlice = createSlice({
folders: string[];
name: string;
objectStatus: number;
contentType: string;
payloadSize: number;
}>,
) {
const { name, folders, objectStatus, bucketName } = payload;
const { name, folders, objectStatus, bucketName, contentType, payloadSize } = payload;
const path = [bucketName, ...folders].join('/');
const items = state.objectListRecords[path] || [];
const objectName = [...folders, name].join('/');
const object = find<ObjectEntity>(items, (i) => i.objectName === objectName);
if (object) {
object.objectStatus = objectStatus;
object.contentType = contentType;
object.payloadSize = payloadSize;
}
const info = state.objectRecords[[path, objectName].join('/')];
if (!info) return;
info.ObjectInfo.ObjectStatus = objectStatus as any; // number
info.ObjectInfo.ContentType = contentType;
info.ObjectInfo.PayloadSize = payloadSize;
},
setObjectListPageRestored(state, { payload }: PayloadAction<boolean>) {
state.objectListPageRestored = payload;
Expand Down

0 comments on commit 3db1167

Please sign in to comment.