mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-11 16:58:38 +00:00
Minor:Restyled button group (#20714)
* restyled button group * updated border radius * fixed button group hover|| modified all other button group * fixed comments * removed segmented values * made constant
This commit is contained in:
parent
06953ee266
commit
b1fc83092a
@ -10,7 +10,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { Col, Radio, RadioChangeEvent, Row, Tooltip, Typography } from 'antd';
|
import { Col, Row, Segmented, Tooltip, Typography } from 'antd';
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { cloneDeep, groupBy, isEmpty, isUndefined, uniqBy } from 'lodash';
|
import { cloneDeep, groupBy, isEmpty, isUndefined, uniqBy } from 'lodash';
|
||||||
@ -90,6 +90,16 @@ const APIEndpointSchema: FC<APIEndpointSchemaProps> = ({
|
|||||||
onUpdate: onApiEndpointUpdate,
|
onUpdate: onApiEndpointUpdate,
|
||||||
} = useGenericContext<APIEndpoint>();
|
} = useGenericContext<APIEndpoint>();
|
||||||
|
|
||||||
|
const viewTypeOptions = [
|
||||||
|
{
|
||||||
|
label: t('label.request'),
|
||||||
|
value: SchemaViewType.REQUEST_SCHEMA,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('label.response'),
|
||||||
|
value: SchemaViewType.RESPONSE_SCHEMA,
|
||||||
|
},
|
||||||
|
];
|
||||||
const {
|
const {
|
||||||
requestSchemaAllRowKeys,
|
requestSchemaAllRowKeys,
|
||||||
responseSchemaAllRowKeys,
|
responseSchemaAllRowKeys,
|
||||||
@ -182,10 +192,6 @@ const APIEndpointSchema: FC<APIEndpointSchemaProps> = ({
|
|||||||
return activeSchemaDiff?.schemaFields ?? [];
|
return activeSchemaDiff?.schemaFields ?? [];
|
||||||
}, [activeSchema, apiEndpointDetails]);
|
}, [activeSchema, apiEndpointDetails]);
|
||||||
|
|
||||||
const handleViewChange = (e: RadioChangeEvent) => {
|
|
||||||
setViewType(e.target.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleExpandedRowsChange = (keys: readonly Key[]) => {
|
const handleExpandedRowsChange = (keys: readonly Key[]) => {
|
||||||
setExpandedRowKeys(keys as string[]);
|
setExpandedRowKeys(keys as string[]);
|
||||||
};
|
};
|
||||||
@ -405,14 +411,13 @@ const APIEndpointSchema: FC<APIEndpointSchemaProps> = ({
|
|||||||
}}
|
}}
|
||||||
extraTableFilters={
|
extraTableFilters={
|
||||||
<div className="d-flex justify-between items-center w-full">
|
<div className="d-flex justify-between items-center w-full">
|
||||||
<Radio.Group value={viewType} onChange={handleViewChange}>
|
<Segmented
|
||||||
<Radio.Button value={SchemaViewType.REQUEST_SCHEMA}>
|
className="segment-toggle"
|
||||||
{t('label.request')}
|
options={viewTypeOptions}
|
||||||
</Radio.Button>
|
value={viewType}
|
||||||
<Radio.Button value={SchemaViewType.RESPONSE_SCHEMA}>
|
onChange={(value) => setViewType(value as SchemaViewType)}
|
||||||
{t('label.response')}
|
/>
|
||||||
</Radio.Button>
|
|
||||||
</Radio.Group>
|
|
||||||
<ToggleExpandButton
|
<ToggleExpandButton
|
||||||
allRowKeys={schemaAllRowKeys}
|
allRowKeys={schemaAllRowKeys}
|
||||||
expandedRowKeys={expandedRowKeys}
|
expandedRowKeys={expandedRowKeys}
|
||||||
|
@ -18,8 +18,8 @@ import {
|
|||||||
DatePicker,
|
DatePicker,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
MenuProps,
|
MenuProps,
|
||||||
Radio,
|
|
||||||
Row,
|
Row,
|
||||||
|
Segmented,
|
||||||
Space,
|
Space,
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import { RangePickerProps } from 'antd/lib/date-picker';
|
import { RangePickerProps } from 'antd/lib/date-picker';
|
||||||
@ -144,15 +144,14 @@ const ExecutionsTab = ({ pipelineFQN, tasks }: ExecutionProps) => {
|
|||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<Space className="justify-between w-full">
|
<Space className="justify-between w-full">
|
||||||
<Radio.Group
|
<Segmented
|
||||||
buttonStyle="solid"
|
className="segment-toggle"
|
||||||
className="radio-switch"
|
|
||||||
data-testid="radio-switch"
|
data-testid="radio-switch"
|
||||||
optionType="button"
|
|
||||||
options={Object.values(PIPELINE_EXECUTION_TABS)}
|
options={Object.values(PIPELINE_EXECUTION_TABS)}
|
||||||
value={view}
|
value={view}
|
||||||
onChange={(e) => setView(e.target.value)}
|
onChange={(value) => setView(value as PIPELINE_EXECUTION_TABS)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Space>
|
<Space>
|
||||||
<Dropdown menu={statusMenuItems} placement="bottom">
|
<Dropdown menu={statusMenuItems} placement="bottom">
|
||||||
<Button
|
<Button
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import Icon from '@ant-design/icons';
|
import Icon from '@ant-design/icons';
|
||||||
import { Card, Radio, Typography } from 'antd';
|
import { Card, Segmented, Typography } from 'antd';
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import { groupBy, isEmpty, isUndefined, uniqBy } from 'lodash';
|
import { groupBy, isEmpty, isUndefined, uniqBy } from 'lodash';
|
||||||
import { EntityTags, TagFilterOptions } from 'Models';
|
import { EntityTags, TagFilterOptions } from 'Models';
|
||||||
@ -294,14 +294,12 @@ export const PipelineTaskTab = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Radio.Group
|
<Segmented
|
||||||
buttonStyle="solid"
|
className="segment-toggle m-b-md"
|
||||||
className="radio-switch m-b-md"
|
|
||||||
data-testid="pipeline-task-switch"
|
data-testid="pipeline-task-switch"
|
||||||
optionType="button"
|
|
||||||
options={Object.values(PIPELINE_TASK_TABS)}
|
options={Object.values(PIPELINE_TASK_TABS)}
|
||||||
value={activeTab}
|
value={activeTab}
|
||||||
onChange={(e) => setActiveTab(e.target.value)}
|
onChange={(value) => setActiveTab(value as PIPELINE_TASK_TABS)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{activeTab === PIPELINE_TASK_TABS.LIST_VIEW ? (
|
{activeTab === PIPELINE_TASK_TABS.LIST_VIEW ? (
|
||||||
|
@ -11,15 +11,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { Col, Row, Segmented, Tag, Tooltip, Typography } from 'antd';
|
||||||
Col,
|
|
||||||
Radio,
|
|
||||||
RadioChangeEvent,
|
|
||||||
Row,
|
|
||||||
Tag,
|
|
||||||
Tooltip,
|
|
||||||
Typography,
|
|
||||||
} from 'antd';
|
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import { Key } from 'antd/lib/table/interface';
|
import { Key } from 'antd/lib/table/interface';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
@ -82,6 +74,14 @@ const TopicSchemaFields: FC<TopicSchemaFieldsProps> = ({
|
|||||||
const [viewType, setViewType] = useState<SchemaViewType>(
|
const [viewType, setViewType] = useState<SchemaViewType>(
|
||||||
SchemaViewType.FIELDS
|
SchemaViewType.FIELDS
|
||||||
);
|
);
|
||||||
|
const viewTypeOptions = [
|
||||||
|
{
|
||||||
|
label: t('label.field-plural'),
|
||||||
|
value: SchemaViewType.FIELDS,
|
||||||
|
},
|
||||||
|
{ label: t('label.text'), value: SchemaViewType.TEXT },
|
||||||
|
];
|
||||||
|
|
||||||
const { fqn: entityFqn } = useFqn();
|
const { fqn: entityFqn } = useFqn();
|
||||||
const {
|
const {
|
||||||
data: topicDetails,
|
data: topicDetails,
|
||||||
@ -312,10 +312,6 @@ const TopicSchemaFields: FC<TopicSchemaFieldsProps> = ({
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleViewChange = (e: RadioChangeEvent) => {
|
|
||||||
setViewType(e.target.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setExpandedRowKeys(schemaAllRowKeys);
|
setExpandedRowKeys(schemaAllRowKeys);
|
||||||
}, []);
|
}, []);
|
||||||
@ -339,14 +335,12 @@ const TopicSchemaFields: FC<TopicSchemaFieldsProps> = ({
|
|||||||
<>
|
<>
|
||||||
{!isEmpty(messageSchema?.schemaFields) && !isVersionView && (
|
{!isEmpty(messageSchema?.schemaFields) && !isVersionView && (
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<Radio.Group value={viewType} onChange={handleViewChange}>
|
<Segmented
|
||||||
<Radio.Button value={SchemaViewType.FIELDS}>
|
className="segment-toggle"
|
||||||
{t('label.field-plural')}
|
options={viewTypeOptions}
|
||||||
</Radio.Button>
|
value={viewType}
|
||||||
<Radio.Button value={SchemaViewType.TEXT}>
|
onChange={(value) => setViewType(value as SchemaViewType)}
|
||||||
{t('label.text')}
|
/>
|
||||||
</Radio.Button>
|
|
||||||
</Radio.Group>
|
|
||||||
</Col>
|
</Col>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import Icon from '@ant-design/icons';
|
import Icon from '@ant-design/icons';
|
||||||
import { Col, Radio, Row, Space, Switch, Typography } from 'antd';
|
import { Col, Row, Segmented, Space, Switch, Typography } from 'antd';
|
||||||
import { isEmpty, isUndefined } from 'lodash';
|
import { isEmpty, isUndefined } from 'lodash';
|
||||||
import React, { useMemo, useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -41,6 +41,17 @@ export const ListView = <T extends object = any>({
|
|||||||
);
|
);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const listViewOptions = [
|
||||||
|
{
|
||||||
|
label: <Icon component={GridIcon} data-testid="grid" />,
|
||||||
|
value: ListViewOptions.CARD,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: <Icon component={ListIcon} data-testid="list" />,
|
||||||
|
value: ListViewOptions.TABLE,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const cardRender = useMemo(() => {
|
const cardRender = useMemo(() => {
|
||||||
if (isEmpty(tableProps.dataSource)) {
|
if (isEmpty(tableProps.dataSource)) {
|
||||||
return tableProps.locale?.emptyText;
|
return tableProps.locale?.emptyText;
|
||||||
@ -82,16 +93,12 @@ export const ListView = <T extends object = any>({
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Radio.Group
|
<Segmented
|
||||||
|
className="segment-toggle"
|
||||||
|
options={listViewOptions}
|
||||||
value={currentView}
|
value={currentView}
|
||||||
onChange={(e) => setCurrentView(e.target.value)}>
|
onChange={(value) => setCurrentView(value as ListViewOptions)}
|
||||||
<Radio.Button value={ListViewOptions.CARD}>
|
/>
|
||||||
<Icon component={GridIcon} data-testid="grid" />
|
|
||||||
</Radio.Button>
|
|
||||||
<Radio.Button value={ListViewOptions.TABLE}>
|
|
||||||
<Icon component={ListIcon} data-testid="list" />
|
|
||||||
</Radio.Button>
|
|
||||||
</Radio.Group>
|
|
||||||
</Space>
|
</Space>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@import '../variables.less';
|
@import (reference) url('../variables.less');
|
||||||
|
|
||||||
.radio-switch {
|
.radio-switch {
|
||||||
.ant-radio-button-wrapper,
|
.ant-radio-button-wrapper,
|
||||||
@ -36,3 +36,46 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Global styling for segment toggle classs
|
||||||
|
.segment-toggle {
|
||||||
|
background: @white;
|
||||||
|
border-radius: @size-sm;
|
||||||
|
border: 1px solid @grey-20;
|
||||||
|
|
||||||
|
.ant-segmented-item {
|
||||||
|
color: @text-color;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&-selected {
|
||||||
|
background: @blue-23;
|
||||||
|
color: @blue-9;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: @size-xs;
|
||||||
|
.ant-segmented-item-label {
|
||||||
|
color: @blue-9;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg path {
|
||||||
|
fill: @blue-9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
background: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-segmented:not(.ant-segmented-disabled):hover,
|
||||||
|
.ant-segmented:not(.ant-segmented-disabled):focus {
|
||||||
|
background: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.segment-toggle.ant-segmented {
|
||||||
|
background-color: @white;
|
||||||
|
border-radius: @size-sm;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user