refactor(auth-files): replace clear disk action with open folder
This commit is contained in:
1 parent
edbce47e4c
commit
642829b23f
3 files changed
+5
-31
No files matched your search
+1
-4
@@ -396,13 +396,10 @@ export const jaOverrides = {
|
||||
'authFiles.runtimeDeleteError': '実行時認証ファイルはディスクから削除できません',
|
||||
'authFiles.deleteConfirm': '「{name}」を削除しますか?',
|
||||
'authFiles.deleted': '認証ファイルを削除しました',
|
||||
'authFiles.deleteAllConfirm': 'ディスク上の認証ファイルをすべて削除しますか?実行時認証は削除されません。',
|
||||
'authFiles.deletedAll': 'ディスク上の認証ファイルをすべて削除しました',
|
||||
'common.copyFailed': 'コピーに失敗しました',
|
||||
'authFiles.title': '認証ファイル',
|
||||
'authFiles.summary': 'ファイル {files} 件 · 無効 {disabled} 件',
|
||||
'common.refresh': '更新',
|
||||
'authFiles.clearDisk': 'ディスクファイルを消去',
|
||||
'common.upload': 'アップロード',
|
||||
'authFiles.searchPlaceholder': 'ファイル名、アカウント、プロバイダーを検索',
|
||||
'authFiles.filter.allProviders': 'すべてのプロバイダー',
|
||||
@@ -423,7 +420,7 @@ export const jaOverrides = {
|
||||
'authFiles.models.settings': '公開モデルを設定',
|
||||
'authFiles.models.button': 'モデル',
|
||||
'authFiles.copyName': 'ファイル名をコピー',
|
||||
'authFiles.openDirectory': '認証情報フォルダーを開く',
|
||||
'authFiles.openDirectory': 'フォルダーを開く',
|
||||
'common.enable': '有効化',
|
||||
'common.disable': '無効化',
|
||||
'authFiles.runtimeFootnote': '{count} 件の認証情報は実行時ストレージ由来です。対応するプロバイダーまたは認証元でのみ管理できます。',
|
||||
|
||||
@@ -399,13 +399,10 @@ export const zhCN = {
|
||||
'authFiles.runtimeDeleteError': '运行时认证文件不能从磁盘删除',
|
||||
'authFiles.deleteConfirm': '确定删除“{name}”吗?',
|
||||
'authFiles.deleted': '认证文件已删除',
|
||||
'authFiles.deleteAllConfirm': '确定删除所有磁盘认证文件吗?运行时认证不会被删除。',
|
||||
'authFiles.deletedAll': '磁盘认证文件已全部删除',
|
||||
'common.copyFailed': '复制失败',
|
||||
'authFiles.title': '认证文件',
|
||||
'authFiles.summary': '{files} 个文件 · {disabled} 个停用',
|
||||
'common.refresh': '刷新',
|
||||
'authFiles.clearDisk': '清空磁盘文件',
|
||||
'common.upload': '上传',
|
||||
'authFiles.searchPlaceholder': '搜索文件名、账号或提供商',
|
||||
'authFiles.filter.allProviders': '全部提供商',
|
||||
@@ -426,7 +423,7 @@ export const zhCN = {
|
||||
'authFiles.models.settings': '设置开放模型',
|
||||
'authFiles.models.button': '模型',
|
||||
'authFiles.copyName': '复制文件名',
|
||||
'authFiles.openDirectory': '打开凭证所在文件夹',
|
||||
'authFiles.openDirectory': '打开文件夹',
|
||||
'common.enable': '启用',
|
||||
'common.disable': '停用',
|
||||
'authFiles.runtimeFootnote': '{count} 个凭据来自运行时存储,只能在对应提供商或认证源中管理。',
|
||||
@@ -1330,13 +1327,10 @@ export const en: Record<MessageKey, string> = {
|
||||
'authFiles.runtimeDeleteError': 'Runtime authentication files cannot be deleted from disk',
|
||||
'authFiles.deleteConfirm': 'Delete “{name}”?',
|
||||
'authFiles.deleted': 'Authentication file deleted',
|
||||
'authFiles.deleteAllConfirm': 'Delete all on-disk authentication files? Runtime credentials will not be deleted.',
|
||||
'authFiles.deletedAll': 'All on-disk authentication files deleted',
|
||||
'common.copyFailed': 'Copy failed',
|
||||
'authFiles.title': 'Authentication Files',
|
||||
'authFiles.summary': '{files} files · {disabled} disabled',
|
||||
'common.refresh': 'Refresh',
|
||||
'authFiles.clearDisk': 'Clear Disk Files',
|
||||
'common.upload': 'Upload',
|
||||
'authFiles.searchPlaceholder': 'Search by file name, account, or provider',
|
||||
'authFiles.filter.allProviders': 'All Providers',
|
||||
@@ -1357,7 +1351,7 @@ export const en: Record<MessageKey, string> = {
|
||||
'authFiles.models.settings': 'Configure open models',
|
||||
'authFiles.models.button': 'Models',
|
||||
'authFiles.copyName': 'Copy file name',
|
||||
'authFiles.openDirectory': 'Open credential folder',
|
||||
'authFiles.openDirectory': 'Open Folder',
|
||||
'common.enable': 'Enable',
|
||||
'common.disable': 'Disable',
|
||||
'authFiles.runtimeFootnote': '{count} credentials come from runtime storage and can only be managed through their provider or authentication source.',
|
||||
|
||||
@@ -437,21 +437,6 @@ export function AuthFileManagementPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const deleteAll = async () => {
|
||||
if (!window.confirm(t('authFiles.deleteAllConfirm'))) return;
|
||||
setBusy(true);
|
||||
setError('');
|
||||
try {
|
||||
await managementApi.delete('/auth-files', { query: { all: true } });
|
||||
setNotice(t('authFiles.deletedAll'));
|
||||
await loadFiles();
|
||||
} catch (requestError) {
|
||||
setError(String(requestError));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const openAuthFilesDirectory = async () => {
|
||||
setBusy(true);
|
||||
setError('');
|
||||
@@ -476,7 +461,6 @@ export function AuthFileManagementPage() {
|
||||
|
||||
const disabledCount = files.filter((file) => readBoolean(file, 'disabled')).length;
|
||||
const runtimeCount = files.filter(isRuntimeOnly).length;
|
||||
const diskCount = files.length - runtimeCount;
|
||||
|
||||
return (
|
||||
<section className="page management-page auth-files-page">
|
||||
@@ -490,8 +474,8 @@ export function AuthFileManagementPage() {
|
||||
<button type="button" className="secondary-button compact-button" onClick={() => void loadFiles()} disabled={loading || busy}>
|
||||
<RefreshCw size={16} />{t('common.refresh')}
|
||||
</button>
|
||||
<button type="button" className="secondary-button compact-button" onClick={deleteAll} disabled={loading || busy || diskCount === 0}>
|
||||
<Trash2 size={16} />{t('authFiles.clearDisk')}
|
||||
<button type="button" className="secondary-button compact-button" onClick={() => void openAuthFilesDirectory()} disabled={busy}>
|
||||
<FolderOpen size={16} />{t('authFiles.openDirectory')}
|
||||
</button>
|
||||
<button type="button" className="primary-button compact-button" onClick={() => fileInputRef.current?.click()} disabled={busy}>
|
||||
<Upload size={16} />{t('common.upload')}
|
||||
@@ -547,7 +531,6 @@ export function AuthFileManagementPage() {
|
||||
{providerKey(file) ? <button type="button" className="secondary-button compact-button" onClick={() => void openOauthModels(file)} disabled={busy} title={t('authFiles.models.settings')}>{t('authFiles.models.button')}</button> : null}
|
||||
<button type="button" className="secondary-button compact-button auth-file-priority-button" onClick={() => openPriorityEditor(file)} disabled={busy} title={t('authFiles.priority.hint')}><Pencil size={14} />{t('authFiles.priority.button', { priority })}</button>
|
||||
<button type="button" className="icon-button quiet" onClick={() => void copyName(name)} disabled={busy} title={t('authFiles.copyName')}>{copied === name ? <Check size={16} /> : <Copy size={16} />}</button>
|
||||
<button type="button" className="icon-button quiet" onClick={() => void openAuthFilesDirectory()} disabled={busy} title={t('authFiles.openDirectory')}><FolderOpen size={16} /></button>
|
||||
<button type="button" className="secondary-button compact-button" onClick={() => void toggleStatus(file)} disabled={busy}>{disabled ? t('common.enable') : t('common.disable')}</button>
|
||||
<button type="button" className="icon-button danger" onClick={() => void deleteFile(file)} disabled={busy || isRuntimeOnly(file)} title={t('common.delete')}><Trash2 size={16} /></button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user