Implemented new message context.
This commit is contained in:
parent
c6088361cd
commit
d7827ecb6d
@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useRef } from 'react'
|
||||
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
|
||||
import NewFilamentStock from './FilamentStocks/NewFilamentStock'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -15,7 +15,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const FilamentStocks = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const tableRef = useRef()
|
||||
|
||||
const [newFilamentStockOpen, setNewFilamentStockOpen] = useState(false)
|
||||
@ -51,7 +50,6 @@ const FilamentStocks = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -94,7 +92,6 @@ const FilamentStocks = () => {
|
||||
<NewFilamentStock
|
||||
onOk={() => {
|
||||
setNewFilamentStockOpen(false)
|
||||
messageApi.success('New filament stock created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newFilamentStockOpen}
|
||||
|
||||
@ -51,9 +51,11 @@ const NewFilamentStock = ({ onOk, reset, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Filament Stock'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewOrderItem from './OrderItems/NewOrderItem'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const OrderItems = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newOrderItemOpen, setNewOrderItemOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -46,7 +45,6 @@ const OrderItems = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -88,7 +86,6 @@ const OrderItems = () => {
|
||||
<NewOrderItem
|
||||
onOk={() => {
|
||||
setNewOrderItemOpen(false)
|
||||
messageApi.success('New order item created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newOrderItemOpen}
|
||||
|
||||
@ -79,9 +79,11 @@ const NewOrderItem = ({ onOk, reset, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Order Item'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useRef } from 'react'
|
||||
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
|
||||
import NewPartStock from './PartStocks/NewPartStock'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -15,7 +15,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const PartStocks = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const tableRef = useRef()
|
||||
|
||||
const [newPartStockOpen, setNewPartStockOpen] = useState(false)
|
||||
@ -51,7 +50,6 @@ const PartStocks = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -94,7 +92,6 @@ const PartStocks = () => {
|
||||
<NewPartStock
|
||||
onOk={() => {
|
||||
setNewPartStockOpen(false)
|
||||
messageApi.success('New part stock created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newPartStockOpen}
|
||||
|
||||
@ -51,9 +51,11 @@ const NewPartStock = ({ onOk, reset, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Part Stock'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewPurchaseOrder from './PurchaseOrders/NewPurchaseOrder'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const PurchaseOrders = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newPurchaseOrderOpen, setNewPurchaseOrderOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -46,7 +45,6 @@ const PurchaseOrders = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -88,7 +86,6 @@ const PurchaseOrders = () => {
|
||||
<NewPurchaseOrder
|
||||
onOk={() => {
|
||||
setNewPurchaseOrderOpen(false)
|
||||
messageApi.success('New purchase order created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newPurchaseOrderOpen}
|
||||
|
||||
@ -70,9 +70,11 @@ const NewPurchaseOrder = ({ onOk, reset, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Purchase Order'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewShipment from './Shipments/NewShipment'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const Shipments = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newShipmentOpen, setNewShipmentOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -46,7 +45,6 @@ const Shipments = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -88,7 +86,6 @@ const Shipments = () => {
|
||||
<NewShipment
|
||||
onOk={() => {
|
||||
setNewShipmentOpen(false)
|
||||
messageApi.success('New shipment created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newShipmentOpen}
|
||||
|
||||
@ -74,9 +74,11 @@ const NewShipment = ({ onOk, reset, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Shipment'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useRef } from 'react'
|
||||
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
|
||||
import NewStockAudit from './StockAudits/NewStockAudit'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -15,7 +15,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const StockAudits = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const tableRef = useRef()
|
||||
|
||||
const [newStockAuditOpen, setNewStockAuditOpen] = useState(false)
|
||||
@ -51,7 +50,6 @@ const StockAudits = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -94,7 +92,6 @@ const StockAudits = () => {
|
||||
<NewStockAudit
|
||||
onOk={() => {
|
||||
setNewStockAuditOpen(false)
|
||||
messageApi.success('New stock audit created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newStockAuditOpen}
|
||||
|
||||
@ -51,9 +51,11 @@ const NewStockAudit = ({ onOk, reset, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Stock Audit'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -9,6 +9,7 @@ import DashboardNavigation from './common/DashboardNavigation'
|
||||
import DashboardBreadcrumb from './common/DashboardBreadcrumb'
|
||||
import DeveloperSidebar from './Developer/DeveloperSidebar'
|
||||
import { useThemeContext } from './context/ThemeContext'
|
||||
import { MessageProvider } from './context/MessageContext'
|
||||
|
||||
const { Content } = Layout
|
||||
|
||||
@ -22,6 +23,7 @@ const DashboardLayout = ({ children }) => {
|
||||
const { isDarkMode } = useThemeContext()
|
||||
|
||||
return (
|
||||
<MessageProvider>
|
||||
<Layout
|
||||
style={{ height: 'var(--unit-100vh)' }}
|
||||
className={isDarkMode ? 'dark-mode' : 'light-mode'}
|
||||
@ -52,6 +54,7 @@ const DashboardLayout = ({ children }) => {
|
||||
</Layout>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</MessageProvider>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewCourierService from './CourierServices/NewCourierService'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const CourierServices = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newCourierServiceOpen, setNewCourierServiceOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -46,7 +45,6 @@ const CourierServices = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -85,7 +83,6 @@ const CourierServices = () => {
|
||||
<NewCourierService
|
||||
onOk={() => {
|
||||
setNewCourierServiceOpen(false)
|
||||
messageApi.success('New courier service created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newCourierServiceOpen}
|
||||
|
||||
@ -68,9 +68,11 @@ const NewCourierService = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Courier Service'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewCourier from './Couriers/NewCourier'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const Couriers = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newCourierOpen, setNewCourierOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -45,7 +44,6 @@ const Couriers = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -84,7 +82,6 @@ const Couriers = () => {
|
||||
<NewCourier
|
||||
onOk={() => {
|
||||
setNewCourierOpen(false)
|
||||
messageApi.success('New courier created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newCourierOpen}
|
||||
|
||||
@ -61,9 +61,11 @@ const NewCourier = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Courier'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewDocumentJob from './DocumentJobs/NewDocumentJob'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const DocumentJobs = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newDocumentJobOpen, setNewDocumentJobOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -46,7 +45,6 @@ const DocumentJobs = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -85,7 +83,6 @@ const DocumentJobs = () => {
|
||||
<NewDocumentJob
|
||||
onOk={() => {
|
||||
setNewDocumentJobOpen(false)
|
||||
messageApi.success('New note type created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newDocumentJobOpen}
|
||||
|
||||
@ -68,6 +68,7 @@ const NewDocumentJob = ({ onOk, defaultValues = {} }) => {
|
||||
}
|
||||
onSubmit={async () => {
|
||||
const newDocumentJob = await handleSubmit()
|
||||
if (newDocumentJob) {
|
||||
await sendObjectAction(
|
||||
newDocumentJob.documentPrinter._id,
|
||||
'documentPrinter',
|
||||
@ -79,6 +80,7 @@ const NewDocumentJob = ({ onOk, defaultValues = {} }) => {
|
||||
if (onOk) {
|
||||
onOk()
|
||||
}
|
||||
}
|
||||
}}
|
||||
actions={[
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import { Button, Flex, Space, Dropdown, message, Modal } from 'antd'
|
||||
import { Button, Flex, Space, Dropdown, Modal } from 'antd'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import ReloadIcon from '../../Icons/ReloadIcon'
|
||||
@ -11,7 +11,6 @@ import ColumnViewButton from '../common/ColumnViewButton'
|
||||
import NewDocumentPrinter from './DocumentPrinters/NewDocumentPrinter'
|
||||
|
||||
const DocumentPrinters = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const tableRef = useRef()
|
||||
const [newDocumentPrinterOpen, setNewDocumentPrinterOpen] = useState(false)
|
||||
const [viewMode, setViewMode] = useViewMode('documentPrinter')
|
||||
@ -45,7 +44,6 @@ const DocumentPrinters = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -84,7 +82,6 @@ const DocumentPrinters = () => {
|
||||
<NewDocumentPrinter
|
||||
onOk={() => {
|
||||
setNewDocumentPrinterOpen(false)
|
||||
messageApi.success('New note type created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newDocumentPrinterOpen}
|
||||
|
||||
@ -66,9 +66,11 @@ const NewDocumentPrinter = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Document Printer'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewDocumentSize from './DocumentSizes/NewDocumentSize'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const DocumentSizes = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newDocumentSizeOpen, setNewDocumentSizeOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
const [viewMode, setViewMode] = useViewMode('documentSize')
|
||||
@ -44,7 +43,6 @@ const DocumentSizes = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -83,7 +81,6 @@ const DocumentSizes = () => {
|
||||
<NewDocumentSize
|
||||
onOk={() => {
|
||||
setNewDocumentSizeOpen(false)
|
||||
messageApi.success('New document size created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newDocumentSizeOpen}
|
||||
|
||||
@ -47,9 +47,11 @@ const NewDocumentSize = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Document Size'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewDocumentTemplate from './DocumentTemplates/NewDocumentTemplate'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const DocumentTemplates = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newDocumentTemplateOpen, setNewDocumentTemplateOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -46,7 +45,6 @@ const DocumentTemplates = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -85,7 +83,6 @@ const DocumentTemplates = () => {
|
||||
<NewDocumentTemplate
|
||||
onOk={() => {
|
||||
setNewDocumentTemplateOpen(false)
|
||||
messageApi.success('New note type created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newDocumentTemplateOpen}
|
||||
|
||||
@ -66,9 +66,11 @@ const NewDocumentTemplate = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Document Template'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// src/filaments.js
|
||||
|
||||
import { useRef, useState } from 'react'
|
||||
import { Button, Flex, Space, Modal, message, Dropdown } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
|
||||
import NewFilament from './Filaments/NewFilament'
|
||||
|
||||
@ -15,7 +15,6 @@ import GridIcon from '../../Icons/GridIcon'
|
||||
import useViewMode from '../hooks/useViewMode'
|
||||
|
||||
const Filaments = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newFilamentOpen, setNewFilamentOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -51,7 +50,6 @@ const Filaments = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -92,7 +90,6 @@ const Filaments = () => {
|
||||
<NewFilament
|
||||
onOk={() => {
|
||||
setNewFilamentOpen(false)
|
||||
messageApi.success('New filament added successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newFilamentOpen}
|
||||
|
||||
@ -61,9 +61,11 @@ const NewFilament = ({ onOk }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Filament'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// src/hosts.js
|
||||
|
||||
import { useRef, useState } from 'react'
|
||||
import { Button, Flex, Space, Modal, message, Dropdown } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
|
||||
import NewHost from './Hosts/NewHost'
|
||||
|
||||
@ -15,7 +15,6 @@ import GridIcon from '../../Icons/GridIcon'
|
||||
import useViewMode from '../hooks/useViewMode'
|
||||
|
||||
const Hosts = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newHostOpen, setNewHostOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -50,7 +49,6 @@ const Hosts = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -91,7 +89,6 @@ const Hosts = () => {
|
||||
<NewHost
|
||||
onOk={() => {
|
||||
setNewHostOpen(false)
|
||||
messageApi.success('New host added successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newHostOpen}
|
||||
|
||||
@ -94,9 +94,11 @@ const NewHost = ({ onOk }) => {
|
||||
totalSteps={steps.length}
|
||||
onPrevious={() => setCurrentStep((prev) => prev - 1)}
|
||||
onNext={() => setCurrentStep((prev) => prev + 1)}
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
formValid={formValid}
|
||||
submitLoading={submitLoading}
|
||||
|
||||
@ -9,12 +9,12 @@ import {
|
||||
Flex,
|
||||
Space,
|
||||
Modal,
|
||||
message,
|
||||
Dropdown,
|
||||
Spin
|
||||
} from 'antd'
|
||||
import { createStyles } from 'antd-style'
|
||||
import { LoadingOutlined } from '@ant-design/icons'
|
||||
import { useMessageContext } from '../context/MessageContext'
|
||||
|
||||
import { AuthContext } from '../context/AuthContext'
|
||||
|
||||
@ -47,7 +47,7 @@ const useStyle = createStyles(({ css, token }) => {
|
||||
})
|
||||
|
||||
const Materials = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const { showError } = useMessageContext()
|
||||
const navigate = useNavigate()
|
||||
const { styles } = useStyle()
|
||||
|
||||
@ -87,12 +87,11 @@ const Materials = () => {
|
||||
setLazyLoading(false)
|
||||
} catch (error) {
|
||||
if (error.response) {
|
||||
messageApi.error(
|
||||
'Error updating material details:',
|
||||
error.response.status
|
||||
showError(
|
||||
`Error updating material details: ${error.response.status}`
|
||||
)
|
||||
} else {
|
||||
messageApi.error(
|
||||
showError(
|
||||
'An unexpected error occurred. Please try again later.'
|
||||
)
|
||||
}
|
||||
@ -100,7 +99,7 @@ const Materials = () => {
|
||||
setLazyLoading(false)
|
||||
}
|
||||
},
|
||||
[messageApi]
|
||||
[showError]
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
@ -241,7 +240,6 @@ const Materials = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
<Button>Actions</Button>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewNoteType from './NoteTypes/NewNoteType'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const NoteTypes = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newNoteTypeOpen, setNewNoteTypeOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -46,7 +45,6 @@ const NoteTypes = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -85,7 +83,6 @@ const NoteTypes = () => {
|
||||
<NewNoteType
|
||||
onOk={() => {
|
||||
setNewNoteTypeOpen(false)
|
||||
messageApi.success('New note type created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newNoteTypeOpen}
|
||||
|
||||
@ -66,9 +66,11 @@ const NewNoteType = ({ onOk }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Note Type'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -31,9 +31,11 @@ const NewNote = ({ onOk, defaultValues = {} }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Note'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useRef } from 'react'
|
||||
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import NewPart from './Parts/NewPart'
|
||||
|
||||
@ -18,8 +18,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const Parts = (filter) => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
|
||||
const [newPartOpen, setNewPartOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
const [viewMode, setViewMode] = useViewMode('part')
|
||||
@ -51,7 +49,6 @@ const Parts = (filter) => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -93,7 +90,6 @@ const Parts = (filter) => {
|
||||
<NewPart
|
||||
onOk={() => {
|
||||
setNewPartOpen(false)
|
||||
messageApi.success('Part created successfully!')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newPartOpen}
|
||||
|
||||
@ -103,9 +103,11 @@ const NewPart = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Part'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -8,7 +8,6 @@ import {
|
||||
Space,
|
||||
Modal,
|
||||
Dropdown,
|
||||
message,
|
||||
Tag,
|
||||
Checkbox,
|
||||
Popover,
|
||||
@ -31,7 +30,6 @@ import ListIcon from '../../Icons/ListIcon'
|
||||
import useViewMode from '../hooks/useViewMode'
|
||||
|
||||
const Products = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const navigate = useNavigate()
|
||||
const [newProductOpen, setNewProductOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
@ -322,7 +320,6 @@ const Products = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -363,7 +360,6 @@ const Products = () => {
|
||||
<NewProduct
|
||||
onOk={() => {
|
||||
setNewProductOpen(false)
|
||||
messageApi.success('Product created successfully!')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newProductOpen}
|
||||
|
||||
@ -88,9 +88,11 @@ const NewProduct = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Product'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewTaxRate from './TaxRates/NewTaxRate'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const TaxRates = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newTaxRateOpen, setNewTaxRateOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -45,7 +44,6 @@ const TaxRates = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -84,7 +82,6 @@ const TaxRates = () => {
|
||||
<NewTaxRate
|
||||
onOk={() => {
|
||||
setNewTaxRateOpen(false)
|
||||
messageApi.success('New tax rate created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newTaxRateOpen}
|
||||
|
||||
@ -61,9 +61,11 @@ const NewTaxRate = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Tax Rate'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewTaxRecord from './TaxRecords/NewTaxRecord'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const TaxRecords = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newTaxRecordOpen, setNewTaxRecordOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -46,7 +45,6 @@ const TaxRecords = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -85,7 +83,6 @@ const TaxRecords = () => {
|
||||
<NewTaxRecord
|
||||
onOk={() => {
|
||||
setNewTaxRecordOpen(false)
|
||||
messageApi.success('New tax record created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newTaxRecordOpen}
|
||||
|
||||
@ -61,9 +61,11 @@ const NewTaxRecord = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Tax Record'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import { useState } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import axios from 'axios'
|
||||
import { useMediaQuery } from 'react-responsive'
|
||||
import {
|
||||
Form,
|
||||
Input,
|
||||
Button,
|
||||
message,
|
||||
Typography,
|
||||
Flex,
|
||||
Steps,
|
||||
Descriptions,
|
||||
Divider
|
||||
} from 'antd'
|
||||
import { useMessageContext } from '../../context/MessageContext'
|
||||
|
||||
import config from '../../../../config'
|
||||
|
||||
@ -27,7 +27,7 @@ const initialNewUserForm = {
|
||||
}
|
||||
|
||||
const NewUser = ({ onOk, reset }) => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const { showError } = useMessageContext()
|
||||
const [newUserLoading, setNewUserLoading] = useState(false)
|
||||
const [currentStep, setCurrentStep] = useState(0)
|
||||
const [nextEnabled, setNextEnabled] = useState(false)
|
||||
@ -88,7 +88,7 @@ const NewUser = ({ onOk, reset }) => {
|
||||
})
|
||||
onOk()
|
||||
} catch (error) {
|
||||
messageApi.error('Error creating new user: ' + error.message)
|
||||
showError('Error creating new user: ' + error.message)
|
||||
} finally {
|
||||
setNewUserLoading(false)
|
||||
}
|
||||
@ -181,8 +181,6 @@ const NewUser = ({ onOk, reset }) => {
|
||||
|
||||
return (
|
||||
<Flex gap='middle'>
|
||||
{contextHolder}
|
||||
|
||||
{!isMobile && (
|
||||
<div style={{ minWidth: '160px' }}>
|
||||
<Steps
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewVendor from './Vendors/NewVendor'
|
||||
import ObjectTable from '../common/ObjectTable'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -11,7 +11,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const Vendors = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newVendorOpen, setNewVendorOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -45,7 +44,6 @@ const Vendors = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -84,7 +82,6 @@ const Vendors = () => {
|
||||
<NewVendor
|
||||
onOk={() => {
|
||||
setNewVendorOpen(false)
|
||||
messageApi.success('New vendor created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={!newVendorOpen}
|
||||
|
||||
@ -64,9 +64,11 @@ const NewVendor = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Vendor'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// src/gcodefiles.js
|
||||
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewGCodeFile from './GCodeFiles/NewGCodeFile'
|
||||
import useColumnVisibility from '../hooks/useColumnVisibility'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
@ -14,7 +14,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import ColumnViewButton from '../common/ColumnViewButton'
|
||||
|
||||
const GCodeFiles = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newGCodeFileOpen, setNewGCodeFileOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
const [viewMode, setViewMode] = useViewMode('gcodeFile')
|
||||
@ -48,7 +47,6 @@ const GCodeFiles = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -89,7 +87,6 @@ const GCodeFiles = () => {
|
||||
<NewGCodeFile
|
||||
onOk={() => {
|
||||
setNewGCodeFileOpen(false)
|
||||
messageApi.success('Finished uploading GCode file!')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newGCodeFileOpen}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import { useMessageContext } from '../../context/MessageContext'
|
||||
import ObjectInfo from '../../common/ObjectInfo'
|
||||
import NewObjectForm from '../../common/NewObjectForm'
|
||||
import WizardView from '../../common/WizardView'
|
||||
|
||||
const NewGCodeFile = ({ onOk, defaultValues }) => {
|
||||
const { showSuccess } = useMessageContext()
|
||||
return (
|
||||
<NewObjectForm
|
||||
type={'gcodeFile'}
|
||||
@ -71,9 +73,12 @@ const NewGCodeFile = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New GCode File'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
showSuccess('Finished uploading GCode file!')
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// src/Jobs.js
|
||||
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, Flex, Space, Modal, Dropdown, message } from 'antd'
|
||||
import { Button, Flex, Space, Modal, Dropdown } from 'antd'
|
||||
import NewJob from './Jobs/NewJob.jsx'
|
||||
import useColumnVisibility from '../hooks/useColumnVisibility.js'
|
||||
import PlusIcon from '../../Icons/PlusIcon.jsx'
|
||||
@ -13,7 +13,6 @@ import useViewMode from '../hooks/useViewMode.js'
|
||||
import ColumnViewButton from '../common/ColumnViewButton.jsx'
|
||||
|
||||
const Jobs = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newJobOpen, setNewJobOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
const [viewMode, setViewMode] = useViewMode('job')
|
||||
@ -50,7 +49,6 @@ const Jobs = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large' style={{ height: '100%' }}>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space size='small'>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -93,7 +91,6 @@ const Jobs = () => {
|
||||
<NewJob
|
||||
onOk={() => {
|
||||
setNewJobOpen(false)
|
||||
messageApi.success('New print job created successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newJobOpen}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import { useMessageContext } from '../../context/MessageContext'
|
||||
import ObjectInfo from '../../common/ObjectInfo'
|
||||
import NewObjectForm from '../../common/NewObjectForm'
|
||||
import WizardView from '../../common/WizardView'
|
||||
|
||||
const NewJob = ({ onOk, defaultValues }) => {
|
||||
const { showSuccess } = useMessageContext()
|
||||
return (
|
||||
<NewObjectForm
|
||||
type={'job'}
|
||||
@ -58,9 +60,12 @@ const NewJob = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Job'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
showSuccess('New job created successfully.')
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// src/Printers.js
|
||||
|
||||
import { useState, useRef } from 'react'
|
||||
import { Button, message, Dropdown, Space, Flex, Modal } from 'antd'
|
||||
import { Button, Dropdown, Space, Flex, Modal } from 'antd'
|
||||
import NewPrinter from './Printers/NewPrinter'
|
||||
import PlusIcon from '../../Icons/PlusIcon'
|
||||
import ReloadIcon from '../../Icons/ReloadIcon'
|
||||
@ -14,7 +14,6 @@ import useViewMode from '../hooks/useViewMode'
|
||||
import useColumnVisibility from '../hooks/useColumnVisibility'
|
||||
|
||||
const Printers = () => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newPrinterOpen, setNewPrinterOpen] = useState(false)
|
||||
const tableRef = useRef()
|
||||
|
||||
@ -50,7 +49,6 @@ const Printers = () => {
|
||||
return (
|
||||
<>
|
||||
<Flex vertical={'true'} gap='large'>
|
||||
{contextHolder}
|
||||
<Flex justify={'space-between'}>
|
||||
<Space>
|
||||
<Dropdown menu={actionItems}>
|
||||
@ -92,7 +90,6 @@ const Printers = () => {
|
||||
<NewPrinter
|
||||
onOk={() => {
|
||||
setNewPrinterOpen(false)
|
||||
messageApi.success('New printer added successfully.')
|
||||
tableRef.current?.reload()
|
||||
}}
|
||||
reset={newPrinterOpen}
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import { useMessageContext } from '../../context/MessageContext'
|
||||
import ObjectInfo from '../../common/ObjectInfo'
|
||||
import NewObjectForm from '../../common/NewObjectForm'
|
||||
import WizardView from '../../common/WizardView'
|
||||
|
||||
const NewPrinter = ({ onOk, defaultValues }) => {
|
||||
const { showSuccess } = useMessageContext()
|
||||
return (
|
||||
<NewObjectForm
|
||||
type={'printer'}
|
||||
@ -93,9 +95,12 @@ const NewPrinter = ({ onOk, defaultValues }) => {
|
||||
loading={submitLoading}
|
||||
formValid={formValid}
|
||||
title='New Printer'
|
||||
onSubmit={() => {
|
||||
handleSubmit()
|
||||
onSubmit={async () => {
|
||||
const result = await handleSubmit()
|
||||
if (result) {
|
||||
showSuccess('New printer added successfully.')
|
||||
onOk()
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import { Button, Tooltip, message } from 'antd'
|
||||
import { Button, Tooltip } from 'antd'
|
||||
import { useMessageContext } from '../context/MessageContext'
|
||||
import CopyIcon from '../../Icons/CopyIcon'
|
||||
|
||||
const CopyButton = ({
|
||||
@ -8,17 +9,17 @@ const CopyButton = ({
|
||||
size = 'small',
|
||||
type = 'text'
|
||||
}) => {
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const { showSuccess, showError } = useMessageContext()
|
||||
|
||||
const doCopy = (copyText) => {
|
||||
if (navigator && navigator.clipboard && navigator.clipboard.writeText) {
|
||||
navigator.clipboard
|
||||
.writeText(copyText)
|
||||
.then(() => {
|
||||
messageApi.success('Copied to clipboard')
|
||||
showSuccess('Copied to clipboard')
|
||||
})
|
||||
.catch(() => {
|
||||
messageApi.error('Failed to copy')
|
||||
showError('Failed to copy')
|
||||
})
|
||||
} else if (
|
||||
document.queryCommandSupported &&
|
||||
@ -34,21 +35,20 @@ const CopyButton = ({
|
||||
textarea.select()
|
||||
try {
|
||||
document.execCommand('copy')
|
||||
messageApi.success('Copied to clipboard')
|
||||
showSuccess('Copied to clipboard')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
console.error(err)
|
||||
messageApi.error('Failed to copy')
|
||||
showError('Failed to copy')
|
||||
}
|
||||
document.body.removeChild(textarea)
|
||||
} else {
|
||||
messageApi.error('Copy not supported in this browser')
|
||||
showError('Copy not supported in this browser')
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{contextHolder}
|
||||
<Tooltip title={tooltip} arrow={false}>
|
||||
<Button
|
||||
icon={<CopyIcon />}
|
||||
|
||||
@ -6,7 +6,6 @@ import { Button, Dropdown, Modal } from 'antd'
|
||||
import { ApiServerContext } from '../context/ApiServerContext'
|
||||
import DocumentTemplateIcon from '../../Icons/DocumentTemplateIcon'
|
||||
import NewDocumentJob from '../Management/DocumentJobs/NewDocumentJob'
|
||||
import { message } from 'antd'
|
||||
import { AuthContext } from '../context/AuthContext'
|
||||
|
||||
const DocumentPrintButton = ({
|
||||
@ -19,7 +18,6 @@ const DocumentPrintButton = ({
|
||||
const [documentTemplates, setDocumentTemplates] = useState([])
|
||||
const [currentDocumentTemplate, setCurrentDocumentTemplate] = useState(null)
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [newDocumentJobOpen, setNewDocumentJobOpen] = useState(false)
|
||||
|
||||
const { token } = useContext(AuthContext)
|
||||
@ -86,7 +84,6 @@ const DocumentPrintButton = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
{contextHolder}
|
||||
<Dropdown
|
||||
menu={{
|
||||
items: menuItems,
|
||||
@ -120,7 +117,6 @@ const DocumentPrintButton = ({
|
||||
<NewDocumentJob
|
||||
onOk={() => {
|
||||
setNewDocumentJobOpen(false)
|
||||
messageApi.success('New document job created successfully.')
|
||||
}}
|
||||
reset={!newDocumentJobOpen}
|
||||
defaultValues={{
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { useState, useEffect, useContext, useCallback } from 'react'
|
||||
import { Form, message } from 'antd'
|
||||
import { Form } from 'antd'
|
||||
import { ApiServerContext } from '../context/ApiServerContext'
|
||||
import { useMessageContext } from '../context/MessageContext'
|
||||
import PropTypes from 'prop-types'
|
||||
import merge from 'lodash/merge'
|
||||
import set from 'lodash/set'
|
||||
@ -35,7 +36,7 @@ const NewObjectForm = ({ type, style, defaultValues = {}, children }) => {
|
||||
const [formValid, setFormValid] = useState(false)
|
||||
const [form] = Form.useForm()
|
||||
const formUpdateValues = Form.useWatch([], form)
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const { showSuccess, showError: showMessageError } = useMessageContext()
|
||||
const { createObject, showError } = useContext(ApiServerContext)
|
||||
|
||||
// Get the model definition for this object type
|
||||
@ -156,14 +157,14 @@ const NewObjectForm = ({ type, style, defaultValues = {}, children }) => {
|
||||
const computedValuesObject = buildObjectFromEntries(computedEntries)
|
||||
const computedObjectData = merge({}, objectData, computedValuesObject)
|
||||
const newObject = await createObject(type, computedObjectData)
|
||||
messageApi.success('Object created successfully')
|
||||
showSuccess('Object created successfully')
|
||||
return newObject
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
if (err.errorFields) {
|
||||
return
|
||||
}
|
||||
messageApi.error('Failed to create object')
|
||||
showMessageError('Failed to create object')
|
||||
showError(
|
||||
`Failed to create object. Message: ${err.message}. Code: ${err.code}`,
|
||||
() => handleSubmit()
|
||||
@ -208,7 +209,6 @@ const NewObjectForm = ({ type, style, defaultValues = {}, children }) => {
|
||||
})
|
||||
}}
|
||||
>
|
||||
{contextHolder}
|
||||
{children({
|
||||
submitLoading: submitLoading,
|
||||
handleSubmit,
|
||||
|
||||
@ -9,7 +9,6 @@ import {
|
||||
Modal,
|
||||
Spin,
|
||||
Alert,
|
||||
message,
|
||||
Dropdown
|
||||
} from 'antd'
|
||||
import { LoadingOutlined } from '@ant-design/icons'
|
||||
@ -27,7 +26,6 @@ const NotesPanel = ({ _id, type }) => {
|
||||
const [newNoteOpen, setNewNoteOpen] = useState(false)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [initialized, setInitialized] = useState(false)
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const [error, setError] = useState(null)
|
||||
const [notes, setNotes] = useState(null)
|
||||
const [expandedNotes, setExpandedNotes] = useState({})
|
||||
@ -145,7 +143,6 @@ const NotesPanel = ({ _id, type }) => {
|
||||
|
||||
return (
|
||||
<Flex vertical gap='large' style={{ width: '100%' }}>
|
||||
{contextHolder}
|
||||
<Flex justify='space-between'>
|
||||
<Space size={'small'}>
|
||||
<Dropdown menu={actionItems} disabled={loading}>
|
||||
@ -188,7 +185,6 @@ const NotesPanel = ({ _id, type }) => {
|
||||
<NewNote
|
||||
onOk={() => {
|
||||
setNewNoteOpen(false)
|
||||
messageApi.success('New note added.')
|
||||
}}
|
||||
reset={newNoteOpen}
|
||||
defaultValues={{
|
||||
|
||||
@ -5,12 +5,12 @@ import {
|
||||
Button,
|
||||
Empty,
|
||||
Spin,
|
||||
message,
|
||||
Popconfirm,
|
||||
Flex,
|
||||
Badge,
|
||||
Dropdown
|
||||
} from 'antd'
|
||||
import { useMessageContext } from '../context/MessageContext'
|
||||
import {
|
||||
BellOutlined,
|
||||
DeleteOutlined,
|
||||
@ -29,7 +29,7 @@ const NotificationCenter = ({ visible }) => {
|
||||
const [notifications, setNotifications] = useState([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const { showSuccess, showError } = useMessageContext()
|
||||
|
||||
const { authenticated } = useContext(AuthContext)
|
||||
|
||||
@ -47,11 +47,11 @@ const NotificationCenter = ({ visible }) => {
|
||||
setNotifications(response.data)
|
||||
} catch (error) {
|
||||
console.error('Error fetching notifications:', error)
|
||||
messageApi.error('Failed to fetch notifications')
|
||||
showError('Failed to fetch notifications')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [authenticated, messageApi])
|
||||
}, [authenticated, showError])
|
||||
|
||||
const markAsRead = useCallback(
|
||||
async (notificationId) => {
|
||||
@ -77,13 +77,13 @@ const NotificationCenter = ({ visible }) => {
|
||||
})
|
||||
)
|
||||
|
||||
messageApi.success('Notification marked as read')
|
||||
showSuccess('Notification marked as read')
|
||||
} catch (error) {
|
||||
console.error('Error marking notification as read:', error)
|
||||
messageApi.error('Failed to mark notification as read')
|
||||
showError('Failed to mark notification as read')
|
||||
}
|
||||
},
|
||||
[messageApi]
|
||||
[showSuccess, showError]
|
||||
)
|
||||
|
||||
const markAllAsRead = useCallback(async () => {
|
||||
@ -104,12 +104,12 @@ const NotificationCenter = ({ visible }) => {
|
||||
prev.map((notification) => ({ ...notification, read: true }))
|
||||
)
|
||||
|
||||
messageApi.success('All notifications marked as read')
|
||||
showSuccess('All notifications marked as read')
|
||||
} catch (error) {
|
||||
console.error('Error marking all notifications as read:', error)
|
||||
messageApi.error('Failed to mark all notifications as read')
|
||||
showError('Failed to mark all notifications as read')
|
||||
}
|
||||
}, [messageApi])
|
||||
}, [showSuccess, showError])
|
||||
|
||||
const deleteAllNotifications = useCallback(async () => {
|
||||
try {
|
||||
@ -121,14 +121,14 @@ const NotificationCenter = ({ visible }) => {
|
||||
})
|
||||
|
||||
setNotifications([])
|
||||
messageApi.success('All notifications deleted')
|
||||
showSuccess('All notifications deleted')
|
||||
} catch (error) {
|
||||
console.error('Error deleting all notifications:', error)
|
||||
messageApi.error('Failed to delete all notifications')
|
||||
showError('Failed to delete all notifications')
|
||||
} finally {
|
||||
setShowDeleteConfirm(false)
|
||||
}
|
||||
}, [messageApi])
|
||||
}, [showSuccess, showError])
|
||||
|
||||
useEffect(() => {
|
||||
if (visible && authenticated) {
|
||||
@ -179,7 +179,6 @@ const NotificationCenter = ({ visible }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{contextHolder}
|
||||
<Flex justify='space-between' align='center'>
|
||||
<Space size='middle'>
|
||||
<Dropdown menu={actionItems}>
|
||||
|
||||
@ -7,9 +7,10 @@ import {
|
||||
useImperativeHandle,
|
||||
useRef
|
||||
} from 'react'
|
||||
import { Form, message } from 'antd'
|
||||
import { Form } from 'antd'
|
||||
import { ApiServerContext } from '../context/ApiServerContext'
|
||||
import { AuthContext } from '../context/AuthContext'
|
||||
import { useMessageContext } from '../context/MessageContext'
|
||||
import PropTypes from 'prop-types'
|
||||
import DeleteObjectModal from './DeleteObjectModal'
|
||||
import merge from 'lodash/merge'
|
||||
@ -54,7 +55,7 @@ const ObjectForm = forwardRef(
|
||||
|
||||
const [form] = Form.useForm()
|
||||
const formUpdateValues = Form.useWatch([], form)
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
const { showSuccess, showError: showMessageError } = useMessageContext()
|
||||
const [deleteModalOpen, setDeleteModalOpen] = useState(false)
|
||||
const [deleteLoading, setDeleteLoading] = useState(false)
|
||||
const {
|
||||
@ -296,7 +297,7 @@ const ObjectForm = forwardRef(
|
||||
onStateChangeRef.current({ loading: false })
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
messageApi.error('Failed to fetch object info')
|
||||
showMessageError('Failed to fetch object info')
|
||||
showError(
|
||||
`Failed to fetch object information. Message: ${err.message}. Code: ${err.code}`,
|
||||
fetchObject
|
||||
@ -308,7 +309,7 @@ const ObjectForm = forwardRef(
|
||||
id,
|
||||
type,
|
||||
form,
|
||||
messageApi,
|
||||
showMessageError,
|
||||
showError,
|
||||
calculateComputedValues,
|
||||
model
|
||||
@ -433,13 +434,13 @@ const ObjectForm = forwardRef(
|
||||
...currentFormData,
|
||||
_isEditing: isEditingRef.current
|
||||
})
|
||||
messageApi.success('Information updated successfully')
|
||||
showSuccess('Information updated successfully')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
if (err.errorFields) {
|
||||
return
|
||||
}
|
||||
messageApi.error('Failed to update information')
|
||||
showMessageError('Failed to update information')
|
||||
showError(
|
||||
`Failed to update information. Message: ${err.message}. Code: ${err.code}`,
|
||||
() => handleUpdate()
|
||||
@ -460,11 +461,11 @@ const ObjectForm = forwardRef(
|
||||
try {
|
||||
await deleteObject(id, type)
|
||||
setDeleteModalOpen(false)
|
||||
messageApi.success('Deleted successfully')
|
||||
showSuccess('Deleted successfully')
|
||||
// Optionally: trigger a callback to parent to remove this object from view
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
messageApi.error('Failed to delete')
|
||||
showMessageError('Failed to delete')
|
||||
showError(
|
||||
`Failed to delete. Message: ${err.message}. Code: ${err.code}`,
|
||||
confirmDelete
|
||||
@ -550,7 +551,6 @@ const ObjectForm = forwardRef(
|
||||
})
|
||||
}}
|
||||
>
|
||||
{contextHolder}
|
||||
{children({
|
||||
loading: fetchLoading,
|
||||
isEditing,
|
||||
|
||||
@ -9,7 +9,6 @@ import {
|
||||
} from 'react'
|
||||
import {
|
||||
Table,
|
||||
message,
|
||||
Skeleton,
|
||||
Card,
|
||||
Row,
|
||||
@ -85,7 +84,6 @@ const ObjectTable = forwardRef(
|
||||
if (cards && isElectron) {
|
||||
adjustedScrollHeight = 'calc(var(--unit-100vh) - 260px)'
|
||||
}
|
||||
const [, contextHolder] = message.useMessage()
|
||||
const tableRef = useRef(null)
|
||||
const model = getModelByName(type)
|
||||
const tableFilterRef = useRef({})
|
||||
@ -781,7 +779,6 @@ const ObjectTable = forwardRef(
|
||||
|
||||
return (
|
||||
<>
|
||||
{contextHolder}
|
||||
<Flex gap={'middle'} vertical>
|
||||
<Table
|
||||
ref={tableRef}
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import PropTypes from 'prop-types'
|
||||
import { Card, Tree, Spin, Space, Button, message } from 'antd'
|
||||
import { Card, Tree, Spin, Space, Button } from 'antd'
|
||||
import { LoadingOutlined } from '@ant-design/icons'
|
||||
import { useState, useEffect, useContext } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useMessageContext } from '../context/MessageContext'
|
||||
import { PrintServerContext } from '../context/PrintServerContext'
|
||||
import axios from 'axios'
|
||||
import JobIcon from '../../Icons/JobIcon'
|
||||
@ -20,7 +21,7 @@ const PrinterJobsTree = ({
|
||||
const [treeLoading, setTreeLoading] = useState(initialLoading)
|
||||
const [error, setError] = useState(null)
|
||||
const { printServer } = useContext(PrintServerContext)
|
||||
const [messageApi] = message.useMessage()
|
||||
const { showError } = useMessageContext()
|
||||
const [expandedKeys, setExpandedKeys] = useState([])
|
||||
const [treeData, setTreeData] = useState([])
|
||||
const navigate = useNavigate()
|
||||
@ -105,7 +106,7 @@ const PrinterJobsTree = ({
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
setError('Failed to fetch sub jobs')
|
||||
messageApi.error('Failed to fetch sub jobs')
|
||||
showError('Failed to fetch sub jobs')
|
||||
} finally {
|
||||
setTreeLoading(false)
|
||||
}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
// PrinterSelect.js
|
||||
import PropTypes from 'prop-types'
|
||||
import { Tree, Card, Spin, Space, Button, message, Typography } from 'antd'
|
||||
import { Tree, Card, Spin, Space, Button, Typography } from 'antd'
|
||||
import { LoadingOutlined } from '@ant-design/icons'
|
||||
import { useState, useEffect, useContext, useCallback } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useMessageContext } from '../context/MessageContext'
|
||||
import PrinterState from './PrinterState'
|
||||
import axios from 'axios'
|
||||
import { PrintServerContext } from '../context/PrintServerContext'
|
||||
@ -22,7 +23,7 @@ const SubJobsTree = ({ jobData, loading }) => {
|
||||
const [treeLoading, setTreeLoading] = useState(loading)
|
||||
const [error, setError] = useState(null)
|
||||
const { printServer } = useContext(PrintServerContext)
|
||||
const [messageApi] = message.useMessage()
|
||||
const { showError } = useMessageContext()
|
||||
const [expandedKeys, setExpandedKeys] = useState([])
|
||||
const [currentJobData, setCurrentJobData] = useState(null)
|
||||
const navigate = useNavigate()
|
||||
@ -104,7 +105,7 @@ const SubJobsTree = ({ jobData, loading }) => {
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
setError('Failed to fetch print job details')
|
||||
messageApi.error('Failed to fetch print job details')
|
||||
showError('Failed to fetch print job details')
|
||||
} finally {
|
||||
setTreeLoading(false)
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import PauseCircleIcon from '../../components/Icons/PauseCircleIcon'
|
||||
import StopCircleIcon from '../../components/Icons/StopCircleIcon'
|
||||
import FilamentStockIcon from '../../components/Icons/FilamentStockIcon'
|
||||
import ControlIcon from '../../components/Icons/ControlIcon'
|
||||
import JobIcon from '../../components/Icons/JobIcon'
|
||||
|
||||
export const Printer = {
|
||||
name: 'printer',
|
||||
@ -114,9 +115,9 @@ export const Printer = {
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'queue',
|
||||
label: 'Queue',
|
||||
icon: PlayCircleIcon,
|
||||
name: 'job',
|
||||
label: 'Job',
|
||||
icon: JobIcon,
|
||||
disabled: (objectData) => {
|
||||
return objectData?.online == false
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user