mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 18:36:08 +00:00
supported class base for navbar utils items (#17932)
* supported class base for navbar utils items * added unit test --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> (cherry picked from commit 1badbb260b8f19773cf3a51ef9505d27ef11d187)
This commit is contained in:
parent
fc4dc8d61f
commit
3cdb07af68
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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 { ROUTES } from '../constants/constants';
|
||||||
|
import {
|
||||||
|
URL_GITHUB_REPO,
|
||||||
|
URL_JOIN_SLACK,
|
||||||
|
URL_OPEN_METADATA_DOCS,
|
||||||
|
} from '../constants/URL.constants';
|
||||||
|
import navbarUtilClassBase from './NavbarUtilClassBase';
|
||||||
|
|
||||||
|
describe('NavbarUtilClassBase', () => {
|
||||||
|
it('should return all helper items with appropriate value', () => {
|
||||||
|
const result = navbarUtilClassBase.getHelpItems();
|
||||||
|
const stringifyResult = JSON.stringify(result);
|
||||||
|
|
||||||
|
expect(stringifyResult).toContain(ROUTES.TOUR);
|
||||||
|
expect(stringifyResult).toContain(URL_OPEN_METADATA_DOCS);
|
||||||
|
expect(stringifyResult).toContain(ROUTES.SWAGGER);
|
||||||
|
expect(stringifyResult).toContain(URL_JOIN_SLACK);
|
||||||
|
expect(stringifyResult).toContain(URL_GITHUB_REPO);
|
||||||
|
expect(stringifyResult).toContain('label.tour');
|
||||||
|
expect(stringifyResult).toContain('label.doc-plural');
|
||||||
|
expect(stringifyResult).toContain('label.api-uppercase');
|
||||||
|
expect(stringifyResult).toContain('label.slack-support');
|
||||||
|
expect(stringifyResult).toContain('label.whats-new');
|
||||||
|
expect(stringifyResult).toContain('label.version');
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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 { HELP_ITEMS } from '../constants/Navbar.constants';
|
||||||
|
|
||||||
|
class NavbarUtilClassBase {
|
||||||
|
public getHelpItems() {
|
||||||
|
return HELP_ITEMS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const navbarUtilClassBase = new NavbarUtilClassBase();
|
||||||
|
|
||||||
|
export default navbarUtilClassBase;
|
||||||
|
export { NavbarUtilClassBase };
|
@ -16,11 +16,8 @@ import { Col, Row, Typography } from 'antd';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { ReactComponent as IconExternalLink } from '../assets/svg/external-links.svg';
|
import { ReactComponent as IconExternalLink } from '../assets/svg/external-links.svg';
|
||||||
import {
|
import { HELP_ITEMS_ENUM, SupportItem } from '../constants/Navbar.constants';
|
||||||
HELP_ITEMS,
|
import navbarUtilClassBase from './NavbarUtilClassBase';
|
||||||
HELP_ITEMS_ENUM,
|
|
||||||
SupportItem,
|
|
||||||
} from '../constants/Navbar.constants';
|
|
||||||
|
|
||||||
const getHelpDropdownLabelContentRenderer = (
|
const getHelpDropdownLabelContentRenderer = (
|
||||||
item: SupportItem,
|
item: SupportItem,
|
||||||
@ -77,7 +74,7 @@ const getHelpDropdownLabel = (item: SupportItem, version?: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getHelpDropdownItems = (version?: string) =>
|
export const getHelpDropdownItems = (version?: string) =>
|
||||||
HELP_ITEMS.map((item) => ({
|
navbarUtilClassBase.getHelpItems().map((item) => ({
|
||||||
label: getHelpDropdownLabel(item, version),
|
label: getHelpDropdownLabel(item, version),
|
||||||
key: item.key,
|
key: item.key,
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user