diff --git a/frontend/src/components/entry/SearchResults.tsx b/frontend/src/components/entry/SearchResults.tsx index e9cedc382..9b9adab6d 100644 --- a/frontend/src/components/entry/SearchResults.tsx +++ b/frontend/src/components/entry/SearchResults.tsx @@ -63,6 +63,7 @@ interface Props { joinAttrs: AdvancedSearchJoinAttrInfo[]; disablePaginationFooter: boolean; setSearchResults: () => void; + isReadonly?: boolean; } export const SearchResults: FC = ({ @@ -80,6 +81,7 @@ export const SearchResults: FC = ({ joinAttrs, disablePaginationFooter, setSearchResults, + isReadonly = false, }) => { // NOTE attrTypes are guessed by the first element on the results. So if it has no appropriate attr, // the type guess doesn't work well. We should improve attr type API if more accurate type is needed. @@ -109,21 +111,28 @@ export const SearchResults: FC = ({ searchAllEntities={searchAllEntities} joinAttrs={joinAttrs} refreshSearchResults={setSearchResults} + isReadonly={isReadonly} /> {results.values?.map((result) => ( - - - handleChangeBulkOperationEntryId( - result.entry.id, - e.target.checked - ) - } - /> - + {/* Bulk operation checkbox would be invisible when Readonly mode is true */} + {!isReadonly && ( + + + handleChangeBulkOperationEntryId( + result.entry.id, + e.target.checked + ) + } + /> + + )} + void; + isReadonly?: boolean; } export const SearchResultsTableHead: FC = ({ @@ -73,6 +74,7 @@ export const SearchResultsTableHead: FC = ({ searchAllEntities, joinAttrs, refreshSearchResults, + isReadonly = false, }) => { const location = useLocation(); const navigate = useNavigate(); @@ -187,25 +189,34 @@ export const SearchResultsTableHead: FC = ({ return ( - + {/* Bulk operation checkbox would be invisible when Readonly mode is true */} + {!isReadonly && } アイテム名 - { - setEntryMenuEls(e.currentTarget); - }} - > - {defaultEntryFilter ? : } - - setEntryMenuEls(null)} - entryFilterDispatcher={entryFilterDispatcher} - handleSelectFilterConditions={handleSelectFilterConditions()} - handleClear={() => handleSelectFilterConditions()(undefined, "")} - /> + + {/* SearchControlMenu would be invisible when Readonly Mode is True */} + {!isReadonly && ( + <> + { + setEntryMenuEls(e.currentTarget); + }} + > + {defaultEntryFilter ? : } + + setEntryMenuEls(null)} + entryFilterDispatcher={entryFilterDispatcher} + handleSelectFilterConditions={handleSelectFilterConditions()} + handleClear={() => + handleSelectFilterConditions()(undefined, "") + } + /> + + )} {attrNames.map((attrName) => ( @@ -213,7 +224,9 @@ export const SearchResultsTableHead: FC = ({ {attrName} + {/* Bulk operation checkbox would be invisible when Readonly mode is true */} {(attrTypes[attrName] & EntryAttributeTypeTypeEnum.OBJECT) > 0 && + !isReadonly && attrsFilter[attrName]?.joinedAttrname === undefined && ( setJoinAttrname(attrName)}> @@ -229,36 +242,40 @@ export const SearchResultsTableHead: FC = ({ refreshSearchResults={refreshSearchResults} /> )} - { - setAttributeMenuEls({ - ...attributeMenuEls, - [attrName]: e.currentTarget, - }); - }} - sx={{ marginLeft: "auto" }} - > - {isFiltered[attrName] ?? false ? ( - - ) : ( - - )} - - - setAttributeMenuEls({ - ...attributeMenuEls, - [attrName]: null, - }) - } - handleSelectFilterConditions={handleSelectFilterConditions( - attrName - )} - handleUpdateAttrFilter={handleUpdateAttrFilter(attrName)} - attrType={attrTypes[attrName]} - /> + {!isReadonly && ( + <> + { + setAttributeMenuEls({ + ...attributeMenuEls, + [attrName]: e.currentTarget, + }); + }} + sx={{ marginLeft: "auto" }} + > + {isFiltered[attrName] ?? false ? ( + + ) : ( + + )} + + + setAttributeMenuEls({ + ...attributeMenuEls, + [attrName]: null, + }) + } + handleSelectFilterConditions={handleSelectFilterConditions( + attrName + )} + handleUpdateAttrFilter={handleUpdateAttrFilter(attrName)} + attrType={attrTypes[attrName]} + /> + + )} ))}