Skip to content

Commit

Permalink
fix(frontend): remove uuid prefix in filename and show inner_id in sa…
Browse files Browse the repository at this point in the history
…mple grid
  • Loading branch information
gary-Shen committed Apr 17, 2024
1 parent ccbb313 commit d32dc76
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions apps/frontend/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export interface PatchSampleCommand {
export interface SampleResponse {
/** Id description: annotation id */
id?: number;
inner_id: number;
/** State description: sample file state, NEW is has not start yet, DONE is completed, SKIPPED is skipped */
state?: SampleState;
/** Data description: sample data, include filename, file url, or result */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface SliderCardProps {
}

const SliderCard = ({ type, cardInfo, index, onClick }: SliderCardProps) => {
const { id, state, file } = cardInfo;
const { id, inner_id, state, file } = cardInfo;
const filename = file.filename;
const url = file.url;
const routeParams = useParams();
Expand Down Expand Up @@ -57,7 +57,7 @@ const SliderCard = ({ type, cardInfo, index, onClick }: SliderCardProps) => {
return (
<VideoCard
src={url!}
title={id}
title={inner_id}
active={id === sampleId}
onClick={() => handleOnClick(cardInfo)}
showPlayIcon
Expand All @@ -81,7 +81,7 @@ const SliderCard = ({ type, cardInfo, index, onClick }: SliderCardProps) => {
{state === 'DONE' && <CheckIcon />}
{state === 'SKIPPED' && <SkipWrapper>跳过</SkipWrapper>}
</ContentWrapper>
<IdWrapper>{id}</IdWrapper>
<IdWrapper>{inner_id}</IdWrapper>
</Wrapper>
);
};
Expand Down
14 changes: 9 additions & 5 deletions apps/frontend/src/pages/tasks.[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const Samples = () => {
const columns: ColumnsType<SampleResponse> = [
{
title: '数据ID',
dataIndex: 'id',
key: 'id',
dataIndex: 'inner_id',
key: 'inner_id',
align: 'left',
},
{
Expand All @@ -80,16 +80,18 @@ const Samples = () => {
key: 'filename',
align: 'left',
render: (filename, record) => {
if (record.file?.filename?.endsWith('.jsonl')) {
const _filename = (record.file?.filename ?? '').substring(9);

if (_filename.endsWith('.jsonl')) {
return (
<span>
{formatter.format('ellipsis', filename, { maxWidth: 160, type: 'tooltip' })}
{formatter.format('ellipsis', _filename, { maxWidth: 160, type: 'tooltip' })}
&nbsp;
<Tag color="processing">预标注</Tag>
</span>
);
}
return formatter.format('ellipsis', filename, { maxWidth: 160, type: 'tooltip' });
return formatter.format('ellipsis', _filename, { maxWidth: 160, type: 'tooltip' });
},
},
{
Expand Down Expand Up @@ -350,6 +352,8 @@ const Samples = () => {
return [...(preAnnotations ?? []), ...(samples ?? [])];
}, [preAnnotations, samples]);

console.log(data);

return (
<FlexLayout flex="column" full gap="2rem">
<HeaderWrapper flex items="center">
Expand Down

0 comments on commit d32dc76

Please sign in to comment.