Compare commits

..

3 Commits

Author SHA1 Message Date
f2ccec483f Refactor invoice, payment, tax record, and stock components to utilize getModelByName for master filters
Some checks failed
farmcontrol/farmcontrol-ui/pipeline/head There was a failure building this commit
- Updated multiple components including InvoiceInfo, PaymentInfo, TaxRecordInfo, and various stock-related components to use getModelByName for constructing master filters.
- Improved code consistency and readability by replacing hardcoded parent ID references with dynamic model prefixes.
- Cleaned up unnecessary whitespace and optimized component structure for better maintainability.
2026-08-19 16:40:10 +01:00
ee038d08c3 Add CodeDiffViewer and DiffLabel components for enhanced code comparison
- Introduced CodeDiffViewer component utilizing @codemirror/merge for visual code diffs.
- Added DiffLabel component to display code change statistics and trigger the CodeDiffViewer modal.
- Updated PropertyChanges component to integrate DiffLabel for code property changes.
- Enhanced styling for code diff display with new CSS classes.
- Updated package.json and lock files to include @codemirror/merge dependency.
2026-08-19 16:40:04 +01:00
d8c13426d1 Refactor text display components to use ElipsisText for improved overflow handling
- Introduced a new ElipsisText component to manage text overflow and truncation more effectively.
- Replaced instances of the Text component with ElipsisText across various components including AddressDisplay, EmailDisplay, and FileList for consistent text handling.
- Updated styles in multiple components to ensure proper layout and responsiveness when displaying long text.
2026-08-19 15:12:55 +01:00
97 changed files with 3739 additions and 3019 deletions

View File

@ -330,6 +330,28 @@ code {
padding: 0 !important; padding: 0 !important;
} }
.iddisplay > *:first-child {
min-width: 0;
flex: 0 1 auto;
max-width: 100%;
overflow: hidden;
}
.iddisplay .ant-btn {
flex-shrink: 0;
}
.miscid > *:first-child {
min-width: 0;
flex: 0 1 auto;
max-width: 100%;
overflow: hidden;
}
.miscid .ant-btn {
flex-shrink: 0;
}
.ant-popover-inner:has(.spotlight-tooltip) { .ant-popover-inner:has(.spotlight-tooltip) {
padding: 0 !important; padding: 0 !important;
} }
@ -1139,3 +1161,150 @@ span.ant-skeleton-input.ant-skeleton-input-sm.text-skeleton {
.filter-sidebar-field-select .ant-select-selector { .filter-sidebar-field-select .ant-select-selector {
width: max-content !important; width: max-content !important;
} }
.elipsis-text-wrapper.ant-typography {
display: block;
min-width: 0;
max-width: 100%;
width: auto;
overflow: hidden;
flex-grow: 0;
flex-shrink: 1;
flex-basis: auto;
}
.elipsis-text-wrapper.ant-typography .elipsis-text {
display: flex;
flex-direction: row;
align-items: baseline;
width: 100%;
max-width: 100%;
min-width: 0;
position: relative;
overflow: hidden;
white-space: pre;
}
.elipsis-text-wrapper.ant-typography code.elipsis-text-measure,
.elipsis-text-wrapper.ant-typography code.elipsis-text-full,
.elipsis-text-wrapper.ant-typography code.elipsis-text-truncated {
margin: 0;
box-sizing: border-box;
}
.elipsis-text-measure {
position: absolute;
visibility: hidden;
pointer-events: none;
white-space: pre;
}
.elipsis-text-full {
display: none;
position: absolute;
left: 0;
top: 0;
width: max-content;
max-width: 100%;
min-width: 0;
overflow: hidden;
white-space: pre;
}
.elipsis-text:not(.is-truncated) .elipsis-text-full {
display: inline-block;
}
.elipsis-text.is-truncated .elipsis-text-full {
display: none;
}
.elipsis-text:not(.is-truncated) .elipsis-text-truncated .elipsis-text-dots {
display: none;
}
.elipsis-text:not(.is-truncated) .elipsis-text-truncated {
visibility: hidden;
}
.elipsis-text-truncated {
display: flex;
flex: 1 1 0;
align-items: baseline;
min-width: 0;
width: 100%;
max-width: 100%;
overflow: hidden;
white-space: pre;
}
.elipsis-text-wrapper.ant-typography code.elipsis-text-truncated {
display: flex;
}
.elipsis-text-start,
.elipsis-text-end {
flex: 1 1 0;
min-width: 0;
overflow: hidden;
white-space: pre;
}
.elipsis-text-start {
mask-image: linear-gradient(
to right,
#000 0%,
#000 calc(100% - 0.8em),
transparent 100%
);
-webkit-mask-image: linear-gradient(
to right,
#000 0%,
#000 calc(100% - 0.8em),
transparent 100%
);
}
.elipsis-text-end {
display: flex;
justify-content: flex-end;
mask-image: linear-gradient(
to left,
#000 0%,
#000 calc(100% - 0.8em),
transparent 100%
);
-webkit-mask-image: linear-gradient(
to left,
#000 0%,
#000 calc(100% - 0.8em),
transparent 100%
);
}
.elipsis-text-end-inner {
flex: 0 0 auto;
white-space: pre;
}
.elipsis-text-dots {
flex: 0 0 auto;
user-select: none;
}
.code-diff-viewer {
height: 70vh;
border: 1px solid #85858541;
}
.code-diff-viewer .cm-mergeView {
height: 100%;
overflow: auto;
}
.diff-label-square {
width: 7px;
height: 7px;
background-color: #85858541;
border-radius: 2px;
}

View File

@ -23,6 +23,7 @@
"@codemirror/lang-xml": "^6.1.0", "@codemirror/lang-xml": "^6.1.0",
"@codemirror/lang-yaml": "^6.1.2", "@codemirror/lang-yaml": "^6.1.2",
"@codemirror/language": "6.12.1", "@codemirror/language": "6.12.1",
"@codemirror/merge": "^6.12.2",
"@codemirror/state": "6.7.1", "@codemirror/state": "6.7.1",
"@codemirror/theme-one-dark": "^6.1.3", "@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "6.39.12", "@codemirror/view": "6.39.12",
@ -238,6 +239,8 @@
"@codemirror/lint": ["@codemirror/lint@6.9.3", "", { "dependencies": { "@codemirror/state": "6.7.1", "@codemirror/view": "6.39.12", "crelt": "1.0.6" } }, "sha512-y3YkYhdnhjDBAe0VIA0c4wVoFOvnp8CnAvfLqi0TqotIv92wIlAAP7HELOpLBsKwjAX6W92rSflA6an/2zBvXw=="], "@codemirror/lint": ["@codemirror/lint@6.9.3", "", { "dependencies": { "@codemirror/state": "6.7.1", "@codemirror/view": "6.39.12", "crelt": "1.0.6" } }, "sha512-y3YkYhdnhjDBAe0VIA0c4wVoFOvnp8CnAvfLqi0TqotIv92wIlAAP7HELOpLBsKwjAX6W92rSflA6an/2zBvXw=="],
"@codemirror/merge": ["@codemirror/merge@6.12.2", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/highlight": "^1.0.0", "style-mod": "^4.1.0" } }, "sha512-V8JvyAPjHbPupqP7BeMcsdsYCbyPij74jxIbaIJDORI+VZzW44zFmon8bF+oxGWvOKhcRmkiUMXd8MxHr3YA2w=="],
"@codemirror/search": ["@codemirror/search@6.6.0", "", { "dependencies": { "@codemirror/state": "6.7.1", "@codemirror/view": "6.39.12", "crelt": "1.0.7" } }, "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw=="], "@codemirror/search": ["@codemirror/search@6.6.0", "", { "dependencies": { "@codemirror/state": "6.7.1", "@codemirror/view": "6.39.12", "crelt": "1.0.7" } }, "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw=="],
"@codemirror/state": ["@codemirror/state@6.7.1", "", { "dependencies": { "@marijn/find-cluster-break": "1.0.3" } }, "sha512-9QzNDgE4EYDnAHfrTlR2lwiPciiOymLtwKK+8yHQzCc7GXhAP9xdEbEJFy2IWB1j9UGUl9BsgMmTo/ImA02T7A=="], "@codemirror/state": ["@codemirror/state@6.7.1", "", { "dependencies": { "@marijn/find-cluster-break": "1.0.3" } }, "sha512-9QzNDgE4EYDnAHfrTlR2lwiPciiOymLtwKK+8yHQzCc7GXhAP9xdEbEJFy2IWB1j9UGUl9BsgMmTo/ImA02T7A=="],

View File

@ -27,6 +27,7 @@
"@codemirror/lang-xml": "^6.1.0", "@codemirror/lang-xml": "^6.1.0",
"@codemirror/lang-yaml": "^6.1.2", "@codemirror/lang-yaml": "^6.1.2",
"@codemirror/language": "6.12.1", "@codemirror/language": "6.12.1",
"@codemirror/merge": "^6.12.2",
"@codemirror/state": "6.7.1", "@codemirror/state": "6.7.1",
"@codemirror/theme-one-dark": "^6.1.3", "@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "6.39.12", "@codemirror/view": "6.39.12",

14
pnpm-lock.yaml generated
View File

@ -70,6 +70,9 @@ importers:
'@codemirror/language': '@codemirror/language':
specifier: 6.12.1 specifier: 6.12.1
version: 6.12.1 version: 6.12.1
'@codemirror/merge':
specifier: ^6.12.2
version: 6.12.2
'@codemirror/state': '@codemirror/state':
specifier: 6.7.1 specifier: 6.7.1
version: 6.7.1 version: 6.7.1
@ -611,6 +614,9 @@ packages:
'@codemirror/lint@6.9.3': '@codemirror/lint@6.9.3':
resolution: {integrity: sha512-y3YkYhdnhjDBAe0VIA0c4wVoFOvnp8CnAvfLqi0TqotIv92wIlAAP7HELOpLBsKwjAX6W92rSflA6an/2zBvXw==} resolution: {integrity: sha512-y3YkYhdnhjDBAe0VIA0c4wVoFOvnp8CnAvfLqi0TqotIv92wIlAAP7HELOpLBsKwjAX6W92rSflA6an/2zBvXw==}
'@codemirror/merge@6.12.2':
resolution: {integrity: sha512-V8JvyAPjHbPupqP7BeMcsdsYCbyPij74jxIbaIJDORI+VZzW44zFmon8bF+oxGWvOKhcRmkiUMXd8MxHr3YA2w==}
'@codemirror/search@6.6.0': '@codemirror/search@6.6.0':
resolution: {integrity: sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==} resolution: {integrity: sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==}
@ -7047,6 +7053,14 @@ snapshots:
'@codemirror/view': 6.39.12 '@codemirror/view': 6.39.12
crelt: 1.0.6 crelt: 1.0.6
'@codemirror/merge@6.12.2':
dependencies:
'@codemirror/language': 6.12.1
'@codemirror/state': 6.7.1
'@codemirror/view': 6.39.12
'@lezer/highlight': 1.2.3
style-mod: 4.1.3
'@codemirror/search@6.6.0': '@codemirror/search@6.6.0':
dependencies: dependencies:
'@codemirror/state': 6.7.1 '@codemirror/state': 6.7.1

View File

@ -26,7 +26,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js' import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx' import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx' import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
@ -38,7 +38,6 @@ const InvoiceInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -82,7 +81,7 @@ const InvoiceInfo = () => {
delete: () => { delete: () => {
objectFormRef?.current?.handleDelete?.() objectFormRef?.current?.handleDelete?.()
return true return true
}, }
} }
return ( return (
@ -253,7 +252,7 @@ const InvoiceInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='payment' type='payment'
masterFilter={{ 'invoice._id': invoiceId }} masterFilter={{ invoice: getModelByName('invoice').prefix + ':' + invoiceId }}
visibleColumns={{ invoice: false }} visibleColumns={{ invoice: false }}
/> />
)} )}
@ -273,9 +272,7 @@ const InvoiceInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -283,8 +280,13 @@ const InvoiceInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': invoiceId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('invoice').prefix +
':' +
invoiceId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -23,6 +23,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('PaymentInfo') const log = loglevel.getLogger('PaymentInfo')
@ -33,7 +34,6 @@ const PaymentInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -74,7 +74,7 @@ const PaymentInfo = () => {
delete: () => { delete: () => {
objectFormRef?.current?.handleDelete?.() objectFormRef?.current?.handleDelete?.()
return true return true
}, }
} }
return ( return (
@ -207,9 +207,7 @@ const PaymentInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -217,8 +215,13 @@ const PaymentInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': paymentId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('payment').prefix +
':' +
paymentId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('TaxRecordInfo') const log = loglevel.getLogger('TaxRecordInfo')
@ -199,8 +200,13 @@ const TaxRecordInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': taxRecordId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('taxRecord').prefix +
':' +
taxRecordId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -22,6 +22,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder'
import DocumentPrintButton from '../../common/DocumentPrintButton' import DocumentPrintButton from '../../common/DocumentPrintButton'
import UserNotifierToggle from '../../common/UserNotifierToggle' import UserNotifierToggle from '../../common/UserNotifierToggle'
import ScrollBox from '../../common/ScrollBox' import ScrollBox from '../../common/ScrollBox'
import { getModelByName } from '../../../../database/ObjectModels.js'
import HistoryDisplay from '../../common/HistoryDisplay' import HistoryDisplay from '../../common/HistoryDisplay'
const FilamentStockInfo = () => { const FilamentStockInfo = () => {
@ -186,7 +187,7 @@ const FilamentStockInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='stockEvent' type='stockEvent'
masterFilter={{ 'parent._id': filamentStockId }} masterFilter={{ parent: getModelByName('filamentStock').prefix + ':' + filamentStockId }}
visibleColumns={{ parent: false }} visibleColumns={{ parent: false }}
/> />
)} )}
@ -234,8 +235,13 @@ const FilamentStockInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': filamentStockId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('filamentStock').prefix +
':' +
filamentStockId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectActions from '../../common/ObjectActions.jsx'
import ObjectTable from '../../common/ObjectTable.jsx' import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('OrderItemInfo') const log = loglevel.getLogger('OrderItemInfo')
@ -205,8 +206,13 @@ const OrderItemInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': orderItemId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('orderItem').prefix +
':' +
orderItemId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -25,6 +25,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import HistoryDisplay from '../../common/HistoryDisplay.jsx' import HistoryDisplay from '../../common/HistoryDisplay.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import PartStockIcon from '../../../Icons/PartStockIcon.jsx' import PartStockIcon from '../../../Icons/PartStockIcon.jsx'
const log = loglevel.getLogger('PartStockInfo') const log = loglevel.getLogger('PartStockInfo')
@ -204,7 +205,7 @@ const PartStockInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='stockEvent' type='stockEvent'
masterFilter={{ 'parent._id': partStockId }} masterFilter={{ parent: getModelByName('partStock').prefix + ':' + partStockId }}
visibleColumns={{ parent: false }} visibleColumns={{ parent: false }}
/> />
)} )}
@ -255,8 +256,13 @@ const PartStockInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': partStockId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('partStock').prefix +
':' +
partStockId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -10,7 +10,7 @@ import InfoCollapse from '../../common/InfoCollapse.jsx'
import ObjectInfo from '../../common/ObjectInfo.jsx' import ObjectInfo from '../../common/ObjectInfo.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx' import ObjectProperty from '../../common/ObjectProperty.jsx'
import ViewButton from '../../common/ViewButton.jsx' import ViewButton from '../../common/ViewButton.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js' import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx' import InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx'
import NoteIcon from '../../../Icons/NoteIcon.jsx' import NoteIcon from '../../../Icons/NoteIcon.jsx'
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx' import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
@ -39,7 +39,6 @@ const ProductStockInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -88,7 +87,7 @@ const ProductStockInfo = () => {
delete: () => { delete: () => {
objectFormRef?.current.handleDelete?.() objectFormRef?.current.handleDelete?.()
return true return true
}, }
} }
return ( return (
@ -240,7 +239,7 @@ const ProductStockInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='stockEvent' type='stockEvent'
masterFilter={{ 'parent._id': productStockId }} masterFilter={{ parent: getModelByName('productStock').prefix + ':' + productStockId }}
visibleColumns={{ parent: false }} visibleColumns={{ parent: false }}
/> />
)} )}
@ -281,9 +280,7 @@ const ProductStockInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -291,8 +288,13 @@ const ProductStockInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': productStockId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('productStock').prefix +
':' +
productStockId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -27,6 +27,7 @@ import ScrollBox from '../../common/ScrollBox.jsx'
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx' import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx' import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx' import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import StockEventIcon from '../../../Icons/StockEventIcon.jsx' import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
const log = loglevel.getLogger('PurchaseOrderInfo') const log = loglevel.getLogger('PurchaseOrderInfo')
@ -39,7 +40,6 @@ const PurchaseOrderInfo = () => {
const shipmentsTableRef = useRef(null) const shipmentsTableRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -92,7 +92,7 @@ const PurchaseOrderInfo = () => {
delete: () => { delete: () => {
objectFormRef?.current?.handleDelete?.() objectFormRef?.current?.handleDelete?.()
return true return true
}, }
} }
return ( return (
@ -225,7 +225,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable <ObjectTable
type='orderItem' type='orderItem'
masterFilter={{ masterFilter={{
'order._id': purchaseOrderId, order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder' orderType: 'purchaseOrder'
}} }}
visibleColumns={{ order: false }} visibleColumns={{ order: false }}
@ -244,7 +244,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable <ObjectTable
type='shipment' type='shipment'
masterFilter={{ masterFilter={{
'order._id': purchaseOrderId, order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder' orderType: 'purchaseOrder'
}} }}
visibleColumns={{ order: false }} visibleColumns={{ order: false }}
@ -266,7 +266,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable <ObjectTable
type='invoice' type='invoice'
masterFilter={{ masterFilter={{
'order._id': purchaseOrderId, order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder' orderType: 'purchaseOrder'
}} }}
visibleColumns={{ order: false }} visibleColumns={{ order: false }}
@ -288,7 +288,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable <ObjectTable
type='stockEvent' type='stockEvent'
masterFilter={{ masterFilter={{
'owner._id': purchaseOrderId owner: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId
}} }}
/> />
)} )}
@ -312,9 +312,7 @@ const PurchaseOrderInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -322,8 +320,13 @@ const PurchaseOrderInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': purchaseOrderId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('purchaseOrder').prefix +
':' +
purchaseOrderId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -27,6 +27,7 @@ import NewOrderItem from '../OrderItems/NewOrderItem.jsx'
import NewShipment from './NewShipment.jsx' import NewShipment from './NewShipment.jsx'
import PostPurchaseOrder from '../PurchaseOrders/PostPurchaseOrder.jsx' import PostPurchaseOrder from '../PurchaseOrders/PostPurchaseOrder.jsx'
import AcknowledgePurchaseOrder from '../PurchaseOrders/AcknowledgePurchaseOrder.jsx' import AcknowledgePurchaseOrder from '../PurchaseOrders/AcknowledgePurchaseOrder.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx' import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
const log = loglevel.getLogger('PurchaseOrderInfo') const log = loglevel.getLogger('PurchaseOrderInfo')
@ -227,7 +228,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable <ObjectTable
type='orderItem' type='orderItem'
masterFilter={{ masterFilter={{
'order._id': purchaseOrderId, order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder' orderType: 'purchaseOrder'
}} }}
visibleColumns={{ order: false }} visibleColumns={{ order: false }}
@ -246,7 +247,7 @@ const PurchaseOrderInfo = () => {
<ObjectTable <ObjectTable
type='shipment' type='shipment'
masterFilter={{ masterFilter={{
'order._id': purchaseOrderId, order: getModelByName('purchaseOrder').prefix + ':' + purchaseOrderId,
orderType: 'purchaseOrder' orderType: 'purchaseOrder'
}} }}
visibleColumns={{ order: false }} visibleColumns={{ order: false }}
@ -282,8 +283,13 @@ const PurchaseOrderInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': purchaseOrderId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('purchaseOrder').prefix +
':' +
purchaseOrderId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -24,6 +24,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx' import OrderItemIcon from '../../../Icons/OrderItemIcon.jsx'
const log = loglevel.getLogger('ShipmentInfo') const log = loglevel.getLogger('ShipmentInfo')
@ -34,7 +35,6 @@ const ShipmentInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -77,7 +77,7 @@ const ShipmentInfo = () => {
delete: () => { delete: () => {
objectFormRef?.current?.handleDelete?.() objectFormRef?.current?.handleDelete?.()
return true return true
}, }
} }
return ( return (
@ -205,7 +205,7 @@ const ShipmentInfo = () => {
> >
<ObjectTable <ObjectTable
type='orderItem' type='orderItem'
masterFilter={{ 'shipment._id': shipmentId }} masterFilter={{ shipment: getModelByName('shipment').prefix + ':' + shipmentId }}
visibleColumns={{ visibleColumns={{
shipment: false, shipment: false,
order: false, order: false,
@ -232,9 +232,7 @@ const ShipmentInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -242,8 +240,13 @@ const ShipmentInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': shipmentId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('shipment').prefix +
':' +
shipmentId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('StockAuditInfo') const log = loglevel.getLogger('StockAuditInfo')
@ -211,8 +212,13 @@ const StockAuditInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': stockAuditId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('stockAudit').prefix +
':' +
stockAuditId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('StockLocationInfo') const log = loglevel.getLogger('StockLocationInfo')
@ -209,8 +210,13 @@ const StockLocationInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': stockLocationId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('stockLocation').prefix +
':' +
stockLocationId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -8,7 +8,7 @@ import InfoCollapse from '../../common/InfoCollapse.jsx'
import ObjectInfo from '../../common/ObjectInfo.jsx' import ObjectInfo from '../../common/ObjectInfo.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx' import ObjectProperty from '../../common/ObjectProperty.jsx'
import ViewButton from '../../common/ViewButton.jsx' import ViewButton from '../../common/ViewButton.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js' import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx' import InfoCircleIcon from '../../../Icons/InfoCircleIcon.jsx'
import NoteIcon from '../../../Icons/NoteIcon.jsx' import NoteIcon from '../../../Icons/NoteIcon.jsx'
import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx' import AuditLogIcon from '../../../Icons/AuditLogIcon.jsx'
@ -31,7 +31,6 @@ const StockTransferInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -78,7 +77,7 @@ const StockTransferInfo = () => {
delete: () => { delete: () => {
objectFormRef?.current.handleDelete?.() objectFormRef?.current.handleDelete?.()
return true return true
}, }
} }
return ( return (
@ -232,9 +231,7 @@ const StockTransferInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -242,8 +239,13 @@ const StockTransferInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': stockTransferId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('stockTransfer').prefix +
':' +
stockTransferId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const AppPasswordInfo = () => { const AppPasswordInfo = () => {
@ -26,7 +27,6 @@ const AppPasswordInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -178,9 +178,7 @@ const AppPasswordInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -188,8 +186,13 @@ const AppPasswordInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': appPasswordId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('appPassword').prefix +
':' +
appPasswordId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -6,6 +6,7 @@ import CloudIcon from '../../../Icons/CloudIcon'
import HostIcon from '../../../Icons/HostIcon' import HostIcon from '../../../Icons/HostIcon'
import ReloadIcon from '../../../Icons/ReloadIcon' import ReloadIcon from '../../../Icons/ReloadIcon'
import HProgress from '../../common/HProgress' import HProgress from '../../common/HProgress'
import ElipsisText from '../../common/ElipsisText'
import CheckCircleIcon from '../../../Icons/CheckCircleIcon' import CheckCircleIcon from '../../../Icons/CheckCircleIcon'
import XMarkCircleIcon from '../../../Icons/XMarkCircleIcon' import XMarkCircleIcon from '../../../Icons/XMarkCircleIcon'
@ -143,9 +144,9 @@ const UpdateStage = ({ stage, status, percent, detail }) => {
style={{ flex: 1, margin: 0 }} style={{ flex: 1, margin: 0 }}
/> />
{detail && ( {detail && (
<Text type='secondary' ellipsis style={{ minWidth: 0 }}> <ElipsisText type='secondary' style={{ minWidth: 0 }}>
{detail} {detail}
</Text> </ElipsisText>
)} )}
</Flex> </Flex>
)} )}

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('CourierServiceInfo') const log = loglevel.getLogger('CourierServiceInfo')
@ -201,8 +202,13 @@ const CourierServiceInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': courierServiceId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('courierService').prefix +
':' +
courierServiceId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -22,6 +22,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import CourierServiceIcon from '../../../Icons/CourierServiceIcon.jsx' import CourierServiceIcon from '../../../Icons/CourierServiceIcon.jsx'
const log = loglevel.getLogger('CourierInfo') const log = loglevel.getLogger('CourierInfo')
@ -186,10 +187,10 @@ const CourierInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='courierService' type='courierService'
masterFilter={{ 'courier._id': courierId }} masterFilter={{ courier: getModelByName('courier').prefix + ':' + courierId }}
visibleColumns={{ visibleColumns={{
courier: false, courier: false,
'courier._id': false courier: false
}} }}
/> />
)} )}
@ -219,8 +220,13 @@ const CourierInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': courierId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('courier').prefix +
':' +
courierId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('DocumentJobInfo') const log = loglevel.getLogger('DocumentJobInfo')
@ -199,8 +200,13 @@ const DocumentJobInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': documentJobId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('documentJob').prefix +
':' +
documentJobId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('DocumentPrinterInfo') const log = loglevel.getLogger('DocumentPrinterInfo')
@ -213,8 +214,13 @@ const DocumentPrinterInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': documentPrinterId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('documentPrinter').prefix +
':' +
documentPrinterId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('DocumentSizeInfo') const log = loglevel.getLogger('DocumentSizeInfo')
@ -200,8 +201,13 @@ const DocumentSizeInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': documentSizeId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('documentSize').prefix +
':' +
documentSizeId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -22,6 +22,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('DocumentTemplateInfo') const log = loglevel.getLogger('DocumentTemplateInfo')
@ -214,8 +215,13 @@ const DocumentTemplateInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': documentTemplateId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('documentTemplate').prefix +
':' +
documentTemplateId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const FilamentSkuInfo = () => { const FilamentSkuInfo = () => {
@ -196,8 +197,13 @@ const FilamentSkuInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': filamentSkuId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('filamentSku').prefix +
':' +
filamentSkuId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -25,6 +25,7 @@ import FilamentIcon from '../../../Icons/FilamentIcon.jsx'
import FilamentSkuIcon from '../../../Icons/FilamentSkuIcon.jsx' import FilamentSkuIcon from '../../../Icons/FilamentSkuIcon.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
const log = loglevel.getLogger('FilamentInfo') const log = loglevel.getLogger('FilamentInfo')
@ -214,7 +215,7 @@ const FilamentInfo = () => {
<ObjectTable <ObjectTable
ref={filamentSkusTableRef} ref={filamentSkusTableRef}
type='filamentSku' type='filamentSku'
masterFilter={{ filament: filamentId }} masterFilter={{ filament: getModelByName('filament').prefix + ':' + filamentId }}
visibleColumns={{ filament: false }} visibleColumns={{ filament: false }}
/> />
)} )}
@ -232,7 +233,7 @@ const FilamentInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='filamentStock' type='filamentStock'
masterFilter={{ filament: filamentId }} masterFilter={{ filament: getModelByName('filament').prefix + ':' + filamentId }}
visibleColumns={{ visibleColumns={{
filament: false, filament: false,
startingWeight: false startingWeight: false
@ -265,8 +266,13 @@ const FilamentInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': filamentId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('filament').prefix +
':' +
filamentId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -28,7 +28,7 @@ import { ApiServerContext } from '../../context/ApiServerContext.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import JsonObjectIcon from '../../../Icons/JsonObjectIcon.jsx' import JsonObjectIcon from '../../../Icons/JsonObjectIcon.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx' import ObjectProperty from '../../common/ObjectProperty.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js' import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
const log = loglevel.getLogger('FileInfo') const log = loglevel.getLogger('FileInfo')
log.setLevel(config.logLevel) log.setLevel(config.logLevel)
@ -250,8 +250,13 @@ const FileInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': fileId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('file').prefix +
':' +
fileId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -25,6 +25,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import PrinterIcon from '../../../Icons/PrinterIcon.jsx' import PrinterIcon from '../../../Icons/PrinterIcon.jsx'
import DocumentPrinterIcon from '../../../Icons/DocumentPrinterIcon.jsx' import DocumentPrinterIcon from '../../../Icons/DocumentPrinterIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('HostInfo') const log = loglevel.getLogger('HostInfo')
@ -35,7 +36,6 @@ const HostInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -208,10 +208,10 @@ const HostInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='printer' type='printer'
masterFilter={{ 'host._id': hostId }} masterFilter={{ host: getModelByName('host').prefix + ':' + hostId }}
visibleColumns={{ visibleColumns={{
host: false, host: false,
'host._id': false host: false
}} }}
/> />
)} )}
@ -230,10 +230,10 @@ const HostInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='documentPrinter' type='documentPrinter'
masterFilter={{ 'host._id': hostId }} masterFilter={{ host: getModelByName('host').prefix + ':' + hostId }}
visibleColumns={{ visibleColumns={{
host: false, host: false,
'host._id': false host: false
}} }}
/> />
)} )}
@ -255,9 +255,7 @@ const HostInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -265,8 +263,13 @@ const HostInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': hostId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('host').prefix +
':' +
hostId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('MaterialInfo') const log = loglevel.getLogger('MaterialInfo')
@ -199,8 +200,13 @@ const MaterialInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': materialId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('material').prefix +
':' +
materialId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -18,6 +18,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const NoteTypeInfo = () => { const NoteTypeInfo = () => {
@ -177,8 +178,13 @@ const NoteTypeInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': noteTypeId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('noteType').prefix +
':' +
noteTypeId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -15,7 +15,7 @@ const NewNote = ({ onOk, defaultValues = {} }) => {
<ObjectInfo <ObjectInfo
type='note' type='note'
column={1} column={1}
visibleProperties={{ 'parent._id': false }} visibleProperties={{ parent: false }}
bordered={false} bordered={false}
isEditing={true} isEditing={true}
required={true} required={true}

View File

@ -25,7 +25,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js' import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
const log = loglevel.getLogger('NoteInfo') const log = loglevel.getLogger('NoteInfo')
log.setLevel(config.logLevel) log.setLevel(config.logLevel)
@ -228,8 +228,13 @@ const NoteInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': noteId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('note').prefix +
':' +
noteId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const PartSkuInfo = () => { const PartSkuInfo = () => {
@ -191,8 +192,13 @@ const PartSkuInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': partSkuId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('partSku').prefix +
':' +
partSkuId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,6 +21,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import PartSkuIcon from '../../../Icons/PartSkuIcon.jsx' import PartSkuIcon from '../../../Icons/PartSkuIcon.jsx'
const PartInfo = () => { const PartInfo = () => {
@ -30,7 +31,6 @@ const PartInfo = () => {
const partId = new URLSearchParams(location.search).get('partId') const partId = new URLSearchParams(location.search).get('partId')
const partSkusTableRef = useRef() const partSkusTableRef = useRef()
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -162,9 +162,7 @@ const PartInfo = () => {
title='Part Information' title='Part Information'
icon={<InfoCircleIcon />} icon={<InfoCircleIcon />}
active={collapseState.info} active={collapseState.info}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('info', expanded)}
updateCollapseState('info', expanded)
}
collapseKey='info' collapseKey='info'
> >
<ObjectInfo <ObjectInfo
@ -180,9 +178,7 @@ const PartInfo = () => {
title='Part SKUs' title='Part SKUs'
icon={<PartSkuIcon />} icon={<PartSkuIcon />}
active={collapseState.partSkus} active={collapseState.partSkus}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('partSkus', expanded)}
updateCollapseState('partSkus', expanded)
}
collapseKey='partSkus' collapseKey='partSkus'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -191,7 +187,7 @@ const PartInfo = () => {
<ObjectTable <ObjectTable
ref={partSkusTableRef} ref={partSkusTableRef}
type='partSku' type='partSku'
masterFilter={{ part: partId }} masterFilter={{ part: getModelByName('part').prefix + ':' + partId }}
visibleColumns={{ part: false }} visibleColumns={{ part: false }}
/> />
)} )}
@ -212,9 +208,7 @@ const PartInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -222,8 +216,13 @@ const PartInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': partId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('part').prefix +
':' +
partId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -19,6 +19,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const ProductCategoryInfo = () => { const ProductCategoryInfo = () => {
@ -196,8 +197,13 @@ const ProductCategoryInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': productCategoryId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('productCategory').prefix +
':' +
productCategoryId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,7 +21,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx' import ObjectProperty from '../../common/ObjectProperty.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js' import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import PartIcon from '../../../Icons/PartIcon.jsx' import PartIcon from '../../../Icons/PartIcon.jsx'
const ProductSkuInfo = () => { const ProductSkuInfo = () => {
@ -224,8 +224,13 @@ const ProductSkuInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': productSkuId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('productSku').prefix +
':' +
productSkuId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,6 +21,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ProductSkuIcon from '../../../Icons/ProductSkuIcon.jsx' import ProductSkuIcon from '../../../Icons/ProductSkuIcon.jsx'
const ProductInfo = () => { const ProductInfo = () => {
@ -36,7 +37,6 @@ const ProductInfo = () => {
}) })
const productSkusTableRef = useRef() const productSkusTableRef = useRef()
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -190,7 +190,7 @@ const ProductInfo = () => {
<ObjectTable <ObjectTable
ref={productSkusTableRef} ref={productSkusTableRef}
type='productSku' type='productSku'
masterFilter={{ product: productId }} masterFilter={{ product: getModelByName('product').prefix + ':' + productId }}
visibleColumns={{ product: false }} visibleColumns={{ product: false }}
/> />
)} )}
@ -215,9 +215,7 @@ const ProductInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -225,8 +223,13 @@ const ProductInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': productId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('product').prefix +
':' +
productId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('TaxRateInfo') const log = loglevel.getLogger('TaxRateInfo')
@ -196,8 +197,13 @@ const TaxRateInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': taxRateId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('taxRate').prefix +
':' +
taxRateId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -23,7 +23,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import ObjectProperty from '../../common/ObjectProperty.jsx' import ObjectProperty from '../../common/ObjectProperty.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js' import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import { useMediaQuery } from 'react-responsive' import { useMediaQuery } from 'react-responsive'
const UserInfo = () => { const UserInfo = () => {
@ -206,7 +206,7 @@ const UserInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='appPassword' type='appPassword'
masterFilter={{ user: userId }} masterFilter={{ user: getModelByName('user').prefix + ':' + userId }}
visibleColumns={{ user: false }} visibleColumns={{ user: false }}
ref={appPasswordsTableRef} ref={appPasswordsTableRef}
/> />
@ -227,9 +227,7 @@ const UserInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -237,8 +235,13 @@ const UserInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': userId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('user').prefix +
':' +
userId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('VendorInfo') const log = loglevel.getLogger('VendorInfo')
@ -196,8 +197,13 @@ const VendorInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': vendorId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('vendor').prefix +
':' +
vendorId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -27,6 +27,7 @@ import SettingsIcon from '../../../Icons/SettingsIcon'
import UserNotifierToggle from '../../common/UserNotifierToggle' import UserNotifierToggle from '../../common/UserNotifierToggle'
import ViewButton from '../../common/ViewButton' import ViewButton from '../../common/ViewButton'
import useCollapseState from '../../hooks/useCollapseState' import useCollapseState from '../../hooks/useCollapseState'
import { getModelByName } from '../../../../database/ObjectModels.js'
import { import {
FILAMENT_PROFILE_BED_TEMPERATURE_PROPERTIES, FILAMENT_PROFILE_BED_TEMPERATURE_PROPERTIES,
FILAMENT_PROFILE_COMPATIBILITY_PROPERTIES, FILAMENT_PROFILE_COMPATIBILITY_PROPERTIES,
@ -160,7 +161,9 @@ const FilamentProfileInfo = () => {
<Space> <Space>
<EditButtons <EditButtons
isEditing={objectFormState.isEditing} isEditing={objectFormState.isEditing}
handleUpdate={() => actionHandlerRef.current.callAction('finishEdit')} handleUpdate={() =>
actionHandlerRef.current.callAction('finishEdit')
}
cancelEditing={() => cancelEditing={() =>
actionHandlerRef.current.callAction('cancelEdit') actionHandlerRef.current.callAction('cancelEdit')
} }
@ -533,8 +536,13 @@ const FilamentProfileInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': filamentProfileId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('filamentProfile').prefix +
':' +
filamentProfileId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -24,7 +24,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelProperty } from '../../../../database/ObjectModels.js' import { getModelProperty, getModelByName } from '../../../../database/ObjectModels.js'
import PartIcon from '../../../Icons/PartIcon.jsx' import PartIcon from '../../../Icons/PartIcon.jsx'
const log = loglevel.getLogger('GCodeFileInfo') const log = loglevel.getLogger('GCodeFileInfo')
@ -235,8 +235,13 @@ const GCodeFileInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': gcodeFileId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('gcodeFile').prefix +
':' +
gcodeFileId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -4,6 +4,7 @@ import WizardView from '../../common/WizardView'
import { ApiServerContext } from '../../context/ApiServerContext' import { ApiServerContext } from '../../context/ApiServerContext'
import { Descriptions, Flex, Typography } from 'antd' import { Descriptions, Flex, Typography } from 'antd'
import ObjectTable from '../../common/ObjectTable' import ObjectTable from '../../common/ObjectTable'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ObjectProperty from '../../common/ObjectProperty' import ObjectProperty from '../../common/ObjectProperty'
const { Text } = Typography const { Text } = Typography
const DeployJob = ({ const DeployJob = ({
@ -26,7 +27,7 @@ const DeployJob = ({
while (hasMore == true) { while (hasMore == true) {
const subJobsPage = await fetchObjects('subJob', { const subJobsPage = await fetchObjects('subJob', {
page: currentPage, page: currentPage,
filter: { 'job._id': job._id } filter: { job: job._id }
}) })
subJobs = [...subJobs, ...subJobsPage.data] subJobs = [...subJobs, ...subJobsPage.data]
if (subJobsPage.data.length >= 25) { if (subJobsPage.data.length >= 25) {
@ -150,7 +151,7 @@ const DeployJob = ({
printer: false, printer: false,
job: false job: false
}} }}
masterFilter={{ 'job._id': job?._id }} masterFilter={{ job: getModelByName('job').prefix + ':' + job?._id }}
size={'small'} size={'small'}
showActions={!slicerIntegration} showActions={!slicerIntegration}
/> />

View File

@ -24,6 +24,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import JobIcon from '../../../Icons/JobIcon.jsx' import JobIcon from '../../../Icons/JobIcon.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('JobInfo') const log = loglevel.getLogger('JobInfo')
@ -34,7 +35,6 @@ const JobInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -74,7 +74,7 @@ const JobInfo = () => {
finishEdit: () => { finishEdit: () => {
objectFormRef?.current.handleUpdate() objectFormRef?.current.handleUpdate()
return true return true
}, }
} }
return ( return (
@ -198,8 +198,8 @@ const JobInfo = () => {
> >
<ObjectTable <ObjectTable
type='subJob' type='subJob'
masterFilter={{ 'job._id': jobId }} masterFilter={{ job: getModelByName('job').prefix + ':' + jobId }}
visibleColumns={{ 'job._id': false }} visibleColumns={{ job: false }}
/> />
</InfoCollapse> </InfoCollapse>
@ -219,9 +219,7 @@ const JobInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -229,8 +227,13 @@ const JobInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': jobId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('job').prefix +
':' +
jobId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -26,7 +26,7 @@ import UserNotifierToggle from '../../common/UserNotifierToggle'
import ViewButton from '../../common/ViewButton' import ViewButton from '../../common/ViewButton'
import useCollapseState from '../../hooks/useCollapseState' import useCollapseState from '../../hooks/useCollapseState'
import ObjectProperty from '../../common/ObjectProperty' import ObjectProperty from '../../common/ObjectProperty'
import { getModelProperty } from '../../../../database/ObjectModels' import { getModelProperty, getModelByName } from '../../../../database/ObjectModels'
import GCodeFileIcon from '../../../Icons/GCodeFileIcon' import GCodeFileIcon from '../../../Icons/GCodeFileIcon'
import SettingsIcon from '../../../Icons/SettingsIcon' import SettingsIcon from '../../../Icons/SettingsIcon'
import ExclamationOctagonIcon from '../../../Icons/ExclamationOctagonIcon' import ExclamationOctagonIcon from '../../../Icons/ExclamationOctagonIcon'
@ -133,7 +133,9 @@ const PrinterProfileInfo = () => {
<Space> <Space>
<EditButtons <EditButtons
isEditing={objectFormState.isEditing} isEditing={objectFormState.isEditing}
handleUpdate={() => actionHandlerRef.current.callAction('finishEdit')} handleUpdate={() =>
actionHandlerRef.current.callAction('finishEdit')
}
cancelEditing={() => cancelEditing={() =>
actionHandlerRef.current.callAction('cancelEdit') actionHandlerRef.current.callAction('cancelEdit')
} }
@ -385,8 +387,13 @@ const PrinterProfileInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': printerProfileId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('printerProfile').prefix +
':' +
printerProfileId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -24,6 +24,7 @@ import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import PrinterProfileIcon from '../../../Icons/PrinterProfileIcon.jsx' import PrinterProfileIcon from '../../../Icons/PrinterProfileIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ObjectTableNavigationButtons from '../../common/ObjectTableNavigationButtons.jsx' import ObjectTableNavigationButtons from '../../common/ObjectTableNavigationButtons.jsx'
const log = loglevel.getLogger('PrinterInfo') const log = loglevel.getLogger('PrinterInfo')
log.setLevel(config.logLevel) log.setLevel(config.logLevel)
@ -34,7 +35,6 @@ const PrinterInfo = () => {
const profilesTableRef = useRef(null) const profilesTableRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
const printerId = new URLSearchParams(location.search).get('printerId') const printerId = new URLSearchParams(location.search).get('printerId')
const [collapseState, updateCollapseState] = useCollapseState('PrinterInfo', { const [collapseState, updateCollapseState] = useCollapseState('PrinterInfo', {
@ -75,7 +75,7 @@ const PrinterInfo = () => {
finishEdit: () => { finishEdit: () => {
objectFormRef?.current.handleUpdate() objectFormRef?.current.handleUpdate()
return true return true
}, }
} }
return ( return (
@ -214,7 +214,7 @@ const PrinterInfo = () => {
<ObjectTable <ObjectTable
ref={profilesTableRef} ref={profilesTableRef}
type='printerProfile' type='printerProfile'
masterFilter={{ printer: printerId }} masterFilter={{ printer: getModelByName('printer').prefix + ':' + printerId }}
visibleColumns={{ visibleColumns={{
printer: false, printer: false,
'printer._id': false 'printer._id': false
@ -239,9 +239,7 @@ const PrinterInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -249,8 +247,13 @@ const PrinterInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': printerId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('printer').prefix +
':' +
printerId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,6 +21,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import StockEventIcon from '../../../Icons/StockEventIcon.jsx' import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
const SubJobInfo = () => { const SubJobInfo = () => {
@ -173,9 +174,9 @@ const SubJobInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='stockEvent' type='stockEvent'
masterFilter={{ 'owner._id': subJobId }} masterFilter={{ owner: getModelByName('subJob').prefix + ':' + subJobId }}
visibleColumns={{ visibleColumns={{
'owner._id': false, owner: false,
'owner.type': false, 'owner.type': false,
owner: false owner: false
}} }}
@ -207,8 +208,13 @@ const SubJobInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': subJobId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('subJob').prefix +
':' +
subJobId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -21,6 +21,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('ClientInfo') const log = loglevel.getLogger('ClientInfo')
@ -196,8 +197,13 @@ const ClientInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': clientId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('client').prefix +
':' +
clientId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -23,6 +23,7 @@ import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
const log = loglevel.getLogger('ListingVarientInfo') const log = loglevel.getLogger('ListingVarientInfo')
log.setLevel(config.logLevel) log.setLevel(config.logLevel)
@ -32,7 +33,6 @@ const ListingVarientInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -77,7 +77,7 @@ const ListingVarientInfo = () => {
delete: () => { delete: () => {
objectFormRef?.current?.handleDelete?.() objectFormRef?.current?.handleDelete?.()
return true return true
}, }
} }
return ( return (
@ -204,9 +204,7 @@ const ListingVarientInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -214,8 +212,13 @@ const ListingVarientInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': listingVarientId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('listingVarient').prefix +
':' +
listingVarientId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -23,6 +23,7 @@ import ObjectTable from '../../common/ObjectTable.jsx'
import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx' import InfoCollapsePlaceholder from '../../common/InfoCollapsePlaceholder.jsx'
import DocumentPrintButton from '../../common/DocumentPrintButton.jsx' import DocumentPrintButton from '../../common/DocumentPrintButton.jsx'
import UserNotifierToggle from '../../common/UserNotifierToggle.jsx' import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
const log = loglevel.getLogger('ListingInfo') const log = loglevel.getLogger('ListingInfo')
@ -34,7 +35,6 @@ const ListingInfo = () => {
const listingVarientsTableRef = useRef(null) const listingVarientsTableRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -75,7 +75,7 @@ const ListingInfo = () => {
delete: () => { delete: () => {
objectFormRef?.current?.handleDelete?.() objectFormRef?.current?.handleDelete?.()
return true return true
}, }
} }
return ( return (
@ -197,7 +197,7 @@ const ListingInfo = () => {
<ObjectTable <ObjectTable
type='listingVarient' type='listingVarient'
masterFilter={{ masterFilter={{
'listing._id': listingId listing: getModelByName('listing').prefix + ':' + listingId
}} }}
visibleColumns={{ listing: false }} visibleColumns={{ listing: false }}
ref={listingVarientsTableRef} ref={listingVarientsTableRef}
@ -222,9 +222,7 @@ const ListingInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -232,8 +230,13 @@ const ListingInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': listingId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('listing').prefix +
':' +
listingId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -1,4 +1,4 @@
import { useContext, useRef, useState , useEffect} from 'react' import { useContext, useRef, useState, useEffect } from 'react'
import { useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
import { Card, Flex, message, Space } from 'antd' import { Card, Flex, message, Space } from 'antd'
import loglevel from 'loglevel' import loglevel from 'loglevel'
@ -25,6 +25,7 @@ import UserNotifierToggle from '../../common/UserNotifierToggle.jsx'
import ScrollBox from '../../common/ScrollBox.jsx' import ScrollBox from '../../common/ScrollBox.jsx'
import { ApiServerContext } from '../../context/ApiServerContext.jsx' import { ApiServerContext } from '../../context/ApiServerContext.jsx'
import { ElectronContext } from '../../context/ElectronContext.jsx' import { ElectronContext } from '../../context/ElectronContext.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import { import {
buildMarketplaceAuthState, buildMarketplaceAuthState,
storeMarketplaceAuthState storeMarketplaceAuthState
@ -38,7 +39,6 @@ const MarketplaceInfo = () => {
const objectFormRef = useRef(null) const objectFormRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -268,9 +268,7 @@ const MarketplaceInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -278,8 +276,13 @@ const MarketplaceInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': marketplaceId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('marketplace').prefix +
':' +
marketplaceId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -27,6 +27,7 @@ import ScrollBox from '../../common/ScrollBox.jsx'
import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx' import OrderItemsIcon from '../../../Icons/OrderItemIcon.jsx'
import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx' import ShipmentIcon from '../../../Icons/ShipmentIcon.jsx'
import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx' import InvoiceIcon from '../../../Icons/InvoiceIcon.jsx'
import { getModelByName } from '../../../../database/ObjectModels.js'
import StockEventIcon from '../../../Icons/StockEventIcon.jsx' import StockEventIcon from '../../../Icons/StockEventIcon.jsx'
const log = loglevel.getLogger('SalesOrderInfo') const log = loglevel.getLogger('SalesOrderInfo')
@ -39,7 +40,6 @@ const SalesOrderInfo = () => {
const shipmentsTableRef = useRef(null) const shipmentsTableRef = useRef(null)
const actionHandlerRef = useRef(null) const actionHandlerRef = useRef(null)
const { setOnModalOk } = useActions() const { setOnModalOk } = useActions()
useEffect(() => { useEffect(() => {
setOnModalOk(() => () => { setOnModalOk(() => () => {
@ -90,7 +90,7 @@ const SalesOrderInfo = () => {
delete: () => { delete: () => {
objectFormRef?.current?.handleDelete?.() objectFormRef?.current?.handleDelete?.()
return true return true
}, }
} }
return ( return (
@ -223,7 +223,7 @@ const SalesOrderInfo = () => {
<ObjectTable <ObjectTable
type='orderItem' type='orderItem'
masterFilter={{ masterFilter={{
'order._id': salesOrderId, order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
orderType: 'salesOrder' orderType: 'salesOrder'
}} }}
visibleColumns={{ order: false }} visibleColumns={{ order: false }}
@ -242,7 +242,7 @@ const SalesOrderInfo = () => {
<ObjectTable <ObjectTable
type='shipment' type='shipment'
masterFilter={{ masterFilter={{
'order._id': salesOrderId, order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
orderType: 'salesOrder' orderType: 'salesOrder'
}} }}
visibleColumns={{ order: false }} visibleColumns={{ order: false }}
@ -264,7 +264,7 @@ const SalesOrderInfo = () => {
<ObjectTable <ObjectTable
type='invoice' type='invoice'
masterFilter={{ masterFilter={{
'order._id': salesOrderId, order: getModelByName('salesOrder').prefix + ':' + salesOrderId,
orderType: 'salesOrder' orderType: 'salesOrder'
}} }}
visibleColumns={{ order: false }} visibleColumns={{ order: false }}
@ -286,7 +286,7 @@ const SalesOrderInfo = () => {
<ObjectTable <ObjectTable
type='stockEvent' type='stockEvent'
masterFilter={{ masterFilter={{
'owner._id': salesOrderId owner: getModelByName('salesOrder').prefix + ':' + salesOrderId
}} }}
/> />
)} )}
@ -310,9 +310,7 @@ const SalesOrderInfo = () => {
title='Audit Logs' title='Audit Logs'
icon={<AuditLogIcon />} icon={<AuditLogIcon />}
active={collapseState.auditLogs} active={collapseState.auditLogs}
onToggle={(expanded) => onToggle={(expanded) => updateCollapseState('auditLogs', expanded)}
updateCollapseState('auditLogs', expanded)
}
collapseKey='auditLogs' collapseKey='auditLogs'
> >
{objectFormState.loading ? ( {objectFormState.loading ? (
@ -320,8 +318,13 @@ const SalesOrderInfo = () => {
) : ( ) : (
<ObjectTable <ObjectTable
type='auditLog' type='auditLog'
masterFilter={{ 'parent._id': salesOrderId }} masterFilter={{
visibleColumns={{ _id: false, 'parent._id': false }} parent:
getModelByName('salesOrder').prefix +
':' +
salesOrderId
}}
visibleColumns={{ _id: false, parent: false }}
/> />
)} )}
</InfoCollapse> </InfoCollapse>

View File

@ -2,6 +2,7 @@ import PropTypes from 'prop-types'
import { Flex, Typography, Input } from 'antd' import { Flex, Typography, Input } from 'antd'
import CountryDisplay from './CountryDisplay' import CountryDisplay from './CountryDisplay'
import CountrySelect from './CountrySelect' import CountrySelect from './CountrySelect'
import ElipsisText from './ElipsisText'
const { Text } = Typography const { Text } = Typography
@ -50,9 +51,9 @@ const AddressDisplay = ({
{isCountry ? ( {isCountry ? (
<CountryDisplay countryCode={fieldValue} /> <CountryDisplay countryCode={fieldValue} />
) : ( ) : (
<Text ellipsis alt={label}> <ElipsisText alt={label}>
{fieldValue} {fieldValue}
</Text> </ElipsisText>
)} )}
</Flex> </Flex>
) )

View File

@ -22,30 +22,21 @@ import { Button, Modal, Typography } from 'antd'
const { Link } = Typography const { Link } = Typography
export default function CodeBlockEditor({ export function toEditorCode(code, language = 'javascript') {
code = '', if (code == null) return ''
language = 'javascript', if (typeof code === 'object' && language === 'json') {
style = {}, return JSON.stringify(code, null, 2)
className = '',
readOnly = false,
onChange = null,
height = 'auto',
showLineNumbers = true,
disabled = false,
minimal = false,
autoCompleteObject = null
}) {
const { isDarkMode } = useThemeContext()
const [codeMirrorOpen, setCodeMirrorOpen] = useState(false)
var editorCode = code
if (typeof code == 'object' && language == 'json') {
editorCode = JSON.stringify(code, null, 2)
} }
return String(code)
}
// Map language to CodeMirror extension export function getCodeLanguageExtension(
const languageExtension = useMemo(() => { language = 'javascript',
switch (language.toLowerCase()) { autoCompleteObject = null
) {
const lang = Array.isArray(language) ? language[0] : language
switch (String(lang || 'javascript').toLowerCase()) {
case 'javascript': case 'javascript':
case 'js': case 'js':
return javascript() return javascript()
@ -85,9 +76,31 @@ export default function CodeBlockEditor({
case 'yml': case 'yml':
return yaml() return yaml()
default: default:
return javascript() // Default fallback return javascript()
} }
}, [language, autoCompleteObject]) }
export default function CodeBlockEditor({
code = '',
language = 'javascript',
style = {},
className = '',
readOnly = false,
onChange = null,
height = 'auto',
showLineNumbers = true,
disabled = false,
minimal = false,
autoCompleteObject = null
}) {
const { isDarkMode } = useThemeContext()
const [codeMirrorOpen, setCodeMirrorOpen] = useState(false)
const editorCode = toEditorCode(code, language)
const languageExtension = useMemo(
() => getCodeLanguageExtension(language, autoCompleteObject),
[language, autoCompleteObject]
)
const handleOnChange = (value) => { const handleOnChange = (value) => {
if (typeof code == 'object' && language == 'json') { if (typeof code == 'object' && language == 'json') {

View File

@ -0,0 +1,85 @@
import { useLayoutEffect, useMemo, useRef } from 'react'
import PropTypes from 'prop-types'
import { MergeView } from '@codemirror/merge'
import { EditorState } from '@codemirror/state'
import { EditorView } from '@codemirror/view'
import { oneDark } from '@codemirror/theme-one-dark'
import { basicSetup } from 'codemirror'
import { useThemeContext } from '../context/ThemeContext'
import {
getCodeLanguageExtension,
toEditorCode
} from './CodeBlockEditor'
export default function CodeDiffViewer({
oldCode = '',
newCode = '',
language = 'javascript'
}) {
const { isDarkMode } = useThemeContext()
const parentRef = useRef(null)
const oldDoc = toEditorCode(oldCode, language)
const newDoc = toEditorCode(newCode, language)
const languageExtension = useMemo(
() => getCodeLanguageExtension(language),
[language]
)
useLayoutEffect(() => {
if (!parentRef.current) return
const editorTheme = EditorView.theme({
'&': {
fontSize: '14px',
fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace'
}
})
const sharedExtensions = [
basicSetup,
languageExtension,
editorTheme,
EditorView.editable.of(false),
EditorState.readOnly.of(true),
...(isDarkMode ? [oneDark] : [])
]
const view = new MergeView({
a: {
doc: oldDoc,
extensions: sharedExtensions
},
b: {
doc: newDoc,
extensions: sharedExtensions
},
parent: parentRef.current,
highlightChanges: true,
gutter: true,
collapseUnchanged: { margin: 3, minSize: 6 }
})
return () => {
view.destroy()
}
}, [oldDoc, newDoc, languageExtension, isDarkMode])
return (
<div
ref={parentRef}
className={
isDarkMode ? 'code-diff-viewer is-dark' : 'code-diff-viewer'
}
/>
)
}
CodeDiffViewer.propTypes = {
oldCode: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
newCode: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
language: PropTypes.oneOfType([
PropTypes.string,
PropTypes.arrayOf(PropTypes.string)
])
}

View File

@ -1,9 +1,8 @@
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { Flex, Typography } from 'antd' import { Flex } from 'antd'
import Flag from './Flag' import Flag from './Flag'
import countries from '../../../database/Countries' import countries from '../../../database/Countries'
import ElipsisText from './ElipsisText'
const { Text } = Typography
const CountryDisplay = ({ countryCode }) => { const CountryDisplay = ({ countryCode }) => {
const country = countries.find((c) => c.code === countryCode) const country = countries.find((c) => c.code === countryCode)
@ -17,7 +16,7 @@ const CountryDisplay = ({ countryCode }) => {
gap={'small'} gap={'small'}
align='center' align='center'
className='country-display' className='country-display'
style={{ minWidth: 0 }} style={{ minWidth: 0, width: '100%' }}
> >
<Flag <Flag
code={country.code} code={country.code}
@ -25,8 +24,8 @@ const CountryDisplay = ({ countryCode }) => {
hasBorder={true} hasBorder={true}
borderRadius={5} borderRadius={5}
/> />
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0, flex: 1, overflow: 'hidden' }}>
<Text ellipsis>{country.name}</Text> <ElipsisText>{country.name}</ElipsisText>
</div> </div>
</Flex> </Flex>
) )

View File

@ -1,9 +1,8 @@
import { Select, Flex, Typography } from 'antd' import { Select, Flex } from 'antd'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import Flag from './Flag' import Flag from './Flag'
import countries from '../../../database/Countries' import countries from '../../../database/Countries'
import ElipsisText from './ElipsisText'
const { Text } = Typography
const CountrySelect = ({ const CountrySelect = ({
value, value,
@ -30,7 +29,7 @@ const CountrySelect = ({
label: ( label: (
<Flex gap='small' align='center' className='country-display'> <Flex gap='small' align='center' className='country-display'>
<Flag code={country.code} size='small' borderRadius={3} /> <Flag code={country.code} size='small' borderRadius={3} />
<Text elipsis>{country.name}</Text> <ElipsisText>{country.name}</ElipsisText>
</Flex> </Flex>
) )
}))} }))}

View File

@ -22,6 +22,7 @@ import { Header } from 'antd/es/layout/layout'
import { useMediaQuery } from 'react-responsive' import { useMediaQuery } from 'react-responsive'
import KeyboardShortcut from './KeyboardShortcut' import KeyboardShortcut from './KeyboardShortcut'
import UserProfilePopover from './UserProfilePopover' import UserProfilePopover from './UserProfilePopover'
import ElipsisText from './ElipsisText'
import FarmControlLogo from '../../Logos/FarmControlLogo' import FarmControlLogo from '../../Logos/FarmControlLogo'
import FarmControlLogoSmall from '../../Logos/FarmControlLogoSmall' import FarmControlLogoSmall from '../../Logos/FarmControlLogoSmall'
@ -194,19 +195,17 @@ const DashboardNavigation = () => {
}} }}
> >
{selectedMenuItem.icon} {selectedMenuItem.icon}
<Text <ElipsisText
ellipsis
style={{ style={{
minWidth: 0, // CRUCIAL for flex children minWidth: 0,
maxWidth: '100%', // Responsive maxWidth: '100%',
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
overflow: 'hidden', overflow: 'hidden',
textOverflow: 'ellipsis', flex: 1
flex: 1 // Take available space, shrink as needed
}} }}
> >
{selectedMenuItem.label} {selectedMenuItem.label}
</Text> </ElipsisText>
</Flex> </Flex>
)} )}
<div style={{ flexGrow: 1 }}> <div style={{ flexGrow: 1 }}>

View File

@ -0,0 +1,116 @@
import { useMemo, useState } from 'react'
import PropTypes from 'prop-types'
import { Button, Modal, Typography, theme, Flex } from 'antd'
import { presentableDiff } from '@codemirror/merge'
import CodeDiffViewer from './CodeDiffViewer'
import { toEditorCode } from './CodeBlockEditor'
const { Link, Text } = Typography
const SQUARE_COUNT = 10
const countLines = (str) => {
if (!str) return 0
const parts = str.split('\n')
if (parts[parts.length - 1] === '') parts.pop()
return Math.max(parts.length, 1)
}
export function getCodeDiffStats(oldCode, newCode, language = 'javascript') {
const oldText = toEditorCode(oldCode, language)
const newText = toEditorCode(newCode, language)
const changes = presentableDiff(oldText, newText)
let additions = 0
let deletions = 0
for (const change of changes) {
const deleted = oldText.slice(change.fromA, change.toA)
const added = newText.slice(change.fromB, change.toB)
if (deleted) deletions += countLines(deleted)
if (added) additions += countLines(added)
}
return { additions, deletions }
}
export default function DiffLabel({
oldCode = '',
newCode = '',
language = 'javascript'
}) {
const { token } = theme.useToken()
const [open, setOpen] = useState(false)
const [viewerReady, setViewerReady] = useState(false)
const { additions, deletions } = useMemo(
() => getCodeDiffStats(oldCode, newCode, language),
[oldCode, newCode, language]
)
const greenCount = Math.round(
(additions / (additions + deletions)) * SQUARE_COUNT
)
return (
<>
<Link
className='diff-label'
onClick={() => {
setOpen(true)
}}
>
<Flex gap='small' align='center' style={{ marginTop: 0.5 }}>
<Text style={{ color: token.colorSuccess }}>+{additions}</Text>
<Flex gap='4px' align='center' style={{ marginBottom: 2 }}>
{Array.from({ length: SQUARE_COUNT }).map((_, i) => (
<div
key={i}
className='diff-label-square'
style={{
backgroundColor:
i < greenCount ? token.colorSuccess : token.colorError
}}
/>
))}
</Flex>
<Text style={{ color: token.colorError }}>-{deletions}</Text>
</Flex>
</Link>
<Modal
closeIcon={false}
open={open}
width='90%'
destroyOnClose
afterOpenChange={setViewerReady}
onCancel={() => {
setOpen(false)
}}
footer={
<Button
onClick={() => {
setOpen(false)
}}
>
Close
</Button>
}
>
{viewerReady ? (
<CodeDiffViewer
oldCode={oldCode}
newCode={newCode}
language={language}
/>
) : null}
</Modal>
</>
)
}
DiffLabel.propTypes = {
oldCode: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
newCode: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
language: PropTypes.oneOfType([
PropTypes.string,
PropTypes.arrayOf(PropTypes.string)
])
}

View File

@ -0,0 +1,108 @@
import { useLayoutEffect, useRef, useState } from 'react'
import PropTypes from 'prop-types'
import { Typography } from 'antd'
const { Text } = Typography
const childrenToString = (children) => {
if (children == null || typeof children === 'boolean') return ''
if (typeof children === 'string' || typeof children === 'number') {
return String(children)
}
if (Array.isArray(children)) {
return children.map(childrenToString).join('')
}
if (typeof children === 'object' && children.props) {
return childrenToString(children.props.children)
}
return ''
}
const splitMiddle = (text) => {
const mid = Math.ceil(text.length / 2)
return {
start: text.slice(0, mid),
end: text.slice(mid)
}
}
const ElipsisText = ({ children, style, className, title, code, ...rest }) => {
const text = childrenToString(children)
const { start, end } = splitMiddle(text)
const containerRef = useRef(null)
const measureRef = useRef(null)
const truncatedRef = useRef(false)
const [truncated, setTruncated] = useState(false)
useLayoutEffect(() => {
const container = containerRef.current
const measure = measureRef.current
if (!container || !measure) return
const update = () => {
const available = container.getBoundingClientRect().width
if (available < 1) return
const textWidth = measure.getBoundingClientRect().width
const next = Boolean(end) && textWidth > available
if (truncatedRef.current === next) return
truncatedRef.current = next
setTruncated(next)
}
update()
const frame = requestAnimationFrame(update)
const resizeObserver = new ResizeObserver(update)
resizeObserver.observe(container)
const intersectionObserver = new IntersectionObserver(update)
intersectionObserver.observe(container)
return () => {
cancelAnimationFrame(frame)
resizeObserver.disconnect()
intersectionObserver.disconnect()
}
}, [text, end])
const showTruncated = truncated && Boolean(end)
const RootTag = code ? 'code' : 'span'
return (
<Text
{...rest}
className={['elipsis-text-wrapper', className].filter(Boolean).join(' ')}
title={title ?? text}
style={style}
>
<span
className={showTruncated ? 'elipsis-text is-truncated' : 'elipsis-text'}
ref={containerRef}
>
<RootTag className='elipsis-text-measure' ref={measureRef}>
{text}
</RootTag>
<RootTag className='elipsis-text-full'>{text}</RootTag>
<RootTag className='elipsis-text-truncated'>
<span className='elipsis-text-start'>{start}</span>
<span className='elipsis-text-dots'>...</span>
<span className='elipsis-text-end'>
<span className='elipsis-text-end-inner'>{end}</span>
</span>
</RootTag>
</span>
</Text>
)
}
ElipsisText.propTypes = {
children: PropTypes.node,
style: PropTypes.object,
className: PropTypes.string,
title: PropTypes.string,
code: PropTypes.bool
}
export default ElipsisText

View File

@ -3,6 +3,7 @@ import { Typography, Flex, Button, Tooltip } from 'antd'
import NewMailIcon from '../../Icons/NewMailIcon' import NewMailIcon from '../../Icons/NewMailIcon'
// import CopyIcon from './CopyIcon' // import CopyIcon from './CopyIcon'
import CopyButton from './CopyButton' import CopyButton from './CopyButton'
import ElipsisText from './ElipsisText'
const { Text, Link } = Typography const { Text, Link } = Typography
@ -18,9 +19,9 @@ const EmailDisplay = ({ email, showCopy = true, showLink = false }) => {
</Link> </Link>
) : ( ) : (
<> <>
<Text style={{ marginRight: 8 }} ellipsis> <ElipsisText style={{ marginRight: 8 }}>
{email} {email}
</Text> </ElipsisText>
<Tooltip title='Email' arrow={false}> <Tooltip title='Email' arrow={false}>
<Button <Button
icon={<NewMailIcon />} icon={<NewMailIcon />}

View File

@ -1,4 +1,4 @@
import { Card, Flex, Typography, Button, Tag, Divider } from 'antd' import { Card, Flex, Button, Tag, Divider } from 'antd'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import FileIcon from '../../Icons/FileIcon' import FileIcon from '../../Icons/FileIcon'
import BinIcon from '../../Icons/BinIcon' import BinIcon from '../../Icons/BinIcon'
@ -11,8 +11,7 @@ import EyeSlashIcon from '../../Icons/EyeSlashIcon'
import { getModelByName } from '../../../database/ObjectModels' import { getModelByName } from '../../../database/ObjectModels'
import InfoCircleIcon from '../../Icons/InfoCircleIcon' import InfoCircleIcon from '../../Icons/InfoCircleIcon'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import ElipsisText from './ElipsisText'
const { Text } = Typography
const FileList = ({ const FileList = ({
files, files,
@ -87,15 +86,15 @@ const FileList = ({
<Flex <Flex
gap={'small'} gap={'small'}
align='center' align='center'
style={{ minWidth: 0, flex: '0 1 auto', overflow: 'hidden' }} style={{ minWidth: 0, flex: '1 1 auto', overflow: 'hidden' }}
> >
<FileIcon <FileIcon
style={{ margin: 0, fontSize: card == true ? '24px' : '16px' }} style={{ margin: 0, fontSize: card == true ? '24px' : '16px' }}
/> />
<Text style={{ marginTop: '1px', minWidth: 0 }} ellipsis> <ElipsisText style={{ marginTop: '1px', minWidth: 0 }}>
{file.name || file.filename || 'Unknown file'} {file.name || file.filename || 'Unknown file'}
</Text> </ElipsisText>
{file.extension && <Tag style={{ margin: 0 }}>{file.extension}</Tag>} {file.extension && <Tag style={{ margin: 0 }}>{file.extension}</Tag>}
</Flex> </Flex>
{!minimal && ( {!minimal && (

View File

@ -4,6 +4,7 @@ import { Flex, Typography, Popover } from 'antd'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { useMediaQuery } from 'react-responsive' import { useMediaQuery } from 'react-responsive'
import CopyButton from './CopyButton' import CopyButton from './CopyButton'
import ElipsisText from './ElipsisText'
import SpotlightTooltip from './SpotlightTooltip' import SpotlightTooltip from './SpotlightTooltip'
import { getModelByName } from '../../../database/ObjectModels' import { getModelByName } from '../../../database/ObjectModels'
import { buildActionUrl } from '../../../utils/modelActions' import { buildActionUrl } from '../../../utils/modelActions'
@ -68,13 +69,12 @@ const IdDisplay = ({
if (plainCode == false) { if (plainCode == false) {
textElement = ( textElement = (
<Text <ElipsisText
code code
ellipsis
style={showCopy ? { marginRight: 6, minWidth: '0px' } : undefined} style={showCopy ? { marginRight: 6, minWidth: '0px' } : undefined}
> >
{displayId} {displayId}
</Text> </ElipsisText>
) )
} }
@ -83,8 +83,12 @@ const IdDisplay = ({
const linkElement = ( const linkElement = (
<Link <Link
onClick={() => navigate(hyperlink)} onClick={() => navigate(hyperlink)}
ellipsis style={{
style={showCopy ? { marginRight: 6 } : undefined} minWidth: 0,
maxWidth: '100%',
display: 'block',
...(showCopy ? { marginRight: 6 } : null)
}}
> >
{textElement} {textElement}
</Link> </Link>

View File

@ -1,6 +1,7 @@
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { Flex, Typography } from 'antd' import { Flex, Typography } from 'antd'
import CopyButton from './CopyButton' import CopyButton from './CopyButton'
import ElipsisText from './ElipsisText'
const { Text } = Typography const { Text } = Typography
@ -15,13 +16,12 @@ const MiscId = ({ value, showCopy = true }) => {
className='miscid' className='miscid'
style={{ minWidth: '0px', width: '100%' }} style={{ minWidth: '0px', width: '100%' }}
> >
<Text <ElipsisText
code code
ellipsis
style={showCopy ? { marginRight: 6, minWidth: '0px' } : undefined} style={showCopy ? { marginRight: 6, minWidth: '0px' } : undefined}
> >
{value} {value}
</Text> </ElipsisText>
{showCopy && ( {showCopy && (
<CopyButton <CopyButton

View File

@ -71,7 +71,9 @@ const NoteItem = ({
setChildNotesLoading(true) setChildNotesLoading(true)
try { try {
const childNotesData = await fetchObjects('note', { const childNotesData = await fetchObjects('note', {
filter: { 'parent._id': note._id } filter: {
parent: getModelByName('note').prefix + ':' + note._id
}
}) })
setChildNotes(childNotesData.data) setChildNotes(childNotesData.data)
} catch (error) { } catch (error) {
@ -105,7 +107,7 @@ const NoteItem = ({
if (isExpanded == true) { if (isExpanded == true) {
subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates( subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates(
'note', 'note',
{ 'parent._id': note._id }, { parent: getModelByName('note').prefix + ':' + note._id },
() => { () => {
if (isExpanded == true) { if (isExpanded == true) {
handleNoteExpand() handleNoteExpand()

View File

@ -19,6 +19,7 @@ import InfoCircleIcon from '../../Icons/InfoCircleIcon'
import ReloadIcon from '../../Icons/ReloadIcon' import ReloadIcon from '../../Icons/ReloadIcon'
import NewNote from '../Management/Notes/NewNote' import NewNote from '../Management/Notes/NewNote'
import NoteItem from './NoteItem' import NoteItem from './NoteItem'
import { getModelByName } from '../../../database/ObjectModels.js'
const { Text } = Typography const { Text } = Typography
@ -40,14 +41,14 @@ const NotesPanel = ({ _id, type }) => {
const fetchData = useCallback( const fetchData = useCallback(
async (id) => { async (id) => {
try { try {
const newData = await fetchNotes(id) const newData = await fetchNotes(id, type)
return newData return newData
} catch (error) { } catch (error) {
setError(error) setError(error)
return null return null
} }
}, },
[fetchNotes] [fetchNotes, type]
) )
const generateNotes = useCallback( const generateNotes = useCallback(
@ -98,7 +99,7 @@ const NotesPanel = ({ _id, type }) => {
if (connected == true && subscribeToObjectTypeUpdatesRef.current == null) { if (connected == true && subscribeToObjectTypeUpdatesRef.current == null) {
subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates( subscribeToObjectTypeUpdatesRef.current = subscribeToObjectTypeUpdates(
'note', 'note',
{ 'parent._id': _id }, { parent: getModelByName(type).prefix + ':' + _id },
() => handleReloadData() () => handleReloadData()
) )
} }

View File

@ -23,6 +23,7 @@ import ExclamationOctagonIcon from '../../Icons/ExclamationOctagonIcon'
import CheckCircleIcon from '../../Icons/CheckCircleIcon' import CheckCircleIcon from '../../Icons/CheckCircleIcon'
import BellIcon from '../../Icons/BellIcon' import BellIcon from '../../Icons/BellIcon'
import { getModelByName } from '../../../database/ObjectModels' import { getModelByName } from '../../../database/ObjectModels'
import ElipsisText from './ElipsisText'
const { Text, Paragraph } = Typography const { Text, Paragraph } = Typography
@ -361,13 +362,12 @@ const Notification = ({
{inlineIcon && {inlineIcon &&
getNotificationIcon(notification.type, notification.metadata)} getNotificationIcon(notification.type, notification.metadata)}
<Text <ElipsisText
strong={!notification.read} strong={!notification.read}
ellipsis
style={{ minWidth: 0 }} style={{ minWidth: 0 }}
> >
{notification.title} {notification.title}
</Text> </ElipsisText>
</Flex> </Flex>
<Flex align='center' gap='5px' style={{ marginLeft: 10 }}> <Flex align='center' gap='5px' style={{ marginLeft: 10 }}>
{showDetails && ( {showDetails && (

View File

@ -9,6 +9,7 @@ import { ApiServerContext } from '../context/ApiServerContext'
import { AuthContext } from '../context/AuthContext' import { AuthContext } from '../context/AuthContext'
import merge from 'lodash/merge' import merge from 'lodash/merge'
import IdDisplay from './IdDisplay' import IdDisplay from './IdDisplay'
import ElipsisText from './ElipsisText'
import SpotlightTooltip from './SpotlightTooltip' import SpotlightTooltip from './SpotlightTooltip'
import StateTag from './StateTag' import StateTag from './StateTag'
@ -183,13 +184,7 @@ const ObjectDisplay = ({
const objectId = getStringId(objectData) const objectId = getStringId(objectData)
if (defaultModelActions.length >= 1 && objectId) { if (defaultModelActions.length >= 1 && objectId) {
hyperlink = buildActionUrl( hyperlink = buildActionUrl(model, defaultModelActions[0], objectId, '', '')
model,
defaultModelActions[0],
objectId,
'',
''
)
} }
// Render name with hyperlink/spotlight support // Render name with hyperlink/spotlight support
@ -197,9 +192,9 @@ const ObjectDisplay = ({
if (!objectData?.name) return null if (!objectData?.name) return null
const textElement = ( const textElement = (
<Text ellipsis style={{ lineHeight: '1', paddingBottom: '2px' }}> <ElipsisText style={{ lineHeight: '1', paddingBottom: '2px' }}>
{objectData.name} {objectData.name}
</Text> </ElipsisText>
) )
// If hyperlink is enabled // If hyperlink is enabled
@ -268,7 +263,7 @@ const ObjectDisplay = ({
style={{ minWidth: 0, height: '24px' }} style={{ minWidth: 0, height: '24px' }}
> >
<Icon /> <Icon />
<Flex gap={'small'} align='center' style={{ minWidth: 0 }}> <Flex gap={'small'} align='center' style={{ minWidth: 0, flex: 1 }}>
{objectData?.color ? ( {objectData?.color ? (
<Badge <Badge
color={objectData?.color} color={objectData?.color}
@ -282,7 +277,7 @@ const ObjectDisplay = ({
style={{ marginBottom: '1.5px' }} style={{ marginBottom: '1.5px' }}
/> />
) : null} ) : null}
<div style={{ minWidth: 0 }}> <div style={{ minWidth: 0, flex: 1, overflow: 'hidden' }}>
{renderNameDisplay()} {renderNameDisplay()}
{objectId && !objectData?.name ? ( {objectId && !objectData?.name ? (

View File

@ -51,6 +51,7 @@ import MiscId from './MiscId'
import AddressDisplay from './AddressDisplay' import AddressDisplay from './AddressDisplay'
import ArrayDisplay from './ArrayDisplay' import ArrayDisplay from './ArrayDisplay'
import ArrayInput from './ArrayInput' import ArrayInput from './ArrayInput'
import ElipsisText from './ElipsisText'
import { round } from '../utils/Utils' import { round } from '../utils/Utils'
const { Text } = Typography const { Text } = Typography
@ -378,11 +379,11 @@ const ObjectProperty = ({
case 'text': case 'text':
if (value != null && value != '') { if (value != null && value != '') {
return ( return (
<Text ellipsis style={style}> <ElipsisText style={style}>
{prefix} {prefix}
{getTextValue(value)} {getTextValue(value)}
{suffix} {suffix}
</Text> </ElipsisText>
) )
} else { } else {
return ( return (

View File

@ -1,7 +1,11 @@
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { Descriptions, Typography, Flex } from 'antd' import { Descriptions, Typography, Flex } from 'antd'
import { getModelProperty } from '../../../database/ObjectModels' import {
getModelProperty,
getPropertyValue
} from '../../../database/ObjectModels'
import ObjectProperty from './ObjectProperty' import ObjectProperty from './ObjectProperty'
import DiffLabel from './DiffLabel'
import ArrowRightIcon from '../../Icons/ArrowRightIcon' import ArrowRightIcon from '../../Icons/ArrowRightIcon'
const { Text } = Typography const { Text } = Typography
@ -51,6 +55,17 @@ const PropertyChanges = ({ type, value }) => {
if (!changeProperty) { if (!changeProperty) {
return null return null
} }
const oldValue = getPropertyValue(value?.old, key)
const newValue = getPropertyValue(value?.new, key)
const isCodeKey = key === 'code' || changeProperty.type === 'codeBlock'
const isCodeEdit =
isCodeKey &&
oldValue != null &&
oldValue !== '' &&
newValue != null &&
newValue !== ''
return ( return (
<Descriptions.Item key={key} label={changeProperty.label}> <Descriptions.Item key={key} label={changeProperty.label}>
<Flex <Flex
@ -58,6 +73,14 @@ const PropertyChanges = ({ type, value }) => {
style={{ minWidth: 0, width: '100%' }} style={{ minWidth: 0, width: '100%' }}
className='property-changes' className='property-changes'
> >
{isCodeEdit ? (
<DiffLabel
oldCode={oldValue}
newCode={newValue}
language={changeProperty.language}
/>
) : (
<>
{value?.old ? ( {value?.old ? (
<ObjectProperty <ObjectProperty
{...changeProperty} {...changeProperty}
@ -83,6 +106,8 @@ const PropertyChanges = ({ type, value }) => {
maxWidth='200px' maxWidth='200px'
/> />
) : null} ) : null}
</>
)}
</Flex> </Flex>
</Descriptions.Item> </Descriptions.Item>
) )

View File

@ -2,6 +2,7 @@ import PropTypes from 'prop-types'
import { Typography, Flex, Button, Tooltip } from 'antd' import { Typography, Flex, Button, Tooltip } from 'antd'
import LinkIcon from '../../Icons/LinkIcon' import LinkIcon from '../../Icons/LinkIcon'
import CopyButton from './CopyButton' import CopyButton from './CopyButton'
import ElipsisText from './ElipsisText'
const { Text, Link } = Typography const { Text, Link } = Typography
@ -24,15 +25,15 @@ const UrlDisplay = ({ url, showCopy = true, showLink = false }) => {
width: 0 width: 0
}} }}
> >
<Text ellipsis style={{ display: 'block' }}> <ElipsisText style={{ display: 'block' }}>
{url} {url}
</Text> </ElipsisText>
</Link> </Link>
) : ( ) : (
<> <>
<Text style={{ marginRight: 8, minWidth: 0 }} ellipsis> <ElipsisText style={{ marginRight: 8, minWidth: 0 }}>
{url} {url}
</Text> </ElipsisText>
<Tooltip title='Open URL' arrow={false}> <Tooltip title='Open URL' arrow={false}>
<Button <Button
icon={<LinkIcon />} icon={<LinkIcon />}

View File

@ -8,6 +8,7 @@ import { User } from '../../../database/models/User'
import { buildActionUrl } from '../../../utils/modelActions' import { buildActionUrl } from '../../../utils/modelActions'
import { AuthContext } from '../context/AuthContext' import { AuthContext } from '../context/AuthContext'
import ObjectActions from './ObjectActions' import ObjectActions from './ObjectActions'
import ElipsisText from './ElipsisText'
const { Text } = Typography const { Text } = Typography
@ -89,13 +90,12 @@ const UserProfilePopover = ({ onClose }) => {
)} )}
<Flex vertical style={{ minWidth: 0 }}> <Flex vertical style={{ minWidth: 0 }}>
{fullName && ( {fullName && (
<Text <ElipsisText
strong strong
ellipsis
style={{ fontSize: 18, lineHeight: 1, marginTop: 1 }} style={{ fontSize: 18, lineHeight: 1, marginTop: 1 }}
> >
{fullName} {fullName}
</Text> </ElipsisText>
)} )}
{email && ( {email && (
<Space> <Space>
@ -106,13 +106,12 @@ const UserProfilePopover = ({ onClose }) => {
> >
@{username} @{username}
</Text> </Text>
<Text <ElipsisText
type='secondary' type='secondary'
ellipsis
style={{ fontSize: 12, lineHeight: 1 }} style={{ fontSize: 12, lineHeight: 1 }}
> >
{email} {email}
</Text> </ElipsisText>
</Space> </Space>
)} )}
{!username && !fullName && !email && ( {!username && !fullName && !email && (

View File

@ -16,6 +16,7 @@ import {
buildActionUrl, buildActionUrl,
stripActionParams stripActionParams
} from '../../../utils/modelActions' } from '../../../utils/modelActions'
import ElipsisText from '../common/ElipsisText'
const ActionsModalContext = createContext() const ActionsModalContext = createContext()
@ -291,15 +292,14 @@ const ActionsModalProvider = ({ children }) => {
> >
{Icon ? <Icon style={{ fontSize: '18px' }} /> : null} {Icon ? <Icon style={{ fontSize: '18px' }} /> : null}
<Flex vertical style={{ flexGrow: 1, minWidth: 0 }}> <Flex vertical style={{ flexGrow: 1, minWidth: 0 }}>
<Text <ElipsisText
ellipsis
style={{ style={{
maxWidth: 320, maxWidth: 320,
width: '100%' width: '100%'
}} }}
> >
{action.fullLabel || action.label || action.name} {action.fullLabel || action.label || action.name}
</Text> </ElipsisText>
</Flex> </Flex>
</Flex> </Flex>
<Flex gap='small' align='center'> <Flex gap='small' align='center'>

View File

@ -1543,12 +1543,12 @@ const ApiServerProvider = ({ children }) => {
} }
// Fetch notes for a specific parent // Fetch notes for a specific parent
const fetchNotes = async (parentId) => { const fetchNotes = async (parentId, parentType) => {
logger.debug('Fetching notes for parent:', parentId) logger.debug('Fetching notes for parent:', parentId, parentType)
try { try {
const response = await axios.get(`${config.backendUrl}/notes`, { const response = await axios.get(`${config.backendUrl}/notes`, {
params: { params: {
'parent._id': parentId, parent: getModelByName(parentType).prefix + ':' + parentId,
sort: 'createdAt', sort: 'createdAt',
order: 'ascend' order: 'ascend'
}, },
@ -1564,7 +1564,7 @@ const ApiServerProvider = ({ children }) => {
} catch (err) { } catch (err) {
console.error(err) console.error(err)
showError(err, () => { showError(err, () => {
fetchNotes(parentId) fetchNotes(parentId, parentType)
}) })
} }
} }

View File

@ -26,6 +26,7 @@ import PropTypes from 'prop-types'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import StateDisplay from '../common/StateDisplay' import StateDisplay from '../common/StateDisplay'
import IdDisplay from '../common/IdDisplay' import IdDisplay from '../common/IdDisplay'
import ElipsisText from '../common/ElipsisText'
import config from '../../../config' import config from '../../../config'
import { import {
@ -501,8 +502,7 @@ const SpotlightContent = ({
{Icon ? <Icon style={{ fontSize: '20px' }} /> : null} {Icon ? <Icon style={{ fontSize: '20px' }} /> : null}
{item.name ? ( {item.name ? (
<Text <ElipsisText
ellipsis
style={{ style={{
maxWidth: 170, maxWidth: 170,
flexGrow: 1, flexGrow: 1,
@ -510,7 +510,7 @@ const SpotlightContent = ({
}} }}
> >
{item.name} {item.name}
</Text> </ElipsisText>
) : null} ) : null}
{item?.state ? ( {item?.state ? (
<StateDisplay <StateDisplay

View File

@ -97,7 +97,6 @@ export const AppPassword = {
'name', 'name',
'user', 'user',
'active', 'active',
'user._id',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'

View File

@ -17,8 +17,8 @@ export const AuditLog = {
'createdAt' 'createdAt'
], ],
filters: [ filters: [
'parent._id', 'parent',
'owner._id', 'owner',
'operation', 'operation',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',

View File

@ -89,7 +89,6 @@ export const CourierService = {
filters: [ filters: [
'_id', '_id',
'courier', 'courier',
'courier._id',
'name', 'name',
'active', 'active',
'tracked', 'tracked',

View File

@ -110,7 +110,6 @@ export const Filament = {
filters: [ filters: [
'_id', '_id',
'material', 'material',
'material._id',
'diameter', 'diameter',
'name', 'name',
'cost', 'cost',

View File

@ -90,7 +90,6 @@ export const FilamentSku = {
'_id', '_id',
'barcode', 'barcode',
'filament', 'filament',
'filament._id',
'name', 'name',
'color', 'color',
'cost', 'cost',

View File

@ -45,14 +45,11 @@ export const FilamentStock = {
], ],
filters: [ filters: [
'filament', 'filament',
'filament._id',
'filamentSku', 'filamentSku',
'state', 'state',
'startingWeight', 'startingWeight',
'currentWeight', 'currentWeight',
'filamentSku._id',
'stockLocation', 'stockLocation',
'stockLocation._id',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'

View File

@ -101,9 +101,7 @@ export const GCodeFile = {
'_id', '_id',
'name', 'name',
'filament', 'filament',
'filament._id',
'filamentSku', 'filamentSku',
'filamentSku._id',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'

View File

@ -166,10 +166,7 @@ export const Invoice = {
'vendor', 'vendor',
'client', 'client',
'state', 'state',
'vendor._id',
'client._id',
'order', 'order',
'order._id',
'orderType', 'orderType',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',

View File

@ -122,7 +122,6 @@ export const ListingVarient = {
], ],
filters: [ filters: [
'listing', 'listing',
'listing._id',
'product', 'product',
'productSku', 'productSku',
'state', 'state',

View File

@ -56,12 +56,10 @@ export const Note = {
filters: [ filters: [
'_id', '_id',
'user', 'user',
'user._id',
'parentType', 'parentType',
'parent', 'parent',
'parent._id', 'parent',
'noteType', 'noteType',
'noteType._id',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'

View File

@ -87,12 +87,9 @@ export const OrderItem = {
'name', 'name',
'itemType', 'itemType',
'item', 'item',
'item._id',
'order', 'order',
'order._id',
'orderType', 'orderType',
'shipment', 'shipment',
'shipment._id',
'state', 'state',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',

View File

@ -92,7 +92,6 @@ export const PartSku = {
'_id', '_id',
'barcode', 'barcode',
'part', 'part',
'part._id',
'name', 'name',
'cost', 'cost',
'price', 'price',

View File

@ -36,9 +36,7 @@ export const PartStock = {
'state', 'state',
'startingQuantity', 'startingQuantity',
'currentQuantity', 'currentQuantity',
'partSku._id',
'stockLocation', 'stockLocation',
'stockLocation._id',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'

View File

@ -163,10 +163,7 @@ export const Payment = {
'vendor', 'vendor',
'client', 'client',
'state', 'state',
'vendor._id',
'client._id',
'invoice', 'invoice',
'invoice._id',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'

View File

@ -102,7 +102,6 @@ export const Product = {
'name', 'name',
'globalPrice', 'globalPrice',
'productCategory', 'productCategory',
'productCategory._id',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'

View File

@ -92,7 +92,6 @@ export const ProductSku = {
'_id', '_id',
'barcode', 'barcode',
'product', 'product',
'product._id',
'name', 'name',
'cost', 'cost',
'price', 'price',

View File

@ -7,6 +7,7 @@ const PostProductStock = lazy(
() => import('../../components/Dashboard/Inventory/ProductStocks/PostProductStock') () => import('../../components/Dashboard/Inventory/ProductStocks/PostProductStock')
) )
import ProductStockIcon from '../../components/Icons/ProductStockIcon' import ProductStockIcon from '../../components/Icons/ProductStockIcon'
import { getModelByName } from '../ObjectModels.js'
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon' import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
import EditIcon from '../../components/Icons/EditIcon' import EditIcon from '../../components/Icons/EditIcon'
import CheckIcon from '../../components/Icons/CheckIcon' import CheckIcon from '../../components/Icons/CheckIcon'
@ -103,9 +104,7 @@ export const ProductStock = {
'productSku', 'productSku',
'state', 'state',
'currentQuantity', 'currentQuantity',
'productSku._id',
'stockLocation', 'stockLocation',
'stockLocation._id',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'
@ -227,7 +226,9 @@ export const ProductStock = {
masterFilter: (objectData) => { masterFilter: (objectData) => {
const partSkuId = objectData?.partSku?._id const partSkuId = objectData?.partSku?._id
if (partSkuId == null) return {} if (partSkuId == null) return {}
return { 'partSku._id': partSkuId } return {
partSku: getModelByName('partSku').prefix + ':' + partSkuId
}
} }
}, },
{ {

View File

@ -231,7 +231,6 @@ export const PurchaseOrder = {
'vendor', 'vendor',
'state', 'state',
'value', 'value',
'vendor._id',
'totalAmount', 'totalAmount',
'totalAmountWithTax', 'totalAmountWithTax',
'totalTaxAmount', 'totalTaxAmount',

View File

@ -238,7 +238,6 @@ export const SalesOrder = {
'client', 'client',
'state', 'state',
'value', 'value',
'client._id',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',
'_reference' '_reference'

View File

@ -147,7 +147,6 @@ export const Shipment = {
'order', 'order',
'state', 'state',
'courierService', 'courierService',
'order._id',
'taxRate', 'taxRate',
'createdAt', 'createdAt',
'updatedAt', 'updatedAt',

View File

@ -9,14 +9,8 @@ export const StockEvent = {
icon: StockEventIcon, icon: StockEventIcon,
actions: [], actions: [],
columns: ['_reference', 'owner', 'parent', 'value', 'createdAt', 'updatedAt'], columns: ['_reference', 'owner', 'parent', 'value', 'createdAt', 'updatedAt'],
filters: [ filters: ['owner', 'parent', 'createdAt', 'updatedAt', '_reference'],
'owner._id', sorters: ['createdAt', 'updatedAt'],
'parent._id',
'createdAt',
'updatedAt',
'_reference'
],
sorters: ['createdAt','updatedAt'],
properties: [ properties: [
{ {
name: '_id', name: '_id',