MINOR: fix status badge for search index application (#17536)

* fix status badge for search index application

* fix sonar and added separate color for activeError

* Running status

* remove the css for activeError

* fix count button styling in explore tree node

* fix the connector icon not proper in list

* remove the unused code

---------

Co-authored-by: mohitdeuex <mohit.y@deuexsolutions.com>
This commit is contained in:
Ashish Gupta 2024-08-22 15:45:35 +05:30 committed by GitHub
parent 7f7dbef411
commit 588535f36e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 98 additions and 13 deletions

View File

@ -154,7 +154,7 @@ public class SearchIndexApp extends AbstractNativeApplication {
"Reindexing Job Has Encountered an Exception. %n Job Data: %s, %n Stack : %s ",
jobData.toString(), ExceptionUtils.getStackTrace(ex)));
LOG.error(indexingError.getMessage());
jobData.setStatus(EventPublisherJob.Status.ACTIVE_ERROR);
jobData.setStatus(EventPublisherJob.Status.RUNNING);
jobData.setFailure(indexingError);
} finally {
// Send update
@ -258,7 +258,7 @@ public class SearchIndexApp extends AbstractNativeApplication {
}
} catch (SearchIndexException rx) {
jobData.setStatus(EventPublisherJob.Status.ACTIVE_ERROR);
jobData.setStatus(EventPublisherJob.Status.RUNNING);
jobData.setFailure(rx.getIndexingError());
paginatedSource.updateStats(
rx.getIndexingError().getSuccessCount(), rx.getIndexingError().getFailedCount());

View File

@ -12,7 +12,6 @@
*/
import { ReactNode } from 'react';
import { EntityFields } from '../../../enums/AdvancedSearch.enum';
import { EntityType } from '../../../enums/entity.enum';
import { ExploreQuickFilterField } from '../ExplorePage.interface';
export type ExploreTreeNode = {
@ -39,7 +38,7 @@ export type TreeNodeData = {
rootIndex?: string;
entityType?: string;
dataId?: string;
childEntities?: EntityType[];
childEntities?: string[];
};
export type DatabaseFields =

View File

@ -40,6 +40,7 @@ import serviceUtilClassBase from '../../../utils/ServiceUtilClassBase';
import { generateUUID } from '../../../utils/StringsUtils';
import { showErrorToast } from '../../../utils/ToastUtils';
import { UrlParams } from '../ExplorePage.interface';
import './explore-tree.less';
import {
ExploreTreeNode,
ExploreTreeProps,
@ -55,7 +56,9 @@ const ExploreTreeTitle = ({ node }: { node: ExploreTreeNode }) => (
data-testid={`explore-tree-title-${node.data?.dataId ?? node.title}`}>
{node.title}
</Typography.Text>
{!isUndefined(node.count) && <span>{getCountBadge(node.count)}</span>}
{!isUndefined(node.count) && (
<span className="explore-node-count">{getCountBadge(node.count)}</span>
)}
</div>
);

View File

@ -0,0 +1,22 @@
/*
* Copyright 2024 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@import (reference) url('../../../styles/variables.less');
.ant-tree-treenode-selected {
.explore-node-count {
span {
color: @white;
background: @primary-color;
}
}
}

View File

@ -13,7 +13,7 @@
import { Button, Col, Row, Typography } from 'antd';
import { ColumnsType } from 'antd/lib/table';
import { AxiosError } from 'axios';
import { capitalize, isNull } from 'lodash';
import { isNull } from 'lodash';
import React, {
forwardRef,
useCallback,
@ -24,7 +24,10 @@ import React, {
} from 'react';
import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router-dom';
import { NO_DATA_PLACEHOLDER } from '../../../../constants/constants';
import {
NO_DATA_PLACEHOLDER,
STATUS_LABEL,
} from '../../../../constants/constants';
import { GlobalSettingOptions } from '../../../../constants/GlobalSettings.constants';
import { AppType } from '../../../../generated/entity/applications/app';
import { Status } from '../../../../generated/entity/applications/appRunRecord';
@ -177,15 +180,17 @@ const AppRunsHistory = forwardRef(
key: 'status',
render: (_, record: AppRunRecordWithId) => {
const status: StatusType = getStatusTypeForApplication(
record.status ?? Status.Failed
record.status ?? Status.Stopped
);
return (
return record.status ? (
<StatusBadge
dataTestId="pipeline-status"
label={capitalize(record.status)}
label={STATUS_LABEL[record.status]}
status={status}
/>
) : (
NO_DATA_PLACEHOLDER
);
},
},

View File

@ -20,6 +20,7 @@ import userEvent from '@testing-library/user-event';
import { Table as AntdTable } from 'antd';
import React from 'react';
import { AppType } from '../../../../generated/entity/applications/app';
import { Status } from '../../../../generated/entity/applications/appRunRecord';
import { mockApplicationData } from '../../../../mocks/rests/applicationAPI.mock';
import AppRunsHistory from './AppRunsHistory.component';
@ -122,6 +123,9 @@ jest.mock('react-router-dom', () => ({
jest.mock('../../../../constants/constants', () => ({
NO_DATA_PLACEHOLDER: '--',
STATUS_LABEL: {
[Status.Success]: 'Success',
},
}));
const mockProps1 = {

View File

@ -18,7 +18,7 @@ import { StatusBadgeProps } from './StatusBadge.interface';
const StatusBadge = ({ label, status, dataTestId }: StatusBadgeProps) => {
return (
<div
className={classNames('w-16 status-badge', status)}
className={classNames('status-badge', status)}
data-testid={dataTestId}>
{label}
</div>

View File

@ -14,6 +14,10 @@ export enum StatusType {
Success = 'success',
Warning = 'warning',
Failure = 'failure',
ActiveError = 'activeError',
Running = 'running',
Started = 'started',
Stopped = 'stopped',
}
export interface StatusBadgeProps {

View File

@ -18,8 +18,9 @@
font-size: 10px;
border: 1px solid;
border-radius: 4px;
padding: 4px;
padding: 4px 8px;
text-align: center;
max-width: fit-content;
&.success {
color: @green-3;
border-color: @green-3;
@ -35,4 +36,15 @@
border-color: @yellow-2;
background-color: @yellow-3;
}
&.started,
&.running {
color: @purple-3;
background-color: @purple-1;
border: 1px solid @purple-3;
}
&.stopped {
color: @grey-3;
background-color: @grey-2;
border: 1px solid @grey-3;
}
}

View File

@ -20,6 +20,7 @@ import { ReactComponent as IconFailedBadge } from '../assets/svg/fail-badge.svg'
import { ReactComponent as IconSuccessBadge } from '../assets/svg/success-badge.svg';
import { COOKIE_VERSION } from '../components/Modals/WhatsNewModal/whatsNewData';
import { EntityTabs, EntityType } from '../enums/entity.enum';
import { Status } from '../generated/entity/applications/appRunRecord';
import { getPartialNameFromFQN } from '../utils/CommonUtils';
import i18n from '../utils/i18next/LocalUtil';
import { getSettingPath } from '../utils/RouterUtils';
@ -590,3 +591,14 @@ export const STATUS_ICON = {
failed: IconFailedBadge,
completed: IconCompleteBadge,
};
export const STATUS_LABEL = {
[Status.Active]: 'Active',
[Status.ActiveError]: 'Active With Error',
[Status.Completed]: 'Completed',
[Status.Failed]: 'Failed',
[Status.Running]: 'Running',
[Status.Started]: 'Started',
[Status.Stopped]: 'Stopped',
[Status.Success]: 'Success',
};

View File

@ -29,11 +29,15 @@ export const getStatusTypeForApplication = (status: Status) => {
case Status.Completed:
return StatusType.Success;
case Status.Active:
case Status.Running:
return StatusType.Warning;
case Status.Started:
return StatusType.Started;
default:
return StatusType.Failure;
return StatusType.Stopped;
}
};

View File

@ -88,6 +88,7 @@ import {
SPLINE,
SQLITE,
SUPERSET,
SYNAPSE,
TABLEAU,
TERADATA,
TOPIC_DEFAULT,
@ -227,6 +228,8 @@ class ServiceUtilClassBase {
public getServiceLogo(type: string) {
const serviceTypes = this.getSupportedServiceFromList();
switch (toLower(type)) {
case this.DatabaseServiceTypeSmallCase.CustomDatabase:
return DATABASE_DEFAULT;
case this.DatabaseServiceTypeSmallCase.Mysql:
return MYSQL;
@ -344,6 +347,12 @@ class ServiceUtilClassBase {
case this.DatabaseServiceTypeSmallCase.Teradata:
return TERADATA;
case this.DatabaseServiceTypeSmallCase.Synapse:
return SYNAPSE;
case this.MessagingServiceTypeSmallCase.CustomMessaging:
return TOPIC_DEFAULT;
case this.MessagingServiceTypeSmallCase.Kafka:
return KAFKA;
@ -353,6 +362,8 @@ class ServiceUtilClassBase {
case this.MessagingServiceTypeSmallCase.Kinesis:
return KINESIS;
case this.DashboardServiceTypeSmallCase.CustomDashboard:
return DASHBOARD_DEFAULT;
case this.DashboardServiceTypeSmallCase.Superset:
return SUPERSET;
@ -389,6 +400,9 @@ class ServiceUtilClassBase {
case this.DashboardServiceTypeSmallCase.Lightdash:
return LIGHT_DASH;
case this.PipelineServiceTypeSmallCase.CustomPipeline:
return PIPELINE_DEFAULT;
case this.PipelineServiceTypeSmallCase.Airflow:
return AIRFLOW;
@ -431,6 +445,9 @@ class ServiceUtilClassBase {
case this.PipelineServiceTypeSmallCase.Flink:
return FLINK;
case this.MlModelServiceTypeSmallCase.CustomMlModel:
return ML_MODEL_DEFAULT;
case this.MlModelServiceTypeSmallCase.Mlflow:
return MLFLOW;
@ -451,6 +468,9 @@ class ServiceUtilClassBase {
case this.MetadataServiceTypeSmallCase.OpenMetadata:
return LOGO;
case this.StorageServiceTypeSmallCase.CustomStorage:
return CUSTOM_STORAGE_DEFAULT;
case this.StorageServiceTypeSmallCase.S3:
return AMAZON_S3;