mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-06 07:04:45 +09:00
1 parent
fd9d87a450
commit
de7195cd36
15 files changed
+253
-119
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 841 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
@@ -1,17 +1,25 @@
|
||||
import React, { memo } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
import TemplateIcon from '@material-ui/icons/Description'
|
||||
import SelectCard from 'client/components/Cards/SelectCard'
|
||||
|
||||
const DEFAULT_IMAGE = '/client/assets/provider.png'
|
||||
|
||||
const ProviderCard = memo(({ value, actions }) => {
|
||||
const { ID, NAME } = value
|
||||
const { ID, NAME, TEMPLATE: { PLAIN = '{}' } } = value
|
||||
const { image = DEFAULT_IMAGE } = JSON.parse(PLAIN)
|
||||
|
||||
return (
|
||||
<SelectCard
|
||||
title={`${ID} - ${NAME}`}
|
||||
icon={<TemplateIcon />}
|
||||
actions={actions}
|
||||
mediaProps={{
|
||||
component: 'img',
|
||||
image,
|
||||
onError: evt => {
|
||||
evt.target.src = DEFAULT_IMAGE
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
})
|
||||
@@ -19,7 +27,14 @@ const ProviderCard = memo(({ value, actions }) => {
|
||||
ProviderCard.propTypes = {
|
||||
value: PropTypes.shape({
|
||||
ID: PropTypes.string.isRequired,
|
||||
NAME: PropTypes.string.isRequired
|
||||
NAME: PropTypes.string.isRequired,
|
||||
TEMPLATE: PropTypes.shape({
|
||||
PLAIN: PropTypes.string,
|
||||
PROVISION_BODY: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.object
|
||||
])
|
||||
})
|
||||
}),
|
||||
actions: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
import React, { memo } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
import FileIcon from '@material-ui/icons/Description'
|
||||
import SelectCard from 'client/components/Cards/SelectCard'
|
||||
|
||||
const ProviderTemplateCard = memo(
|
||||
({ value, handleClick }) => {
|
||||
const { name } = value
|
||||
|
||||
return (
|
||||
<SelectCard
|
||||
title={name}
|
||||
handleClick={handleClick}
|
||||
icon={<FileIcon />}
|
||||
/>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
ProviderTemplateCard.propTypes = {
|
||||
value: PropTypes.shape({
|
||||
name: PropTypes.string.isRequired
|
||||
}),
|
||||
handleClick: PropTypes.func
|
||||
}
|
||||
|
||||
ProviderTemplateCard.defaultProps = {
|
||||
value: {},
|
||||
handleClick: undefined
|
||||
}
|
||||
|
||||
ProviderTemplateCard.displayName = 'ProviderTemplateCard'
|
||||
|
||||
export default ProviderTemplateCard
|
||||
@@ -1,17 +1,25 @@
|
||||
import React, { memo } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
import ProvisionIcon from '@material-ui/icons/Cloud'
|
||||
import SelectCard from 'client/components/Cards/SelectCard'
|
||||
|
||||
const DEFAULT_IMAGE = '/client/assets/provision.jpg'
|
||||
|
||||
const ProvisionCard = memo(({ value, actions }) => {
|
||||
const { ID, NAME } = value
|
||||
const { ID, NAME, TEMPLATE: { PLAIN = '{}' } } = value
|
||||
const { image = DEFAULT_IMAGE } = JSON.parse(PLAIN)
|
||||
|
||||
return (
|
||||
<SelectCard
|
||||
title={`${ID} - ${NAME}`}
|
||||
icon={<ProvisionIcon />}
|
||||
actions={actions}
|
||||
mediaProps={{
|
||||
component: 'img',
|
||||
image,
|
||||
onError: evt => {
|
||||
evt.target.src = DEFAULT_IMAGE
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
})
|
||||
@@ -19,7 +27,14 @@ const ProvisionCard = memo(({ value, actions }) => {
|
||||
ProvisionCard.propTypes = {
|
||||
value: PropTypes.shape({
|
||||
ID: PropTypes.string.isRequired,
|
||||
NAME: PropTypes.string.isRequired
|
||||
NAME: PropTypes.string.isRequired,
|
||||
TEMPLATE: PropTypes.shape({
|
||||
PLAIN: PropTypes.string,
|
||||
PROVISION_BODY: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.object
|
||||
])
|
||||
})
|
||||
}),
|
||||
actions: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import React, { memo } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
import { Avatar } from '@material-ui/core'
|
||||
import SelectCard from 'client/components/Cards/SelectCard'
|
||||
|
||||
const PROVIDER_IMAGE = '/client/assets/provider.png'
|
||||
const PROVISION_IMAGE = '/client/assets/provision.jpg'
|
||||
|
||||
const ProvisionTemplateCard = memo(
|
||||
({ value, isProvider, isSelected, handleClick }) => {
|
||||
const { name, plain: { image } = {} } = value
|
||||
const DEFAULT_IMG = isProvider ? PROVIDER_IMAGE : PROVISION_IMAGE
|
||||
|
||||
return (
|
||||
<SelectCard
|
||||
stylesProps={{ minHeight: 80 }}
|
||||
title={name}
|
||||
isSelected={isSelected}
|
||||
handleClick={handleClick}
|
||||
icon={
|
||||
<Avatar
|
||||
src={image ?? DEFAULT_IMG}
|
||||
variant="rounded"
|
||||
style={{ width: 100, height: 80 }}
|
||||
imgProps={{
|
||||
onError: evt => {
|
||||
evt.target.src = DEFAULT_IMG
|
||||
}
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
ProvisionTemplateCard.propTypes = {
|
||||
value: PropTypes.shape({
|
||||
name: PropTypes.string.isRequired,
|
||||
plain: PropTypes.shape({
|
||||
image: PropTypes.string
|
||||
})
|
||||
}),
|
||||
isProvider: PropTypes.bool,
|
||||
isSelected: PropTypes.bool,
|
||||
handleClick: PropTypes.func
|
||||
}
|
||||
|
||||
ProvisionTemplateCard.defaultProps = {
|
||||
value: {},
|
||||
isProvider: undefined,
|
||||
isSelected: undefined,
|
||||
handleClick: undefined
|
||||
}
|
||||
|
||||
ProvisionTemplateCard.displayName = 'ProvisionTemplateCard'
|
||||
|
||||
export default ProvisionTemplateCard
|
||||
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
||||
import clsx from 'clsx'
|
||||
|
||||
import {
|
||||
makeStyles, Card, CardActionArea, CardHeader, CardActions, IconButton
|
||||
makeStyles, Card, CardActionArea, CardHeader, CardActions, IconButton, CardMedia
|
||||
} from '@material-ui/core'
|
||||
import { Skeleton } from '@material-ui/lab'
|
||||
|
||||
@@ -11,7 +11,10 @@ import useNearScreen from 'client/hooks/useNearScreen'
|
||||
import ConditionalWrap from 'client/components/HOC/ConditionalWrap'
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: { height: '100%' },
|
||||
root: {
|
||||
height: '100%',
|
||||
display: ({ isMedia }) => isMedia ? 'flex' : 'block'
|
||||
},
|
||||
selected: {
|
||||
color: theme.palette.primary.contrastText,
|
||||
backgroundColor: theme.palette.primary.main,
|
||||
@@ -23,13 +26,20 @@ const useStyles = makeStyles(theme => ({
|
||||
color: 'inherit'
|
||||
}
|
||||
},
|
||||
actionArea: {
|
||||
actionArea: ({ minHeight = 140, isMedia }) => ({
|
||||
height: '100%',
|
||||
minHeight: ({ minHeight = 140 }) => minHeight,
|
||||
padding: theme.spacing(1)
|
||||
},
|
||||
minHeight,
|
||||
padding: !isMedia && theme.spacing(1)
|
||||
}),
|
||||
mediaImage: { width: '40%' },
|
||||
headerRoot: ({ isMedia }) => isMedia && ({
|
||||
flex: '1'
|
||||
}),
|
||||
headerAvatar: { display: 'flex' },
|
||||
headerContent: { overflowX: 'hidden' },
|
||||
title: ({ isMedia }) => isMedia && ({
|
||||
paddingLeft: theme.spacing(1)
|
||||
}),
|
||||
subheader: {
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
@@ -38,7 +48,17 @@ const useStyles = makeStyles(theme => ({
|
||||
lineClamp: 2,
|
||||
boxOrient: 'vertical'
|
||||
},
|
||||
actionsIcon: { margin: theme.spacing(1) }
|
||||
actions: ({ isMedia }) => isMedia && ({
|
||||
justifyContent: 'space-around',
|
||||
padding: theme.spacing(1)
|
||||
}),
|
||||
actionsIcon: { margin: theme.spacing(1) },
|
||||
details: {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
flex: 1,
|
||||
width: ({ isMedia }) => isMedia && '60%'
|
||||
}
|
||||
}))
|
||||
|
||||
const SelectCard = memo(({
|
||||
@@ -49,13 +69,14 @@ const SelectCard = memo(({
|
||||
title,
|
||||
subheader,
|
||||
cardHeaderProps,
|
||||
mediaProps,
|
||||
isSelected,
|
||||
handleClick,
|
||||
cardProps,
|
||||
observerOff,
|
||||
children
|
||||
}) => {
|
||||
const classes = useStyles(stylesProps)
|
||||
const classes = useStyles({ ...stylesProps, isMedia: !!mediaProps })
|
||||
const { isNearScreen, fromRef } = useNearScreen({
|
||||
distance: '100px'
|
||||
})
|
||||
@@ -89,38 +110,56 @@ const SelectCard = memo(({
|
||||
</CardActionArea>
|
||||
}
|
||||
>
|
||||
<CardHeader
|
||||
action={action}
|
||||
avatar={icon}
|
||||
classes={{
|
||||
content: classes.headerContent,
|
||||
avatar: classes.headerAvatar
|
||||
}}
|
||||
title={title}
|
||||
titleTypographyProps={{
|
||||
variant: 'body2',
|
||||
noWrap: true,
|
||||
title
|
||||
}}
|
||||
subheader={subheader}
|
||||
subheaderTypographyProps={{
|
||||
variant: 'body2',
|
||||
noWrap: true,
|
||||
className: classes.subheader,
|
||||
title: subheader
|
||||
}}
|
||||
{...cardHeaderProps}
|
||||
/>
|
||||
{children}
|
||||
{actions?.length > 0 && (
|
||||
<CardActions>
|
||||
{actions?.map(action => renderAction(action))}
|
||||
</CardActions>
|
||||
{mediaProps && (
|
||||
<CardMedia className={classes.mediaImage} {...mediaProps} />
|
||||
)}
|
||||
<ConditionalWrap
|
||||
condition={!!mediaProps}
|
||||
wrap={children =>
|
||||
<div className={classes.details}>
|
||||
{children}
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<CardHeader
|
||||
action={action}
|
||||
avatar={icon}
|
||||
classes={{
|
||||
root: classes.headerRoot,
|
||||
content: classes.headerContent,
|
||||
avatar: classes.headerAvatar
|
||||
}}
|
||||
title={title}
|
||||
titleTypographyProps={{
|
||||
variant: 'body2',
|
||||
noWrap: true,
|
||||
className: classes.title,
|
||||
title
|
||||
}}
|
||||
subheader={subheader}
|
||||
subheaderTypographyProps={{
|
||||
variant: 'body2',
|
||||
noWrap: true,
|
||||
className: classes.subheader,
|
||||
title: subheader
|
||||
}}
|
||||
{...cardHeaderProps}
|
||||
/>
|
||||
{children}
|
||||
{actions?.length > 0 && (
|
||||
<CardActions className={classes.actions} disableSpacing={!!mediaProps}>
|
||||
{actions?.map(action => renderAction(action))}
|
||||
</CardActions>
|
||||
)}
|
||||
</ConditionalWrap>
|
||||
</ConditionalWrap>
|
||||
</Card>
|
||||
) : (
|
||||
<Skeleton variant="rect" width="100%" height={140} />
|
||||
<Skeleton
|
||||
variant="rect"
|
||||
width="100%"
|
||||
height={stylesProps?.minHeight ?? 140}
|
||||
/>
|
||||
)}
|
||||
</ConditionalWrap>
|
||||
)
|
||||
@@ -155,6 +194,14 @@ SelectCard.propTypes = {
|
||||
titleTypographyProps: PropTypes.object,
|
||||
subheaderTypographyProps: PropTypes.object
|
||||
}),
|
||||
mediaProps: PropTypes.shape({
|
||||
classes: PropTypes.object,
|
||||
className: PropTypes.string,
|
||||
component: PropTypes.elementType,
|
||||
image: PropTypes.string,
|
||||
src: PropTypes.string,
|
||||
style: PropTypes.object
|
||||
}),
|
||||
isSelected: PropTypes.bool,
|
||||
handleClick: PropTypes.func,
|
||||
cardProps: PropTypes.object,
|
||||
@@ -174,6 +221,7 @@ SelectCard.defaultProps = {
|
||||
title: undefined,
|
||||
subheader: undefined,
|
||||
cardHeaderProps: undefined,
|
||||
mediaProps: undefined,
|
||||
isSelected: false,
|
||||
handleClick: undefined,
|
||||
cardProps: undefined,
|
||||
|
||||
@@ -9,7 +9,7 @@ import ApplicationTemplateCard from 'client/components/Cards/ApplicationTemplate
|
||||
import ApplicationCard from 'client/components/Cards/ApplicationCard'
|
||||
import ApplicationNetworkCard from 'client/components/Cards/ApplicationNetworkCard'
|
||||
import PolicyCard from 'client/components/Cards/PolicyCard'
|
||||
import ProviderTemplateCard from 'client/components/Cards/ProviderTemplateCard'
|
||||
import ProvisionTemplateCard from 'client/components/Cards/ProvisionTemplateCard'
|
||||
import ProviderCard from 'client/components/Cards/ProviderCard'
|
||||
import ProvisionCard from 'client/components/Cards/ProvisionCard'
|
||||
import LocationCard from 'client/components/Cards/LocationCard'
|
||||
@@ -26,7 +26,7 @@ export {
|
||||
ApplicationCard,
|
||||
ApplicationNetworkCard,
|
||||
PolicyCard,
|
||||
ProviderTemplateCard,
|
||||
ProvisionTemplateCard,
|
||||
ProviderCard,
|
||||
ProvisionCard,
|
||||
LocationCard
|
||||
|
||||
@@ -24,7 +24,7 @@ export default makeStyles(theme =>
|
||||
paper: {
|
||||
overflow: 'hidden',
|
||||
padding: theme.spacing(2),
|
||||
height: 440,
|
||||
minHeight: 440,
|
||||
[theme.breakpoints.up('xs')]: {
|
||||
display: 'flex',
|
||||
flexDirection: 'column'
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import React, { useCallback, useEffect } from 'react'
|
||||
import { Redirect } from 'react-router-dom'
|
||||
|
||||
import FileIcon from '@material-ui/icons/Description'
|
||||
|
||||
import useFetch from 'client/hooks/useFetch'
|
||||
import useProvision from 'client/hooks/useProvision'
|
||||
import useListForm from 'client/hooks/useListForm'
|
||||
|
||||
import ListCards from 'client/components/List/ListCards'
|
||||
import { EmptyCard, SelectCard } from 'client/components/Cards'
|
||||
import { EmptyCard, ProvisionTemplateCard } from 'client/components/Cards'
|
||||
import { PATH } from 'client/router/provision'
|
||||
|
||||
import { STEP_ID as CONNECTION_ID } from 'client/containers/Providers/Form/Create/Steps/Connection'
|
||||
@@ -50,13 +48,12 @@ const Provider = () => ({
|
||||
EmptyComponent={
|
||||
<EmptyCard title={'Your providers templates list is empty'} />
|
||||
}
|
||||
CardComponent={SelectCard}
|
||||
CardComponent={ProvisionTemplateCard}
|
||||
cardsProps={({ value: { name } }) => {
|
||||
const isSelected = data?.some(selected => selected === name)
|
||||
|
||||
return {
|
||||
icon: <FileIcon />,
|
||||
title: name,
|
||||
isProvider: true,
|
||||
isSelected,
|
||||
handleClick: () => handleClick(name, isSelected)
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ function ProviderCreateForm () {
|
||||
|
||||
const formatData = {
|
||||
...(!isUpdate && { name: `${providerSelected}_${locationSelected}` }),
|
||||
...(providerTemplate?.image && {
|
||||
plain: { image: providerTemplate.image }
|
||||
}),
|
||||
provider: providerSelected,
|
||||
connection: {
|
||||
...connection,
|
||||
@@ -76,7 +79,13 @@ function ProviderCreateForm () {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
isUpdate && fetchRequestAll([getProvider({ id }), getProvidersTemplates()])
|
||||
isUpdate && fetchRequestAll([
|
||||
getProvider({ id }),
|
||||
getProvidersTemplates({
|
||||
onError: () =>
|
||||
history.push(PATH.PROVIDERS.LIST)
|
||||
})
|
||||
])
|
||||
}, [isUpdate])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -84,16 +93,20 @@ function ProviderCreateForm () {
|
||||
const [provider = {}, templates = []] = data
|
||||
|
||||
const { TEMPLATE: { PROVISION_BODY = {} } } = provider
|
||||
const { connection, provider: providerName, registration_time: time } = PROVISION_BODY
|
||||
const {
|
||||
connection, provider: providerName, registration_time: time
|
||||
} = PROVISION_BODY
|
||||
|
||||
const {
|
||||
location_key: key
|
||||
} = templates?.find(({ name }) => name === providerName) ?? {}
|
||||
|
||||
if (!key) {
|
||||
showError(`
|
||||
Cannot found provider template (${providerName}),
|
||||
ask your cloud administrator`)
|
||||
showError({
|
||||
message: `
|
||||
Cannot found provider template (${providerName}),
|
||||
ask your cloud administrator`
|
||||
})
|
||||
history.push(PATH.PROVIDERS.LIST)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
import React, { useCallback, useEffect } from 'react'
|
||||
|
||||
import { Redirect } from 'react-router-dom'
|
||||
import ProvisionIcon from '@material-ui/icons/SettingsSystemDaydream'
|
||||
|
||||
import useFetch from 'client/hooks/useFetch'
|
||||
import useProvision from 'client/hooks/useProvision'
|
||||
import useListForm from 'client/hooks/useListForm'
|
||||
|
||||
import ListCards from 'client/components/List/ListCards'
|
||||
import { EmptyCard, SelectCard } from 'client/components/Cards'
|
||||
import { EmptyCard, ProvisionTemplateCard } from 'client/components/Cards'
|
||||
import { PATH } from 'client/router/provision'
|
||||
|
||||
import {
|
||||
STEP_ID as INPUTS_ID
|
||||
} from 'client/containers/Provisions/Form/Create/Steps/Inputs'
|
||||
import { STEP_ID as INPUTS_ID } from 'client/containers/Provisions/Form/Create/Steps/Inputs'
|
||||
import { STEP_FORM_SCHEMA } from './schema'
|
||||
|
||||
export const STEP_ID = 'provision'
|
||||
@@ -51,13 +47,11 @@ const Provision = () => ({
|
||||
EmptyComponent={
|
||||
<EmptyCard title={'Your provisions templates list is empty'} />
|
||||
}
|
||||
CardComponent={SelectCard}
|
||||
CardComponent={ProvisionTemplateCard}
|
||||
cardsProps={({ value: { name } }) => {
|
||||
const isSelected = data?.some(selected => selected === name)
|
||||
|
||||
return {
|
||||
icon: <ProvisionIcon />,
|
||||
title: name,
|
||||
isSelected,
|
||||
handleClick: () => handleClick(name, isSelected)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useState, useCallback, useEffect, useRef } from 'react'
|
||||
import axios from 'axios'
|
||||
import { debounce } from '@material-ui/core'
|
||||
import { fakeDelay } from 'client/utils'
|
||||
|
||||
@@ -15,7 +14,7 @@ const useRequest = request => {
|
||||
const doFetch = useCallback(
|
||||
debounce(payload =>
|
||||
request({ ...payload }).then(response => {
|
||||
if (isMounted.current && !axios.isCancel(response)) {
|
||||
if (isMounted.current) {
|
||||
if (response !== undefined) {
|
||||
setData(response)
|
||||
setError(false)
|
||||
|
||||
@@ -1,26 +1,54 @@
|
||||
import { useState, useCallback } from 'react'
|
||||
import { useState, useCallback, useEffect, useRef } from 'react'
|
||||
import { debounce } from '@material-ui/core'
|
||||
import { fakeDelay } from 'client/utils'
|
||||
|
||||
const useRequestAll = () => {
|
||||
const [data, setData] = useState(undefined)
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [reloading, setReloading] = useState(false)
|
||||
const [error, setError] = useState(false)
|
||||
const isMounted = useRef(true)
|
||||
|
||||
const fetchRequestAll = useCallback(
|
||||
requests => {
|
||||
setLoading(true)
|
||||
setError(false)
|
||||
useEffect(() => () => { isMounted.current = false }, [])
|
||||
|
||||
const doFetchs = useCallback(
|
||||
debounce(requests =>
|
||||
Promise
|
||||
.all(requests)
|
||||
.then(response => {
|
||||
if (response !== undefined) setData(response)
|
||||
else setError(true)
|
||||
})
|
||||
.finally(() => { setLoading(false) })
|
||||
},
|
||||
[]
|
||||
)
|
||||
if (isMounted.current) {
|
||||
if (response !== undefined) {
|
||||
setData(response)
|
||||
setError(false)
|
||||
} else setError(true)
|
||||
|
||||
return { data, fetchRequestAll, loading, error }
|
||||
setLoading(false)
|
||||
setReloading(false)
|
||||
}
|
||||
})
|
||||
), [isMounted])
|
||||
|
||||
const fetchRequestAll = useCallback((requests, options = {}) => {
|
||||
const { reload = false, delay = 0 } = options
|
||||
if (!(Number.isInteger(delay) && delay >= 0)) {
|
||||
console.error(`
|
||||
Delay must be a number >= 0!
|
||||
If you're using it as a function, it must also return a number >= 0.`)
|
||||
}
|
||||
|
||||
if (isMounted.current) {
|
||||
reload ? setReloading(true) : setLoading(true)
|
||||
}
|
||||
|
||||
fakeDelay(delay).then(() => doFetchs(requests))
|
||||
}, [isMounted])
|
||||
|
||||
return {
|
||||
data,
|
||||
fetchRequestAll,
|
||||
loading,
|
||||
reloading,
|
||||
error
|
||||
}
|
||||
}
|
||||
export default useRequestAll
|
||||
@@ -33,15 +33,16 @@ export default function useOpennebula () {
|
||||
// --------------------------------------------
|
||||
|
||||
const getProvidersTemplates = useCallback(
|
||||
({ end, start } = { end: -1, start: -1 }) =>
|
||||
({ onError }) =>
|
||||
serviceProvision
|
||||
.getProvidersTemplates({ filter, end, start })
|
||||
.getProvidersTemplates({ filter })
|
||||
.then(doc => {
|
||||
dispatch(setProvidersTemplates(doc))
|
||||
return doc
|
||||
})
|
||||
.catch(err => {
|
||||
dispatch(enqueueError(err ?? 'Error GET providers templates'))
|
||||
onError && onError(err)
|
||||
}),
|
||||
[dispatch, filter, providersTemplates]
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user