From 2f4d3fe9ebc7a5a4ebecc05ff2c191f94d300f35 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Fri, 10 Nov 2023 23:47:15 +0530 Subject: [PATCH] feat(ui): supported github star popup on ui (#13933) * supported github star popup on ui * localization keys * changes as per figma design * file path change * icon change * icon change * support closing on ESC button --- .../ui/src/assets/svg/ic-star-filled.svg | 4 +- .../ui/src/assets/svg/ic-star-github.svg | 4 + .../src/assets/svg/ic-start-filled-github.svg | 93 ++++++++++ .../GithubStarModal.component.tsx | 168 ++++++++++++++++++ .../github-star-modal.style.less | 65 +++++++ .../ui/src/components/NavBar/NavBar.tsx | 3 + .../resources/ui/src/constants/constants.ts | 1 + .../ui/src/locale/languages/de-de.json | 2 + .../ui/src/locale/languages/en-us.json | 2 + .../ui/src/locale/languages/es-es.json | 2 + .../ui/src/locale/languages/fr-fr.json | 2 + .../ui/src/locale/languages/ja-jp.json | 2 + .../ui/src/locale/languages/pt-br.json | 2 + .../ui/src/locale/languages/ru-ru.json | 2 + .../ui/src/locale/languages/zh-cn.json | 2 + .../main/resources/ui/src/rest/commonAPI.ts | 28 +++ .../ui/src/utils/WhatsNewModal.util.ts | 5 +- 17 files changed, 382 insertions(+), 5 deletions(-) create mode 100644 openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-star-github.svg create mode 100644 openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-start-filled-github.svg create mode 100644 openmetadata-ui/src/main/resources/ui/src/components/Modals/GithubStarModal/GithubStarModal.component.tsx create mode 100644 openmetadata-ui/src/main/resources/ui/src/components/Modals/GithubStarModal/github-star-modal.style.less create mode 100644 openmetadata-ui/src/main/resources/ui/src/rest/commonAPI.ts diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-star-filled.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-star-filled.svg index fe31f52abaa..957c06f1480 100644 --- a/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-star-filled.svg +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-star-filled.svg @@ -1,3 +1,3 @@ - - + + diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-star-github.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-star-github.svg new file mode 100644 index 00000000000..b66e2c790d1 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-star-github.svg @@ -0,0 +1,4 @@ + + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-start-filled-github.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-start-filled-github.svg new file mode 100644 index 00000000000..9068514c024 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/ic-start-filled-github.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Modals/GithubStarModal/GithubStarModal.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Modals/GithubStarModal/GithubStarModal.component.tsx new file mode 100644 index 00000000000..0b8e875a7e6 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/components/Modals/GithubStarModal/GithubStarModal.component.tsx @@ -0,0 +1,168 @@ +/* + * Copyright 2023 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 { Button, Card, Modal, Skeleton, Typography } from 'antd'; +import { CookieStorage } from 'cookie-storage'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Link, useLocation } from 'react-router-dom'; +import { ReactComponent as CloseIcon } from '../../../assets/svg/close.svg'; +import { ReactComponent as StarGithubIcon } from '../../../assets/svg/ic-star-github.svg'; +import { ReactComponent as StarIcon } from '../../../assets/svg/ic-start-filled-github.svg'; + +import Icon from '@ant-design/icons/lib/components/Icon'; +import ButtonGroup from 'antd/lib/button/button-group'; +import { + ROUTES, + STAR_OMD_USER, + TEXT_GREY_MUTED, +} from '../../../constants/constants'; +import { getRepositoryData } from '../../../rest/commonAPI'; +import { getReleaseVersionExpiry } from '../../../utils/WhatsNewModal.util'; +import { useAuthContext } from '../../Auth/AuthProviders/AuthProvider'; +import './github-star-modal.style.less'; + +const cookieStorage = new CookieStorage(); + +const GithubStarModal = () => { + const { t } = useTranslation(); + const location = useLocation(); + const { currentUser } = useAuthContext(); + const [showGithubStarPopup, setShowGithubStarPopup] = useState(false); + const [starredCount, setStarredCount] = useState(0); + const [isLoading, setIsLoading] = useState(true); + + const loggedInUserName = useMemo(() => currentUser?.name, [currentUser]); + + const userCookieName = useMemo( + () => `${STAR_OMD_USER}_${loggedInUserName}`, + [loggedInUserName] + ); + + const isHomePage = useMemo( + () => location.pathname.includes(ROUTES.MY_DATA), + [location.pathname] + ); + + const usernameExistsInCookie = useMemo( + () => Boolean(cookieStorage.getItem(userCookieName)), + [userCookieName] + ); + + const fetchOpenMetaData = async () => { + try { + const res = await getRepositoryData(); + setStarredCount(res.stargazers_count); + } catch (err) { + // Error + } finally { + setIsLoading(false); + } + }; + + const updateGithubPopup = useCallback( + (show: boolean) => { + if (loggedInUserName && show) { + fetchOpenMetaData(); + cookieStorage.setItem(userCookieName, 'true', { + expires: getReleaseVersionExpiry(), + }); + } + setShowGithubStarPopup(show); + }, + [ + loggedInUserName, + usernameExistsInCookie, + userCookieName, + getReleaseVersionExpiry, + ] + ); + + useEffect(() => { + updateGithubPopup(!usernameExistsInCookie); + + return () => setShowGithubStarPopup(false); + }, [usernameExistsInCookie, updateGithubPopup]); + + return ( + <> + {showGithubStarPopup && isHomePage && ( + setShowGithubStarPopup(false)} + /> + } + data-testid="github-star-popup-modal" + footer={null} + maskClosable={false} + width={440} + onCancel={() => setShowGithubStarPopup(false)}> + + + + + {t('label.star-us-on-github')} + + + + {t('message.star-on-github-description')} + + + + + }> + {t('label.star')} + + + + + + + + + + )} + + ); +}; + +export default GithubStarModal; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Modals/GithubStarModal/github-star-modal.style.less b/openmetadata-ui/src/main/resources/ui/src/components/Modals/GithubStarModal/github-star-modal.style.less new file mode 100644 index 00000000000..c04edc77e3e --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/components/Modals/GithubStarModal/github-star-modal.style.less @@ -0,0 +1,65 @@ +/* + * Copyright 2023 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'); + +.github-star-popup-modal { + .github-star-popup-card { + border: none; + text-align: center; + + .github-star-icon { + display: block; + margin: 24px auto; + width: 50px; + color: @yellow-2; + } + + .github-star-popup-header { + color: @primary-color; + font-size: 20px; + font-weight: 500; + } + + .github-star-popup-description { + margin-top: 10px; + color: @text-grey-muted; + font-size: 14px; + font-weight: 400; + } + + .github-action-button-group { + border-radius: 4px; + border: @global-border; + overflow: hidden; + + .github-star-button { + background: linear-gradient(0.5turn, rgba(0, 0, 0, 0.2), transparent); + border-right: @global-border !important; + } + + .github-modal-action-button { + border: none; + + &:hover { + color: initial; + border: none; + } + &:focus { + color: initial; + border: none; + } + } + } + } +} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx b/openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx index a36ebe817f0..e83ab74dfcf 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/NavBar/NavBar.tsx @@ -74,6 +74,7 @@ import BrandImage from '../common/BrandImage/BrandImage'; import CmdKIcon from '../common/CmdKIcon/CmdKIcon.component'; import { useDomainProvider } from '../Domain/DomainProvider/DomainProvider'; import { useGlobalSearchProvider } from '../GlobalSearchProvider/GlobalSearchProvider'; +import GithubStarModal from '../Modals/GithubStarModal/GithubStarModal.component'; import WhatsNewAlert from '../Modals/WhatsNewModal/WhatsNewAlert/WhatsNewAlert.component'; import WhatsNewModal from '../Modals/WhatsNewModal/WhatsNewModal'; import NotificationBox from '../NotificationBox/NotificationBox.component'; @@ -519,6 +520,8 @@ const NavBar = ({ onCancel={handleModalCancel} /> + + ); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts index 38edff32064..7881cc411b9 100644 --- a/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts @@ -86,6 +86,7 @@ export const imageTypes = { export const NO_DATA_PLACEHOLDER = '--'; export const PIPE_SYMBOL = '|'; export const NO_DATA = '-'; +export const STAR_OMD_USER = 'STAR_OMD_USER'; export const TOUR_SEARCH_TERM = 'dim_a'; export const ERROR500 = t('message.something-went-wrong'); diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json index a5a6838029b..5b238dba2c8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/de-de.json @@ -957,6 +957,7 @@ "sql-uppercase-query": "SQL-Abfrage", "sso-uppercase": "SSO", "stage-file-location": "Speicherort der Bühnendatei", + "star": "Star", "star-open-metadata": "Star OpenMetadata", "star-us-on-github": "Sterne uns auf Github", "start-date-time-zone": "Startdatum ({{timeZone}})", @@ -1561,6 +1562,7 @@ "sql-query-tooltip": "Abfragen, die eine oder mehrere Zeilen zurückgeben, führen dazu, dass der Test fehlschlägt.", "sso-provider-not-supported": "SSO-Provider {{provider}} wird nicht unterstützt.", "stage-file-location-message": "Temporärer Dateiname zum Speichern der Abfrageprotokolle vor der Verarbeitung. Es wird ein absoluter Dateipfad benötigt.", + "star-on-github-description": "Spread the word to help data enthusiasts discover OpenMetadata. Show your support by contributing to the open-source project with Stars!", "still-running-into-issue": "Wenn Sie immer noch auf Probleme stoßen, kontaktieren Sie uns bitte über Slack.", "success-status-for-entity-deploy": "<0>{{entity}} wurde {{entityStatus}} und erfolgreich bereitgestellt", "successfully-completed-the-tour": "Sie haben die Tour erfolgreich abgeschlossen.", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json index b381e6f5eb3..c65709b3946 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/en-us.json @@ -957,6 +957,7 @@ "sql-uppercase-query": "SQL Query", "sso-uppercase": "SSO", "stage-file-location": "Stage File Location", + "star": "Star", "star-open-metadata": "Star OpenMetadata", "star-us-on-github": "Star us on Github", "start-date-time-zone": "Start Date: ({{timeZone}})", @@ -1561,6 +1562,7 @@ "sql-query-tooltip": "Queries returning one or more rows will result in the test failing.", "sso-provider-not-supported": "SSO Provider {{provider}} is not supported.", "stage-file-location-message": "Temporary file name to store the query logs before processing. Absolute file path required.", + "star-on-github-description": "Spread the word to help data enthusiasts discover OpenMetadata. Show your support by contributing to the open-source project with Stars!", "still-running-into-issue": "If you are still running into issues, please reach out to us on slack.", "success-status-for-entity-deploy": "<0>{{entity}} has been {{entityStatus}} and deployed successfully", "successfully-completed-the-tour": "You’ve successfully completed the tour.", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/es-es.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/es-es.json index 7b87d34cbbf..e7c76e45be8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/es-es.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/es-es.json @@ -957,6 +957,7 @@ "sql-uppercase-query": "Consulta SQL", "sso-uppercase": "SSO", "stage-file-location": "Ubicación del Archivo de Etapa", + "star": "Star", "star-open-metadata": "Star OpenMetadata", "star-us-on-github": "Danos una Estrella en Github", "start-date-time-zone": "Fecha de Inicio: ({{timeZone}})", @@ -1561,6 +1562,7 @@ "sql-query-tooltip": "Las consultas que devuelvan una o varias filas provocarán el fallo del test.", "sso-provider-not-supported": "No se admite el proveedor SSO {{provider}}.", "stage-file-location-message": "Nombre de archivo temporal para almacenar los registros de consulta antes del procesamiento. Se requiere una ruta de archivo absoluta.", + "star-on-github-description": "Spread the word to help data enthusiasts discover OpenMetadata. Show your support by contributing to the open-source project with Stars!", "still-running-into-issue": "Si todavía tienes problemas, contáctanos en Slack.", "success-status-for-entity-deploy": "<0>{{entity}} se ha {{entityStatus}} y desplegado con éxito", "successfully-completed-the-tour": "Has completado el recorrido con éxito.", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/fr-fr.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/fr-fr.json index a0f097ecbec..8c43a0a19c4 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/fr-fr.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/fr-fr.json @@ -957,6 +957,7 @@ "sql-uppercase-query": "Requête SQL", "sso-uppercase": "SSO", "stage-file-location": "Emplacement du Fichier de Staging", + "star": "Star", "star-open-metadata": "Star OpenMetadata", "star-us-on-github": "Étoilez-nous sur Github", "start-date-time-zone": "Date de Début ({{timeZone}})", @@ -1561,6 +1562,7 @@ "sql-query-tooltip": "Requête avec 1 ligne ou plus entraînera l'échec du test.", "sso-provider-not-supported": "Le fournisseur SSO {{provider}} n’est pas pris en charge.", "stage-file-location-message": "Nom du fichier temporaire pour stocker les journaux de requête avant le traitement. Chemin de fichier absolu requis.", + "star-on-github-description": "Spread the word to help data enthusiasts discover OpenMetadata. Show your support by contributing to the open-source project with Stars!", "still-running-into-issue": "Si vous rencontrez toujours des problèmes, veuillez nous contacter sur slack.", "success-status-for-entity-deploy": "<0>{{entity}} a été {{entityStatus}} et déployé avec succès", "successfully-completed-the-tour": "Vous avez fini la visite avec succès.", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json index d14f3513da0..28fdfacdbc8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ja-jp.json @@ -957,6 +957,7 @@ "sql-uppercase-query": "SQL Query", "sso-uppercase": "SSO", "stage-file-location": "Stage File Location", + "star": "Star", "star-open-metadata": "Star OpenMetadata", "star-us-on-github": "Githubプロジェクトにスターを付ける", "start-date-time-zone": "開始日: ({{timeZone}})", @@ -1561,6 +1562,7 @@ "sql-query-tooltip": "Queries returning one or more rows will result in the test failing.", "sso-provider-not-supported": "SSO Provider {{provider}} is not supported.", "stage-file-location-message": "処理前のクエリログを保存するための一時ファイルの名前です。絶対パスである必要があります。", + "star-on-github-description": "Spread the word to help data enthusiasts discover OpenMetadata. Show your support by contributing to the open-source project with Stars!", "still-running-into-issue": "まだ問題が発生している場合は, Slackでご連絡ください。", "success-status-for-entity-deploy": "<0>{{entity}} has been {{entityStatus}} and deployed successfully", "successfully-completed-the-tour": "あなたは無事ツアーを終了しました。", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-br.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-br.json index 5ec4fc5ab62..e3bc3ea91a6 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-br.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/pt-br.json @@ -957,6 +957,7 @@ "sql-uppercase-query": "Consulta SQL", "sso-uppercase": "SSO", "stage-file-location": "Localização de Arquivo de Estágio", + "star": "Star", "star-open-metadata": "Star OpenMetadata", "star-us-on-github": "Nos avalie no Github", "start-date-time-zone": "Data de Início: ({{timeZone}})", @@ -1561,6 +1562,7 @@ "sql-query-tooltip": "Consultas que retornam uma ou mais linhas resultarão na falha do teste.", "sso-provider-not-supported": "O provedor SSO {{provider}} não é suportado.", "stage-file-location-message": "Nome do arquivo temporário para armazenar os logs de consulta antes do processamento. É necessário um caminho absoluto para o arquivo.", + "star-on-github-description": "Spread the word to help data enthusiasts discover OpenMetadata. Show your support by contributing to the open-source project with Stars!", "still-running-into-issue": "Se você ainda estiver enfrentando problemas, entre em contato conosco no Slack.", "success-status-for-entity-deploy": "<0>{{entity}} foi {{entityStatus}} e implantado com sucesso", "successfully-completed-the-tour": "Você concluiu o tour com sucesso.", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ru-ru.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ru-ru.json index f4236dbdc48..67264f11277 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/ru-ru.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/ru-ru.json @@ -957,6 +957,7 @@ "sql-uppercase-query": "SQL Запрос", "sso-uppercase": "SSO", "stage-file-location": "Расположение файла", + "star": "Star", "star-open-metadata": "Star OpenMetadata", "star-us-on-github": "Пометить на Github", "start-date-time-zone": "Дата начала: ({{timeZone}})", @@ -1561,6 +1562,7 @@ "sql-query-tooltip": "Запросы, возвращающие одну или несколько строк, приведут к сбою теста.", "sso-provider-not-supported": "Поставщик единого входа {{provider}} не поддерживается.", "stage-file-location-message": "Имя временного файла для хранения журналов запросов перед обработкой. Требуется абсолютный путь к файлу.", + "star-on-github-description": "Spread the word to help data enthusiasts discover OpenMetadata. Show your support by contributing to the open-source project with Stars!", "still-running-into-issue": "Если у вас по-прежнему возникают проблемы, свяжитесь с нами в Slack.", "success-status-for-entity-deploy": "<0>{{entity}} был {{entityStatus}} и успешно развернут", "successfully-completed-the-tour": "Вы успешно завершили экскурсию.", diff --git a/openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-cn.json b/openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-cn.json index d9e4865317b..b01bb2e1dc8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-cn.json +++ b/openmetadata-ui/src/main/resources/ui/src/locale/languages/zh-cn.json @@ -957,6 +957,7 @@ "sql-uppercase-query": "SQL查询", "sso-uppercase": "SSO", "stage-file-location": "临时文件位置", + "star": "Star", "star-open-metadata": "Star OpenMetadata", "star-us-on-github": "在 Github 上给我们点赞", "start-date-time-zone": "开始日期:({{timeZone}})", @@ -1561,6 +1562,7 @@ "sql-query-tooltip": "返回一行或多行的查询将导致测试失败", "sso-provider-not-supported": "不支持 SSO 提供程序{{provider}}", "stage-file-location-message": "临时文件名用于存储处理前的查询日志,需要使用绝对文件路径", + "star-on-github-description": "Spread the word to help data enthusiasts discover OpenMetadata. Show your support by contributing to the open-source project with Stars!", "still-running-into-issue": "如果您仍然遇到问题,请在 slack 上与我们联系", "success-status-for-entity-deploy": "<0>{{entity}}已{{entityStatus}}并成功部署", "successfully-completed-the-tour": "您已成功完成导览", diff --git a/openmetadata-ui/src/main/resources/ui/src/rest/commonAPI.ts b/openmetadata-ui/src/main/resources/ui/src/rest/commonAPI.ts new file mode 100644 index 00000000000..0b6e203da12 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/rest/commonAPI.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2023 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 axios from 'axios'; + +// type created based on used data, you can add types as per your requirement and api response +export interface RepositoryData { + stargazers_count: number; +} + +// api will provide us the OpenMetadata Repository Data +export const getRepositoryData = async () => { + const response = await axios.get( + 'https://api.github.com/repos/open-metadata/OpenMetadata' + ); + + return response.data as RepositoryData; +}; diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/WhatsNewModal.util.ts b/openmetadata-ui/src/main/resources/ui/src/utils/WhatsNewModal.util.ts index 9d5c025f92e..2832d95b915 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/WhatsNewModal.util.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/WhatsNewModal.util.ts @@ -11,6 +11,5 @@ * limitations under the License. */ -export const getReleaseVersionExpiry = () => { - return new Date(Date.now() + 60 * 60 * 24 * 31 * 1000); -}; +export const getReleaseVersionExpiry = () => + new Date(Date.now() + 60 * 60 * 24 * 31 * 1000);