From ee4ba79e182388591b0e384f0d707750a3ba7403 Mon Sep 17 00:00:00 2001 From: zhuth Date: Tue, 4 Oct 2022 09:59:56 +0800 Subject: [PATCH] dataset update --- src/api.js | 5 +++-- src/locales/chs.json | 4 +++- src/locales/cht.json | 4 +++- src/locales/en.json | 4 +++- src/locales/ja.json | 4 +++- src/views/DatasetList.vue | 13 +++++++++---- src/views/SearchForm.vue | 6 +++--- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/api.js b/src/api.js index 1e88265..cfee0b7 100644 --- a/src/api.js +++ b/src/api.js @@ -518,7 +518,7 @@ export default { }; data = data.map((x) => { - x.segments = x.name.split("--"); + x.segments = (x.display_name || x.name).split("--"); x.level = x.segments.length; return x; }); @@ -537,6 +537,7 @@ export default { }; bundles[cand.id] = { name: segs, + dataset_name: x.name, mongocollection: x.mongocollection, }; parent_obj.children.push(cand); @@ -581,7 +582,7 @@ export default { get_image_url(src) { var path = '' - if (src.file.indexOf('://') >= 0 && src.block_id) { + if (src.file.indexOf('://') >= 0) { let ext = (src.url || src.orig_path || '').split('.').pop() let segs = src.file.split('://') path = `/images/${segs[0]}/${segs[1].replace('$', src.block_id) || src.block_id}/image.${ext.length <= 4 ? ext : 'data'}` diff --git a/src/locales/chs.json b/src/locales/chs.json index 07fe8aa..178e2ad 100644 --- a/src/locales/chs.json +++ b/src/locales/chs.json @@ -154,5 +154,7 @@ "success": "成功", "latest-imported": "最近导入", "new-folder": "新建文件夹", - "folder-name": "文件夹名称" + "folder-name": "文件夹名称", + "display-name": "显示名称", + "mongocollection": "数据库集合名" } \ No newline at end of file diff --git a/src/locales/cht.json b/src/locales/cht.json index 35e8486..9bb2ee8 100644 --- a/src/locales/cht.json +++ b/src/locales/cht.json @@ -154,5 +154,7 @@ "success": "成功", "latest-imported": "最近導入", "new-folder": "新資料夾", - "folder-name": "資料夾名" + "folder-name": "資料夾名", + "display-name": "顯示名", + "mongocollection": "資料庫集合名" } \ No newline at end of file diff --git a/src/locales/en.json b/src/locales/en.json index 0e2aa02..9753839 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -154,5 +154,7 @@ "success": "Success", "latest-imported": "Latest Imported", "new-folder": "New Folder", - "folder-name": "Folder Name" + "folder-name": "Folder Name", + "display-name": "Display Name", + "mongocollection": "MongoDB Collection Name" } \ No newline at end of file diff --git a/src/locales/ja.json b/src/locales/ja.json index 3afbaa0..3ebc5e4 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -155,5 +155,7 @@ "success": "完了", "latest-imported": "最新の輸入", "new-folder": "新しいフォルダ", - "folder-name": "フォルダ名" + "folder-name": "フォルダ名", + "display-name": "表示名", + "mongocollection": "データベースコレクション" } \ No newline at end of file diff --git a/src/views/DatasetList.vue b/src/views/DatasetList.vue index 4f99abe..a463cbd 100644 --- a/src/views/DatasetList.vue +++ b/src/views/DatasetList.vue @@ -8,8 +8,8 @@ - {{ ds.name }} - + {{ ds.display_name || ds.name }} + ({{ ds.name }}) + + diff --git a/src/views/SearchForm.vue b/src/views/SearchForm.vue index 94cb384..df4ca6b 100644 --- a/src/views/SearchForm.vue +++ b/src/views/SearchForm.vue @@ -137,12 +137,12 @@ export default { if (selected.length > 0) { var datasets = selected .filter((x) => !x.source) - .map((x) => api.escape_regex(x.name)), + .map((x) => api.escape_regex(x.dataset_name)), sourcefiles = selected .filter((x) => x.source) .map((x) => ({ file: x.source.split(":", 2).pop(), - dataset: x.name, + dataset: x.dataset_name, })), req_datasets = "", req_sourcefiles = ""; @@ -151,7 +151,7 @@ export default { ); if (datasets.length > 0) { - req_datasets = "dataset%`^" + datasets.join("|^") + "`"; + req_datasets = "dataset%`^" + datasets.map(x => x == '' ? '$' : api.escape_regex(x)).join("|^") + "`"; } if (sourcefiles.length > 0) { req_sourcefiles = sourcefiles