Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1465 | concept clone | indicating if source…
Browse files Browse the repository at this point in the history
… and destination are same
  • Loading branch information
snyaggarwal committed Feb 14, 2023
1 parent 8cb4f4b commit daaca58
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/components/common/CloneToSource.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class CloneToSource extends React.Component {
onPreviewClick={this.onPreviewClick}
payload={payload}
requestURL={requestURL}
toSource={selectedSource}
/>
}
</Dialog>
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/CloneToSourceDialogContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import CascadeParametersForm from './CascadeParametersForm';
import ConceptTable from '../concepts/ConceptTable';
import APIPreview from './APIPreview'

const CloneToSourceDialogContent = ({onClose, onAdd, advancedSettings, toggleSettings, defaultParams, onParamsChange, sourceName, concepts, isAdding, result, onPreviewClick, payload, requestURL }) => {
const CloneToSourceDialogContent = ({onClose, onAdd, advancedSettings, toggleSettings, defaultParams, onParamsChange, sourceName, concepts, isAdding, result, onPreviewClick, payload, requestURL, toSource }) => {
return (
<React.Fragment>
<DialogContent>
Expand Down Expand Up @@ -56,7 +56,7 @@ const CloneToSourceDialogContent = ({onClose, onAdd, advancedSettings, toggleSet
</DialogContentText>
</div>
<div className='col-xs-12 no-side-padding' style={{marginTop: '10px'}}>
<ConceptTable concepts={concepts} showProgress={isAdding} showStatus={isAdding || result} visualFilters={defaultParams} onPreviewClick={onPreviewClick} />
<ConceptTable toSource={toSource} concepts={concepts} showProgress={isAdding} showStatus={isAdding || result} visualFilters={defaultParams} onPreviewClick={onPreviewClick} />
</div>

<div className='col-xs-12 no-side-padding' style={{marginTop: '10px'}}>
Expand Down
16 changes: 13 additions & 3 deletions src/components/concepts/ConceptTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import React from 'react';
import { Table, TableHead, TableBody, TableRow, TableCell, IconButton, Tooltip, Badge, CircularProgress, Chip } from '@mui/material';
import {
QueryStats as HierarchyIcon,
FormatListNumbered as ListIcon
FormatListNumbered as ListIcon,
Error as ErrorIcon
} from '@mui/icons-material'
import { map, get, find, isEmpty, includes } from 'lodash';
import { toParentURI } from '../../common/utils';
import ConceptDisplayName from './ConceptDisplayName';
import ConceptCascadeVisualizeDialog from './ConceptCascadeVisualizeDialog';
import BetaLabel from '../common/BetaLabel';
Expand Down Expand Up @@ -55,7 +57,7 @@ const ConceptStatus = ({ status, added, onVisualize, onPreview }) => {
)
}

const ConceptTable = ({ concepts, showProgress, showStatus, visualFilters, onPreviewClick }) => {
const ConceptTable = ({ concepts, showProgress, showStatus, visualFilters, onPreviewClick, toSource }) => {
const [visualize, setVisualize] = React.useState(false);
const [isClonedConcept, setIsClonedConcept] = React.useState(false)
let headers = ["Owner", "ID", "Display Name", "Class", "DataType", "Preview"]
Expand Down Expand Up @@ -95,7 +97,15 @@ const ConceptTable = ({ concepts, showProgress, showStatus, visualFilters, onPre
map(concepts, concept => (
<TableRow key={concept.id}>
<TableCell>
{concept.owner}/{concept.source}
<span style={{display: 'flex', alignItems: 'center'}}>
{
toSource?.url === toParentURI(concept.url) &&
<Tooltip title='Same source as destination. Nothing will be cloned'>
<ErrorIcon color='error' style={{marginRight: '5px'}}/>
</Tooltip>
}
{concept.owner}/{concept.source}
</span>
</TableCell>
<TableCell>
{concept.id}
Expand Down

0 comments on commit daaca58

Please sign in to comment.