-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support primary and sort keys flags (#762)
- Loading branch information
1 parent
5497c74
commit ad56e85
Showing
14 changed files
with
185 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...m-api/src/main/resources/db/migration/V0_0_46__primary_and_sort_key_for_dataset_field.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ALTER TABLE dataset_field | ||
ADD COLUMN is_primary_key BOOLEAN NOT NULL DEFAULT FALSE, | ||
ADD COLUMN is_sort_key BOOLEAN NOT NULL DEFAULT FALSE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...yDetails/DatasetStructure/DatasetStructureKeyFieldLabel/DatasetStructureKeyFieldLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import type { DatasetFieldKeyType } from './DatasetStructureKeyFieldLabelStyles'; | ||
import * as S from './DatasetStructureKeyFieldLabelStyles'; | ||
|
||
interface DatasetStructureKeyFieldLabelProps { | ||
keyType: DatasetFieldKeyType; | ||
} | ||
|
||
const DatasetStructureKeyFieldLabel: React.FC< | ||
DatasetStructureKeyFieldLabelProps | ||
> = ({ keyType }) => ( | ||
<S.Container title={keyType}> | ||
<S.FilledContainer $keyType={keyType}>{keyType} key</S.FilledContainer> | ||
</S.Container> | ||
); | ||
|
||
export default DatasetStructureKeyFieldLabel; |
26 changes: 26 additions & 0 deletions
26
...ils/DatasetStructure/DatasetStructureKeyFieldLabel/DatasetStructureKeyFieldLabelStyles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import styled from 'styled-components'; | ||
|
||
export type DatasetFieldKeyType = 'primary' | 'sort'; | ||
|
||
interface FilledContainerProps { | ||
$keyType: DatasetFieldKeyType; | ||
} | ||
|
||
export const Container = styled('div')(({ theme }) => ({ | ||
display: 'inline-flex', | ||
alignItems: 'center', | ||
marginTop: theme.spacing(0.3), | ||
whiteSpace: 'nowrap', | ||
})); | ||
export const FilledContainer = styled('span')<FilledContainerProps>( | ||
({ theme, $keyType }) => ({ | ||
fontSize: theme.typography.body2.fontSize, | ||
lineHeight: theme.typography.body2.lineHeight, | ||
borderRadius: '12px', | ||
border: '1px solid', | ||
padding: theme.spacing(0, 1), | ||
backgroundColor: theme.palette.datasetFieldKey[$keyType].background, | ||
borderColor: theme.palette.datasetFieldKey[$keyType].border, | ||
marginLeft: '10px', | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
odd-platform-ui/src/components/shared/TruncatedLabel/TruncatedLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import TruncateMarkup from 'react-truncate-markup'; | ||
import { Label } from 'generated-sources'; | ||
import LabelItem from 'components/shared/LabelItem/LabelItem'; | ||
import TruncatedLabelMenu from './TruncatedLabelMenu/TruncatedLabelMenu'; | ||
|
||
interface TruncatedLabelProps { | ||
labelList?: Label[]; | ||
onSizeChange: () => void; | ||
} | ||
|
||
const TruncatedLabel: React.FC<TruncatedLabelProps> = ({ | ||
labelList, | ||
onSizeChange, | ||
}) => ( | ||
<div> | ||
<TruncateMarkup | ||
lines={1} | ||
onTruncate={() => onSizeChange()} | ||
ellipsis={<TruncatedLabelMenu labelList={labelList} />} | ||
> | ||
<div> | ||
{labelList?.map(label => ( | ||
<TruncateMarkup.Atom key={label.id}> | ||
<LabelItem labelName={label.name} /> | ||
</TruncateMarkup.Atom> | ||
))} | ||
</div> | ||
</TruncateMarkup> | ||
</div> | ||
); | ||
export default TruncatedLabel; |
35 changes: 35 additions & 0 deletions
35
...latform-ui/src/components/shared/TruncatedLabel/TruncatedLabelMenu/TruncatedLabelMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import LabelItem from 'components/shared/LabelItem/LabelItem'; | ||
import { Label } from 'generated-sources'; | ||
import AppIconButton from 'components/shared/AppIconButton/AppIconButton'; | ||
import MoreIcon from 'components/shared/Icons/MoreIcon'; | ||
import AppPopover from 'components/shared/AppPopover/AppPopover'; | ||
|
||
interface TruncatedLabelMenuProps { | ||
labelList?: Label[]; | ||
} | ||
|
||
const TruncatedLabelMenu: React.FC<TruncatedLabelMenuProps> = ({ | ||
labelList, | ||
}) => ( | ||
<AppPopover | ||
childrenSx={{ width: '280px' }} | ||
renderOpenBtn={({ onClick, ariaDescribedBy }) => ( | ||
<AppIconButton | ||
sx={{ ml: 0.5 }} | ||
ariaDescribedBy={ariaDescribedBy} | ||
color="expand" | ||
icon={<MoreIcon />} | ||
onClick={onClick} | ||
/> | ||
)} | ||
anchorOrigin={{ vertical: 'bottom', horizontal: 24 }} | ||
transformOrigin={{ vertical: -4, horizontal: 'right' }} | ||
> | ||
{labelList?.map(label => ( | ||
<LabelItem key={label.id} labelName={label.name} /> | ||
))} | ||
</AppPopover> | ||
); | ||
|
||
export default TruncatedLabelMenu; |
14 changes: 14 additions & 0 deletions
14
odd-platform-ui/src/components/shared/TruncatedLabel/TruncatedLabelStyles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { TypographyProps } from '@mui/material'; | ||
import styled from 'styled-components'; | ||
|
||
export const TruncatedList = styled('span')(({ theme }) => ({ | ||
marginBottom: theme.spacing(0.5), | ||
marginLeft: theme.spacing(0.5), | ||
'& > *': { | ||
margin: theme.spacing(0, 0.25), | ||
}, | ||
})); | ||
|
||
export const LinkContent = styled('div')<TypographyProps>(() => ({ | ||
display: 'inline-flex', | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters