mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-02 21:53:30 +00:00
fix(ui): widget size labels (#13650)
* added localized labels for widget size selection * localization changes for other languages * fixed total assets widget overflow issue * Changed placeholder color while dragging widget
This commit is contained in:
parent
fc335f2aff
commit
b2d0c67275
@ -14,13 +14,14 @@
|
|||||||
import { CheckOutlined } from '@ant-design/icons';
|
import { CheckOutlined } from '@ant-design/icons';
|
||||||
import { Modal, Space, Tabs, TabsProps } from 'antd';
|
import { Modal, Space, Tabs, TabsProps } from 'antd';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import { isEmpty } from 'lodash';
|
import { isEmpty, toString } from 'lodash';
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { ERROR_PLACEHOLDER_TYPE } from '../../../enums/common.enum';
|
import { ERROR_PLACEHOLDER_TYPE } from '../../../enums/common.enum';
|
||||||
import { WidgetWidths } from '../../../enums/CustomizablePage.enum';
|
import { WidgetWidths } from '../../../enums/CustomizablePage.enum';
|
||||||
import { Document } from '../../../generated/entity/docStore/document';
|
import { Document } from '../../../generated/entity/docStore/document';
|
||||||
import { getAllKnowledgePanels } from '../../../rest/DocStoreAPI';
|
import { getAllKnowledgePanels } from '../../../rest/DocStoreAPI';
|
||||||
|
import { getWidgetWidthLabelFromKey } from '../../../utils/CustomizableLandingPageUtils';
|
||||||
import { showErrorToast } from '../../../utils/ToastUtils';
|
import { showErrorToast } from '../../../utils/ToastUtils';
|
||||||
import ErrorPlaceHolder from '../../common/error-with-placeholder/ErrorPlaceHolder';
|
import ErrorPlaceHolder from '../../common/error-with-placeholder/ErrorPlaceHolder';
|
||||||
import {
|
import {
|
||||||
@ -64,7 +65,7 @@ function AddWidgetModal({
|
|||||||
widgetsList?.map((widget) => {
|
widgetsList?.map((widget) => {
|
||||||
const widgetSizeOptions: Array<WidgetSizeInfo> =
|
const widgetSizeOptions: Array<WidgetSizeInfo> =
|
||||||
widget.data.gridSizes.map((size: WidgetWidths) => ({
|
widget.data.gridSizes.map((size: WidgetWidths) => ({
|
||||||
label: size,
|
label: getWidgetWidthLabelFromKey(toString(size)),
|
||||||
value: WidgetWidths[size],
|
value: WidgetWidths[size],
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* 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');
|
||||||
|
|
||||||
|
.grid-container {
|
||||||
|
.react-grid-item.react-grid-placeholder {
|
||||||
|
background-color: @announcement-background-dark;
|
||||||
|
}
|
||||||
|
}
|
@ -54,6 +54,7 @@ import ActivityFeedProvider from '../../ActivityFeed/ActivityFeedProvider/Activi
|
|||||||
import PageLayoutV1 from '../../containers/PageLayoutV1';
|
import PageLayoutV1 from '../../containers/PageLayoutV1';
|
||||||
import AddWidgetModal from '../AddWidgetModal/AddWidgetModal';
|
import AddWidgetModal from '../AddWidgetModal/AddWidgetModal';
|
||||||
import { CustomizeMyDataProps } from './CustomizeMyData.interface';
|
import { CustomizeMyDataProps } from './CustomizeMyData.interface';
|
||||||
|
import './CustomizeMyData.less';
|
||||||
|
|
||||||
const ReactGridLayout = WidthProvider(RGL);
|
const ReactGridLayout = WidthProvider(RGL);
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ const TotalDataAssetsWidget = ({
|
|||||||
</Row>
|
</Row>
|
||||||
)}
|
)}
|
||||||
{data.length ? (
|
{data.length ? (
|
||||||
<Row>
|
<Row className="h-95">
|
||||||
<Col span={isWidgetSizeLarge ? 14 : 24}>
|
<Col span={isWidgetSizeLarge ? 14 : 24}>
|
||||||
<Typography.Text className="font-medium">
|
<Typography.Text className="font-medium">
|
||||||
{t('label.data-insight-total-entity-summary')}
|
{t('label.data-insight-total-entity-summary')}
|
||||||
@ -160,7 +160,7 @@ const TotalDataAssetsWidget = ({
|
|||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
{isWidgetSizeLarge && (
|
{isWidgetSizeLarge && (
|
||||||
<Col span={10}>
|
<Col className="overflow-y-scroll h-max-full" span={10}>
|
||||||
<TotalEntityInsightSummary
|
<TotalEntityInsightSummary
|
||||||
entities={entities}
|
entities={entities}
|
||||||
latestData={latestData}
|
latestData={latestData}
|
||||||
|
@ -16,3 +16,8 @@
|
|||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.total-data-insight-card {
|
||||||
|
.ant-card-body {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -538,6 +538,7 @@
|
|||||||
"kpi-uppercase-plural": "KPIs",
|
"kpi-uppercase-plural": "KPIs",
|
||||||
"landing-page": "Landing Page",
|
"landing-page": "Landing Page",
|
||||||
"language": "Sprache",
|
"language": "Sprache",
|
||||||
|
"large": "Large",
|
||||||
"last": "Letzte",
|
"last": "Letzte",
|
||||||
"last-error": "Letzter Fehler",
|
"last-error": "Letzter Fehler",
|
||||||
"last-failed-at": "Zuletzt gescheitert am",
|
"last-failed-at": "Zuletzt gescheitert am",
|
||||||
@ -590,6 +591,7 @@
|
|||||||
"may": "Mai",
|
"may": "Mai",
|
||||||
"mean": "Durchschnitt",
|
"mean": "Durchschnitt",
|
||||||
"median": "Median",
|
"median": "Median",
|
||||||
|
"medium": "Medium",
|
||||||
"member-plural": "Mitglieder",
|
"member-plural": "Mitglieder",
|
||||||
"mention-plural": "Erwähnungen",
|
"mention-plural": "Erwähnungen",
|
||||||
"message-lowercase": "Nachricht",
|
"message-lowercase": "Nachricht",
|
||||||
@ -920,6 +922,7 @@
|
|||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"slack-support": "Slack-Unterstützung",
|
"slack-support": "Slack-Unterstützung",
|
||||||
"slash-symbol": "/",
|
"slash-symbol": "/",
|
||||||
|
"small": "Small",
|
||||||
"soft-delete": "Soft-Löschung",
|
"soft-delete": "Soft-Löschung",
|
||||||
"soft-lowercase": "soft",
|
"soft-lowercase": "soft",
|
||||||
"source": "Quelle",
|
"source": "Quelle",
|
||||||
|
@ -538,6 +538,7 @@
|
|||||||
"kpi-uppercase-plural": "KPIs",
|
"kpi-uppercase-plural": "KPIs",
|
||||||
"landing-page": "Landing Page",
|
"landing-page": "Landing Page",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
|
"large": "Large",
|
||||||
"last": "Last",
|
"last": "Last",
|
||||||
"last-error": "Last error",
|
"last-error": "Last error",
|
||||||
"last-failed-at": "Last Failed At",
|
"last-failed-at": "Last Failed At",
|
||||||
@ -590,6 +591,7 @@
|
|||||||
"may": "May",
|
"may": "May",
|
||||||
"mean": "Mean",
|
"mean": "Mean",
|
||||||
"median": "Median",
|
"median": "Median",
|
||||||
|
"medium": "Medium",
|
||||||
"member-plural": "Members",
|
"member-plural": "Members",
|
||||||
"mention-plural": "Mentions",
|
"mention-plural": "Mentions",
|
||||||
"message-lowercase": "message",
|
"message-lowercase": "message",
|
||||||
@ -920,6 +922,7 @@
|
|||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"slack-support": "Slack Support",
|
"slack-support": "Slack Support",
|
||||||
"slash-symbol": "/",
|
"slash-symbol": "/",
|
||||||
|
"small": "Small",
|
||||||
"soft-delete": "Soft Delete",
|
"soft-delete": "Soft Delete",
|
||||||
"soft-lowercase": "soft",
|
"soft-lowercase": "soft",
|
||||||
"source": "Source",
|
"source": "Source",
|
||||||
|
@ -538,6 +538,7 @@
|
|||||||
"kpi-uppercase-plural": "KPIs",
|
"kpi-uppercase-plural": "KPIs",
|
||||||
"landing-page": "Landing Page",
|
"landing-page": "Landing Page",
|
||||||
"language": "Idioma",
|
"language": "Idioma",
|
||||||
|
"large": "Large",
|
||||||
"last": "Último",
|
"last": "Último",
|
||||||
"last-error": "Último error",
|
"last-error": "Último error",
|
||||||
"last-failed-at": "Último fallo en",
|
"last-failed-at": "Último fallo en",
|
||||||
@ -590,6 +591,7 @@
|
|||||||
"may": "Mayo",
|
"may": "Mayo",
|
||||||
"mean": "Media",
|
"mean": "Media",
|
||||||
"median": "Mediana",
|
"median": "Mediana",
|
||||||
|
"medium": "Medium",
|
||||||
"member-plural": "Miembros",
|
"member-plural": "Miembros",
|
||||||
"mention-plural": "Menciones",
|
"mention-plural": "Menciones",
|
||||||
"message-lowercase": "mensaje",
|
"message-lowercase": "mensaje",
|
||||||
@ -920,6 +922,7 @@
|
|||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"slack-support": "Slack Support",
|
"slack-support": "Slack Support",
|
||||||
"slash-symbol": "/",
|
"slash-symbol": "/",
|
||||||
|
"small": "Small",
|
||||||
"soft-delete": "Borrado Suave",
|
"soft-delete": "Borrado Suave",
|
||||||
"soft-lowercase": "suave",
|
"soft-lowercase": "suave",
|
||||||
"source": "Fuente",
|
"source": "Fuente",
|
||||||
|
@ -538,6 +538,7 @@
|
|||||||
"kpi-uppercase-plural": "KPIs",
|
"kpi-uppercase-plural": "KPIs",
|
||||||
"landing-page": "Landing Page",
|
"landing-page": "Landing Page",
|
||||||
"language": "Langage",
|
"language": "Langage",
|
||||||
|
"large": "Large",
|
||||||
"last": "Dernier·ère",
|
"last": "Dernier·ère",
|
||||||
"last-error": "Dernière erreur",
|
"last-error": "Dernière erreur",
|
||||||
"last-failed-at": "Dernier Échec à",
|
"last-failed-at": "Dernier Échec à",
|
||||||
@ -590,6 +591,7 @@
|
|||||||
"may": "Mai",
|
"may": "Mai",
|
||||||
"mean": "Moyenne",
|
"mean": "Moyenne",
|
||||||
"median": "Médiane",
|
"median": "Médiane",
|
||||||
|
"medium": "Medium",
|
||||||
"member-plural": "Membres",
|
"member-plural": "Membres",
|
||||||
"mention-plural": "Mentions",
|
"mention-plural": "Mentions",
|
||||||
"message-lowercase": "message",
|
"message-lowercase": "message",
|
||||||
@ -920,6 +922,7 @@
|
|||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"slack-support": "Support Slack",
|
"slack-support": "Support Slack",
|
||||||
"slash-symbol": "/",
|
"slash-symbol": "/",
|
||||||
|
"small": "Small",
|
||||||
"soft-delete": "Suppression Logique (Soft delete)",
|
"soft-delete": "Suppression Logique (Soft delete)",
|
||||||
"soft-lowercase": "logique (soft)",
|
"soft-lowercase": "logique (soft)",
|
||||||
"source": "Source",
|
"source": "Source",
|
||||||
|
@ -538,6 +538,7 @@
|
|||||||
"kpi-uppercase-plural": "KPIs",
|
"kpi-uppercase-plural": "KPIs",
|
||||||
"landing-page": "Landing Page",
|
"landing-page": "Landing Page",
|
||||||
"language": "言語",
|
"language": "言語",
|
||||||
|
"large": "Large",
|
||||||
"last": "最新",
|
"last": "最新",
|
||||||
"last-error": "最新のエラー",
|
"last-error": "最新のエラー",
|
||||||
"last-failed-at": "最新のエラー",
|
"last-failed-at": "最新のエラー",
|
||||||
@ -590,6 +591,7 @@
|
|||||||
"may": "3月",
|
"may": "3月",
|
||||||
"mean": "Mean",
|
"mean": "Mean",
|
||||||
"median": "中央値",
|
"median": "中央値",
|
||||||
|
"medium": "Medium",
|
||||||
"member-plural": "メンバー",
|
"member-plural": "メンバー",
|
||||||
"mention-plural": "メンション",
|
"mention-plural": "メンション",
|
||||||
"message-lowercase": "メッセージ",
|
"message-lowercase": "メッセージ",
|
||||||
@ -920,6 +922,7 @@
|
|||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"slack-support": "Slack Support",
|
"slack-support": "Slack Support",
|
||||||
"slash-symbol": "/",
|
"slash-symbol": "/",
|
||||||
|
"small": "Small",
|
||||||
"soft-delete": "Soft Delete",
|
"soft-delete": "Soft Delete",
|
||||||
"soft-lowercase": "soft",
|
"soft-lowercase": "soft",
|
||||||
"source": "ソース",
|
"source": "ソース",
|
||||||
|
@ -538,6 +538,7 @@
|
|||||||
"kpi-uppercase-plural": "KPIs",
|
"kpi-uppercase-plural": "KPIs",
|
||||||
"landing-page": "Landing Page",
|
"landing-page": "Landing Page",
|
||||||
"language": "Idioma",
|
"language": "Idioma",
|
||||||
|
"large": "Large",
|
||||||
"last": "Último",
|
"last": "Último",
|
||||||
"last-error": "Último erro",
|
"last-error": "Último erro",
|
||||||
"last-failed-at": "Último erro em",
|
"last-failed-at": "Último erro em",
|
||||||
@ -590,6 +591,7 @@
|
|||||||
"may": "Maio",
|
"may": "Maio",
|
||||||
"mean": "Média",
|
"mean": "Média",
|
||||||
"median": "Mediana",
|
"median": "Mediana",
|
||||||
|
"medium": "Medium",
|
||||||
"member-plural": "Membros",
|
"member-plural": "Membros",
|
||||||
"mention-plural": "Menções",
|
"mention-plural": "Menções",
|
||||||
"message-lowercase": "mensagem",
|
"message-lowercase": "mensagem",
|
||||||
@ -920,6 +922,7 @@
|
|||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"slack-support": "Slack Support",
|
"slack-support": "Slack Support",
|
||||||
"slash-symbol": "/",
|
"slash-symbol": "/",
|
||||||
|
"small": "Small",
|
||||||
"soft-delete": "Exclusão Suave",
|
"soft-delete": "Exclusão Suave",
|
||||||
"soft-lowercase": "suave",
|
"soft-lowercase": "suave",
|
||||||
"source": "Fonte",
|
"source": "Fonte",
|
||||||
|
@ -538,6 +538,7 @@
|
|||||||
"kpi-uppercase-plural": "KPIs",
|
"kpi-uppercase-plural": "KPIs",
|
||||||
"landing-page": "Landing Page",
|
"landing-page": "Landing Page",
|
||||||
"language": "Язык",
|
"language": "Язык",
|
||||||
|
"large": "Large",
|
||||||
"last": "Последний",
|
"last": "Последний",
|
||||||
"last-error": "Последняя ошибка",
|
"last-error": "Последняя ошибка",
|
||||||
"last-failed-at": "Последний сбой в",
|
"last-failed-at": "Последний сбой в",
|
||||||
@ -590,6 +591,7 @@
|
|||||||
"may": "Май",
|
"may": "Май",
|
||||||
"mean": "Среднее",
|
"mean": "Среднее",
|
||||||
"median": "Медианна",
|
"median": "Медианна",
|
||||||
|
"medium": "Medium",
|
||||||
"member-plural": "Участники",
|
"member-plural": "Участники",
|
||||||
"mention-plural": "Упоминания",
|
"mention-plural": "Упоминания",
|
||||||
"message-lowercase": "сообщение",
|
"message-lowercase": "сообщение",
|
||||||
@ -920,6 +922,7 @@
|
|||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"slack-support": "Поддержка Slack",
|
"slack-support": "Поддержка Slack",
|
||||||
"slash-symbol": "/",
|
"slash-symbol": "/",
|
||||||
|
"small": "Small",
|
||||||
"soft-delete": "Мягкое удаление",
|
"soft-delete": "Мягкое удаление",
|
||||||
"soft-lowercase": "мягкий",
|
"soft-lowercase": "мягкий",
|
||||||
"source": "Источник",
|
"source": "Источник",
|
||||||
|
@ -538,6 +538,7 @@
|
|||||||
"kpi-uppercase-plural": "KPIs",
|
"kpi-uppercase-plural": "KPIs",
|
||||||
"landing-page": "Landing Page",
|
"landing-page": "Landing Page",
|
||||||
"language": "语言",
|
"language": "语言",
|
||||||
|
"large": "Large",
|
||||||
"last": "最近",
|
"last": "最近",
|
||||||
"last-error": "最近错误",
|
"last-error": "最近错误",
|
||||||
"last-failed-at": "最近失败时间",
|
"last-failed-at": "最近失败时间",
|
||||||
@ -590,6 +591,7 @@
|
|||||||
"may": "五月",
|
"may": "五月",
|
||||||
"mean": "平均值",
|
"mean": "平均值",
|
||||||
"median": "中位数",
|
"median": "中位数",
|
||||||
|
"medium": "Medium",
|
||||||
"member-plural": "成员",
|
"member-plural": "成员",
|
||||||
"mention-plural": "提及",
|
"mention-plural": "提及",
|
||||||
"message-lowercase": "消息",
|
"message-lowercase": "消息",
|
||||||
@ -920,6 +922,7 @@
|
|||||||
"slack": "Slack",
|
"slack": "Slack",
|
||||||
"slack-support": "Slack 支持",
|
"slack-support": "Slack 支持",
|
||||||
"slash-symbol": "/",
|
"slash-symbol": "/",
|
||||||
|
"small": "Small",
|
||||||
"soft-delete": "软删除",
|
"soft-delete": "软删除",
|
||||||
"soft-lowercase": "软",
|
"soft-lowercase": "软",
|
||||||
"source": "源",
|
"source": "源",
|
||||||
|
@ -279,6 +279,9 @@
|
|||||||
.h-full {
|
.h-full {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.h-95 {
|
||||||
|
height: 95%;
|
||||||
|
}
|
||||||
.h-max-full {
|
.h-max-full {
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { isEmpty, isUndefined, max, uniqueId } from 'lodash';
|
import i18next from 'i18next';
|
||||||
|
import { capitalize, isEmpty, isUndefined, max, uniqueId } from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Layout } from 'react-grid-layout';
|
import { Layout } from 'react-grid-layout';
|
||||||
import EmptyWidgetPlaceholder from '../components/CustomizableComponents/EmptyWidgetPlaceholder/EmptyWidgetPlaceholder';
|
import EmptyWidgetPlaceholder from '../components/CustomizableComponents/EmptyWidgetPlaceholder/EmptyWidgetPlaceholder';
|
||||||
@ -142,6 +143,19 @@ export const getWidgetWidth = (widget: Document) => {
|
|||||||
return widgetSize as number;
|
return widgetSize as number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getWidgetWidthLabelFromKey = (widgetKey: string) => {
|
||||||
|
switch (widgetKey) {
|
||||||
|
case 'large':
|
||||||
|
return i18next.t('label.large');
|
||||||
|
case 'medium':
|
||||||
|
return i18next.t('label.medium');
|
||||||
|
case 'small':
|
||||||
|
return i18next.t('label.small');
|
||||||
|
default:
|
||||||
|
return capitalize(widgetKey);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const getAllWidgetsArray = (layout: WidgetConfig[]) => {
|
const getAllWidgetsArray = (layout: WidgetConfig[]) => {
|
||||||
const widgetsArray: WidgetConfig[] = [];
|
const widgetsArray: WidgetConfig[] = [];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user