diff --git a/src/components/backend-ai-summary-view.ts b/src/components/backend-ai-summary-view.ts index 02ac97faf..01ff36706 100644 --- a/src/components/backend-ai-summary-view.ts +++ b/src/components/backend-ai-summary-view.ts @@ -388,6 +388,35 @@ export default class BackendAISummary extends BackendAIPage { }); } + /** + * Returns tab according to vfolder information + * + * @param vfolderInfo + * @returns {string} - tab name of vfolder (model, general, data, automount) + */ + static getVFolderTabByVFolderInfo(vfolderInfo) { + if ( + !vfolderInfo.name.startsWith('.') && + vfolderInfo.usage_mode == 'model' + ) { + return 'model'; + } else if ( + !vfolderInfo.name.startsWith('.') && + vfolderInfo.usage_mode == 'general' + ) { + return 'general'; + } else if ( + !vfolderInfo.name.startsWith('.') && + vfolderInfo.usage_mode == 'data' + ) { + return 'data'; + } else if (vfolderInfo.name.startsWith('.')) { + return 'automount'; + } else { + return 'general'; + } + } + /** * Accept invitation and make you can access vfolder. * @@ -400,9 +429,14 @@ export default class BackendAISummary extends BackendAIPage { } try { await globalThis.backendaiclient.vfolder.accept_invitation(invitation.id); + const vfolderInfo = await globalThis.backendaiclient.vfolder.info( + invitation.vfolder_name, + ); + const tabName = BackendAISummary.getVFolderTabByVFolderInfo(vfolderInfo); + this.notification.url = `/data?tab=${tabName}&folder=${invitation.vfolder_id.replace('-', '')}`; this.notification.text = _text('summary.AcceptSharedVFolder') + `${invitation.vfolder_name}`; - this.notification.show(); + this.notification.show(true); } catch (err) { this.notification.text = PainKiller.relieve(err.title); this.notification.detail = err.message;