-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use patternfly icons and time components
Signed-off-by: yaacov <[email protected]>
- Loading branch information
Showing
33 changed files
with
175 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
4 changes: 4 additions & 0 deletions
4
packages/forklift-console-plugin/src/components/ConsoleTimestamp/ConsoleTimestamp.style.css
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,4 @@ | ||
.forklift-table__console-timestamp { | ||
text-decoration-line: none !important; | ||
color: var(--pf-v5-c-content--Color); | ||
} |
55 changes: 55 additions & 0 deletions
55
packages/forklift-console-plugin/src/components/ConsoleTimestamp/ConsoleTimestamp.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,55 @@ | ||
import * as React from 'react'; | ||
|
||
import { Timestamp, TimestampTooltipVariant } from '@patternfly/react-core'; | ||
import { GlobeAmericasIcon } from '@patternfly/react-icons'; | ||
|
||
/** | ||
* Patternfly timestamp use: | ||
* gray color | ||
* dashed underline | ||
* Console show timestamp using: | ||
* black color | ||
* no underline decoration | ||
*/ | ||
import './ConsoleTimestamp.style.css'; | ||
|
||
export type TimestampProps = { | ||
timestamp: string | number | Date; | ||
className?: string; | ||
}; | ||
|
||
/** | ||
* Patternfly timestamp use: | ||
* standard format | ||
* no icon | ||
* Console show timestamp using: | ||
* glob icon | ||
* custom format | ||
*/ | ||
export const ConsoleTimestamp = (props: TimestampProps) => { | ||
// Check for null. If props.timestamp is null, it returns incorrect date and time of Wed Dec 31 1969 19:00:00 GMT-0500 (Eastern Standard Time) | ||
if (!props.timestamp) { | ||
return <div className="co-timestamp">-</div>; | ||
} | ||
|
||
const currentDate = new Date(props.timestamp); | ||
|
||
return ( | ||
<div className={props.className}> | ||
<GlobeAmericasIcon className="co-icon-and-text__icon" /> | ||
<Timestamp | ||
className="forklift-table__console-timestamp" | ||
date={currentDate} | ||
customFormat={{ | ||
year: '2-digit', | ||
month: 'short', | ||
weekday: 'short', | ||
day: 'numeric', | ||
hour: 'numeric', | ||
minute: 'numeric', | ||
}} | ||
tooltip={{ variant: TimestampTooltipVariant.default }} | ||
/> | ||
</div> | ||
); | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/forklift-console-plugin/src/components/ConsoleTimestamp/index.ts
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,3 @@ | ||
// @index(['./*', /style/g], f => `export * from '${f.path}';`) | ||
export * from './ConsoleTimestamp'; | ||
// @endindex |
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
18 changes: 9 additions & 9 deletions
18
packages/forklift-console-plugin/src/components/cells/utils.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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
GreenCheckCircleIcon, | ||
RedExclamationCircleIcon, | ||
YellowExclamationTriangleIcon, | ||
} from '@openshift-console/dynamic-plugin-sdk'; | ||
CheckCircleIcon, | ||
ExclamationCircleIcon, | ||
ExclamationTriangleIcon, | ||
} from '@patternfly/react-icons'; | ||
|
||
export const categoryIcons = { | ||
Critical: { True: <RedExclamationCircleIcon />, False: undefined }, | ||
Error: { True: <RedExclamationCircleIcon />, False: undefined }, | ||
Required: { True: <GreenCheckCircleIcon />, False: undefined }, | ||
Warn: { True: <YellowExclamationTriangleIcon />, False: undefined }, | ||
Advisory: { True: <GreenCheckCircleIcon />, False: undefined }, | ||
Critical: { True: <ExclamationCircleIcon color="#C9190B" />, False: undefined }, | ||
Error: { True: <ExclamationCircleIcon color="#C9190B" />, False: undefined }, | ||
Required: { True: <CheckCircleIcon color="#3E8635" />, False: undefined }, | ||
Warn: { True: <ExclamationTriangleIcon color="#F0AB00" />, False: undefined }, | ||
Advisory: { True: <CheckCircleIcon color="#3E8635" />, False: undefined }, | ||
}; |
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
16 changes: 8 additions & 8 deletions
16
...forklift-console-plugin/src/modules/Overview/views/overview/components/OperatorStatus.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
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
Oops, something went wrong.