Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration status not available for sources with status = null #4138

Merged
merged 1 commit into from
Dec 3, 2024
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
6 changes: 6 additions & 0 deletions locales/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -12941,6 +12941,12 @@
"value": "Status/Actions"
}
],
"statusMissing": [
{
"type": 0,
"value": "Missing status"
}
],
"statusMsg": [
{
"options": {
Expand Down
1 change: 1 addition & 0 deletions locales/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@
"start": "Start",
"status": "Status",
"statusActions": "Status/Actions",
"statusMissing": "Missing status",
"statusMsg": "{value, select, complete {Complete} failed {Failed} in_progress {in-Progress} paused {Paused} pending {Pending} other {}}",
"statusStates": "{value, select, pending {Pending} running {Running} failed {Failed} other {}}",
"storage": "Storage",
Expand Down
5 changes: 5 additions & 0 deletions src/locales/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3720,6 +3720,11 @@ export default defineMessages({
description: 'Status/Actions',
id: 'statusActions',
},
statusMissing: {
defaultMessage: 'Missing status',
description: 'Missing status',
id: 'statusMissing',
},
statusMsg: {
defaultMessage:
'{value, select, ' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { MessageDescriptor } from 'react-intl';
import { useIntl } from 'react-intl';
import { useSelector } from 'react-redux';
import { formatDate } from 'routes/details/components/providerStatus/utils/format';
import { getOverallStatusIcon } from 'routes/details/components/providerStatus/utils/icon';
import { getOverallStatusIcon, getWarningStatusIcon } from 'routes/details/components/providerStatus/utils/icon';
import {
getProviderAvailability,
getProviderStatus,
Expand All @@ -27,6 +27,7 @@ interface OverallStatusOwnProps {
isStatusMsg?: boolean;
providerId?: string;
providerType: ProviderType;
showWarningIcon?: boolean; // Show warning icon for no status
uuId?: string;
}

Expand All @@ -45,6 +46,7 @@ const OverallStatus: React.FC<OverallStatusProps> = ({
isStatusMsg,
providerId,
providerType,
showWarningIcon,
uuId,
}: OverallStatusProps) => {
const { providers, providersError } = useMapToProps();
Expand Down Expand Up @@ -210,7 +212,12 @@ const OverallStatus: React.FC<OverallStatusProps> = ({
</>
);
}
return null;
return showWarningIcon ? (
<>
<span style={styles.statusIcon}>{getWarningStatusIcon()}</span>
<span style={styles.description}>{intl.formatMessage(messages.statusMissing)}</span>
</>
) : null;
};

if (!providers || providersError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ProviderStatus: React.FC<ProviderStatusProps> = ({
}

// Filter providers to skip an extra API request
const filteredProviders = filterProviders(providers, providerType)?.data?.filter(data => data.status !== null);
const filteredProviders = filterProviders(providers, providerType)?.data;
if (filteredProviders.length === 0) {
return;
}
Expand Down
19 changes: 11 additions & 8 deletions src/routes/details/components/providerStatus/providerTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,22 @@ const ProviderTable: React.FC<ProviderTableProps> = ({ onClick, providers, provi
providers?.map(item => {
// const clusterId = item?.authentication?.credentials?.cluster_id;

const getDetailsLink = () => {
return onClick ? (
<Button onClick={() => onClick(item.id)} style={styles.dataDetailsButton} variant={ButtonVariant.link}>
{intl.formatMessage(messages.dataDetails)}
</Button>
) : (
<ProviderBreakdownModal providerId={item.id} providerType={providerType} />
);
};
newRows.push({
cells: [
{ value: <SourceLink provider={item} showLabel={false} /> },
{ value: <OverallStatus isLastUpdated providerId={item.id} providerType={providerType} /> },
{ value: <OverallStatus isStatusMsg providerId={item.id} providerType={providerType} /> },
{ value: <OverallStatus isStatusMsg providerId={item.id} providerType={providerType} showWarningIcon /> },
{
value: onClick ? (
<Button onClick={() => onClick(item.id)} style={styles.dataDetailsButton} variant={ButtonVariant.link}>
{intl.formatMessage(messages.dataDetails)}
</Button>
) : (
<ProviderBreakdownModal providerId={item.id} providerType={providerType} />
),
value: item.status !== null ? getDetailsLink() : null,
},
],
item,
Expand Down
9 changes: 9 additions & 0 deletions src/routes/details/components/providerStatus/utils/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ExclamationCircleIcon } from '@patternfly/react-icons/dist/esm/icons/ex
import { InProgressIcon } from '@patternfly/react-icons/dist/esm/icons/in-progress-icon';
import { PauseIcon } from '@patternfly/react-icons/dist/esm/icons/pause-icon';
import { PendingIcon } from '@patternfly/react-icons/dist/esm/icons/pending-icon';
import { WarningTriangleIcon } from '@patternfly/react-icons/dist/esm/icons/warning-triangle-icon';
import React from 'react';

import { lookupKey, StatusType } from './status';
Expand Down Expand Up @@ -48,3 +49,11 @@ export const getOverallStatusIcon = (status: StatusType) => {
}
return icon ? <Icon status={variant}>{icon}</Icon> : null;
};

export const getWarningStatusIcon = () => {
return (
<Icon status="warning">
<WarningTriangleIcon />
</Icon>
);
};
Loading