-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(md): redesign of artifacts - metadata + rollback and compare to …
…UX (#9738) * feat(md): redesign of rollback interactions + redesign of versions metadata * fix(pr): use reject instead of never deploy * fix(pr): removed the red color from the rollback button
- Loading branch information
Showing
23 changed files
with
709 additions
and
479 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
77 changes: 77 additions & 0 deletions
77
packages/core/src/managed/artifactActions/ArtifactActions.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,77 @@ | ||
import classnames from 'classnames'; | ||
import React from 'react'; | ||
import { Dropdown, MenuItem } from 'react-bootstrap'; | ||
|
||
import { ACTION_BUTTON_CLASS_NAME } from '../utils/defaults'; | ||
import { useLogEvent } from '../utils/logging'; | ||
import type { ICompareLinks } from '../versionMetadata/MetadataComponents'; | ||
|
||
export interface VersionAction { | ||
onClick?: () => void; | ||
href?: string; | ||
content: string; | ||
disabled?: boolean; | ||
} | ||
|
||
interface IArtifactActionsProps { | ||
actions?: VersionAction[]; | ||
version: string; | ||
buildNumber?: string; | ||
compareLinks?: ICompareLinks; | ||
className?: string; | ||
} | ||
|
||
export const ArtifactActions = ({ version, buildNumber, actions, compareLinks, className }: IArtifactActionsProps) => { | ||
const compareActions: VersionAction[] = [ | ||
{ content: 'Current version', href: compareLinks?.current, disabled: !compareLinks?.current }, | ||
{ content: 'Previous version', href: compareLinks?.previous, disabled: !compareLinks?.previous }, | ||
]; | ||
return ( | ||
<div className={classnames('horizontal md-actions-gap', className)}> | ||
{actions?.map((action) => ( | ||
<button | ||
key={action.content} | ||
className={ACTION_BUTTON_CLASS_NAME} | ||
disabled={action.disabled} | ||
onClick={action.onClick} | ||
> | ||
{action.content} | ||
</button> | ||
))} | ||
<CompareToMenu id={`${version}-${buildNumber}-compare`} title="Compare to" actions={compareActions} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export interface ICompareToMenuProps { | ||
id: string; | ||
actions: VersionAction[]; | ||
title: string; | ||
className?: string; | ||
pullRight?: boolean; | ||
} | ||
|
||
const CompareToMenu = ({ id, title, actions, className, pullRight }: ICompareToMenuProps) => { | ||
const logEvent = useLogEvent('ArtifactActions'); | ||
return ( | ||
<Dropdown id={id} className={classnames('ArtifactActionsMenu', className)} pullRight={pullRight}> | ||
<Dropdown.Toggle className="md-btn md-action-button">{title}</Dropdown.Toggle> | ||
<Dropdown.Menu> | ||
{actions.map((action, index) => ( | ||
<MenuItem | ||
key={index} | ||
disabled={action.disabled} | ||
onClick={() => { | ||
action.onClick?.(); | ||
logEvent({ action: `Compare to - ${action.content}` }); | ||
}} | ||
href={action.href} | ||
target="_blank" | ||
> | ||
{action.content} | ||
</MenuItem> | ||
))} | ||
</Dropdown.Menu> | ||
</Dropdown> | ||
); | ||
}; |
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
19 changes: 19 additions & 0 deletions
19
packages/core/src/managed/overview/artifact/ArtifactActionModal.less
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,19 @@ | ||
.ArtifactActionModal { | ||
.details { | ||
display: grid; | ||
grid-template-columns: auto 1fr; | ||
column-gap: 10px; | ||
align-items: baseline; | ||
|
||
dd { | ||
min-width: 0; | ||
} | ||
|
||
dt { | ||
font-weight: 600; | ||
text-transform: uppercase; | ||
font-size: 13px; | ||
color: var(--color-concrete); | ||
} | ||
} | ||
} |
Oops, something went wrong.