This repository has been archived by the owner on Nov 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96b1471
commit ecdee48
Showing
30 changed files
with
2,588 additions
and
2,628 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ jobs: | |
- name: Cypress run | ||
uses: cypress-io/[email protected] | ||
with: | ||
start: yarn dev, yarn start-console | ||
start: yarn serve-build, yarn start-console | ||
wait-on: "http://localhost:9001" | ||
browser: chrome | ||
headed: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Builder container | ||
FROM registry.access.redhat.com/ubi9/nodejs-18 AS build | ||
|
||
# Install yarn | ||
RUN npm install -g yarn -s &>/dev/null | ||
|
||
# Copy app source | ||
COPY . /opt/app-root/src/app | ||
WORKDIR /opt/app-root/src/app | ||
|
||
# Run install as supper tux | ||
USER 0 | ||
RUN yarn install --frozen-lockfile --network-timeout 600000 && yarn build | ||
|
||
# Web server container | ||
FROM registry.access.redhat.com/ubi9/nginx-120 | ||
|
||
# Use none-root user | ||
USER 1001 | ||
|
||
# Set nginx configuration | ||
# COPY nginx.conf /etc/nginx/nginx.conf | ||
|
||
# When using ubi9/nginx-120 defaults: | ||
# listen 8080 default_server; | ||
# root /opt/app-root/src; | ||
|
||
COPY --from=build /opt/app-root/src/app/dist /opt/app-root/src | ||
|
||
# Run the server | ||
CMD nginx -g "daemon off;" |
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
37 changes: 37 additions & 0 deletions
37
src/utils/components/ActionDropdownItem/ActionDropdownItem.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,37 @@ | ||
import React, { Dispatch, FC, SetStateAction } from 'react'; | ||
|
||
import { Action, useAccessReview } from '@openshift-console/dynamic-plugin-sdk'; | ||
import { DropdownItem } from '@patternfly/react-core'; | ||
|
||
import './action-dropdown-item.scss'; | ||
|
||
type ActionDropdownItemProps = { | ||
action: Action; | ||
setIsOpen: Dispatch<SetStateAction<boolean>>; | ||
}; | ||
|
||
const ActionDropdownItem: FC<ActionDropdownItemProps> = ({ action, setIsOpen }) => { | ||
const [actionAllowed] = useAccessReview(action?.accessReview); | ||
|
||
const handleClick = () => { | ||
if (typeof action?.cta === 'function') { | ||
action?.cta(); | ||
setIsOpen(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<DropdownItem | ||
data-test-id={`${action?.id}`} | ||
description={action?.description} | ||
isDisabled={action?.disabled || !actionAllowed} | ||
key={action?.id} | ||
onClick={handleClick} | ||
> | ||
{action?.label} | ||
{action?.icon && <span className="text-muted">{action.icon}</span>} | ||
</DropdownItem> | ||
); | ||
}; | ||
|
||
export default ActionDropdownItem; |
6 changes: 6 additions & 0 deletions
6
src/utils/components/ActionDropdownItem/action-dropdown-item.scss
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,6 @@ | ||
.ActionDropdownItem { | ||
&__disabled { | ||
cursor: unset; | ||
color: var(--pf-global--disabled-color--100); | ||
} | ||
} |
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,63 @@ | ||
import React, { FC, memo, useState } from 'react'; | ||
|
||
import { Action } from '@openshift-console/dynamic-plugin-sdk'; | ||
import { Dropdown, DropdownList } from '@patternfly/react-core'; | ||
import DropdownToggle from '@utils/components/Toggles/DropdownToggle'; | ||
import KebabToggle from '@utils/components/Toggles/KebabToggle'; | ||
import { useNMStateTranslation } from '@utils/hooks/useNMStateTranslation'; | ||
|
||
import ActionDropdownItem from '../ActionDropdownItem/ActionDropdownItem'; | ||
|
||
type ActionsDropdownProps = { | ||
actions: Action[]; | ||
className?: string; | ||
id?: string; | ||
isKebabToggle?: boolean; | ||
onLazyClick?: () => void; | ||
}; | ||
|
||
const ActionsDropdown: FC<ActionsDropdownProps> = ({ | ||
actions = [], | ||
className, | ||
id, | ||
isKebabToggle, | ||
onLazyClick, | ||
}) => { | ||
const { t } = useNMStateTranslation(); | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const onToggle = () => { | ||
setIsOpen((prevIsOpen) => { | ||
if (onLazyClick && !prevIsOpen) onLazyClick(); | ||
|
||
return !prevIsOpen; | ||
}); | ||
}; | ||
|
||
const Toggle = isKebabToggle | ||
? KebabToggle({ isExpanded: isOpen, onClick: onToggle }) | ||
: DropdownToggle({ | ||
children: t('Actions'), | ||
isExpanded: isOpen, | ||
onClick: onToggle, | ||
}); | ||
|
||
return ( | ||
<Dropdown | ||
className={className} | ||
data-test-id={id} | ||
isOpen={isOpen} | ||
onOpenChange={(open: boolean) => setIsOpen(open)} | ||
popperProps={{ enableFlip: true, position: 'right' }} | ||
toggle={Toggle} | ||
> | ||
<DropdownList> | ||
{actions?.map((action) => ( | ||
<ActionDropdownItem action={action} key={action?.id} setIsOpen={setIsOpen} /> | ||
))} | ||
</DropdownList> | ||
</Dropdown> | ||
); | ||
}; | ||
|
||
export default memo(ActionsDropdown); |
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.