Skip to content

Commit 05cb4ec

Browse files
committed
1 parent 76c4d51 commit 05cb4ec

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/components/map-projects/AICandidatesAnalysis.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ import DataObjectIcon from '@mui/icons-material/DataObject';
1717

1818
import get from 'lodash/get'
1919

20-
import { isAdminUser } from '../../common/utils'
2120

22-
23-
const AICandidatesAnalysis = ({ analysis, onClose, sx }) => {
21+
const AICandidatesAnalysis = ({ analysis, onClose, sx, isCoreUser }) => {
2422
const { t } = useTranslation();
2523
const [openDetails, setOpenDetails] = React.useState(false)
2624

@@ -65,7 +63,7 @@ const AICandidatesAnalysis = ({ analysis, onClose, sx }) => {
6563
<Typography gutterBottom sx={{ color: 'text.secondary', fontSize: 13, mb: 0, textAlign: 'right' }}>
6664
{getModelName()}
6765
{
68-
isAdminUser() &&
66+
isCoreUser &&
6967
<Tooltip title={t('map_project.view_raw_json')} placement='right'>
7068
<span>
7169
<IconButton color='primary' size='small' disabled={!analysis} sx={{padding: '4px', marginLeft: '4px', marginTop: '-2px'}} onClick={() => setOpenDetails(!openDetails)}>

src/components/map-projects/Candidates.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ const SubHeader = ({count, onClick, isCollapsed, header, indicatorColor, isFirst
184184
}
185185

186186

187-
const CandidateList = ({candidates, header, rowIndex, orderBy, order, setShowItem, showItem, setShowHighlights, isSelectedForMap, onMap, onFetchMore, bgColor, bucketId, display, onDisplayChange, noToolbar, toolbarControl, repoVersion, alignToolbarLeft, rightControl, analysis, showAnalysis, openAnalysis, onCloseAnalysis, AIRecommendedCandidateId, locales, scispacy, showAlgo, collapsed, onCollapse, candidatesScore, algoScoreFirst, conceptCache, byAlgorithm, isFirst}) => {
187+
const CandidateList = ({candidates, header, rowIndex, orderBy, order, setShowItem, showItem, setShowHighlights, isSelectedForMap, onMap, onFetchMore, bgColor, bucketId, display, onDisplayChange, noToolbar, toolbarControl, repoVersion, alignToolbarLeft, rightControl, analysis, showAnalysis, openAnalysis, onCloseAnalysis, AIRecommendedCandidateId, locales, scispacy, showAlgo, collapsed, onCollapse, candidatesScore, algoScoreFirst, conceptCache, byAlgorithm, isFirst, isCoreUser}) => {
188188
const results = {total: onFetchMore ? candidates?.length : 1, results: candidates || []}
189189
const isCollapsed = collapsed.includes(bucketId)
190190
const onCollapseToggle = () => {
@@ -248,7 +248,7 @@ const CandidateList = ({candidates, header, rowIndex, orderBy, order, setShowIte
248248
subheader={
249249
(showAnalysis && openAnalysis) ? (
250250
<div className='col-xs-12 padding-0' style={{display: 'inline-flex', flexDirection: 'column'}}>
251-
<AICandidatesAnalysis analysis={analysis} onClose={onCloseAnalysis} sx={{marginBottom: '4px'}}/>
251+
<AICandidatesAnalysis analysis={analysis} onClose={onCloseAnalysis} sx={{marginBottom: '4px'}} isCoreUser={isCoreUser} />
252252
{
253253
showHeader &&
254254
<SubHeader count={count} onClick={onCollapseToggle} isCollapsed={isCollapsed} header={header} indicatorColor={bgColor} isFirst={isFirst} />
@@ -293,7 +293,7 @@ const CandidateList = ({candidates, header, rowIndex, orderBy, order, setShowIte
293293
)
294294
}
295295

296-
const Candidates = ({rowIndex, alert, setAlert, candidates, setShowItem, showItem, setShowHighlights, isSelectedForMap, onMap, onFetchMore, isLoading, candidatesScore, repoVersion, analysis, onFetchRecommendation, appliedFacets, setAppliedFacets, filters, facets, columns, defaultFilters, locales, models, selectedModel, onModelChange, onRefreshClick, rowStage, inAIAssistantGroup, algosSelected, conceptCache}) => {
296+
const Candidates = ({rowIndex, alert, setAlert, candidates, setShowItem, showItem, setShowHighlights, isSelectedForMap, onMap, onFetchMore, isLoading, candidatesScore, repoVersion, analysis, onFetchRecommendation, appliedFacets, setAppliedFacets, filters, facets, columns, defaultFilters, locales, models, selectedModel, onModelChange, onRefreshClick, rowStage, inAIAssistantGroup, algosSelected, conceptCache, isCoreUser}) => {
297297
const { t } = useTranslation();
298298
const [sortBy, setSortBy] = React.useState('search_meta.search_normalized_score')
299299
const [groupBy, setGroupBy] = React.useState('quality')
@@ -331,7 +331,8 @@ const Candidates = ({rowIndex, alert, setAlert, candidates, setShowItem, showIte
331331
locales: locales,
332332
candidatesScore: candidatesScore,
333333
algoScoreFirst: algoScoreFirst,
334-
conceptCache: conceptCache
334+
conceptCache: conceptCache,
335+
isCoreUser: isCoreUser
335336
}
336337

337338
const onSort = option => {

src/components/map-projects/Controls.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const IkonButton = ({title, icon, onClick, color, disabled, id}) => {
3838
)
3939
}
4040

41-
const Controls = ({project, onDownload, onSave, onDelete, owner, file, isSaving, onImport, importResponse, onDownloadImportReport, onProjectLogsClick, isProjectsLogOpen, configure, setConfigure, isStaff, loadingMatches}) => {
41+
const Controls = ({project, onDownload, onSave, onDelete, owner, file, isSaving, onImport, importResponse, onDownloadImportReport, onProjectLogsClick, isProjectsLogOpen, configure, setConfigure, isCoreUser, loadingMatches}) => {
4242
const { t } = useTranslation();
4343
const [anchorEl, setAnchorEl] = React.useState(null);
4444
const downloadOpen = Boolean(anchorEl);
@@ -136,7 +136,7 @@ const Controls = ({project, onDownload, onSave, onDelete, owner, file, isSaving,
136136
</ListItemIcon>
137137
<ListItemText>{t('common.download_csv')}</ListItemText>
138138
</MenuItem>
139-
<MenuItem onClick={() => {setAnchorEl(null); onDownload('candidates_metadata');}} disabled={!isStaff}>
139+
<MenuItem onClick={() => {setAnchorEl(null); onDownload('candidates_metadata');}} disabled={!isCoreUser}>
140140
<ListItemIcon>
141141
<JSONIcon sx={{fontSize: '1.25rem'}} />
142142
</ListItemIcon>

src/components/map-projects/MapProject.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ const MapProject = () => {
231231
const SCISPACY_API_URL = window.SCISPACY_LOINC_API_URL || process.env.SCISPACY_LOINC_API_URL
232232
const OCL_ONLINE_API_URL = window.OCL_ONLINE_API_URL || process.env.OCL_ONLINE_API_URL
233233
const inAIAssistantGroup = Boolean(hasAuthGroup(user, 'mapper_ai_assistant') && AI_ASSISTANT_API_URL)
234-
const isStaff = user?.is_staff
234+
const isCoreUser = hasAuthGroup(user, 'core_user')
235235
const CANDIDATES_LIMIT = 15
236236
const canBridge = bridgeRef?.current?.canBridge()
237237
const canScispacy = Boolean(canBridge && SCISPACY_API_URL && toggles.SCISPACY_LOINC_TOGGLE === true)
@@ -2717,7 +2717,7 @@ const MapProject = () => {
27172717
</span>
27182718
}
27192719
<Controls
2720-
isStaff={isStaff}
2720+
isCoreUser={isCoreUser}
27212721
project={project}
27222722
onDownload={onDownloadClick}
27232723
onSave={onSave}
@@ -3095,6 +3095,7 @@ const MapProject = () => {
30953095
inAIAssistantGroup={inAIAssistantGroup}
30963096
algosSelected={algosSelected}
30973097
conceptCache={conceptCache}
3098+
isCoreUser={isCoreUser}
30983099
/>
30993100
}
31003101
{

0 commit comments

Comments
 (0)