Skip to content

Commit 918cf92

Browse files
committed
fix: error words improvement, pass resourceConfig
1 parent 4d3f56c commit 918cf92

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

custom/uploader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ const onFileChange = async (e) => {
273273
});
274274
if (!success) {
275275
adminforth.alert({
276-
messageHtml: `<div>${t('Sorry but the file was not uploaded because of S3 Request Error:')}</div>
276+
messageHtml: `<div>${t('Sorry but the file was not uploaded because of internal storage Request Error:')}</div>
277277
<pre style="white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word; max-width: 100%;">${
278278
xhr.responseText.replace(/</g, '&lt;').replace(/>/g, '&gt;')
279279
}</pre>`,

index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export default class UploadPlugin extends AdminForthPlugin {
1414
totalCalls: number;
1515
totalDuration: number;
1616

17+
resourceConfig: AdminForthResource;
18+
1719
constructor(options: PluginOptions) {
1820
super(options, import.meta.url);
1921
this.options = options;
@@ -28,7 +30,8 @@ export default class UploadPlugin extends AdminForthPlugin {
2830
}
2931

3032
async setupLifecycleRule() {
31-
this.options.storageAdapter.setupLifecycle();
33+
const adapterUserUniqueRepresentation = `${this.resourceConfig.resourceId}-${this.pluginInstanceId}`;
34+
this.options.storageAdapter.setupLifecycle(adapterUserUniqueRepresentation);
3235
}
3336

3437
async genPreviewUrl(record: any) {
@@ -43,6 +46,7 @@ export default class UploadPlugin extends AdminForthPlugin {
4346

4447
async modifyResourceConfig(adminforth: IAdminForth, resourceConfig: AdminForthResource) {
4548
super.modifyResourceConfig(adminforth, resourceConfig);
49+
this.resourceConfig = resourceConfig;
4650
// after column to store the path of the uploaded file, add new VirtualColumn,
4751
// show only in edit and create views
4852
// use component uploader.vue

0 commit comments

Comments
 (0)