diff --git a/packages/core/admin/admin/src/pages/Roles/ListPage/index.js b/packages/core/admin/admin/src/pages/Roles/ListPage/index.js index bdf4743e71b..b4ef24d995b 100644 --- a/packages/core/admin/admin/src/pages/Roles/ListPage/index.js +++ b/packages/core/admin/admin/src/pages/Roles/ListPage/index.js @@ -105,14 +105,14 @@ const RoleListPage = () => { }> {formatMessage({ id: 'Settings.roles.list.button.add', defaultMessage: 'Add new role', })} - )} + } title={formatMessage({ id: 'Settings.roles.title', defaultMessage: 'roles', @@ -126,14 +126,14 @@ const RoleListPage = () => { }> {formatMessage({ id: 'Settings.roles.list.button.add', defaultMessage: 'Add new role', })} - )} + } > diff --git a/packages/core/admin/admin/src/pages/Webhooks/ListView/index.js b/packages/core/admin/admin/src/pages/Webhooks/ListView/index.js index f52fc13a5ed..b5d06590bc2 100644 --- a/packages/core/admin/admin/src/pages/Webhooks/ListView/index.js +++ b/packages/core/admin/admin/src/pages/Webhooks/ListView/index.js @@ -6,25 +6,37 @@ import React, { useEffect, useReducer, useRef, useState } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; -import { Header, List } from '@buffetjs/custom'; -import { Button } from '@buffetjs/core'; -import { Plus } from '@buffetjs/icons'; -import { omit } from 'lodash'; import { useIntl } from 'react-intl'; import { request, - ListButton, PopUpWarning, useRBAC, LoadingIndicatorPage, - EmptyState, useNotification, + useFocusWhenNavigate, } from '@strapi/helper-plugin'; -import adminPermissions from '../../../permissions'; -import PageTitle from '../../../components/SettingsPageTitle'; -import { ListRow } from '../../../components/Webhooks'; -import Wrapper from './Wrapper'; + +import { HeaderLayout, Layout, ContentLayout } from '@strapi/parts/Layout'; +import { EmptyStateLayout } from '@strapi/parts/EmptyStateLayout'; +import { Row } from '@strapi/parts/Row'; +import { Stack } from '@strapi/parts/Stack'; +import { IconButton } from '@strapi/parts/IconButton'; +import { BaseCheckbox } from '@strapi/parts/BaseCheckbox'; +import { Table, Thead, Tr, Th, Tbody, Td, TFooter } from '@strapi/parts/Table'; +import { Text, TableLabel } from '@strapi/parts/Text'; +import { Button } from '@strapi/parts/Button'; +import { VisuallyHidden } from '@strapi/parts/VisuallyHidden'; +import { Switch } from '@strapi/parts/Switch'; +import { Main } from '@strapi/parts/Main'; +import { LinkButton } from '@strapi/parts/LinkButton'; +import { notifyStatus } from '@strapi/parts/LiveRegions'; +import AddIcon from '@strapi/icons/AddIcon'; +import EditIcon from '@strapi/icons/EditIcon'; +import DeleteIcon from '@strapi/icons/DeleteIcon'; +import EmptyStateDocument from '@strapi/icons/EmptyStateDocument'; import reducer, { initialState } from './reducer'; +import PageTitle from '../../../components/SettingsPageTitle'; +import adminPermissions from '../../../permissions'; function ListView() { const { @@ -35,12 +47,16 @@ function ListView() { const isMounted = useRef(true); const { formatMessage } = useIntl(); const [showModal, setShowModal] = useState(false); - const [{ webhooks, webhooksToDelete, webhookToDelete }, dispatch] = useReducer( + const [{ webhooks, webhooksToDelete, webhookToDelete, loadingWebhooks }, dispatch] = useReducer( reducer, initialState ); + + useFocusWhenNavigate(); const { push } = useHistory(); const { pathname } = useLocation(); + const rowsCount = webhooks.length; + const getWebhookIndex = id => webhooks.findIndex(webhook => webhook.id === id); useEffect(() => { isMounted.current = true; @@ -52,81 +68,12 @@ function ListView() { useEffect(() => { if (canRead) { - fetchData(); + fetchWebHooks(); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [canRead]); - const getWebhookIndex = id => webhooks.findIndex(webhook => webhook.id === id); - - // New button - const addBtnLabel = formatMessage({ - id: 'Settings.webhooks.list.button.add', - }); - - const newButtonProps = { - label: addBtnLabel, - onClick: () => handleGoTo('create'), - color: 'primary', - type: 'button', - icon: , - Component: props => { - if (canCreate) { - return
(canCreate ? handleGoTo('create') : {})} + icon={} + > + {formatMessage({ id: 'Settings.webhooks.list.field.add' })} + + } + > + + + + + + + + + + + {webhooks.map(webhook => ( + + + + + + + + ))} + +
+ 0 && webhooksToDelete.length < rowsCount + } + value={webhooksToDelete.length === rowsCount} + onValueChange={handleSelectAllCheckbox} + /> + + + {formatMessage({ id: 'Settings.webhooks.form.name' })} + + + + {formatMessage({ id: 'Settings.webhooks.form.url' })} + + + + {formatMessage({ id: 'Settings.webhooks.list.th.status' })} + + + + {formatMessage({ id: 'Settings.webhooks.list.th.actions' })} + +
+ handleSelectOneCheckbox(value, webhook.id)} + id="select" + name="select" + /> + + + {webhook.name} + + + {webhook.url} + + + handleEnabledChange(!webhook.isEnabled, webhook.id)} + visibleLabels + /> + + + + {canUpdate && ( + { + handleGoTo(webhook.id); + }} + label={formatMessage({ id: 'Settings.webhooks.events.update' })} + icon={} + noBorder + /> + )} + {canDelete && ( + handleDeleteClick(webhook.id)} + label={formatMessage({ id: 'Settings.webhooks.events.delete' })} + icon={} + noBorder + /> + )} + +
+ ) : ( + } + content={formatMessage({ id: 'Settings.webhooks.list.empty.description' })} + action={ + + } + /> + )} + + )} - {canCreate && } - secondaryAction={( + secondaryAction={ - )} + } title="Other CT" subtitle="36 entries found" as="h1" diff --git a/packages/core/admin/package.json b/packages/core/admin/package.json index 8c2aaae12d6..cd5c8294aaf 100644 --- a/packages/core/admin/package.json +++ b/packages/core/admin/package.json @@ -41,8 +41,8 @@ "@strapi/babel-plugin-switch-ee-ce": "1.0.0", "@strapi/helper-plugin": "3.6.6", "@strapi/utils": "3.6.6", - "@strapi/icons": "0.0.1-alpha.11", - "@strapi/parts": "0.0.1-alpha.11", + "@strapi/icons": "0.0.1-alpha.15", + "@strapi/parts": "0.0.1-alpha.15", "axios": "^0.21.1", "babel-loader": "8.2.2", "babel-plugin-styled-components": "1.12.0", diff --git a/yarn.lock b/yarn.lock index 662826e10cd..f1d9ab6ccc1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3497,15 +3497,15 @@ tslib "^2.0.0" upath "2.0.1" -"@strapi/icons@0.0.1-alpha.11": - version "0.0.1-alpha.11" - resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-0.0.1-alpha.11.tgz#a92b27f8f3fd6081249c07c6acc6e4aefe38bd68" - integrity sha512-BTl/2bGzCaVqhwj/vcmicL4Ya19J6NZ4A3O8MDDogoRwaDfHceLT1RpzKsID4x4kfXasopbNST1GzrJ2pvz9mw== - -"@strapi/parts@0.0.1-alpha.11": - version "0.0.1-alpha.11" - resolved "https://registry.yarnpkg.com/@strapi/parts/-/parts-0.0.1-alpha.11.tgz#ad42d40d979cabe73df4815faf2c65629a9b497d" - integrity sha512-tyPPZm0QIPh/hSMvtei0hum2S2XM3WmFALOXNGI8rSOyGLYnRzWf+phlyUNOYYuyxwEeNIR3vU+w3n7xpRpXiQ== +"@strapi/icons@0.0.1-alpha.15": + version "0.0.1-alpha.15" + resolved "https://registry.yarnpkg.com/@strapi/icons/-/icons-0.0.1-alpha.15.tgz#32fc824b732b4a21d5282f84696d6207ac5cbea1" + integrity sha512-FIczXDSEBPXTfptgqR6Hjh65Fpf4XF+kEm3o53PQX8G0GZ0Udpcbspqf2Kieeocg8TePgRkTI/oU6KS1aJbXrg== + +"@strapi/parts@0.0.1-alpha.15": + version "0.0.1-alpha.15" + resolved "https://registry.yarnpkg.com/@strapi/parts/-/parts-0.0.1-alpha.15.tgz#250cc29be0fa4cc2b91c8c0be49e1c2070a25450" + integrity sha512-VF4gp6xrowpnHBe3qJf0BHljZEXT8Y+oMk7XbW9HJ6w7Fxrm6SmmBfGb3LGFLxkzMj+5Log7FXD+ANER298r+A== dependencies: "@internationalized/number" "^3.0.2" compute-scroll-into-view "^1.0.17"