diff --git a/frontend/src/components/dirent-detail/embedded-file-details/index.js b/frontend/src/components/dirent-detail/embedded-file-details/index.js index 120a37af0f0..ea94d317f62 100644 --- a/frontend/src/components/dirent-detail/embedded-file-details/index.js +++ b/frontend/src/components/dirent-detail/embedded-file-details/index.js @@ -8,6 +8,7 @@ import { Header, Body } from '../detail'; import FileDetails from './file-details'; import { MetadataContext } from '../../../metadata'; import { MetadataDetailsProvider } from '../../../metadata/hooks'; +import Settings from '../../../metadata/components/metadata-details/settings'; import './index.css'; @@ -52,7 +53,9 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = })} style={{ width }} > -
+
+ +
{dirent && direntDetail && (
diff --git a/frontend/src/metadata/hooks/metadata-details.js b/frontend/src/metadata/hooks/metadata-details.js index 33b9617b220..e4d1c102292 100644 --- a/frontend/src/metadata/hooks/metadata-details.js +++ b/frontend/src/metadata/hooks/metadata-details.js @@ -7,7 +7,9 @@ import { SYSTEM_FOLDERS } from '../../constants'; import Column from '../model/column'; import { normalizeFields } from '../components/metadata-details/utils'; import { CellType, EVENT_BUS_TYPE, PREDEFINED_COLUMN_KEYS, PRIVATE_COLUMN_KEY } from '../constants'; -import { getCellValueByColumn, getOptionName, getColumnOptionNamesByIds, getColumnOptionNameById, getRecordIdFromRecord, getFileObjIdFromRecord } from '../utils/cell'; +import { getCellValueByColumn, getOptionName, getColumnOptionNamesByIds, getColumnOptionNameById, getRecordIdFromRecord, + getFileObjIdFromRecord +} from '../utils/cell'; import tagsAPI from '../../tag/api'; import { getColumnByKey, getColumnOptions, getColumnOriginName } from '../utils/column'; import LocalStorage from '../utils/local-storage'; @@ -147,20 +149,7 @@ export const MetadataDetailsProvider = ({ repoID, repoInfo, path, dirent, dirent useEffect(() => { setLoading(true); - if (!dirent || !direntDetail) { - setRecord(null); - setColumns([]); - setLoading(false); - return; - } - - if (!enableMetadata) { - setRecord(null); - setColumns([]); - setLoading(false); - } - - if (SYSTEM_FOLDERS.find(folderPath => path.startsWith(folderPath))) { + if (!dirent || !direntDetail || !enableMetadata || SYSTEM_FOLDERS.find(folderPath => path.startsWith(folderPath))) { setRecord(null); setColumns([]); setLoading(false); @@ -177,7 +166,7 @@ export const MetadataDetailsProvider = ({ repoID, repoInfo, path, dirent, dirent metadataAPI.getMetadataRecordInfo(repoID, parentDir, fileName).then(res => { const { results, metadata } = res.data; const record = Array.isArray(results) && results.length > 0 ? results[0] : {}; - const columns = normalizeFields(metadata, record).map(field => new Column(field)); + const columns = normalizeFields(metadata).map(field => new Column(field)); allColumnsRef.current = columns; setRecord(record); localStorageRef.current = new LocalStorage(`sf-metadata-detail-settings-${repoID}`);