Added localization changes for (#9016)

- MetadataToESConfigForm
- Ingestion component
- TestSuitePipelineTab component
This commit is contained in:
Aniket Katkar 2022-11-26 11:36:22 +05:30 committed by GitHub
parent fa15f66331
commit e4dfac3520
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 49 deletions

View File

@ -20,7 +20,6 @@ import {
Switch,
Typography,
} from 'antd';
import { startCase } from 'lodash';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ConfigClass } from '../../../../generated/entity/services/ingestionPipelines/ingestionPipeline';
@ -58,7 +57,7 @@ const MetadataToESConfigForm = ({
label={
<EsConfigFieldLabel
description={t('message.field-ca-certs-description')}
label={startCase('caCerts')}
label={t('label.ca-certs')}
/>
}
name="caCerts">
@ -68,7 +67,7 @@ const MetadataToESConfigForm = ({
label={
<EsConfigFieldLabel
description={t('message.field-region-name-description')}
label={startCase('regionName')}
label={t('label.region-name')}
/>
}
name="regionName">
@ -78,7 +77,7 @@ const MetadataToESConfigForm = ({
label={
<EsConfigFieldLabel
description={t('message.field-timeout-description')}
label={startCase('timeout')}
label={t('label.timeout')}
/>
}
name="timeout">
@ -87,7 +86,7 @@ const MetadataToESConfigForm = ({
<Divider />
<Form.Item
className="switch-item"
label={startCase('useAwsCredentials')}
label={t('label.use-aws-credentials')}
name="useAwsCredentials">
<Switch />
</Form.Item>
@ -97,7 +96,7 @@ const MetadataToESConfigForm = ({
<Divider />
<Form.Item
className="switch-item"
label={startCase('useSSL')}
label={t('label.use-ssl')}
name="useSSL">
<Switch />
</Form.Item>
@ -107,7 +106,7 @@ const MetadataToESConfigForm = ({
<Divider />
<Form.Item
className="switch-item"
label={startCase('verifyCerts')}
label={t('label.verify-certs')}
name="verifyCerts">
<Switch />
</Form.Item>

View File

@ -25,7 +25,6 @@ import React, { Fragment, useEffect, useMemo, useState } from 'react';
import { useHistory } from 'react-router-dom';
import { PAGE_SIZE } from '../../constants/constants';
import { WORKFLOWS_METADATA_DOCS } from '../../constants/docs.constants';
import { NO_PERMISSION_TO_VIEW } from '../../constants/HelperTextUtil';
import { MetadataServiceType } from '../../generated/api/services/createMetadataService';
import { Connection } from '../../generated/entity/services/databaseService';
import {
@ -90,7 +89,6 @@ const Ingestion: React.FC<IngestionProps> = ({
state: '',
});
const [isKillModalOpen, setIsKillModalOpen] = useState<boolean>(false);
const noConnectionMsg = `${serviceName} doesn't have connection details filled in. Please add the details before scheduling an ingestion job.`;
const isOpenmetadataService = useMemo(
() =>
serviceDetails.connection?.config?.type ===
@ -188,7 +186,7 @@ const Ingestion: React.FC<IngestionProps> = ({
setCurrTriggerId({ id, state: 'success' });
setTimeout(() => {
setCurrTriggerId({ id: '', state: '' });
showSuccessToast('Pipeline triggered successfully');
showSuccessToast(t('message.pipeline-trigger-success-message'));
}, 1500);
})
.catch(() => setCurrTriggerId({ id: '', state: '' }));
@ -262,7 +260,7 @@ const Ingestion: React.FC<IngestionProps> = ({
size="small"
type="primary"
onClick={() => handleAddIngestionClick(type)}>
Add {startCase(type)} Ingestion
{t('label.add-pipeline-ingestion', { pipelineType: startCase(type) })}
</Button>
);
};
@ -277,7 +275,7 @@ const Ingestion: React.FC<IngestionProps> = ({
size="small"
type="primary"
onClick={() => setShowActions((pre) => !pre)}>
Add Ingestion{' '}
{t('label.add-pipeline-ingestion', { pipelineType: '' })}
{showActions ? (
<DropdownIcon
style={{
@ -417,7 +415,7 @@ const Ingestion: React.FC<IngestionProps> = ({
title={
permissions.ViewAll || permissions.ViewBasic
? t('label.view-dag')
: NO_PERMISSION_TO_VIEW
: t('message.no-permission-to-view')
}>
<Button
className="tw-mr-2"
@ -589,7 +587,6 @@ const Ingestion: React.FC<IngestionProps> = ({
},
],
[
NO_PERMISSION_TO_VIEW,
permissions,
airflowEndpoint,
getTriggerDeployButton,
@ -615,7 +612,11 @@ const Ingestion: React.FC<IngestionProps> = ({
{!isRequiredDetailsAvailable && (
<div className="tw-rounded tw-bg-error-lite tw-text-error tw-font-medium tw-px-4 tw-py-1 tw-mb-4 tw-flex tw-items-center tw-gap-1">
<FontAwesomeIcon icon={faExclamationCircle} />
<p> {noConnectionMsg} </p>
<p>
{t('message.no-service-connection-details-message', {
serviceName,
})}
</p>
</div>
)}
</div>
@ -623,7 +624,7 @@ const Ingestion: React.FC<IngestionProps> = ({
<div className="tw-w-4/12">
{searchText || !isEmpty(ingestionData) ? (
<Searchbar
placeholder="Search for ingestion..."
placeholder={`${t('message.search-for-ingestion')}...`}
searchValue={searchText}
typingInterval={500}
onSearch={handleSearchAction}
@ -686,7 +687,7 @@ const Ingestion: React.FC<IngestionProps> = ({
{isConfirmationModalOpen && (
<EntityDeleteModal
entityName={deleteSelection.name}
entityType="ingestion"
entityType={t('label.ingestion-lowercase')}
loadingState={deleteSelection.state}
onCancel={handleCancelConfirmationModal}
onConfirm={() =>

View File

@ -28,13 +28,8 @@ import {
triggerIngestionPipelineById,
} from '../../axiosAPIs/ingestionPipelineAPI';
import { fetchAirflowConfig } from '../../axiosAPIs/miscAPI';
import {
NO_PERMISSION_FOR_ACTION,
NO_PERMISSION_TO_VIEW,
} from '../../constants/HelperTextUtil';
import { Operation } from '../../generated/entity/policies/policy';
import { IngestionPipeline } from '../../generated/entity/services/ingestionPipelines/ingestionPipeline';
import jsonData from '../../jsons/en';
import { getLoadingStatus } from '../../utils/CommonUtils';
import { checkPermission, userPermissions } from '../../utils/PermissionsUtils';
import {
@ -153,7 +148,10 @@ const TestSuitePipelineTab = () => {
} catch (error) {
showErrorToast(
error as AxiosError,
`${jsonData['api-error-messages']['delete-ingestion-error']} ${displayName}`
t('server.ingestion-workflow-operation-error', {
operation: 'deleting',
displayName,
})
);
} finally {
handleCancelConfirmationModal();
@ -174,10 +172,7 @@ const TestSuitePipelineTab = () => {
await enableDisableIngestionPipelineById(id);
getAllIngestionWorkflows();
} catch (error) {
showErrorToast(
error as AxiosError,
jsonData['api-error-messages']['unexpected-server-response']
);
showErrorToast(error as AxiosError, t('server.unexpected-response'));
}
};
@ -207,7 +202,10 @@ const TestSuitePipelineTab = () => {
getAllIngestionWorkflows();
} catch (error) {
showErrorToast(
`${jsonData['api-error-messages']['triggering-ingestion-error']} ${displayName}`
t('server.ingestion-workflow-operation-error', {
operation: 'triggering',
displayName,
})
);
setCurrTriggerId({ id: '', state: '' });
}
@ -229,7 +227,10 @@ const TestSuitePipelineTab = () => {
setCurrDeployId({ id: '', state: '' });
showErrorToast(
error as AxiosError,
jsonData['api-error-messages']['update-ingestion-error']
t('server.ingestion-workflow-operation-error', {
operation: 'updating',
displayName: '',
})
);
}
};
@ -239,7 +240,11 @@ const TestSuitePipelineTab = () => {
return (
<>
<Tooltip
title={editPermission ? t('label.run') : NO_PERMISSION_FOR_ACTION}>
title={
editPermission
? t('label.run')
: t('message.no-permission-for-action')
}>
<Button
data-testid="run"
disabled={!editPermission}
@ -253,7 +258,9 @@ const TestSuitePipelineTab = () => {
{separator}
<Tooltip
title={
editPermission ? t('label.re-deploy') : NO_PERMISSION_FOR_ACTION
editPermission
? t('label.re-deploy')
: t('message.no-permission-for-action')
}>
<Button
data-testid="re-deploy-btn"
@ -274,7 +281,11 @@ const TestSuitePipelineTab = () => {
} else {
return (
<Tooltip
title={editPermission ? t('label.deploy') : NO_PERMISSION_FOR_ACTION}>
title={
editPermission
? t('label.deploy')
: t('message.no-permission-for-action')
}>
<Button
data-testid="deploy"
disabled={!editPermission}
@ -311,12 +322,15 @@ const TestSuitePipelineTab = () => {
const pipelineColumns = useMemo(() => {
const column: ColumnsType<IngestionPipeline> = [
{
title: 'Name',
title: t('label.name'),
dataIndex: 'name',
key: 'name',
render: (name: string) => {
return (
<Tooltip title={viewPermission ? name : NO_PERMISSION_TO_VIEW}>
<Tooltip
title={
viewPermission ? name : t('message.no-permission-to-view')
}>
<Button type="link">
<a
className="link-text tw-mr-2"
@ -338,12 +352,12 @@ const TestSuitePipelineTab = () => {
},
},
{
title: 'Type',
title: t('label.type'),
dataIndex: 'pipelineType',
key: 'pipelineType',
},
{
title: 'Schedule',
title: t('label.schedule'),
dataIndex: 'airflowConfig',
key: 'airflowEndpoint',
render: (_, record) => {
@ -375,7 +389,7 @@ const TestSuitePipelineTab = () => {
},
},
{
title: 'Recent Runs',
title: t('label.recent-runs'),
dataIndex: 'pipelineStatuses',
key: 'recentRuns',
render: (_, record) => (
@ -385,7 +399,7 @@ const TestSuitePipelineTab = () => {
),
},
{
title: 'Actions',
title: t('label.actions'),
dataIndex: 'actions',
key: 'actions',
render: (_, record) => {
@ -400,7 +414,7 @@ const TestSuitePipelineTab = () => {
title={
editPermission
? t('label.pause')
: NO_PERMISSION_FOR_ACTION
: t('message.no-permission-for-action')
}>
<Button
data-testid="pause"
@ -418,7 +432,7 @@ const TestSuitePipelineTab = () => {
title={
editPermission
? t('label.unpause')
: NO_PERMISSION_FOR_ACTION
: t('message.no-permission-for-action')
}>
<Button
data-testid="unpause"
@ -434,7 +448,9 @@ const TestSuitePipelineTab = () => {
{separator}
<Tooltip
title={
editPermission ? t('label.edit') : NO_PERMISSION_FOR_ACTION
editPermission
? t('label.edit')
: t('message.no-permission-for-action')
}>
<Button
data-testid="edit"
@ -456,7 +472,7 @@ const TestSuitePipelineTab = () => {
title={
deletePermission
? t('label.delete')
: NO_PERMISSION_FOR_ACTION
: t('message.no-permission-for-action')
}>
<Button
data-testid="delete"
@ -479,7 +495,9 @@ const TestSuitePipelineTab = () => {
{separator}
<Tooltip
title={
editPermission ? t('label.kill') : NO_PERMISSION_FOR_ACTION
editPermission
? t('label.kill')
: t('message.no-permission-for-action')
}>
<Button
data-testid="kill"
@ -495,7 +513,9 @@ const TestSuitePipelineTab = () => {
{separator}
<Tooltip
title={
viewPermission ? t('label.logs') : NO_PERMISSION_FOR_ACTION
viewPermission
? t('label.logs')
: t('message.no-permission-for-action')
}>
<Button
data-testid="logs"
@ -551,7 +571,7 @@ const TestSuitePipelineTab = () => {
<ErrorPlaceHolderIngestion />
) : (
<TestCaseCommonTabContainer
buttonName="Add Ingestion"
buttonName={t('label.add-pipeline-ingestion', { pipelineType: '' })}
hasAccess={createPermission}
showButton={testSuitePipelines.length === 0}
onButtonClick={() => {
@ -572,7 +592,7 @@ const TestSuitePipelineTab = () => {
{isConfirmationModalOpen && (
<EntityDeleteModal
entityName={deleteSelection.name}
entityType="ingestion"
entityType={t('label.ingestion-lowercase')}
loadingState={deleteSelection.state}
onCancel={handleCancelConfirmationModal}
onConfirm={() =>

View File

@ -319,7 +319,15 @@
"add-display-name": "Add display name",
"token-security": "Token Security",
"teams": "Teams",
"pctile-lowercase": "pctile"
"ingestion-lowercase": "ingestion",
"pctile-lowercase": "pctile",
"add-pipeline-ingestion": "Add {{pipelineType}} Ingestion",
"ca-certs": "Ca Certs",
"region-name": "Region Name",
"timeout": "Timeout",
"use-aws-credentials": "Use Aws Credentials",
"use-ssl": "Use SSL",
"verify-certs": "Verify Certs"
},
"message": {
"service-email-required": "Service account Email is required",
@ -377,7 +385,10 @@
"no-data-available-for-selected-filter": "No data found. Try changing the filters.",
"token-security-description": "Anyone who has your JWT Token will be able to send REST API requests to the OpenMetadata Server. Do not expose the JWT Token in your application code. Do not share it on GitHub or anywhere else online.",
"org-url-required": "OrgURL is required",
"all-charts-are-mapped": "All charts are mapped with existing KPIs."
"all-charts-are-mapped": "All charts are mapped with existing KPIs.",
"no-service-connection-details-message": "{{serviceName}} doesn't have connection details filled in. Please add the details before scheduling an ingestion job.",
"pipeline-trigger-success-message": "Pipeline triggered successfully",
"search-for-ingestion": "Search for ingestion"
},
"server": {
"no-user-entities": "You have not {{type}} anything yet.",
@ -392,7 +403,8 @@
"join-team-error": "Error while joining the team!",
"leave-team-error": "Error while leaving the team!",
"no-query-available": "No query available",
"unexpected-response": "Unexpected response from server!"
"unexpected-response": "Unexpected response from server!",
"ingestion-workflow-operation-error": "Error while {{operation}} ingestion workflow {{displayName}}"
},
"url": {}
}