Enhance ObjectList and ObjectProperty components with hyperlink support
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Updated ObjectList to accept a new prop, showHyperlink, allowing for conditional rendering of hyperlinks for object items. - Modified ObjectProperty to pass the showHyperlink prop to ObjectList and ObjectSelect components, enhancing their functionality. - Improved error handling in ApiServerContext by adding detailed logging for error responses. - Updated various database models to include showHyperlink attribute for object lists, improving user navigation and interaction. - Enhanced CSS styles for the permissions matrix table to improve visual clarity and user experience.
This commit is contained in:
parent
f07b0d5eef
commit
0b501a11c6
@ -1337,6 +1337,64 @@ span.ant-skeleton-input.ant-skeleton-input-sm.text-skeleton {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.permissions-matrix-table .permissions-matrix-group-row > .ant-table-cell {
|
||||||
|
font-weight: 600;
|
||||||
|
background-color: color-mix(
|
||||||
|
in srgb,
|
||||||
|
var(--color-text) 6%,
|
||||||
|
var(--layout-header-bg)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions-matrix-table
|
||||||
|
.permissions-matrix-group-row
|
||||||
|
> .ant-table-cell.ant-table-cell-row-hover {
|
||||||
|
background: color-mix(
|
||||||
|
in srgb,
|
||||||
|
var(--color-text) 10%,
|
||||||
|
var(--layout-header-bg)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions-matrix-table .ant-table-row-expand-icon,
|
||||||
|
.permissions-matrix-table .ant-table-row-indent {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions-matrix-expand-button.ant-btn {
|
||||||
|
width: 22px;
|
||||||
|
min-width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
padding: 0;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions-matrix-expand-button.ant-btn:hover,
|
||||||
|
.permissions-matrix-expand-button.ant-btn:focus,
|
||||||
|
.permissions-matrix-expand-button.ant-btn:focus-visible {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions-matrix-expand-spacer {
|
||||||
|
display: inline-block;
|
||||||
|
width: 18px;
|
||||||
|
height: 22px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions-matrix-expand-icon {
|
||||||
|
font-size: 12px !important;
|
||||||
|
color: inherit;
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.permissions-matrix-expand-icon-open {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
|
||||||
.permissions-matrix-table .ant-table-thead > tr > th {
|
.permissions-matrix-table .ant-table-thead > tr > th {
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { Space, Typography } from 'antd'
|
|||||||
|
|
||||||
const { Text } = Typography
|
const { Text } = Typography
|
||||||
|
|
||||||
const ObjectList = ({ value, objectType, style }) => {
|
const ObjectList = ({ value, objectType, style, showHyperlink = false }) => {
|
||||||
if (!value || !Array.isArray(value) || value.length === 0) {
|
if (!value || !Array.isArray(value) || value.length === 0) {
|
||||||
return <Text type='secondary'>n/a</Text>
|
return <Text type='secondary'>n/a</Text>
|
||||||
}
|
}
|
||||||
@ -12,7 +12,12 @@ const ObjectList = ({ value, objectType, style }) => {
|
|||||||
return (
|
return (
|
||||||
<Space size={'small'} wrap style={style}>
|
<Space size={'small'} wrap style={style}>
|
||||||
{value.map((item) => (
|
{value.map((item) => (
|
||||||
<ObjectDisplay object={item} objectType={objectType} key={item._id} />
|
<ObjectDisplay
|
||||||
|
object={item}
|
||||||
|
objectType={objectType}
|
||||||
|
key={item._id}
|
||||||
|
showHyperlink={showHyperlink}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</Space>
|
</Space>
|
||||||
)
|
)
|
||||||
@ -21,7 +26,8 @@ const ObjectList = ({ value, objectType, style }) => {
|
|||||||
ObjectList.propTypes = {
|
ObjectList.propTypes = {
|
||||||
value: PropTypes.array,
|
value: PropTypes.array,
|
||||||
objectType: PropTypes.string,
|
objectType: PropTypes.string,
|
||||||
style: PropTypes.object
|
style: PropTypes.object,
|
||||||
|
showHyperlink: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ObjectList
|
export default ObjectList
|
||||||
|
|||||||
@ -475,7 +475,13 @@ const ObjectProperty = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 'objectList': {
|
case 'objectList': {
|
||||||
return <ObjectList value={value} objectType={objectType} />
|
return (
|
||||||
|
<ObjectList
|
||||||
|
value={value}
|
||||||
|
objectType={objectType}
|
||||||
|
showHyperlink={showHyperlink}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
case 'objectChildren': {
|
case 'objectChildren': {
|
||||||
return (
|
return (
|
||||||
@ -958,7 +964,14 @@ const ObjectProperty = ({
|
|||||||
<ObjectTypeSelect masterFilter={masterFilter} {...inputProps} />
|
<ObjectTypeSelect masterFilter={masterFilter} {...inputProps} />
|
||||||
)
|
)
|
||||||
case 'objectList':
|
case 'objectList':
|
||||||
return <ObjectSelect type={objectType} multiple {...inputProps} />
|
return (
|
||||||
|
<ObjectSelect
|
||||||
|
type={objectType}
|
||||||
|
multiple
|
||||||
|
showHyperlink={showHyperlink}
|
||||||
|
{...inputProps}
|
||||||
|
/>
|
||||||
|
)
|
||||||
case 'tags':
|
case 'tags':
|
||||||
return (
|
return (
|
||||||
<TagsInput
|
<TagsInput
|
||||||
|
|||||||
@ -1015,6 +1015,16 @@ const ApiServerProvider = ({ children }) => {
|
|||||||
|
|
||||||
const showError = useCallback(
|
const showError = useCallback(
|
||||||
(error, callback = null) => {
|
(error, callback = null) => {
|
||||||
|
console.error(error)
|
||||||
|
console.error(error.response)
|
||||||
|
console.error(error.response.data)
|
||||||
|
console.error(error.response.data.code)
|
||||||
|
console.error(error.response.data.error)
|
||||||
|
console.error(error.response.data.message)
|
||||||
|
console.error(error.response.data.status)
|
||||||
|
console.error(error.response.data.timestamp)
|
||||||
|
console.error(error.response.data.path)
|
||||||
|
console.error(error.response.data.method)
|
||||||
const code = error.response.data.code || 'UNKNOWN'
|
const code = error.response.data.code || 'UNKNOWN'
|
||||||
if (code == 'UNAUTHORIZED') {
|
if (code == 'UNAUTHORIZED') {
|
||||||
setUnauthenticated()
|
setUnauthenticated()
|
||||||
|
|||||||
@ -208,7 +208,8 @@ export const DocumentTemplate = {
|
|||||||
label: 'Document Printers',
|
label: 'Document Printers',
|
||||||
required: false,
|
required: false,
|
||||||
type: 'objectList',
|
type: 'objectList',
|
||||||
objectType: 'documentPrinter'
|
objectType: 'documentPrinter',
|
||||||
|
showHyperlink: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'content',
|
name: 'content',
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
import { createElement, lazy } from 'react'
|
import { createElement, lazy } from 'react'
|
||||||
|
|
||||||
const FilamentProfileInfo = lazy(
|
const FilamentProfileInfo = lazy(
|
||||||
() => import('../../components/Dashboard/Production/FilamentProfiles/FilamentProfileInfo')
|
() =>
|
||||||
|
import('../../components/Dashboard/Production/FilamentProfiles/FilamentProfileInfo')
|
||||||
)
|
)
|
||||||
import FilamentProfileIcon from '../../components/Icons/FilamentProfileIcon'
|
import FilamentProfileIcon from '../../components/Icons/FilamentProfileIcon'
|
||||||
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
import InfoCircleIcon from '../../components/Icons/InfoCircleIcon'
|
||||||
@ -75,8 +76,15 @@ export const FilamentProfile = {
|
|||||||
content: () => createElement(FilamentProfileInfo)
|
content: () => createElement(FilamentProfileInfo)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
columns: ['_reference', 'name', 'filamentType', 'filament', 'createdAt', 'updatedAt'],
|
columns: [
|
||||||
filters: ['_id','name','createdAt','updatedAt','_reference'],
|
'_reference',
|
||||||
|
'name',
|
||||||
|
'filamentType',
|
||||||
|
'filament',
|
||||||
|
'createdAt',
|
||||||
|
'updatedAt'
|
||||||
|
],
|
||||||
|
filters: ['_id', 'name', 'createdAt', 'updatedAt', '_reference'],
|
||||||
sorters: ['name', 'createdAt', 'updatedAt'],
|
sorters: ['name', 'createdAt', 'updatedAt'],
|
||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
@ -1203,7 +1211,8 @@ export const FilamentProfile = {
|
|||||||
type: 'objectList',
|
type: 'objectList',
|
||||||
objectType: 'printerProfile',
|
objectType: 'printerProfile',
|
||||||
span: 2,
|
span: 2,
|
||||||
columnWidth: 220
|
columnWidth: 220,
|
||||||
|
showHyperlink: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'compatiblePrintersCondition',
|
name: 'compatiblePrintersCondition',
|
||||||
|
|||||||
@ -270,7 +270,8 @@ export const Host = {
|
|||||||
objectType: 'file',
|
objectType: 'file',
|
||||||
required: false,
|
required: false,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
columnWidth: 200
|
columnWidth: 200,
|
||||||
|
showHyperlink: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -245,7 +245,8 @@ export const Job = {
|
|||||||
type: 'objectList',
|
type: 'objectList',
|
||||||
objectType: 'printer',
|
objectType: 'printer',
|
||||||
required: true,
|
required: true,
|
||||||
columnWidth: 200
|
columnWidth: 200,
|
||||||
|
showHyperlink: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
stats: [
|
stats: [
|
||||||
|
|||||||
@ -4,7 +4,8 @@ const ListingInfo = lazy(
|
|||||||
() => import('../../components/Dashboard/Sales/Listings/ListingInfo')
|
() => import('../../components/Dashboard/Sales/Listings/ListingInfo')
|
||||||
)
|
)
|
||||||
const NewListingVarient = lazy(
|
const NewListingVarient = lazy(
|
||||||
() => import('../../components/Dashboard/Sales/ListingVarients/NewListingVarient')
|
() =>
|
||||||
|
import('../../components/Dashboard/Sales/ListingVarients/NewListingVarient')
|
||||||
)
|
)
|
||||||
const PublishListing = lazy(
|
const PublishListing = lazy(
|
||||||
() => import('../../components/Dashboard/Sales/Listings/PublishListing')
|
() => import('../../components/Dashboard/Sales/Listings/PublishListing')
|
||||||
@ -76,7 +77,11 @@ export const Listing = {
|
|||||||
label: 'New Listing Varient',
|
label: 'New Listing Varient',
|
||||||
icon: PlusIcon,
|
icon: PlusIcon,
|
||||||
content: (objectData, { onOk } = {}) => {
|
content: (objectData, { onOk } = {}) => {
|
||||||
return createElement(NewListingVarient, { defaultValues: { listing: objectData }, onOk, reset: true })
|
return createElement(NewListingVarient, {
|
||||||
|
defaultValues: { listing: objectData },
|
||||||
|
onOk,
|
||||||
|
reset: true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ type: 'divider' },
|
{ type: 'divider' },
|
||||||
@ -308,7 +313,7 @@ export const Listing = {
|
|||||||
name: 'courierServices',
|
name: 'courierServices',
|
||||||
label: 'Courier Services',
|
label: 'Courier Services',
|
||||||
type: 'objectList',
|
type: 'objectList',
|
||||||
multiple: true,
|
showHyperlink: true,
|
||||||
objectType: 'courierService',
|
objectType: 'courierService',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
required: true,
|
required: true,
|
||||||
|
|||||||
@ -482,6 +482,7 @@ export const Printer = {
|
|||||||
name: 'queue',
|
name: 'queue',
|
||||||
label: 'Queue',
|
label: 'Queue',
|
||||||
type: 'objectList',
|
type: 'objectList',
|
||||||
|
showHyperlink: true,
|
||||||
objectType: 'subJob',
|
objectType: 'subJob',
|
||||||
required: false,
|
required: false,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
|
|||||||
@ -185,6 +185,7 @@ export const User = {
|
|||||||
name: 'groups',
|
name: 'groups',
|
||||||
label: 'Groups',
|
label: 'Groups',
|
||||||
type: 'objectList',
|
type: 'objectList',
|
||||||
|
showHyperlink: true,
|
||||||
objectType: 'userGroup',
|
objectType: 'userGroup',
|
||||||
span: 2,
|
span: 2,
|
||||||
columnWidth: 250
|
columnWidth: 250
|
||||||
|
|||||||
@ -75,8 +75,20 @@ export const UserGroup = {
|
|||||||
content: () => createElement(UserGroupInfo)
|
content: () => createElement(UserGroupInfo)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
columns: ['_reference', 'name', 'permissionSettings', 'createdAt', 'updatedAt'],
|
columns: [
|
||||||
filters: ['name', 'permissionSettings', 'createdAt', 'updatedAt', '_reference'],
|
'_reference',
|
||||||
|
'name',
|
||||||
|
'permissionSettings',
|
||||||
|
'createdAt',
|
||||||
|
'updatedAt'
|
||||||
|
],
|
||||||
|
filters: [
|
||||||
|
'name',
|
||||||
|
'permissionSettings',
|
||||||
|
'createdAt',
|
||||||
|
'updatedAt',
|
||||||
|
'_reference'
|
||||||
|
],
|
||||||
sorters: ['name', 'createdAt', '_id', 'updatedAt'],
|
sorters: ['name', 'createdAt', '_id', 'updatedAt'],
|
||||||
properties: [
|
properties: [
|
||||||
{
|
{
|
||||||
@ -126,7 +138,8 @@ export const UserGroup = {
|
|||||||
type: 'objectList',
|
type: 'objectList',
|
||||||
objectType: 'permissionSetting',
|
objectType: 'permissionSetting',
|
||||||
span: 2,
|
span: 2,
|
||||||
columnWidth: 250
|
columnWidth: 250,
|
||||||
|
showHyperlink: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'permissions',
|
name: 'permissions',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user