Compare commits

..

No commits in common. "6fd375b4c9de59439af768eac80905e85c79b361" and "478010ea5bbc7ab0ae718fefc423cc9234cda9b0" have entirely different histories.

46 changed files with 90 additions and 204 deletions

View File

@ -1,9 +1,7 @@
import PropTypes from 'prop-types'
import { useState } from 'react'
import { Button, Flex, Typography, Card, Dropdown, Modal, Table } from 'antd'
import { Button, Flex, Typography, Card } from 'antd'
import TimeDisplay from '../../common/TimeDisplay'
import FarmControlAppIcon from '../../../Logos/FarmControlAppIcon'
import EyeIcon from '../../../Icons/EyeIcon'
const { Text, Title } = Typography
@ -11,131 +9,56 @@ const NewAppUpdate = ({ update, onCancel, onUpdate }) => {
const artifacts = Array.isArray(update?.artifacts) ? update.artifacts : []
const primaryArtifact = artifacts.find((artifact) => artifact.url)
const [changesMenuOpen, setChangesMenuOpen] = useState(false)
const columns = [
{
title: 'Date',
dataIndex: 'date',
key: 'date',
width: 290,
render: (text, record) => {
return <TimeDisplay dateTime={record.date} showSince={true} />
}
},
{
title: 'Author',
dataIndex: 'author',
key: 'author',
width: 180
},
{
title: 'Message',
dataIndex: 'message',
key: 'message',
width: 500
}
]
const actionsMenu = {
items: [
{
label: 'View Changes',
key: 'viewChanges',
icon: <EyeIcon />
}
],
onClick: ({ key }) => {
if (key === 'viewChanges') {
setChangesMenuOpen(true)
}
}
}
return (
<>
<Flex vertical gap='middle'>
<Text>
A new Farm Control update is available. Would you like to update now?
</Text>
<Card styles={{ body: { padding: '12px 18px 12px 12px' } }}>
<Flex gap={12} style={{ width: '100%' }}>
<FarmControlAppIcon style={{ width: '70px', height: '70px' }} />
<Flex vertical gap={2} justify='center' style={{ width: '100%' }}>
<Title level={3} style={{ margin: 0 }}>
{'Farm Control UI'}
</Title>
<Flex
align='center'
justify='space-between'
style={{ width: '100%' }}
>
<Flex style={{ columnGap: '15px', rowGap: '8px' }}>
<Text style={{ margin: 0 }} type='secondary'>
Version:{' '}
<Text>
{update?.version ? `v${update.version}` : 'Unknown'}
</Text>
</Text>
<Text style={{ margin: 0 }} type='secondary'>
Build Number:{' '}
<Text>
{update?.buildNumber
? `b${update.buildNumber}`
: 'Unknown'}
</Text>
</Text>
<Text style={{ margin: 0 }} type='secondary'>
Branch: <Text>{update?.branch || 'Unknown'}</Text>
</Text>
</Flex>
<Dropdown menu={actionsMenu}>
<Button size='small' type='text'>
Actions
</Button>
</Dropdown>
</Flex>
<Flex vertical gap='middle'>
<Text>
A new Farm Control update is available. Would you like to update now?
</Text>
<Card styles={{ body: { padding: 12 } }}>
<Flex gap={12}>
<FarmControlAppIcon style={{ width: '70px', height: '70px' }} />
<Flex vertical gap={2} justify='center'>
<Title level={3} style={{ margin: 0 }}>
{'Farm Control UI'}
</Title>
<Flex style={{ columnGap: '15px', rowGap: '8px' }}>
<Text style={{ margin: 0 }} type='secondary'>
Version:{' '}
<Text>
{update?.version ? `v${update.version}` : 'Unknown'}
</Text>
</Text>
<Text style={{ margin: 0 }} type='secondary'>
Build Number:{' '}
<Text>
{update?.buildNumber ? `b${update.buildNumber}` : 'Unknown'}
</Text>
</Text>
<Text style={{ margin: 0 }} type='secondary'>
Branch: <Text>{update?.branch || 'Unknown'}</Text>
</Text>
</Flex>
</Flex>
</Card>
<Flex justify='space-between' gap='small' align='center'>
<Flex gap='small'>
<Text type='secondary'>Built at:</Text>
<TimeDisplay dateTime={update?.builtAt} />
</Flex>
<Flex gap='small'>
<Button onClick={onCancel}>Not Now</Button>
<Button
type='primary'
onClick={() => onUpdate(update)}
disabled={!primaryArtifact}
>
Update Now
</Button>
</Flex>
</Flex>
</Card>
<Modal
open={changesMenuOpen}
onCancel={() => setChangesMenuOpen(false)}
footer={null}
title='View Changes'
width={1200}
>
<div style={{ marginTop: '20px' }}>
<Table
dataSource={update?.changes}
columns={columns}
scroll={{ x: 1100 }}
bordered={true}
pagination={false}
className='child-table'
/>
</div>
</Modal>
<Flex justify='space-between' gap='small' align='center'>
<Flex gap='small'>
<Text type='secondary'>Built at:</Text>
<TimeDisplay dateTime={update?.builtAt} />
</Flex>
<Flex gap='small'>
<Button onClick={onCancel}>Not Now</Button>
<Button
type='primary'
onClick={() => onUpdate(update)}
disabled={!primaryArtifact}
>
Update Now
</Button>
</Flex>
</Flex>
</>
</Flex>
)
}

View File

@ -96,8 +96,7 @@ export const AppPassword = {
columnFixed: 'left',
objectType: 'appPassword',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -42,8 +42,7 @@ export const AuditLog = {
columnFixed: 'left',
objectType: 'auditLog',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'updatedAt',

View File

@ -115,8 +115,7 @@ export const Client = {
columnFixed: 'left',
objectType: 'client',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -88,8 +88,7 @@ export const Courier = {
columnFixed: 'left',
objectType: 'courier',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -104,8 +104,7 @@ export const CourierService = {
columnFixed: 'left',
objectType: 'courierService',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -79,8 +79,7 @@ export const DocumentJob = {
columnFixed: 'left',
objectType: 'documentJob',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -86,8 +86,7 @@ export const DocumentPrinter = {
columnFixed: 'left',
objectType: 'documentPrinter',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -93,8 +93,7 @@ export const DocumentSize = {
columnFixed: 'left',
objectType: 'documentSize',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -108,8 +108,7 @@ export const DocumentTemplate = {
columnFixed: 'left',
objectType: 'documentTemplate',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -114,8 +114,7 @@ export const Filament = {
columnFixed: 'left',
objectType: 'filament',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -119,8 +119,7 @@ export const FilamentSku = {
columnFixed: 'left',
objectType: 'filamentSku',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -55,8 +55,7 @@ export const FilamentStock = {
columnFixed: 'left',
objectType: 'filamentStock',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'state',

View File

@ -106,8 +106,7 @@ export const File = {
columnFixed: 'left',
objectType: 'file',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -126,8 +126,7 @@ export const GCodeFile = {
columnFixed: 'left',
objectType: 'gcodeFile',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -98,8 +98,7 @@ export const Host = {
columnFixed: 'left',
objectType: 'host',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -175,7 +175,7 @@ export const Invoice = {
objectType: 'invoice',
showCopy: true,
readOnly: true,
columnWidth: 180
columnWidth: 140
},
{
name: 'updatedAt',

View File

@ -57,8 +57,7 @@ export const Job = {
columnFixed: 'left',
objectType: 'job',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'state',

View File

@ -154,8 +154,7 @@ export const Listing = {
columnFixed: 'left',
objectType: 'listing',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'updatedAt',

View File

@ -138,8 +138,7 @@ export const ListingVarient = {
columnFixed: 'left',
objectType: 'listingVarient',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'updatedAt',

View File

@ -180,8 +180,7 @@ export const Marketplace = {
columnFixed: 'left',
objectType: 'marketplace',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'updatedAt',

View File

@ -89,8 +89,7 @@ export const Material = {
columnFixed: 'left',
objectType: 'material',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -37,8 +37,7 @@ export const Note = {
columnFixed: 'left',
objectType: 'note',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'updatedAt',

View File

@ -76,8 +76,7 @@ export const NoteType = {
columnFixed: 'left',
objectType: 'noteType',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -130,7 +130,7 @@ export const OrderItem = {
objectType: 'orderItem',
showCopy: true,
readOnly: true,
columnWidth: 180
columnWidth: 140
},
{
name: 'updatedAt',

View File

@ -101,8 +101,7 @@ export const Part = {
columnFixed: 'left',
objectType: 'part',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -111,8 +111,7 @@ export const PartSku = {
columnFixed: 'left',
objectType: 'partSku',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -53,8 +53,7 @@ export const PartStock = {
columnFixed: 'left',
objectType: 'partStock',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'state',

View File

@ -142,7 +142,7 @@ export const Payment = {
objectType: 'payment',
showCopy: true,
readOnly: true,
columnWidth: 180
columnWidth: 140
},
{
name: 'updatedAt',

View File

@ -234,7 +234,7 @@ export const Printer = {
objectType: 'printer',
showCopy: true,
readOnly: true,
columnWidth: 180
columnWidth: 150
},
{
name: 'createdAt',

View File

@ -126,8 +126,7 @@ export const Product = {
columnFixed: 'left',
objectType: 'product',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -92,8 +92,7 @@ export const ProductCategory = {
columnFixed: 'left',
objectType: 'productCategory',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -121,8 +121,7 @@ export const ProductSku = {
columnFixed: 'left',
objectType: 'productSku',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{

View File

@ -120,8 +120,7 @@ export const ProductStock = {
columnFixed: 'left',
objectType: 'productStock',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'state',

View File

@ -232,7 +232,7 @@ export const PurchaseOrder = {
objectType: 'purchaseOrder',
showCopy: true,
readOnly: true,
columnWidth: 180
columnWidth: 140
},
{
name: 'updatedAt',

View File

@ -214,7 +214,7 @@ export const SalesOrder = {
objectType: 'salesOrder',
showCopy: true,
readOnly: true,
columnWidth: 180
columnWidth: 140
},
{
name: 'updatedAt',

View File

@ -167,7 +167,7 @@ export const Shipment = {
objectType: 'shipment',
showCopy: true,
readOnly: true,
columnWidth: 180
columnWidth: 140
},
{

View File

@ -45,8 +45,7 @@ export const StockAudit = {
columnFixed: 'left',
objectType: 'stockAudit',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'state',

View File

@ -37,7 +37,7 @@ export const StockEvent = {
value: null,
showCopy: true,
readOnly: true,
columnWidth: 180
columnWidth: 140
},
{
name: 'updatedAt',

View File

@ -45,8 +45,7 @@ export const StockLocation = {
columnFixed: 'left',
objectType: 'stockLocation',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'updatedAt',

View File

@ -112,8 +112,7 @@ export const StockTransfer = {
columnFixed: 'left',
objectType: 'stockTransfer',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -57,8 +57,7 @@ export const SubJob = {
columnFixed: 'left',
objectType: 'subJob',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'state',

View File

@ -104,8 +104,7 @@ export const TaxRate = {
columnFixed: 'left',
objectType: 'taxRate',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -97,8 +97,7 @@ export const TaxRecord = {
columnFixed: 'left',
objectType: 'taxRecord',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'taxRate',

View File

@ -63,8 +63,7 @@ export const User = {
columnFixed: 'left',
objectType: 'user',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',

View File

@ -113,8 +113,7 @@ export const Vendor = {
columnFixed: 'left',
objectType: 'vendor',
showCopy: true,
readOnly: true,
columnWidth: 180
readOnly: true
},
{
name: 'name',