mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Updated add team website form.
This commit is contained in:
parent
c990459238
commit
a14e11bae2
18 changed files with 149 additions and 129 deletions
57
src/app/(main)/settings/websites/WebsitesDataTable.js
Normal file
57
src/app/(main)/settings/websites/WebsitesDataTable.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
'use client';
|
||||
import WebsitesTable from 'app/(main)/settings/websites/WebsitesTable';
|
||||
import useUser from 'components/hooks/useUser';
|
||||
import useApi from 'components/hooks/useApi';
|
||||
import DataTable from 'components/common/DataTable';
|
||||
import useFilterQuery from 'components/hooks/useFilterQuery';
|
||||
import WebsitesHeader from './WebsitesHeader';
|
||||
|
||||
function useWebsites({ includeTeams, onlyTeams }) {
|
||||
const { user } = useUser();
|
||||
const { get } = useApi();
|
||||
return useFilterQuery(
|
||||
['websites', { includeTeams, onlyTeams }],
|
||||
params => {
|
||||
return get(`/users/${user?.id}/websites`, {
|
||||
includeTeams,
|
||||
onlyTeams,
|
||||
...params,
|
||||
});
|
||||
},
|
||||
{ enabled: !!user },
|
||||
);
|
||||
}
|
||||
|
||||
export function WebsitesDataTable({
|
||||
showHeader = true,
|
||||
showEditButton = true,
|
||||
showViewButton = true,
|
||||
showActions = true,
|
||||
showTeam,
|
||||
includeTeams,
|
||||
onlyTeams,
|
||||
children,
|
||||
}) {
|
||||
const queryResult = useWebsites({ includeTeams, onlyTeams });
|
||||
|
||||
return (
|
||||
<>
|
||||
{showHeader && <WebsitesHeader />}
|
||||
<DataTable queryResult={queryResult}>
|
||||
{({ data }) => (
|
||||
<WebsitesTable
|
||||
data={data}
|
||||
showTeam={showTeam}
|
||||
showActions={showActions}
|
||||
showEditButton={showEditButton}
|
||||
showViewButton={showViewButton}
|
||||
>
|
||||
{children}
|
||||
</WebsitesTable>
|
||||
)}
|
||||
</DataTable>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default WebsitesDataTable;
|
||||
Loading…
Add table
Add a link
Reference in a new issue