-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1743 from manaswinidas/delete-pipeline-server
Delete pipeline server from the Pipelines Section in Projects page
- Loading branch information
Showing
4 changed files
with
92 additions
and
50 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
frontend/src/concepts/pipelines/content/pipelinesDetails/pipeline/PipelineServerActions.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,84 @@ | ||
import * as React from 'react'; | ||
import { | ||
Dropdown, | ||
DropdownItem, | ||
DropdownSeparator, | ||
DropdownToggle, | ||
KebabToggle, | ||
Tooltip, | ||
} from '@patternfly/react-core'; | ||
import { DeleteServerModal, ViewServerModal } from '~/concepts/pipelines/context'; | ||
|
||
type PipelineServerActionsProps = { | ||
variant?: 'kebab' | 'dropdown'; | ||
isDisabled: boolean; | ||
}; | ||
|
||
const PipelineServerActions: React.FC<PipelineServerActionsProps> = ({ variant, isDisabled }) => { | ||
const [open, setOpen] = React.useState(false); | ||
const [deleteOpen, setDeleteOpen] = React.useState(false); | ||
const [viewOpen, setViewOpen] = React.useState(false); | ||
|
||
const DropdownComponent = ( | ||
<Dropdown | ||
removeFindDomNode | ||
onSelect={() => setOpen(false)} | ||
toggle={ | ||
variant === 'kebab' ? ( | ||
<KebabToggle isDisabled={isDisabled} onToggle={() => setOpen(!open)} /> | ||
) : ( | ||
<DropdownToggle | ||
toggleVariant="secondary" | ||
isDisabled={isDisabled} | ||
onToggle={() => setOpen(!open)} | ||
> | ||
Pipeline server actions | ||
</DropdownToggle> | ||
) | ||
} | ||
isOpen={open} | ||
position="right" | ||
isPlain={variant === 'kebab'} | ||
dropdownItems={[ | ||
<DropdownItem key="view-server-details" onClick={() => setViewOpen(true)}> | ||
View pipeline server configuration | ||
</DropdownItem>, | ||
<DropdownSeparator key="separator" />, | ||
<DropdownItem | ||
onClick={() => { | ||
setDeleteOpen(true); | ||
}} | ||
key="delete-server" | ||
> | ||
Delete pipeline server | ||
</DropdownItem>, | ||
]} | ||
/> | ||
); | ||
|
||
if (isDisabled) { | ||
return ( | ||
<Tooltip | ||
content="To access pipeline server actions, first create a pipeline server." | ||
position="right" | ||
> | ||
{DropdownComponent} | ||
</Tooltip> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
{DropdownComponent} | ||
<DeleteServerModal | ||
isOpen={deleteOpen} | ||
onClose={() => { | ||
setDeleteOpen(false); | ||
}} | ||
/> | ||
<ViewServerModal isOpen={viewOpen} onClose={() => setViewOpen(false)} /> | ||
</> | ||
); | ||
}; | ||
|
||
export default PipelineServerActions; |
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
48 changes: 0 additions & 48 deletions
48
frontend/src/pages/pipelines/global/pipelines/PipelinesPageHeaderActions.tsx
This file was deleted.
Oops, something went wrong.
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