-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement toolbar for selecting tests and quick actions
- Loading branch information
Showing
28 changed files
with
617 additions
and
135 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,12 @@ | ||
import React, {ReactNode} from 'react'; | ||
import {ImageEntity, ImageEntityError} from '@/static/new-ui/types/store'; | ||
import {TestStatus} from '@/constants'; | ||
import {Icon} from '@gravity-ui/uikit'; | ||
import { | ||
ArrowRightArrowLeft, | ||
CircleCheck, | ||
FileCheck, | ||
FileExclamation, | ||
FileLetterX, | ||
FilePlus, | ||
SquareExclamation, | ||
SquareXmark, | ||
FileArrowUp | ||
} from '@gravity-ui/icons'; | ||
import {isInvalidRefImageError, isNoRefImageError} from '@/common-utils'; | ||
import {ImageEntity} from '@/static/new-ui/types/store'; | ||
import styles from './index.module.css'; | ||
import {getAssertViewStatusIcon, getAssertViewStatusMessage} from '@/static/new-ui/utils/assert-view-status'; | ||
|
||
interface AssertViewStatusProps { | ||
image: ImageEntity | null; | ||
} | ||
|
||
export function AssertViewStatus({image}: AssertViewStatusProps): ReactNode { | ||
let status = <><Icon data={SquareXmark} width={16}/><span>Failed to compare</span></>; | ||
|
||
if (image === null) { | ||
status = <><Icon data={SquareExclamation} width={16}/><span>Image is absent</span></>; | ||
} else if (image.status === TestStatus.SUCCESS) { | ||
status = <><Icon data={CircleCheck} width={16}/><span>Images match</span></>; | ||
} else if (image.status === TestStatus.STAGED) { | ||
status = <><Icon data={FilePlus} width={16}/><span>Image is staged</span></>; | ||
} else if (image.status === TestStatus.COMMITED) { | ||
status = <><Icon data={FileArrowUp} width={16}/><span>Image was committed</span></>; | ||
} else if (isNoRefImageError((image as ImageEntityError).error)) { | ||
status = <><Icon data={FileLetterX} width={16}/><span>Reference not found</span></>; | ||
} else if (isInvalidRefImageError((image as ImageEntityError).error)) { | ||
status = <><Icon data={FileExclamation} width={16}/><span>Reference is broken</span></>; | ||
} else if (image.status === TestStatus.FAIL) { | ||
status = <><Icon data={ArrowRightArrowLeft} width={16}/><span>Difference detected</span></>; | ||
} else if (image.status === TestStatus.UPDATED) { | ||
status = <><Icon data={FileCheck} width={16}/><span>Reference updated</span></>; | ||
} | ||
|
||
return <div className={styles.container}>{status}</div>; | ||
return <div className={styles.container}>{getAssertViewStatusIcon(image)}<span>{getAssertViewStatusMessage(image)}</span></div>; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {Button, ButtonView, Tooltip} from '@gravity-ui/uikit'; | ||
import React, {ReactNode} from 'react'; | ||
|
||
interface IconButtonProps { | ||
icon: ReactNode; | ||
tooltip: string; | ||
onClick?: () => void; | ||
view?: ButtonView; | ||
disabled?: boolean; | ||
} | ||
|
||
export function IconButton(props: IconButtonProps): ReactNode { | ||
return <Tooltip content={props.tooltip} placement={'top'} openDelay={0}> | ||
<Button view={props.view} onClick={props.onClick} disabled={props.disabled}>{props.icon}</Button> | ||
</Tooltip>; | ||
} |
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
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
Oops, something went wrong.