Compare commits
No commits in common. "847e59315487b7b248690f2dc886613a59ee8430" and "3f9da22b58d7d5e487bbe7b11bc146314ddcf000" have entirely different histories.
847e593154
...
3f9da22b58
@ -37,8 +37,6 @@
|
|||||||
.ant-badge,
|
.ant-badge,
|
||||||
.ant-select-dropdown,
|
.ant-select-dropdown,
|
||||||
.ant-splitter,
|
.ant-splitter,
|
||||||
.ant-steps-item-title,
|
|
||||||
.ant-steps-icon,
|
|
||||||
[class*=' ant-radio'] {
|
[class*=' ant-radio'] {
|
||||||
font-family: 'DM Sans';
|
font-family: 'DM Sans';
|
||||||
}
|
}
|
||||||
@ -48,15 +46,6 @@
|
|||||||
font-family: 'DM Mono';
|
font-family: 'DM Mono';
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-steps .ant-steps-item-icon {
|
|
||||||
line-height: 30px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-steps .ant-steps-item-icon .anticon.anticon-check.ant-steps-finish-icon {
|
|
||||||
line-height: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-typography .id-text {
|
.ant-typography .id-text {
|
||||||
font-family: 'DM Mono';
|
font-family: 'DM Mono';
|
||||||
font-size: 11.9px;
|
font-size: 11.9px;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ const StockEvents = () => {
|
|||||||
const [viewMode, setViewMode] = useViewMode('stockEvents')
|
const [viewMode, setViewMode] = useViewMode('stockEvents')
|
||||||
|
|
||||||
const [columnVisibility, setColumnVisibility] =
|
const [columnVisibility, setColumnVisibility] =
|
||||||
useColumnVisibility('stockEvent')
|
useColumnVisibility('stockEvents')
|
||||||
|
|
||||||
const actionItems = {
|
const actionItems = {
|
||||||
items: [
|
items: [
|
||||||
|
|||||||
@ -11,7 +11,7 @@ const AuditLogs = () => {
|
|||||||
const tableRef = useRef()
|
const tableRef = useRef()
|
||||||
|
|
||||||
const [columnVisibility, updateColumnVisibility] =
|
const [columnVisibility, updateColumnVisibility] =
|
||||||
useColumnVisibility('auditLog')
|
useColumnVisibility('auditLogs')
|
||||||
|
|
||||||
const actionItems = {
|
const actionItems = {
|
||||||
items: [
|
items: [
|
||||||
|
|||||||
@ -54,8 +54,8 @@ const CourierServices = () => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='courierService'
|
type='courierService'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='courierService' />
|
<ExportListButton objectType='courierService' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -53,8 +53,8 @@ const Couriers = () => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='courier'
|
type='courier'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='courier' />
|
<ExportListButton objectType='courier' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -54,8 +54,8 @@ const DocumentJobs = () => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='documentJob'
|
type='documentJob'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='documentJob' />
|
<ExportListButton objectType='documentJob' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -53,8 +53,8 @@ const DocumentPrinters = () => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='documentPrinter'
|
type='documentPrinter'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='documentPrinter' />
|
<ExportListButton objectType='documentPrinter' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -54,8 +54,8 @@ const DocumentTemplates = () => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='documentTemplate'
|
type='documentTemplate'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='documentTemplate' />
|
<ExportListButton objectType='documentTemplate' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -42,8 +42,8 @@ const Files = () => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='file'
|
type='file'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='file' />
|
<ExportListButton objectType='file' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -84,7 +84,6 @@ const Hosts = () => {
|
|||||||
open={newHostOpen}
|
open={newHostOpen}
|
||||||
footer={null}
|
footer={null}
|
||||||
width={700}
|
width={700}
|
||||||
destroyOnHidden={true}
|
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setNewHostOpen(false)
|
setNewHostOpen(false)
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -1,14 +1,21 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { useMediaQuery } from 'react-responsive'
|
||||||
|
import { Typography, Flex, Steps, Divider } from 'antd'
|
||||||
|
|
||||||
import ObjectInfo from '../../common/ObjectInfo'
|
import ObjectInfo from '../../common/ObjectInfo'
|
||||||
import NewObjectForm from '../../common/NewObjectForm'
|
import NewObjectForm from '../../common/NewObjectForm'
|
||||||
import WizardView from '../../common/WizardView'
|
import NewObjectButtons from '../../common/NewObjectButtons'
|
||||||
|
|
||||||
|
const { Title } = Typography
|
||||||
|
|
||||||
const NewHost = ({ onOk }) => {
|
const NewHost = ({ onOk }) => {
|
||||||
|
const [currentStep, setCurrentStep] = useState(0)
|
||||||
|
|
||||||
|
const isMobile = useMediaQuery({ maxWidth: 768 })
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NewObjectForm
|
<NewObjectForm type={'host'}>
|
||||||
type={'host'}
|
|
||||||
defaultValues={{ active: true, state: { type: 'offline' } }}
|
|
||||||
>
|
|
||||||
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
@ -36,20 +43,6 @@ const NewHost = ({ onOk }) => {
|
|||||||
isEditing={true}
|
isEditing={true}
|
||||||
required={false}
|
required={false}
|
||||||
objectData={objectData}
|
objectData={objectData}
|
||||||
visibleProperties={{
|
|
||||||
_id: false,
|
|
||||||
createdAt: false,
|
|
||||||
updatedAt: false,
|
|
||||||
operatingSystem: false,
|
|
||||||
'deviceInfo.os': false,
|
|
||||||
'deviceInfo.os.hostname': false,
|
|
||||||
'deviceInfo.cpu': false,
|
|
||||||
'deviceInfo.cpu.model': false,
|
|
||||||
'deviceInfo.user.username': false,
|
|
||||||
'deviceInfo.user.homedir': false,
|
|
||||||
'deviceInfo.process.nodeVersion': false,
|
|
||||||
files: false
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -64,18 +57,7 @@ const NewHost = ({ onOk }) => {
|
|||||||
visibleProperties={{
|
visibleProperties={{
|
||||||
_id: false,
|
_id: false,
|
||||||
createdAt: false,
|
createdAt: false,
|
||||||
updatedAt: false,
|
updatedAt: false
|
||||||
operatingSystem: false,
|
|
||||||
'deviceInfo.os': false,
|
|
||||||
'deviceInfo.os.hostname': false,
|
|
||||||
'deviceInfo.cpu': false,
|
|
||||||
'deviceInfo.cpu.model': false,
|
|
||||||
'deviceInfo.user.username': false,
|
|
||||||
'deviceInfo.user.homedir': false,
|
|
||||||
'deviceInfo.process.nodeVersion': false,
|
|
||||||
files: false,
|
|
||||||
connectedAt: false,
|
|
||||||
online: false
|
|
||||||
}}
|
}}
|
||||||
isEditing={false}
|
isEditing={false}
|
||||||
objectData={objectData}
|
objectData={objectData}
|
||||||
@ -84,18 +66,45 @@ const NewHost = ({ onOk }) => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
<WizardView
|
<Flex gap='middle'>
|
||||||
steps={steps}
|
{!isMobile && (
|
||||||
loading={submitLoading}
|
<div style={{ minWidth: '160px' }}>
|
||||||
formValid={formValid}
|
<Steps
|
||||||
title='New Host'
|
current={currentStep}
|
||||||
|
items={steps}
|
||||||
|
direction='vertical'
|
||||||
|
style={{ width: 'fit-content' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!isMobile && (
|
||||||
|
<Divider type='vertical' style={{ height: 'unset' }} />
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Flex vertical gap='middle' style={{ flexGrow: 1 }}>
|
||||||
|
<Title level={2} style={{ margin: 0 }}>
|
||||||
|
New Host
|
||||||
|
</Title>
|
||||||
|
<div style={{ minHeight: '260px', marginBottom: 8 }}>
|
||||||
|
{steps[currentStep].content}
|
||||||
|
</div>
|
||||||
|
<NewObjectButtons
|
||||||
|
currentStep={currentStep}
|
||||||
|
totalSteps={steps.length}
|
||||||
|
onPrevious={() => setCurrentStep((prev) => prev - 1)}
|
||||||
|
onNext={() => setCurrentStep((prev) => prev + 1)}
|
||||||
onSubmit={async () => {
|
onSubmit={async () => {
|
||||||
const result = await handleSubmit()
|
const result = await handleSubmit()
|
||||||
if (result) {
|
if (result) {
|
||||||
onOk()
|
onOk()
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
formValid={formValid}
|
||||||
|
submitLoading={submitLoading}
|
||||||
/>
|
/>
|
||||||
|
</Flex>
|
||||||
|
</Flex>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
</NewObjectForm>
|
</NewObjectForm>
|
||||||
|
|||||||
@ -54,8 +54,8 @@ const NoteTypes = () => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='noteType'
|
type='noteType'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='noteType' />
|
<ExportListButton objectType='noteType' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -58,8 +58,8 @@ const Parts = (filter) => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='part'
|
type='part'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='part' />
|
<ExportListButton objectType='part' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -231,7 +231,7 @@ const Products = () => {
|
|||||||
]
|
]
|
||||||
|
|
||||||
const [columnVisibility, updateColumnVisibility] = useColumnVisibility(
|
const [columnVisibility, updateColumnVisibility] = useColumnVisibility(
|
||||||
'product',
|
'Products',
|
||||||
columns
|
columns
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -53,8 +53,8 @@ const TaxRates = () => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='taxRate'
|
type='taxRate'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='taxRate' />
|
<ExportListButton objectType='taxRate' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -53,8 +53,8 @@ const Vendors = () => {
|
|||||||
<ColumnViewButton
|
<ColumnViewButton
|
||||||
type='vendor'
|
type='vendor'
|
||||||
loading={false}
|
loading={false}
|
||||||
visibleState={columnVisibility}
|
collapseState={columnVisibility}
|
||||||
updateVisibleState={setColumnVisibility}
|
updateCollapseState={setColumnVisibility}
|
||||||
/>
|
/>
|
||||||
<ExportListButton objectType='vendor' />
|
<ExportListButton objectType='vendor' />
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useMediaQuery } from 'react-responsive'
|
import { useMediaQuery } from 'react-responsive'
|
||||||
import CheckIcon from '../../Icons/CheckIcon'
|
|
||||||
import {
|
import {
|
||||||
Typography,
|
Typography,
|
||||||
Flex,
|
Flex,
|
||||||
@ -41,17 +40,7 @@ const WizardView = ({
|
|||||||
<div style={{ minWidth: sideBarGrow == true ? '100%' : '160px' }}>
|
<div style={{ minWidth: sideBarGrow == true ? '100%' : '160px' }}>
|
||||||
<Steps
|
<Steps
|
||||||
current={currentStep}
|
current={currentStep}
|
||||||
items={steps.map((step, index) => ({
|
items={steps}
|
||||||
...step,
|
|
||||||
icon:
|
|
||||||
index < currentStep ? (
|
|
||||||
<div className='ant-steps-item-icon'>
|
|
||||||
<CheckIcon />
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
step.icon
|
|
||||||
)
|
|
||||||
}))}
|
|
||||||
direction='vertical'
|
direction='vertical'
|
||||||
style={{ width: 'fit-content' }}
|
style={{ width: 'fit-content' }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -1,22 +1,13 @@
|
|||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import { getModelByName } from '../../../database/ObjectModels'
|
import { getModelByName } from '../../../database/ObjectModels'
|
||||||
|
|
||||||
const useColumnVisibility = (type, customColumns) => {
|
const useColumnVisibility = (type) => {
|
||||||
const getInitialVisibility = () => {
|
const getInitialVisibility = () => {
|
||||||
const storageKey = `${type}_columnVisibility`
|
const stored = sessionStorage.getItem(`${type}_columnVisibility`)
|
||||||
const stored = sessionStorage.getItem(storageKey)
|
|
||||||
if (stored) {
|
if (stored) {
|
||||||
return JSON.parse(stored)
|
return JSON.parse(stored)
|
||||||
}
|
}
|
||||||
// Default visibility - all columns visible
|
// Default visibility - all columns visible
|
||||||
if (customColumns && Array.isArray(customColumns)) {
|
|
||||||
return customColumns.reduce((acc, col) => {
|
|
||||||
if (col.key) {
|
|
||||||
acc[col.key] = true
|
|
||||||
}
|
|
||||||
return acc
|
|
||||||
}, {})
|
|
||||||
}
|
|
||||||
const model = getModelByName(type)
|
const model = getModelByName(type)
|
||||||
const columns = model.columns || []
|
const columns = model.columns || []
|
||||||
return columns.reduce((acc, columnName) => {
|
return columns.reduce((acc, columnName) => {
|
||||||
|
|||||||
@ -28,6 +28,13 @@ export const Host = {
|
|||||||
url: (_id) =>
|
url: (_id) =>
|
||||||
`/dashboard/management/hosts/info?hostId=${_id}&action=reload`
|
`/dashboard/management/hosts/info?hostId=${_id}&action=reload`
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'connect',
|
||||||
|
label: 'Connect',
|
||||||
|
icon: OTPIcon,
|
||||||
|
url: (_id) =>
|
||||||
|
`/dashboard/management/hosts/info?hostId=${_id}&action=hostOTP`
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'edit',
|
name: 'edit',
|
||||||
label: 'Edit',
|
label: 'Edit',
|
||||||
@ -58,16 +65,6 @@ export const Host = {
|
|||||||
visible: (objectData) => {
|
visible: (objectData) => {
|
||||||
return objectData?._isEditing && objectData?._isEditing == true
|
return objectData?._isEditing && objectData?._isEditing == true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'divider'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'connect',
|
|
||||||
label: 'Connect',
|
|
||||||
icon: OTPIcon,
|
|
||||||
url: (_id) =>
|
|
||||||
`/dashboard/management/hosts/info?hostId=${_id}&action=hostOTP`
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
columns: ['name', '_reference', 'state', 'tags', 'connectedAt'],
|
columns: ['name', '_reference', 'state', 'tags', 'connectedAt'],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user