Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtron-labs/devtron-fe-common-lib",
"version": "1.22.0-alpha-11",
"version": "1.22.0-alpha-12",
"description": "Supporting common component library",
"type": "module",
"main": "dist/index.js",
Expand Down
6 changes: 6 additions & 0 deletions src/Assets/IconV2/ic-ses.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/Assets/IconV2/ic-slack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/Assets/IconV2/ic-smtp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/Assets/IconV2/ic-webhook-config.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Draggable, { DraggableProps } from 'react-draggable'
import { ReactComponent as SortIcon } from '@Icons/ic-arrow-up-down.svg'
import { ReactComponent as SortArrowDown } from '@Icons/ic-sort-arrow-down.svg'
import { Tooltip } from '@Common/Tooltip'
import { Icon } from '@Shared/Components/Icon'

import { SortingOrder } from '../Constants'
import { noop } from '../Helper'
Expand Down Expand Up @@ -68,6 +69,7 @@ const SortableTableHeaderCell = ({
id,
handleResize,
isResizable,
infoTooltipText,
}: SortableTableHeaderCellProps) => {
const isCellResizable = !!(isResizable && id && handleResize)

Expand Down Expand Up @@ -107,7 +109,18 @@ const SortableTableHeaderCell = ({
data-testid={title}
>
<Tooltip showOnTruncate={showTippyOnTruncate} content={title}>
<span className="dc__uppercase dc__truncate">{title}</span>
<div className="dc__gap-4 flex left">
<span className="dc__uppercase dc__truncate">{title}</span>

{infoTooltipText && (
<Icon
name="ic-help-outline"
color="N600"
size={12}
tooltipProps={{ content: infoTooltipText, alwaysShowTippyOnHover: true }}
/>
)}
</div>
</Tooltip>
{renderSortIcon()}
</button>
Expand Down
4 changes: 4 additions & 0 deletions src/Common/SortableTableHeaderCell/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export type SortableTableHeaderCellProps = {
* @default false
*/
showTippyOnTruncate?: boolean
/**
* If provided, shown in a tooltip on info-icon-outline beside the label
*/
infoTooltipText?: string
} & (
| {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import './ConflictedResourcesTable.scss'
const Wrapper = ({ children }: TableViewWrapperProps<unknown, FiltersTypeEnum.STATE>) => (
<div className="dc__overflow-hidden flexbox-col flex-grow-1">{children}</div>
)
const filter = () => true

const ConflictedResourcesTable = ({ resourceConflictDetails }: ConflictedResourcesTableProps) => {
const rows: RowsType<ResourceConflictItemType> = useMemo(
Expand Down Expand Up @@ -42,7 +41,7 @@ const ConflictedResourcesTable = ({ resourceConflictDetails }: ConflictedResourc
}}
filtersVariant={FiltersTypeEnum.STATE}
ViewWrapper={Wrapper}
filter={filter}
filter={null}
/>
)
}
Expand Down
8 changes: 8 additions & 0 deletions src/Shared/Components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,12 @@ import { ReactComponent as ICSecurityPolicy } from '@IconsV2/ic-security-policy.
import { ReactComponent as ICSecurityScan } from '@IconsV2/ic-security-scan.svg'
import { ReactComponent as ICSecurityVulnerability } from '@IconsV2/ic-security-vulnerability.svg'
import { ReactComponent as ICSelected } from '@IconsV2/ic-selected.svg'
import { ReactComponent as ICSes } from '@IconsV2/ic-ses.svg'
import { ReactComponent as ICShapes } from '@IconsV2/ic-shapes.svg'
import { ReactComponent as ICShieldCheck } from '@IconsV2/ic-shield-check.svg'
import { ReactComponent as ICSlack } from '@IconsV2/ic-slack.svg'
import { ReactComponent as ICSlidersVertical } from '@IconsV2/ic-sliders-vertical.svg'
import { ReactComponent as ICSmtp } from '@IconsV2/ic-smtp.svg'
import { ReactComponent as ICSoftwareReleaseManagement } from '@IconsV2/ic-software-release-management.svg'
import { ReactComponent as ICSortAscending } from '@IconsV2/ic-sort-ascending.svg'
import { ReactComponent as ICSortDescending } from '@IconsV2/ic-sort-descending.svg'
Expand Down Expand Up @@ -308,6 +311,7 @@ import { ReactComponent as ICWarning } from '@IconsV2/ic-warning.svg'
import { ReactComponent as ICWarningFill } from '@IconsV2/ic-warning-fill.svg'
import { ReactComponent as ICWarningStroke } from '@IconsV2/ic-warning-stroke.svg'
import { ReactComponent as ICWebhook } from '@IconsV2/ic-webhook.svg'
import { ReactComponent as ICWebhookConfig } from '@IconsV2/ic-webhook-config.svg'
import { ReactComponent as ICWifiSlash } from '@IconsV2/ic-wifi-slash.svg'
import { ReactComponent as ICWorldGlobe } from '@IconsV2/ic-world-globe.svg'

Expand Down Expand Up @@ -568,9 +572,12 @@ export const iconMap = {
'ic-security-scan': ICSecurityScan,
'ic-security-vulnerability': ICSecurityVulnerability,
'ic-selected': ICSelected,
'ic-ses': ICSes,
'ic-shapes': ICShapes,
'ic-shield-check': ICShieldCheck,
'ic-slack': ICSlack,
'ic-sliders-vertical': ICSlidersVertical,
'ic-smtp': ICSmtp,
'ic-software-release-management': ICSoftwareReleaseManagement,
'ic-sort-ascending': ICSortAscending,
'ic-sort-descending': ICSortDescending,
Expand Down Expand Up @@ -623,6 +630,7 @@ export const iconMap = {
'ic-warning-fill': ICWarningFill,
'ic-warning-stroke': ICWarningStroke,
'ic-warning': ICWarning,
'ic-webhook-config': ICWebhookConfig,
'ic-webhook': ICWebhook,
'ic-wifi-slash': ICWifiSlash,
'ic-world-globe': ICWorldGlobe,
Expand Down
17 changes: 14 additions & 3 deletions src/Shared/Components/Table/InternalTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ const InternalTable = <
rowActionOnHoverConfig,
pageSizeOptions,
clearFilters: userGivenUrlClearFilters,
rowStartIconConfig,
onRowClick,
areFiltersApplied: userProvidedAreFiltersApplied,
}: InternalTableProps<RowData, FilterVariant, AdditionalProps>) => {
const {
sortBy,
Expand Down Expand Up @@ -124,6 +127,7 @@ const InternalTable = <
rows,
filter,
filterData,
additionalProps,
visibleColumns.find(({ field }) => field === sortBy)?.comparator,
)

Expand All @@ -138,10 +142,14 @@ const InternalTable = <
// useAsync hook for 'rows' scenario
const [_areRowsLoading, rowsResult, rowsError, reloadRows] = useAsync(
handleFiltering,
[searchKey, sortBy, sortOrder, rows, JSON.stringify(otherFilters), visibleColumns],
[searchKey, filter, sortBy, sortOrder, rows, JSON.stringify(otherFilters), visibleColumns],
!!rows,
)

// NOTE: passing getRows to queryKey won't trigger a refetch
// since it is a function
const lastUpdatedGetRowsInstance = useMemo(() => new Date().toISOString(), [getRows])

// useAsync hook for 'getRows' scenario
const {
isFetching: _areGetRowsLoading,
Expand All @@ -158,7 +166,7 @@ const InternalTable = <
searchKey,
sortBy,
sortOrder,
getRows,
lastUpdatedGetRowsInstance,
offset,
pageSize,
JSON.stringify(otherFilters),
Expand Down Expand Up @@ -188,7 +196,8 @@ const InternalTable = <
}

if (!areFilteredRowsLoading && !filteredRows?.length && !loading) {
return filtersVariant !== FiltersTypeEnum.NONE && areFiltersApplied ? (
return filtersVariant !== FiltersTypeEnum.NONE &&
(userProvidedAreFiltersApplied !== undefined ? userProvidedAreFiltersApplied : areFiltersApplied) ? (
<GenericFilterEmptyState
{...emptyStateConfig.noRowsForFilterConfig}
handleClearFilters={userGivenUrlClearFilters ?? clearFilters}
Expand Down Expand Up @@ -219,6 +228,8 @@ const InternalTable = <
stylesConfig={stylesConfig}
getRows={getRows}
totalRows={totalRows}
rowStartIconConfig={rowStartIconConfig}
onRowClick={onRowClick}
/>
</UseRegisterShortcutProvider>
)
Expand Down
Loading