Minor: Moved the documentation base url to classBase for customisability (#19613)

* I moved the documentation base url to classBase for customizability

* Move the docs URLs to the classBase

* Add tests for the DocumentationLinksClassBase
This commit is contained in:
Aniket Katkar 2025-01-31 12:27:50 +05:30 committed by GitHub
parent 554d52ba08
commit 5dcfa357a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 287 additions and 80 deletions

View File

@ -13,6 +13,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ReactComponent as NoDataIcon } from '../../../../../assets/svg/no-data-icon.svg';
import documentationLinksClassBase from '../../../../../utils/DocumentationLinksClassBase';
const NoProfilerBanner = () => {
const { t } = useTranslation();
@ -26,7 +27,7 @@ const NoProfilerBanner = () => {
{t('message.no-profiler-message')}
<a
data-testid="documentation-link"
href="https://docs.open-metadata.org/how-to-guides/data-quality-observability/profiler/workflow"
href={`${documentationLinksClassBase.getDocsBaseURL()}how-to-guides/data-quality-observability/profiler/workflow`}
rel="noreferrer"
target="_blank"
title="data quality observability profiler workflow">

View File

@ -17,14 +17,11 @@ import { ReactComponent as IconTour } from '../assets/svg/icon-tour.svg';
import { ReactComponent as IconSlackGrey } from '../assets/svg/slack-grey.svg';
import { ReactComponent as IconVersionBlack } from '../assets/svg/version-black.svg';
import { ReactComponent as IconWhatsNew } from '../assets/svg/whats-new.svg';
import documentationLinksClassBase from '../utils/DocumentationLinksClassBase';
import i18n from '../utils/i18next/LocalUtil';
import { ROUTES } from './constants';
import {
URL_GITHUB_REPO,
URL_JOIN_SLACK,
URL_OPEN_METADATA_DOCS,
} from './URL.constants';
import { URL_GITHUB_REPO, URL_JOIN_SLACK } from './URL.constants';
export enum HELP_ITEMS_ENUM {
TOUR = 'tour',
@ -56,7 +53,7 @@ export const HELP_ITEMS = [
key: HELP_ITEMS_ENUM.DOC,
label: i18n.t('label.doc-plural'),
icon: IconDoc,
link: URL_OPEN_METADATA_DOCS,
link: documentationLinksClassBase.getDocsBaseURL(),
isExternal: true,
},
{

View File

@ -11,77 +11,33 @@
* limitations under the License.
*/
export const OMD_REPOSITORY_LINK = 'https://star-us.open-metadata.org/';
import documentationLinksClassBase from '../utils/DocumentationLinksClassBase';
export const WORKFLOWS_PROFILER_DOCS =
'https://docs.open-metadata.org/how-to-guides/data-quality-observability/profiler/workflow';
export const GLOSSARIES_DOCS =
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/entity/data/glossary';
export const CONNECTORS_DOCS = 'https://docs.open-metadata.org/connectors';
export const WORKFLOWS_METADATA_DOCS =
'https://docs.open-metadata.org/connectors/ingestion/workflows/metadata';
export const INGESTION_FRAMEWORK_DEPLOYMENT_DOCS =
'https://docs.open-metadata.org/deployment/ingestion';
export const BOTS_DOCS =
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/entity/bot';
export const TEAMS_DOCS =
'https://docs.open-metadata.org/how-to-guides/admin-guide/teams-and-users/team-structure-openmetadata';
export const ADD_CUSTOM_PROPERTIES_DOCS =
'https://docs.open-metadata.org/latest/how-to-guides/guide-for-data-users/custom';
export const ROLE_DOCS =
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/entity/teams/role';
export const DATA_INSIGHT_DOCS =
'https://docs.open-metadata.org/how-to-guides/data-insights';
export const INGESTION_DOCS =
'https://docs.open-metadata.org/connectors/ingestion/workflows';
export const USAGE_DOCS =
'https://docs.open-metadata.org/connectors/ingestion/workflows/usage';
export const LOCAL_DEPLOYMENT =
'https://docs.open-metadata.org/quick-start/local-docker-deployment';
export const OMD_SLACK_LINK =
'https://join.slack.com/t/openmetadata/shared_invite/zt-1r1kv175f-9qM5eTB39MF6U2DBhZhWow';
export const DATA_INSIGHTS_PIPELINE_DOCS =
'https://docs.open-metadata.org/how-to-guides/data-insights/ingestion';
export const ELASTIC_SEARCH_RE_INDEX_PIPELINE_DOCS =
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/entity/services/connections/metadata/metadataesconnection';
export const ALERTS_DOCS =
'https://docs.open-metadata.org/how-to-guides/admin-guide/alerts';
export const TAGS_DOCS =
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/api/tags';
export const AIRFLOW_DOCS =
'https://docs.open-metadata.org/latest/deployment/ingestion/external/airflow';
export const FOLLOW_DATA_ASSET =
'https://docs.open-metadata.org/how-to-guides/guide-for-data-users/follow-data-asset';
export const RECENTLY_VIEWED =
'https://docs.open-metadata.org/how-to-guides/data-discovery/discover';
export const DATA_QUALITY_PROFILER_DOCS =
'https://docs.open-metadata.org/latest/how-to-guides/data-quality-observability';
export const CUSTOM_PROPERTIES_DOCS =
'https://docs.open-metadata.org/how-to-guides/guide-for-data-users/custom';
export const DATA_DISCOVERY_DOCS =
'https://docs.open-metadata.org/how-to-guides/data-discovery';
export const HOW_TO_GUIDE_DOCS = 'https://docs.open-metadata.org/how-to-guides';
export const {
OMD_REPOSITORY_LINK,
WORKFLOWS_PROFILER_DOCS,
GLOSSARIES_DOCS,
CONNECTORS_DOCS,
WORKFLOWS_METADATA_DOCS,
INGESTION_FRAMEWORK_DEPLOYMENT_DOCS,
BOTS_DOCS,
TEAMS_DOCS,
ADD_CUSTOM_PROPERTIES_DOCS,
ROLE_DOCS,
DATA_INSIGHT_DOCS,
INGESTION_DOCS,
USAGE_DOCS,
LOCAL_DEPLOYMENT,
OMD_SLACK_LINK,
DATA_INSIGHTS_PIPELINE_DOCS,
ELASTIC_SEARCH_RE_INDEX_PIPELINE_DOCS,
ALERTS_DOCS,
TAGS_DOCS,
AIRFLOW_DOCS,
FOLLOW_DATA_ASSET,
RECENTLY_VIEWED,
DATA_QUALITY_PROFILER_DOCS,
CUSTOM_PROPERTIES_DOCS,
DATA_DISCOVERY_DOCS,
HOW_TO_GUIDE_DOCS,
} = documentationLinksClassBase.getDocsURLS();

View File

@ -0,0 +1,192 @@
/*
* Copyright 2025 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 { DocumentationLinksClassBase } from './DocumentationLinksClassBase';
describe('DocumentationLinksClassBase', () => {
let documentationLinksClassBase: DocumentationLinksClassBase;
beforeEach(() => {
documentationLinksClassBase = new DocumentationLinksClassBase();
});
it('should return the default docsBaseURL', () => {
expect(documentationLinksClassBase.getDocsBaseURL()).toBe(
'https://docs.open-metadata.org/'
);
});
it('should return the correct documentation URLs', () => {
const docsURLs = documentationLinksClassBase.getDocsURLS();
expect(docsURLs.WORKFLOWS_PROFILER_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides/data-quality-observability/profiler/workflow'
);
expect(docsURLs.GLOSSARIES_DOCS).toBe(
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/entity/data/glossary'
);
expect(docsURLs.CONNECTORS_DOCS).toBe(
'https://docs.open-metadata.org/connectors'
);
expect(docsURLs.WORKFLOWS_METADATA_DOCS).toBe(
'https://docs.open-metadata.org/connectors/ingestion/workflows/metadata'
);
expect(docsURLs.INGESTION_FRAMEWORK_DEPLOYMENT_DOCS).toBe(
'https://docs.open-metadata.org/deployment/ingestion'
);
expect(docsURLs.BOTS_DOCS).toBe(
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/entity/bot'
);
expect(docsURLs.TEAMS_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides/admin-guide/teams-and-users/team-structure-openmetadata'
);
expect(docsURLs.ADD_CUSTOM_PROPERTIES_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides/guide-for-data-users/custom'
);
expect(docsURLs.ROLE_DOCS).toBe(
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/entity/teams/role'
);
expect(docsURLs.DATA_INSIGHT_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides/data-insights'
);
expect(docsURLs.INGESTION_DOCS).toBe(
'https://docs.open-metadata.org/connectors/ingestion/workflows'
);
expect(docsURLs.USAGE_DOCS).toBe(
'https://docs.open-metadata.org/connectors/ingestion/workflows/usage'
);
expect(docsURLs.LOCAL_DEPLOYMENT).toBe(
'https://docs.open-metadata.org/quick-start/local-docker-deployment'
);
expect(docsURLs.DATA_INSIGHTS_PIPELINE_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides/data-insights/ingestion'
);
expect(docsURLs.ELASTIC_SEARCH_RE_INDEX_PIPELINE_DOCS).toBe(
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/entity/services/connections/metadata/metadataesconnection'
);
expect(docsURLs.ALERTS_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides/admin-guide/alerts'
);
expect(docsURLs.TAGS_DOCS).toBe(
'https://docs.open-metadata.org/main-concepts/metadata-standard/schemas/api/tags'
);
expect(docsURLs.AIRFLOW_DOCS).toBe(
'https://docs.open-metadata.org/deployment/ingestion/external/airflow'
);
expect(docsURLs.FOLLOW_DATA_ASSET).toBe(
'https://docs.open-metadata.org/how-to-guides/guide-for-data-users/follow-data-asset'
);
expect(docsURLs.RECENTLY_VIEWED).toBe(
'https://docs.open-metadata.org/how-to-guides/data-discovery/discover'
);
expect(docsURLs.DATA_QUALITY_PROFILER_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides/data-quality-observability'
);
expect(docsURLs.CUSTOM_PROPERTIES_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides/guide-for-data-users/custom'
);
expect(docsURLs.DATA_DISCOVERY_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides/data-discovery'
);
expect(docsURLs.HOW_TO_GUIDE_DOCS).toBe(
'https://docs.open-metadata.org/how-to-guides'
);
expect(docsURLs.OMD_SLACK_LINK).toBe(
'https://join.slack.com/t/openmetadata/shared_invite/zt-1r1kv175f-9qM5eTB39MF6U2DBhZhWow'
);
expect(docsURLs.OMD_REPOSITORY_LINK).toBe(
'https://star-us.open-metadata.org/'
);
});
it('should return updated documentation URLs after changing the base URL', () => {
// Use a private method to update the base URL for testing purposes
const newURL = 'https://new-docs-url.org/';
(documentationLinksClassBase as any).updateDocsBaseURL(newURL);
const docsURLs = documentationLinksClassBase.getDocsURLS();
expect(docsURLs.WORKFLOWS_PROFILER_DOCS).toBe(
`${newURL}how-to-guides/data-quality-observability/profiler/workflow`
);
expect(docsURLs.GLOSSARIES_DOCS).toBe(
`${newURL}main-concepts/metadata-standard/schemas/entity/data/glossary`
);
expect(docsURLs.CONNECTORS_DOCS).toBe(`${newURL}connectors`);
expect(docsURLs.WORKFLOWS_METADATA_DOCS).toBe(
`${newURL}connectors/ingestion/workflows/metadata`
);
expect(docsURLs.INGESTION_FRAMEWORK_DEPLOYMENT_DOCS).toBe(
`${newURL}deployment/ingestion`
);
expect(docsURLs.BOTS_DOCS).toBe(
`${newURL}main-concepts/metadata-standard/schemas/entity/bot`
);
expect(docsURLs.TEAMS_DOCS).toBe(
`${newURL}how-to-guides/admin-guide/teams-and-users/team-structure-openmetadata`
);
expect(docsURLs.ADD_CUSTOM_PROPERTIES_DOCS).toBe(
`${newURL}how-to-guides/guide-for-data-users/custom`
);
expect(docsURLs.ROLE_DOCS).toBe(
`${newURL}main-concepts/metadata-standard/schemas/entity/teams/role`
);
expect(docsURLs.DATA_INSIGHT_DOCS).toBe(
`${newURL}how-to-guides/data-insights`
);
expect(docsURLs.INGESTION_DOCS).toBe(
`${newURL}connectors/ingestion/workflows`
);
expect(docsURLs.USAGE_DOCS).toBe(
`${newURL}connectors/ingestion/workflows/usage`
);
expect(docsURLs.LOCAL_DEPLOYMENT).toBe(
`${newURL}quick-start/local-docker-deployment`
);
expect(docsURLs.DATA_INSIGHTS_PIPELINE_DOCS).toBe(
`${newURL}how-to-guides/data-insights/ingestion`
);
expect(docsURLs.ELASTIC_SEARCH_RE_INDEX_PIPELINE_DOCS).toBe(
`${newURL}main-concepts/metadata-standard/schemas/entity/services/connections/metadata/metadataesconnection`
);
expect(docsURLs.ALERTS_DOCS).toBe(
`${newURL}how-to-guides/admin-guide/alerts`
);
expect(docsURLs.TAGS_DOCS).toBe(
`${newURL}main-concepts/metadata-standard/schemas/api/tags`
);
expect(docsURLs.AIRFLOW_DOCS).toBe(
`${newURL}deployment/ingestion/external/airflow`
);
expect(docsURLs.FOLLOW_DATA_ASSET).toBe(
`${newURL}how-to-guides/guide-for-data-users/follow-data-asset`
);
expect(docsURLs.RECENTLY_VIEWED).toBe(
`${newURL}how-to-guides/data-discovery/discover`
);
expect(docsURLs.DATA_QUALITY_PROFILER_DOCS).toBe(
`${newURL}how-to-guides/data-quality-observability`
);
expect(docsURLs.CUSTOM_PROPERTIES_DOCS).toBe(
`${newURL}how-to-guides/guide-for-data-users/custom`
);
expect(docsURLs.DATA_DISCOVERY_DOCS).toBe(
`${newURL}how-to-guides/data-discovery`
);
expect(docsURLs.HOW_TO_GUIDE_DOCS).toBe(`${newURL}how-to-guides`);
expect(docsURLs.OMD_SLACK_LINK).toBe(
'https://join.slack.com/t/openmetadata/shared_invite/zt-1r1kv175f-9qM5eTB39MF6U2DBhZhWow'
);
expect(docsURLs.OMD_REPOSITORY_LINK).toBe(
'https://star-us.open-metadata.org/'
);
});
});

View File

@ -0,0 +1,61 @@
/*
* Copyright 2025 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.
*/
class DocumentationLinksClassBase {
docsBaseURL = 'https://docs.open-metadata.org/';
protected updateDocsBaseURL(url: string) {
this.docsBaseURL = url;
}
public getDocsBaseURL() {
return this.docsBaseURL;
}
public getDocsURLS() {
return {
WORKFLOWS_PROFILER_DOCS: `${this.docsBaseURL}how-to-guides/data-quality-observability/profiler/workflow`,
GLOSSARIES_DOCS: `${this.docsBaseURL}main-concepts/metadata-standard/schemas/entity/data/glossary`,
CONNECTORS_DOCS: `${this.docsBaseURL}connectors`,
WORKFLOWS_METADATA_DOCS: `${this.docsBaseURL}connectors/ingestion/workflows/metadata`,
INGESTION_FRAMEWORK_DEPLOYMENT_DOCS: `${this.docsBaseURL}deployment/ingestion`,
BOTS_DOCS: `${this.docsBaseURL}main-concepts/metadata-standard/schemas/entity/bot`,
TEAMS_DOCS: `${this.docsBaseURL}how-to-guides/admin-guide/teams-and-users/team-structure-openmetadata`,
ADD_CUSTOM_PROPERTIES_DOCS: `${this.docsBaseURL}how-to-guides/guide-for-data-users/custom`,
ROLE_DOCS: `${this.docsBaseURL}main-concepts/metadata-standard/schemas/entity/teams/role`,
DATA_INSIGHT_DOCS: `${this.docsBaseURL}how-to-guides/data-insights`,
INGESTION_DOCS: `${this.docsBaseURL}connectors/ingestion/workflows`,
USAGE_DOCS: `${this.docsBaseURL}connectors/ingestion/workflows/usage`,
LOCAL_DEPLOYMENT: `${this.docsBaseURL}quick-start/local-docker-deployment`,
DATA_INSIGHTS_PIPELINE_DOCS: `${this.docsBaseURL}how-to-guides/data-insights/ingestion`,
ELASTIC_SEARCH_RE_INDEX_PIPELINE_DOCS: `${this.docsBaseURL}main-concepts/metadata-standard/schemas/entity/services/connections/metadata/metadataesconnection`,
ALERTS_DOCS: `${this.docsBaseURL}how-to-guides/admin-guide/alerts`,
TAGS_DOCS: `${this.docsBaseURL}main-concepts/metadata-standard/schemas/api/tags`,
AIRFLOW_DOCS: `${this.docsBaseURL}deployment/ingestion/external/airflow`,
FOLLOW_DATA_ASSET: `${this.docsBaseURL}how-to-guides/guide-for-data-users/follow-data-asset`,
RECENTLY_VIEWED: `${this.docsBaseURL}how-to-guides/data-discovery/discover`,
DATA_QUALITY_PROFILER_DOCS: `${this.docsBaseURL}how-to-guides/data-quality-observability`,
CUSTOM_PROPERTIES_DOCS: `${this.docsBaseURL}how-to-guides/guide-for-data-users/custom`,
DATA_DISCOVERY_DOCS: `${this.docsBaseURL}how-to-guides/data-discovery`,
HOW_TO_GUIDE_DOCS: `${this.docsBaseURL}how-to-guides`,
OMD_SLACK_LINK:
'https://join.slack.com/t/openmetadata/shared_invite/zt-1r1kv175f-9qM5eTB39MF6U2DBhZhWow',
OMD_REPOSITORY_LINK: 'https://star-us.open-metadata.org/',
};
}
}
const documentationLinksClassBase = new DocumentationLinksClassBase();
export default documentationLinksClassBase;
export { DocumentationLinksClassBase };