mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-01 05:36:58 +00:00
* Fixed #668 UI: Should have some search box for Services page. * searchbar fix
This commit is contained in:
parent
d96da13d86
commit
0e18dca0fd
@ -181,7 +181,7 @@ const Appbar: React.FC = (): JSX.Element => {
|
|||||||
data-testid="appbar-item">
|
data-testid="appbar-item">
|
||||||
<span className="fa fa-search tw-absolute tw-block tw-z-10 tw-w-9 tw-h-8 tw-leading-8 tw-text-center tw-pointer-events-none tw-text-gray-400" />
|
<span className="fa fa-search tw-absolute tw-block tw-z-10 tw-w-9 tw-h-8 tw-leading-8 tw-text-center tw-pointer-events-none tw-text-gray-400" />
|
||||||
<input
|
<input
|
||||||
className="tw-relative search-grey tw-rounded tw-border tw-border-main tw-bg-body-main focus:tw-outline-none tw-pl-8 tw-py-1"
|
className="tw-relative search-grey tw-rounded tw-border tw-border-main tw-bg-body-main focus:tw-outline-none tw-pl-8 tw-py-1 tw-form-inputs"
|
||||||
id="searchBox"
|
id="searchBox"
|
||||||
type="text"
|
type="text"
|
||||||
value={searchValue || ''}
|
value={searchValue || ''}
|
||||||
|
@ -70,6 +70,7 @@ const Searchbar = ({
|
|||||||
data-testid="search-bar-container">
|
data-testid="search-bar-container">
|
||||||
{label !== '' && <label>{label}</label>}
|
{label !== '' && <label>{label}</label>}
|
||||||
<div className="tw-flex tw-bg-body-main tw-h-8">
|
<div className="tw-flex tw-bg-body-main tw-h-8">
|
||||||
|
<span className="fa fa-search tw-absolute tw-block tw-z-10 tw-w-9 tw-h-8 tw-leading-8 tw-text-center tw-pointer-events-none tw-text-gray-400" />
|
||||||
{/* <div className="tw-flex-initial">
|
{/* <div className="tw-flex-initial">
|
||||||
<span className="input-group-text1 tw-pr-3 tw-py-1.5 tw-flex">
|
<span className="input-group-text1 tw-pr-3 tw-py-1.5 tw-flex">
|
||||||
<SVGIcons
|
<SVGIcons
|
||||||
@ -80,7 +81,7 @@ const Searchbar = ({
|
|||||||
</span>
|
</span>
|
||||||
</div> */}
|
</div> */}
|
||||||
<input
|
<input
|
||||||
className="tw-form-inputs tw-px-3 tw-py-1"
|
className="tw-form-inputs tw-relative tw-px-3 tw-py-1 tw-pl-8"
|
||||||
data-testid="searchbar"
|
data-testid="searchbar"
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { AxiosError, AxiosResponse } from 'axios';
|
import { AxiosError, AxiosResponse } from 'axios';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { isNull } from 'lodash';
|
import { isNull, lowerCase } from 'lodash';
|
||||||
import { ServiceCollection, ServiceData, ServiceTypes } from 'Models';
|
import { ServiceCollection, ServiceData, ServiceTypes } from 'Models';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
@ -30,6 +30,7 @@ import {
|
|||||||
} from '../../axiosAPIs/serviceAPI';
|
} from '../../axiosAPIs/serviceAPI';
|
||||||
import NonAdminAction from '../../components/common/non-admin-action/NonAdminAction';
|
import NonAdminAction from '../../components/common/non-admin-action/NonAdminAction';
|
||||||
import RichTextEditorPreviewer from '../../components/common/rich-text-editor/RichTextEditorPreviewer';
|
import RichTextEditorPreviewer from '../../components/common/rich-text-editor/RichTextEditorPreviewer';
|
||||||
|
import Searchbar from '../../components/common/searchbar/Searchbar';
|
||||||
import PageContainer from '../../components/containers/PageContainer';
|
import PageContainer from '../../components/containers/PageContainer';
|
||||||
import Loader from '../../components/Loader/Loader';
|
import Loader from '../../components/Loader/Loader';
|
||||||
import {
|
import {
|
||||||
@ -94,6 +95,7 @@ const ServicesPage = () => {
|
|||||||
const [serviceList, setServiceList] = useState<Array<ServiceDataObj>>([]);
|
const [serviceList, setServiceList] = useState<Array<ServiceDataObj>>([]);
|
||||||
const [editData, setEditData] = useState<ServiceDataObj>();
|
const [editData, setEditData] = useState<ServiceDataObj>();
|
||||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||||
|
const [searchText, setSearchText] = useState('');
|
||||||
|
|
||||||
const updateServiceList = (
|
const updateServiceList = (
|
||||||
allServiceCollectionArr: Array<ServiceCollection>
|
allServiceCollectionArr: Array<ServiceCollection>
|
||||||
@ -126,7 +128,17 @@ const ServicesPage = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const handleSearchAction = (searchValue: string) => {
|
||||||
|
setSearchText(searchValue);
|
||||||
|
const curServ = services[serviceName];
|
||||||
|
setServiceList(
|
||||||
|
(curServ as unknown as Array<ServiceDataObj>).filter(
|
||||||
|
(serv) =>
|
||||||
|
serv.description?.includes(lowerCase(searchValue)) ||
|
||||||
|
serv.name?.includes(lowerCase(searchValue))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
const handleAddService = () => {
|
const handleAddService = () => {
|
||||||
setEditData(undefined);
|
setEditData(undefined);
|
||||||
setIsModalOpen(true);
|
setIsModalOpen(true);
|
||||||
@ -360,6 +372,14 @@ const ServicesPage = () => {
|
|||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="md:tw-w-2/6 sm:tw-w-2/5">
|
||||||
|
<Searchbar
|
||||||
|
placeholder={`Search for ${servicesDisplayName[serviceName]}...`}
|
||||||
|
searchValue={searchText}
|
||||||
|
typingInterval={1500}
|
||||||
|
onSearch={handleSearchAction}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
{serviceList.length ? (
|
{serviceList.length ? (
|
||||||
<div
|
<div
|
||||||
className="tw-grid tw-grid-cols-4 tw-gap-4"
|
className="tw-grid tw-grid-cols-4 tw-gap-4"
|
||||||
@ -492,8 +512,10 @@ const ServicesPage = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="tw-mt-11">
|
<div className="tw-mt-11">
|
||||||
<p className="tw-text-lg">
|
<p className="tw-text-lg tw-text-center">
|
||||||
No services found.{' '}
|
No services found for {`"${searchText}"`}
|
||||||
|
</p>
|
||||||
|
<p className="tw-text-lg tw-text-center">
|
||||||
<button
|
<button
|
||||||
className="link-text tw-underline"
|
className="link-text tw-underline"
|
||||||
onClick={handleAddService}>
|
onClick={handleAddService}>
|
||||||
|
@ -242,9 +242,7 @@
|
|||||||
.horz-separator {
|
.horz-separator {
|
||||||
@apply tw-border-b tw-border-separator;
|
@apply tw-border-b tw-border-separator;
|
||||||
}
|
}
|
||||||
.side-panel .activeCategory {
|
|
||||||
@apply tw--mx-4 tw-pl-4 tw-pr-3 tw-py-1 tw-border-r-4 tw-border-orange-400;
|
|
||||||
}
|
|
||||||
.side-panel .activeCategory .tag-category {
|
.side-panel .activeCategory .tag-category {
|
||||||
@apply tw-text-primary tw-font-medium;
|
@apply tw-text-primary tw-font-medium;
|
||||||
}
|
}
|
||||||
|
@ -405,13 +405,6 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
.side-panel .activeCategory {
|
|
||||||
margin-right: -15px;
|
|
||||||
margin-left: -15px;
|
|
||||||
padding: 0px 15px;
|
|
||||||
border-right: 3px solid rgba(249, 130, 108);
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-wrapper + .page-container .side-panel {
|
.search-wrapper + .page-container .side-panel {
|
||||||
top: 102px;
|
top: 102px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user