Compare commits
6 Commits
7e1ec9f3ae
...
309d825110
| Author | SHA1 | Date | |
|---|---|---|---|
| 309d825110 | |||
| ab9818d18f | |||
| 72fea29593 | |||
| 6eb9f8d37f | |||
| 664bd7751f | |||
| f462717bb3 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -26,3 +26,5 @@ yarn-error.log*
|
||||
.nova
|
||||
|
||||
/design_files/*.af~lock~
|
||||
|
||||
stats.html
|
||||
@ -48,7 +48,6 @@
|
||||
"keycloak-js": "^26.2.0",
|
||||
"keytar": "^7.9.0",
|
||||
"loglevel": "^1.9.2",
|
||||
"moment": "^2.30.1",
|
||||
"online-3d-viewer": "^0.16.0",
|
||||
"prettier": "^3.6.2",
|
||||
"prettier-eslint": "^16.4.2",
|
||||
@ -113,6 +112,7 @@
|
||||
"express": "^5.1.0",
|
||||
"prettier": "^3.6.2",
|
||||
"prettier-eslint": "^16.4.2",
|
||||
"rollup-plugin-visualizer": "^6.0.5",
|
||||
"serve": "^14.2.4",
|
||||
"standard": "^17.1.2",
|
||||
"svgo": "^4.0.0",
|
||||
|
||||
@ -144,6 +144,7 @@ const ApiContextDebug = () => {
|
||||
)
|
||||
msgApi.destroy()
|
||||
msgApi.success('fetchObject test completed')
|
||||
logger.debug('fetchObject test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('fetchObject test failed')
|
||||
@ -160,6 +161,7 @@ const ApiContextDebug = () => {
|
||||
})
|
||||
msgApi.destroy()
|
||||
msgApi.success('fetchObjects test completed')
|
||||
logger.debug('fetchObjects test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('fetchObjects test failed')
|
||||
@ -196,6 +198,7 @@ const ApiContextDebug = () => {
|
||||
)
|
||||
msgApi.destroy()
|
||||
msgApi.success('fetchObjectLock test completed')
|
||||
logger.debug('fetchObjectLock test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('fetchObjectLock test failed')
|
||||
@ -217,6 +220,7 @@ const ApiContextDebug = () => {
|
||||
)
|
||||
msgApi.destroy()
|
||||
msgApi.success('updateObject test completed')
|
||||
logger.debug('updateObject test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('updateObject test failed')
|
||||
@ -234,6 +238,7 @@ const ApiContextDebug = () => {
|
||||
const result = await createObject(testInputs.objectType, testData)
|
||||
msgApi.destroy()
|
||||
msgApi.success('createObject test completed')
|
||||
logger.debug('createObject test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('createObject test failed')
|
||||
@ -250,6 +255,7 @@ const ApiContextDebug = () => {
|
||||
)
|
||||
msgApi.destroy()
|
||||
msgApi.success('deleteObject test completed')
|
||||
logger.debug('deleteObject test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('deleteObject test failed')
|
||||
@ -268,6 +274,7 @@ const ApiContextDebug = () => {
|
||||
const result = await fetchObjectsByProperty(testInputs.objectType, params)
|
||||
msgApi.destroy()
|
||||
msgApi.success('fetchObjectsByProperty test completed')
|
||||
logger.debug('fetchObjectsByProperty test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('fetchObjectsByProperty test failed')
|
||||
@ -281,6 +288,7 @@ const ApiContextDebug = () => {
|
||||
const result = await fetchSpotlightData(testInputs.query)
|
||||
msgApi.destroy()
|
||||
msgApi.success('fetchSpotlightData test completed')
|
||||
logger.debug('fetchSpotlightData test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('fetchSpotlightData test failed')
|
||||
@ -291,13 +299,14 @@ const ApiContextDebug = () => {
|
||||
const testfetchFileContent = async () => {
|
||||
try {
|
||||
msgApi.loading('Testing fetchFileContent...', 0)
|
||||
await fetchFileContent(
|
||||
const result = await fetchFileContent(
|
||||
testInputs.objectId,
|
||||
'gcodefile',
|
||||
testInputs.fileName
|
||||
)
|
||||
msgApi.destroy()
|
||||
msgApi.success('fetchFileContent test completed')
|
||||
logger.debug('fetchFileContent test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('fetchFileContent test failed')
|
||||
@ -316,6 +325,7 @@ const ApiContextDebug = () => {
|
||||
testInputs.scale,
|
||||
(result) => {
|
||||
msgApi.destroy()
|
||||
logger.debug('fetchTemplatePreview test completed', result)
|
||||
if (result.success) {
|
||||
msgApi.success('fetchTemplatePreview test completed')
|
||||
} else {
|
||||
@ -336,6 +346,7 @@ const ApiContextDebug = () => {
|
||||
const result = await fetchNotes(testInputs.parentId)
|
||||
msgApi.destroy()
|
||||
msgApi.success('fetchNotes test completed')
|
||||
logger.debug('fetchNotes test completed', result)
|
||||
} catch (err) {
|
||||
msgApi.destroy()
|
||||
msgApi.error('fetchNotes test failed')
|
||||
@ -349,6 +360,7 @@ const ApiContextDebug = () => {
|
||||
|
||||
fetchHostOTP(testInputs.hostId, (result) => {
|
||||
msgApi.destroy()
|
||||
logger.debug('fetchHostOTP test completed', result)
|
||||
if (result.otp) {
|
||||
msgApi.success('fetchHostOTP test completed: ' + result.otp)
|
||||
} else {
|
||||
@ -372,6 +384,7 @@ const ApiContextDebug = () => {
|
||||
testInputs.action,
|
||||
(result) => {
|
||||
msgApi.destroy()
|
||||
logger.debug('sendObjectAction test completed', result)
|
||||
if (result.success) {
|
||||
msgApi.success('sendObjectAction test completed')
|
||||
} else {
|
||||
|
||||
@ -2,22 +2,48 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Flex, Typography, Tag } from 'antd'
|
||||
import moment from 'moment'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
const { Text } = Typography
|
||||
|
||||
const formatTimeDifference = (dateTime) => {
|
||||
const now = moment()
|
||||
const diff = moment(dateTime)
|
||||
const duration = moment.duration(now.diff(diff))
|
||||
const now = dayjs()
|
||||
const diff = dayjs(dateTime)
|
||||
|
||||
const years = Math.floor(duration.asYears())
|
||||
const months = Math.floor(duration.asMonths()) % 12
|
||||
const weeks = Math.floor(duration.asWeeks()) % 4
|
||||
const days = Math.floor(duration.asDays()) % 7
|
||||
const hours = duration.hours()
|
||||
const minutes = duration.minutes()
|
||||
const seconds = duration.seconds()
|
||||
const years = now.diff(diff, 'year')
|
||||
const months = now.diff(diff.add(years, 'year'), 'month')
|
||||
const weeks = now.diff(diff.add(years, 'year').add(months, 'month'), 'week')
|
||||
const days = now.diff(
|
||||
diff.add(years, 'year').add(months, 'month').add(weeks, 'week'),
|
||||
'day'
|
||||
)
|
||||
const hours = now.diff(
|
||||
diff
|
||||
.add(years, 'year')
|
||||
.add(months, 'month')
|
||||
.add(weeks, 'week')
|
||||
.add(days, 'day'),
|
||||
'hour'
|
||||
)
|
||||
const minutes = now.diff(
|
||||
diff
|
||||
.add(years, 'year')
|
||||
.add(months, 'month')
|
||||
.add(weeks, 'week')
|
||||
.add(days, 'day')
|
||||
.add(hours, 'hour'),
|
||||
'minute'
|
||||
)
|
||||
const seconds = now.diff(
|
||||
diff
|
||||
.add(years, 'year')
|
||||
.add(months, 'month')
|
||||
.add(weeks, 'week')
|
||||
.add(days, 'day')
|
||||
.add(hours, 'hour')
|
||||
.add(minutes, 'minute'),
|
||||
'second'
|
||||
)
|
||||
|
||||
if (years > 0) {
|
||||
return `${years}y`
|
||||
@ -67,7 +93,7 @@ const TimeDisplay = ({
|
||||
dateFormat += 'HH:mm:ss '
|
||||
}
|
||||
|
||||
const formattedDate = moment(dateTime).format(dateFormat)
|
||||
const formattedDate = dayjs(dateTime).format(dateFormat)
|
||||
|
||||
return (
|
||||
<Flex align={'center'} gap={'small'}>
|
||||
|
||||
@ -214,7 +214,7 @@ const ActionsModalProvider = ({ children }) => {
|
||||
footer={null}
|
||||
width={700}
|
||||
styles={{ content: { padding: 0 } }}
|
||||
destroyOnClose={true}
|
||||
destroyOnHidden={true}
|
||||
>
|
||||
<Flex vertical>
|
||||
<Input
|
||||
|
||||
@ -9,16 +9,74 @@ export default defineConfig({
|
||||
plugins: [react(), svgo(), svgr(), eslintPlugin()],
|
||||
build: {
|
||||
outDir: 'build',
|
||||
chunkSizeWarningLimit: 1500,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
antd: ['antd'],
|
||||
codemirror: [
|
||||
'@codemirror/lang-javascript',
|
||||
'@codemirror/lang-python' /* etc */
|
||||
],
|
||||
three: ['three', 'gcode-preview'],
|
||||
'react-vendor': ['react', 'react-dom', 'react-router-dom']
|
||||
manualChunks(id) {
|
||||
// --- CodeMirror
|
||||
if (id.includes('node_modules/@codemirror')) {
|
||||
return 'codemirror'
|
||||
}
|
||||
|
||||
// --- Lezer
|
||||
if (id.includes('node_modules/@lezer')) {
|
||||
return 'lezer'
|
||||
}
|
||||
|
||||
// --- Ant Design
|
||||
if (id.includes('node_modules/antd')) {
|
||||
return 'antd'
|
||||
}
|
||||
|
||||
if (id.includes('node_modules/@ant-design/icons')) {
|
||||
return 'ant-icons'
|
||||
}
|
||||
|
||||
if (id.includes('node_modules/@ant-design/charts')) {
|
||||
return 'ant-charts'
|
||||
}
|
||||
|
||||
// --- AntV
|
||||
if (id.includes('node_modules/@antv')) {
|
||||
return 'antv'
|
||||
}
|
||||
|
||||
// --- Three.js
|
||||
if (id.includes('node_modules/three')) {
|
||||
return 'three'
|
||||
}
|
||||
|
||||
// --- GCode Preview
|
||||
if (id.includes('node_modules/gcode-preview')) {
|
||||
return 'gcode-preview'
|
||||
}
|
||||
|
||||
// --- Online 3D Viewer
|
||||
if (id.includes('node_modules/online-3d-viewer')) {
|
||||
return 'online-3d-viewer'
|
||||
}
|
||||
|
||||
// --- Lodash
|
||||
if (id.includes('node_modules/lodash')) {
|
||||
return 'lodash'
|
||||
}
|
||||
|
||||
// --- tsparticles
|
||||
if (
|
||||
id.includes('node_modules/@tsparticles') ||
|
||||
id.includes('node_modules/tsparticles')
|
||||
) {
|
||||
return 'tsparticles'
|
||||
}
|
||||
|
||||
// --- React vendor
|
||||
if (
|
||||
id.includes('node_modules/react') ||
|
||||
id.includes('node_modules/react-dom') ||
|
||||
id.includes('node_modules/react-router-dom')
|
||||
) {
|
||||
return 'react-vendor'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
38
yarn.lock
38
yarn.lock
@ -4357,6 +4357,11 @@ define-data-property@^1.0.1, define-data-property@^1.1.4:
|
||||
es-errors "^1.3.0"
|
||||
gopd "^1.0.1"
|
||||
|
||||
define-lazy-prop@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f"
|
||||
integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==
|
||||
|
||||
define-properties@^1.1.3, define-properties@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c"
|
||||
@ -6187,7 +6192,7 @@ is-decimal@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/is-decimal/-/is-decimal-2.0.1.tgz#9469d2dc190d0214fd87d78b78caecc0cc14eef7"
|
||||
integrity sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==
|
||||
|
||||
is-docker@^2.0.0:
|
||||
is-docker@^2.0.0, is-docker@^2.1.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
|
||||
integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==
|
||||
@ -7439,11 +7444,6 @@ ml-matrix@^6.10.4:
|
||||
is-any-array "^2.0.1"
|
||||
ml-array-rescale "^1.3.7"
|
||||
|
||||
moment@^2.30.1:
|
||||
version "2.30.1"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
|
||||
integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==
|
||||
|
||||
ms@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||
@ -7658,6 +7658,15 @@ online-3d-viewer@^0.16.0:
|
||||
fflate "0.8.2"
|
||||
three "0.176.0"
|
||||
|
||||
open@^8.0.0:
|
||||
version "8.4.2"
|
||||
resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9"
|
||||
integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==
|
||||
dependencies:
|
||||
define-lazy-prop "^2.0.0"
|
||||
is-docker "^2.1.1"
|
||||
is-wsl "^2.2.0"
|
||||
|
||||
optionator@^0.9.3:
|
||||
version "0.9.4"
|
||||
resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734"
|
||||
@ -8801,6 +8810,16 @@ roarr@^2.15.3:
|
||||
semver-compare "^1.0.0"
|
||||
sprintf-js "^1.1.2"
|
||||
|
||||
rollup-plugin-visualizer@^6.0.5:
|
||||
version "6.0.5"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-6.0.5.tgz#9cf774cff88f4ba2887c97354766b68931323280"
|
||||
integrity sha512-9+HlNgKCVbJDs8tVtjQ43US12eqaiHyyiLMdBwQ7vSZPiHMysGNo2E88TAp1si5wx8NAoYriI2A5kuKfIakmJg==
|
||||
dependencies:
|
||||
open "^8.0.0"
|
||||
picomatch "^4.0.2"
|
||||
source-map "^0.7.4"
|
||||
yargs "^17.5.1"
|
||||
|
||||
rollup@^2.77.2:
|
||||
version "2.79.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.2.tgz#f150e4a5db4b121a21a747d762f701e5e9f49090"
|
||||
@ -9261,6 +9280,11 @@ source-map@^0.6.0:
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||
|
||||
source-map@^0.7.4:
|
||||
version "0.7.6"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.6.tgz#a3658ab87e5b6429c8a1f3ba0083d4c61ca3ef02"
|
||||
integrity sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==
|
||||
|
||||
space-separated-tokens@^2.0.0:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz#1ecd9d2350a3844572c3f4a312bceb018348859f"
|
||||
@ -10313,7 +10337,7 @@ yargs-parser@^21.1.1:
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
|
||||
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
|
||||
|
||||
yargs@17.7.2, yargs@^17.0.1, yargs@^17.6.2:
|
||||
yargs@17.7.2, yargs@^17.0.1, yargs@^17.5.1, yargs@^17.6.2:
|
||||
version "17.7.2"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
|
||||
integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user