@fdm-monster/client-next 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/RELEASE_NOTES.MD +28 -1
  3. package/dist/assets/MaterialIcons-Regular-BjXOXp5c.eot +0 -0
  4. package/dist/assets/MaterialIcons-Regular-DEUTIz1o.ttf +0 -0
  5. package/dist/assets/MaterialIcons-Regular-DOtZ65Va.woff2 +0 -0
  6. package/dist/assets/MaterialIcons-Regular-FsbMSDLx.woff +0 -0
  7. package/dist/assets/index-CHzfWKPO.css +5 -0
  8. package/dist/assets/index-WVqTlgq7.js +90 -0
  9. package/dist/assets/index-WVqTlgq7.js.map +1 -0
  10. package/dist/favicon.ico +0 -0
  11. package/dist/img/DavidZwart.jpg +0 -0
  12. package/dist/img/OIG.JYDC2RaWdz7g9.jpg +0 -0
  13. package/dist/img/OIG.jpg +0 -0
  14. package/dist/img/icons/android-chrome-256x256.png +0 -0
  15. package/dist/img/icons/android-chrome-384x384.png +0 -0
  16. package/dist/img/icons/android-chrome-512x512.png +0 -0
  17. package/dist/img/icons/favicon.svg +1 -0
  18. package/dist/img/logo.png +0 -0
  19. package/dist/img/logo.svg +1 -0
  20. package/dist/img/manifest.webmanifest +33 -0
  21. package/dist/img/octoprint-tentacle.svg +144 -0
  22. package/dist/img/thumbail_unknown.jpg +0 -0
  23. package/dist/img/vbanner.jpg +0 -0
  24. package/dist/index.html +24 -0
  25. package/dist/robots.txt +2 -0
  26. package/package.json +1 -1
  27. package/.all-contributorsrc +0 -57
  28. package/.editorconfig +0 -5
  29. package/.eslintrc.js +0 -126
  30. package/.github/FUNDING.yml +0 -3
  31. package/.github/workflows/release-client.yml +0 -94
  32. package/.github/workflows/vue-publish.yml +0 -26
  33. package/.prettierignore +0 -15
  34. package/.whitesource +0 -12
  35. package/renovate.json +0 -30
  36. package/src/App.vue +0 -60
  37. package/src/AppLoader.vue +0 -383
  38. package/src/assets/adjectives.json +0 -1468
  39. package/src/assets/logo.svg +0 -6
  40. package/src/assets/nouns.json +0 -4309
  41. package/src/auto-imports.d.ts +0 -139
  42. package/src/backend/app.service.ts +0 -39
  43. package/src/backend/auth.service.ts +0 -56
  44. package/src/backend/base.service.ts +0 -57
  45. package/src/backend/batch.service.ts +0 -37
  46. package/src/backend/camera-stream.service.ts +0 -33
  47. package/src/backend/custom-gcode.service.ts +0 -11
  48. package/src/backend/dto/octoprint-settings.dto.ts +0 -168
  49. package/src/backend/first-time-setup.service.ts +0 -17
  50. package/src/backend/floor.service.ts +0 -84
  51. package/src/backend/index.ts +0 -4
  52. package/src/backend/print-completions.service.ts +0 -11
  53. package/src/backend/printer-file.service.ts +0 -91
  54. package/src/backend/printer-group.service.ts +0 -62
  55. package/src/backend/printer-job.service.ts +0 -20
  56. package/src/backend/printer-settings.service.ts +0 -28
  57. package/src/backend/printers.service.ts +0 -136
  58. package/src/backend/server-private.service.ts +0 -55
  59. package/src/backend/server.api.ts +0 -132
  60. package/src/backend/settings.service.ts +0 -85
  61. package/src/backend/user.service.ts +0 -51
  62. package/src/components/AboutHelp/AboutView.vue +0 -164
  63. package/src/components/CameraGrid/CameraGridView.vue +0 -111
  64. package/src/components/FirstTimeSetup/FirstTimeSetupView.vue +0 -354
  65. package/src/components/Generic/Actions/PrinterConnectionAction.vue +0 -56
  66. package/src/components/Generic/Actions/PrinterCreateAction.vue +0 -22
  67. package/src/components/Generic/Actions/PrinterDeleteAction.vue +0 -29
  68. package/src/components/Generic/Actions/PrinterQuickStopAction.vue +0 -35
  69. package/src/components/Generic/Actions/PrinterSettingsAction.vue +0 -35
  70. package/src/components/Generic/Actions/PrinterUrlAction.vue +0 -24
  71. package/src/components/Generic/Actions/RefreshFilesAction.vue +0 -50
  72. package/src/components/Generic/Actions/SyncPrinterNameAction.vue +0 -36
  73. package/src/components/Generic/Dialogs/AddOrUpdateCameraStreamDialog.vue +0 -131
  74. package/src/components/Generic/Dialogs/AddOrUpdateFloorDialog.vue +0 -141
  75. package/src/components/Generic/Dialogs/AddOrUpdatePrinterDialog.vue +0 -303
  76. package/src/components/Generic/Dialogs/BaseDialog.vue +0 -81
  77. package/src/components/Generic/Dialogs/BatchJsonCreateDialog.vue +0 -109
  78. package/src/components/Generic/Dialogs/BatchReprintDialog.vue +0 -190
  79. package/src/components/Generic/Dialogs/PrinterChecksPanel.vue +0 -37
  80. package/src/components/Generic/Dialogs/PrinterControlDialog.vue +0 -202
  81. package/src/components/Generic/Dialogs/PrinterMaintenanceDialog.vue +0 -130
  82. package/src/components/Generic/Dialogs/YamlImportExportDialog.vue +0 -186
  83. package/src/components/Generic/Dialogs/dialog.constants.ts +0 -19
  84. package/src/components/Generic/FileExplorerSideNav.vue +0 -734
  85. package/src/components/Generic/Loaders/GridLoader.vue +0 -68
  86. package/src/components/Generic/NavigationDrawer.vue +0 -69
  87. package/src/components/Generic/PrintJobsMenu.vue +0 -148
  88. package/src/components/Generic/Snackbars/AppErrorSnackbar.vue +0 -64
  89. package/src/components/Generic/Snackbars/AppInfoSnackbar.vue +0 -63
  90. package/src/components/Generic/Snackbars/AppProgressSnackbar.vue +0 -158
  91. package/src/components/Generic/Vuetify/TooltipButton.vue +0 -47
  92. package/src/components/HelpOverlay/HelpOverlay.vue +0 -57
  93. package/src/components/Login/LoginForm.vue +0 -206
  94. package/src/components/Login/LoginView.spec.ts +0 -64
  95. package/src/components/Login/LoginView.vue +0 -65
  96. package/src/components/Login/Logo.vue +0 -13
  97. package/src/components/Login/PermissionDenied.vue +0 -109
  98. package/src/components/Login/RegistrationForm.vue +0 -207
  99. package/src/components/Login/RegistrationView.vue +0 -17
  100. package/src/components/Login/__snapshots__/LoginView.spec.ts.snap +0 -1051
  101. package/src/components/NotFound/NotFoundView.vue +0 -39
  102. package/src/components/PrintStatistics/PrintStatistics.vue +0 -168
  103. package/src/components/PrintStatistics/PrintStatisticsView.vue +0 -15
  104. package/src/components/PrinterGrid/HomeToolbar.vue +0 -90
  105. package/src/components/PrinterGrid/PrinterGrid.vue +0 -164
  106. package/src/components/PrinterGrid/PrinterGridTile.vue +0 -438
  107. package/src/components/PrinterGrid/PrinterGridView.vue +0 -210
  108. package/src/components/PrinterList/FileControlList.vue +0 -40
  109. package/src/components/PrinterList/PrinterDetails.vue +0 -91
  110. package/src/components/PrinterList/PrintersView.vue +0 -492
  111. package/src/components/Settings/AccountSettings.vue +0 -163
  112. package/src/components/Settings/DiagnosticsSettings.vue +0 -137
  113. package/src/components/Settings/EmergencyCommands.vue +0 -265
  114. package/src/components/Settings/FloorSettings.vue +0 -276
  115. package/src/components/Settings/GridSettings.vue +0 -127
  116. package/src/components/Settings/OctoPrintSettings.vue +0 -188
  117. package/src/components/Settings/ServerProtectionSettings.vue +0 -370
  118. package/src/components/Settings/SettingsView.vue +0 -73
  119. package/src/components/Settings/SoftwareUpgradeSettings.vue +0 -297
  120. package/src/components/Settings/UserManagementSettings.vue +0 -257
  121. package/src/components/TopBar.vue +0 -147
  122. package/src/components.d.ts +0 -70
  123. package/src/directives/file-upload.directive.ts +0 -117
  124. package/src/directives/printer-drop-position.directive.ts +0 -92
  125. package/src/env.d.ts +0 -6
  126. package/src/main.ts +0 -76
  127. package/src/models/batch/reprint.dto.ts +0 -79
  128. package/src/models/batch.model.ts +0 -11
  129. package/src/models/camera-streams/camera-stream.ts +0 -19
  130. package/src/models/floors/floor.model.ts +0 -30
  131. package/src/models/octoprint/connection-options.model.ts +0 -8
  132. package/src/models/plugins/firmware-updates/prusa-firmware-release.model.ts +0 -57
  133. package/src/models/print-completions/print-completions.model.ts +0 -49
  134. package/src/models/printers/crud/create-printer.model.ts +0 -26
  135. package/src/models/printers/file-upload-commands.model.ts +0 -4
  136. package/src/models/printers/gcode/gcode-analysis.model.ts +0 -30
  137. package/src/models/printers/printer-current-job.model.ts +0 -90
  138. package/src/models/printers/printer-file.model.ts +0 -48
  139. package/src/models/printers/printer.model.ts +0 -18
  140. package/src/models/server/client-releases.model.ts +0 -27
  141. package/src/models/server/export-yaml.model.ts +0 -11
  142. package/src/models/server/features.model.ts +0 -37
  143. package/src/models/server/github-rate-limit.model.ts +0 -21
  144. package/src/models/server/version.model.ts +0 -14
  145. package/src/models/settings/printer-file-clean-settings.model.ts +0 -5
  146. package/src/models/settings/server-settings.dto.ts +0 -19
  147. package/src/models/settings/settings.model.ts +0 -57
  148. package/src/models/socketio-messages/socketio-message.model.ts +0 -53
  149. package/src/models/uploads/queued-upload.model.ts +0 -12
  150. package/src/models/user.model.ts +0 -15
  151. package/src/plugins/README.md +0 -3
  152. package/src/plugins/index.ts +0 -17
  153. package/src/plugins/vuetify.ts +0 -53
  154. package/src/router/index.ts +0 -192
  155. package/src/router/route-names.ts +0 -14
  156. package/src/router/utils.ts +0 -23
  157. package/src/shared/alert.events.ts +0 -14
  158. package/src/shared/app.constants.ts +0 -23
  159. package/src/shared/auth.constants.ts +0 -34
  160. package/src/shared/dialog.composable.ts +0 -41
  161. package/src/shared/drag.constants.ts +0 -19
  162. package/src/shared/experimental.constants.ts +0 -1
  163. package/src/shared/http-client.ts +0 -162
  164. package/src/shared/noun-adjectives.data.ts +0 -24
  165. package/src/shared/printer-grid.constants.ts +0 -5
  166. package/src/shared/printer-state.constants.ts +0 -194
  167. package/src/shared/snackbar.composable.ts +0 -66
  168. package/src/shared/socketio.service.ts +0 -104
  169. package/src/store/auth.store.ts +0 -255
  170. package/src/store/connection.store.ts +0 -66
  171. package/src/store/dialog.store.ts +0 -114
  172. package/src/store/features.store.ts +0 -57
  173. package/src/store/floor.store.ts +0 -173
  174. package/src/store/grid.store.ts +0 -10
  175. package/src/store/index.ts +0 -4
  176. package/src/store/printer-state.store.ts +0 -246
  177. package/src/store/printer.store.ts +0 -236
  178. package/src/store/profile.store.ts +0 -25
  179. package/src/store/settings.store.ts +0 -64
  180. package/src/store/test-printer.store.ts +0 -70
  181. package/src/store/uploads.store.ts +0 -75
  182. package/src/styles/README.md +0 -3
  183. package/src/styles/settings.scss +0 -10
  184. package/src/types/global.d.ts +0 -15
  185. package/src/utils/array.utils.ts +0 -15
  186. package/src/utils/date.utils.ts +0 -5
  187. package/src/utils/download-file.util.ts +0 -25
  188. package/src/utils/error.utils.ts +0 -3
  189. package/src/utils/file-size.util.ts +0 -11
  190. package/src/utils/id.type.ts +0 -1
  191. package/src/utils/sentry.util.ts +0 -8
  192. package/src/utils/test.util.ts +0 -30
  193. package/src/utils/time.utils.ts +0 -2
  194. package/src/utils/uploads-state.utils.ts +0 -58
  195. package/src/utils/validation.utils.ts +0 -14
  196. package/src/vite-env.d.ts +0 -7
  197. package/test/setup-axios-mock.ts +0 -15
  198. /package/{src/assets/logo.png → dist/assets/logo-CJVdjy51.png} +0 -0
  199. /package/{src/assets → dist/img/icons}/android-chrome-192x192.png +0 -0
@@ -1,91 +0,0 @@
1
- import { BaseService } from '@/backend/base.service'
2
- import { ServerApi } from '@/backend/server.api'
3
- import { FileUploadCommands } from '@/models/printers/file-upload-commands.model'
4
- import {
5
- ClearedFilesResult,
6
- FileDto
7
- } from '@/models/printers/printer-file.model'
8
- import { PrinterDto } from '@/models/printers/printer.model'
9
- import { useSnackbar } from '@/shared/snackbar.composable'
10
- import { IdType } from '@/utils/id.type'
11
-
12
- export class PrinterFileService extends BaseService {
13
- static async getFiles(printerId: IdType, recursive = false) {
14
- const path = `${ServerApi.printerFilesRoute}/${printerId}/?recursive=${recursive}`
15
-
16
- return (await this.get(path)) as FileDto[]
17
- }
18
-
19
- /**
20
- * A nice alternative for offline or disabled printers
21
- * @param printerId
22
- */
23
- static async getFileCache(printerId: IdType) {
24
- const path = `${ServerApi.printerFilesCacheRoute(printerId)}`
25
-
26
- return (await this.get(path)) as FileDto[]
27
- }
28
-
29
- static async selectAndPrintFile(
30
- printerId: IdType,
31
- filePath: string,
32
- print = true
33
- ) {
34
- const path = ServerApi.printerFilesSelectAndPrintRoute(printerId)
35
- return await this.post(path, { filePath, print })
36
- }
37
-
38
- static async uploadFile(
39
- printer: PrinterDto,
40
- file: File,
41
- commands: FileUploadCommands = {
42
- select: true,
43
- print: true
44
- }
45
- ) {
46
- const path = ServerApi.printerFilesUploadRoute(printer.id)
47
-
48
- const formData = new FormData()
49
- if (commands.select) {
50
- formData.append('select', 'true')
51
- }
52
- if (commands.print) {
53
- formData.append('print', 'true')
54
- }
55
- formData.append('files[0]', file)
56
-
57
- return this.postUpload(path, formData, {
58
- onUploadProgress: (progress) => {
59
- const snackbar = useSnackbar()
60
- snackbar.openProgressMessage(
61
- 'single-file-upload',
62
- `Uploading file ${file.name}`,
63
- (100 * progress.loaded) / progress.total!,
64
- false
65
- )
66
- }
67
- })
68
- }
69
-
70
- static async clearFiles(printerId: IdType) {
71
- const path = `${ServerApi.printerFilesClearRoute(printerId)}`
72
-
73
- return this.delete<ClearedFilesResult>(path)
74
- }
75
-
76
- static async purgeFiles() {
77
- const path = `${ServerApi.printerFilesPurgeRoute}`
78
-
79
- return this.post(path)
80
- }
81
-
82
- static async deleteFileOrFolder(printerId: IdType, path: string) {
83
- const urlPath = `${ServerApi.printerFilesRoute}/${printerId}/?path=${path}`
84
-
85
- return this.delete(urlPath)
86
- }
87
-
88
- static downloadFile(file: FileDto) {
89
- window.location.href = file.refs.download
90
- }
91
- }
@@ -1,62 +0,0 @@
1
- import { BaseService } from '@/backend/base.service'
2
- import { ServerApi } from '@/backend/server.api'
3
- import { IdType } from '@/utils/id.type'
4
-
5
- export interface PrinterGroupDto<KeyType = number> {
6
- printerId: KeyType
7
- groupId: KeyType
8
- }
9
-
10
- export interface GroupDto<KeyType extends string | number = number> {
11
- id: KeyType
12
- name: string
13
- }
14
-
15
- export interface GroupWithPrintersDto<KeyType extends string | number = number>
16
- extends GroupDto<KeyType> {
17
- printers: PrinterGroupDto<KeyType>[]
18
- }
19
-
20
- export class PrinterGroupService extends BaseService {
21
- static async createGroup(name: string) {
22
- const path = `${ServerApi.createGroupRoute}`
23
- const body = {
24
- name
25
- }
26
- return (await this.post(path, body)) as void
27
- }
28
-
29
- static async deleteGroup(groupId: IdType) {
30
- const path = `${ServerApi.deleteGroupRoute(groupId)}`
31
- return (await this.delete(path)) as GroupWithPrintersDto<IdType>[]
32
- }
33
-
34
- static async getGroupsWithPrinters() {
35
- const path = `${ServerApi.printerGroupRoute}`
36
- return (await this.get(path)) as GroupWithPrintersDto<IdType>[]
37
- }
38
-
39
- static async addPrinterToGroup(groupId: IdType, printerId: IdType) {
40
- const path = `${ServerApi.addPrinterToGroupRoute(groupId)}`
41
- const body = {
42
- printerId
43
- }
44
- return (await this.post(path, body)) as GroupWithPrintersDto<IdType>[]
45
- }
46
-
47
- static async deletePrinterFromGroup(groupId: IdType, printerId: IdType) {
48
- const path = `${ServerApi.deletePrinterFromGroupRoute(groupId)}`
49
- const body = {
50
- printerId
51
- }
52
- return (await this.delete(path, body)) as GroupWithPrintersDto<IdType>[]
53
- }
54
-
55
- static async updateGroupName(groupId: IdType, name: string) {
56
- const path = `${ServerApi.updateGroupNameRoute(groupId)}`
57
- const body = {
58
- name
59
- }
60
- return (await this.patch(path, body)) as GroupWithPrintersDto<IdType>[]
61
- }
62
- }
@@ -1,20 +0,0 @@
1
- import { ServerApi } from '@/backend/server.api'
2
- import { BaseService } from '@/backend/base.service'
3
- import { IdType } from '@/utils/id.type'
4
-
5
- export class PrinterJobService extends BaseService {
6
- static async stopPrintJob(printerId: IdType) {
7
- const path = ServerApi.printerStopJobRoute(printerId)
8
- return await this.post(path)
9
- }
10
-
11
- static async pausePrintJob(printerId: IdType) {
12
- const path = ServerApi.printerPauseJobRoute(printerId)
13
- return await this.post(path)
14
- }
15
-
16
- static async resumePrintJob(printerId: IdType) {
17
- const path = ServerApi.printerResumeJobRoute(printerId)
18
- return await this.post(path)
19
- }
20
- }
@@ -1,28 +0,0 @@
1
- import { BaseService } from '@/backend/base.service'
2
- import { ServerApi } from '@/backend/server.api'
3
- import { IdType } from '@/utils/id.type'
4
-
5
- export class PrinterSettingsService extends BaseService {
6
- static async getSettings(printerId: IdType) {
7
- const path = `${ServerApi.getPrinterSettingsRoute(printerId)}`
8
-
9
- return await this.get(path)
10
- }
11
-
12
- /**
13
- * Enabled: true => idle, enabled: false => disabled
14
- * @param printerId
15
- * @param enabled
16
- */
17
- static async setGCodeAnalysis(printerId: IdType, enabled = false) {
18
- const path = `${ServerApi.setPrinterSettingsGCodeAnalysisRoute(printerId)}`
19
-
20
- return await this.post(path, { enabled })
21
- }
22
-
23
- static async syncPrinterName(printerId: IdType) {
24
- const path = `${ServerApi.syncPrinterNameSettingRoute(printerId)}`
25
-
26
- return await this.post(path)
27
- }
28
- }
@@ -1,136 +0,0 @@
1
- import { ServerApi } from '@/backend/server.api'
2
- import { BaseService } from '@/backend/base.service'
3
- import { LoginDetails, PrinterDto } from '@/models/printers/printer.model'
4
- import {
5
- CreatePrinter,
6
- getDefaultCreatePrinter,
7
- PreCreatePrinter
8
- } from '@/models/printers/crud/create-printer.model'
9
- import { newRandomNamePair } from '@/shared/noun-adjectives.data'
10
- import { IdType } from '@/utils/id.type'
11
-
12
- export class PrintersService extends BaseService {
13
- static applyLoginDetailsPatchForm(
14
- patch: { printerURL: string; apiKey: string; name: string },
15
- formData: PreCreatePrinter
16
- ) {
17
- formData.name = patch.name || newRandomNamePair()
18
- formData.apiKey = patch.apiKey
19
- }
20
-
21
- static convertPrinterToCreateForm(printer: CreatePrinter) {
22
- // Inverse transformation
23
- const newFormData = getDefaultCreatePrinter()
24
-
25
- newFormData.id = printer.id
26
- newFormData.printerURL = printer.printerURL
27
- newFormData.name = printer.name || newRandomNamePair()
28
- newFormData.apiKey = printer.apiKey
29
- newFormData.enabled = printer.enabled
30
- return newFormData
31
- }
32
-
33
- static openPrinterURL(printerURL: string) {
34
- if (!printerURL) return
35
-
36
- window.open(printerURL)
37
- }
38
-
39
- static async getPrinters() {
40
- const path = ServerApi.printerRoute
41
-
42
- return (await this.get<PrinterDto[]>(path)) as PrinterDto[]
43
- }
44
-
45
- static async getPrinterLoginDetails(printerId: IdType) {
46
- const path = ServerApi.getPrinterLoginDetailsRoute(printerId)
47
-
48
- return (await this.get<LoginDetails>(path)) as LoginDetails
49
- }
50
-
51
- static async restartOctoPrint(printerId: IdType) {
52
- const path = `${ServerApi.restartOctoPrintRoute(printerId)}`
53
- return (await this.post(path)) as any
54
- }
55
-
56
- static async refreshSocket(printerId: IdType) {
57
- const path = `${ServerApi.refreshSocketRoute(printerId)}`
58
- return (await this.post(path)) as any
59
- }
60
-
61
- static async sendPrinterConnectCommand(printerId: IdType) {
62
- const path = ServerApi.printerSerialConnectRoute(printerId)
63
-
64
- return await this.post(path)
65
- }
66
-
67
- static async sendPrinterDisconnectCommand(printerId: IdType) {
68
- const path = ServerApi.printerSerialDisconnectRoute(printerId)
69
-
70
- return await this.post(path)
71
- }
72
-
73
- static async sendPrinterJogCommand(
74
- printerId: IdType,
75
- amounts: { x?: number; y?: number; z?: number }
76
- ) {
77
- const path = ServerApi.printerJogCommandRoute(printerId)
78
-
79
- return await this.post(path, amounts)
80
- }
81
-
82
- static async sendPrinterHomeCommand(printerId: IdType, axes: string[]) {
83
- const path = ServerApi.printerHomeCommandRoute(printerId)
84
-
85
- return await this.post(path, axes)
86
- }
87
-
88
- static async createPrinter(printer: CreatePrinter, forceSave: boolean) {
89
- const path = `${ServerApi.printerRoute}?forceSave=${forceSave}`
90
-
91
- return (await this.post(path, printer)) as PrinterDto
92
- }
93
-
94
- static async batchImportPrinters(printers: CreatePrinter[]) {
95
- const path = ServerApi.printerBatchRoute
96
-
97
- return (await this.post(path, printers)) as PrinterDto[]
98
- }
99
-
100
- static async deletePrinter(printerId: IdType) {
101
- const path = ServerApi.getPrinterRoute(printerId)
102
-
103
- return await this.delete(path)
104
- }
105
-
106
- static async updatePrinter(
107
- printerId: IdType,
108
- printer: CreatePrinter,
109
- forceSave: boolean
110
- ) {
111
- const path = ServerApi.getPrinterRoute(printerId)
112
- const fullPath = `${path}?forceSave=${forceSave}`
113
- return (await this.patch(fullPath, printer)) as PrinterDto
114
- }
115
-
116
- static async updatePrinterMaintenance(
117
- printerId: IdType,
118
- disabledReason: string | null = null
119
- ) {
120
- const path = ServerApi.postPrinterDisabledReasonRoute(printerId)
121
-
122
- return (await this.patch(path, { disabledReason })) as PrinterDto
123
- }
124
-
125
- static async testConnection(printer: CreatePrinter) {
126
- const path = ServerApi.printerTestConnectionRoute
127
-
128
- return (await this.post(path, printer)) as PrinterDto
129
- }
130
-
131
- static async toggleEnabled(printerId: IdType, enabled: boolean) {
132
- const path = ServerApi.printerEnabledRoute(printerId)
133
-
134
- return await this.patch(path, { enabled })
135
- }
136
- }
@@ -1,55 +0,0 @@
1
- import { BaseService } from '@/backend/base.service'
2
- import { ServerApi } from '@/backend/server.api'
3
- import { ExportYamlModel } from '@/models/server/export-yaml.model'
4
- import { downloadFileByBlob } from '@/utils/download-file.util'
5
- import { getHttpClient } from '@/shared/http-client'
6
-
7
- export class ServerPrivateService extends BaseService {
8
- public static async restartServer() {
9
- const path = ServerApi.serverRestartCommandRoute
10
-
11
- return await this.post(path)
12
- }
13
-
14
- public static async downloadYamlExport(input: ExportYamlModel) {
15
- const client = await getHttpClient()
16
- const response = await client.request<any>({
17
- method: 'POST',
18
- url: 'api/server/export-printers-floors-yaml',
19
- data: input,
20
- responseType: 'arraybuffer'
21
- })
22
- downloadFileByBlob(
23
- response.data as ArrayBuffer,
24
- 'export-fdm-monster-' + Date.now() + '.yaml'
25
- )
26
- }
27
-
28
- public static async uploadAndImportYaml(file: File) {
29
- const formData = new FormData()
30
- formData.append('file', file)
31
- return await this.postUpload(
32
- 'api/server/import-printers-floors-yaml',
33
- formData,
34
- {}
35
- )
36
- }
37
-
38
- public static async downloadLogDump() {
39
- const client = await getHttpClient()
40
- const response = await client.request<any>({
41
- method: 'POST',
42
- url: `api/server/dump-fdm-monster-logs`,
43
- responseType: 'arraybuffer'
44
- })
45
- downloadFileByBlob(
46
- response.data as ArrayBuffer,
47
- 'logs-fdm-monster-' + Date.now() + '.zip'
48
- )
49
- }
50
-
51
- public static async clearLogFilesOlderThanWeek() {
52
- const path = `api/server/clear-outdated-fdm-monster-logs`
53
- return await this.delete(path)
54
- }
55
- }
@@ -1,132 +0,0 @@
1
- import { IdType } from '@/utils/id.type'
2
-
3
- export class ServerApi {
4
- static base = '/api'
5
-
6
- static firstTimeSetupRoute = `${ServerApi.base}/first-time-setup`
7
- static completeFirstTimeSetupRoute = `${ServerApi.firstTimeSetupRoute}/complete`
8
-
9
- static printerRoute = `${ServerApi.base}/printer`
10
- static printerBatchRoute = `${ServerApi.printerRoute}/batch`
11
- static printerTestConnectionRoute = `${ServerApi.printerRoute}/test-connection`
12
-
13
- static printerSettingsRoute = `${ServerApi.base}/printer-settings`
14
-
15
- static floorRoute = `${ServerApi.base}/floor`
16
-
17
- static batchRoute = `${ServerApi.base}/batch`
18
- static batchGetLastPrintedFilesRoute = `${ServerApi.batchRoute}/reprint/list`
19
- static batchReprintFilesRoute = `${ServerApi.batchRoute}/reprint/execute`
20
-
21
- static printCompletionRoute = `${ServerApi.base}/print-completion`
22
-
23
- static printerFilesRoute = `${ServerApi.base}/printer-files`
24
- static printerFilesPurgeRoute = `${ServerApi.printerFilesRoute}/purge`
25
-
26
- static printerGroupRoute = `${ServerApi.base}/printer-group`
27
- static createGroupRoute = `${ServerApi.base}/printer-group`
28
- static deleteGroupRoute = (id: IdType) =>
29
- `${ServerApi.base}/printer-group/${id}`
30
- static updateGroupNameRoute = (id: IdType) =>
31
- `${ServerApi.base}/printer-group/${id}/name`
32
- static addPrinterToGroupRoute = (id: IdType) =>
33
- `${ServerApi.base}/printer-group/${id}/printer`
34
- static deletePrinterFromGroupRoute = ServerApi.addPrinterToGroupRoute
35
-
36
- static customGCodeRoute = `${ServerApi.base}/custom-gcode`
37
-
38
- static userRoute = `${ServerApi.base}/user`
39
- static rolesRoute = `${ServerApi.base}/user/roles`
40
- static userProfileRoute = `${ServerApi.userRoute}/profile`
41
-
42
- static settingsRoute = `${ServerApi.base}/settings`
43
- static settingsSensitiveRoute = `${ServerApi.settingsRoute}/sensitive`
44
- static updateLoginRequiredRoute = `${ServerApi.settingsRoute}/login-required`
45
- static updateRegistrationEnabledRoute = `${ServerApi.settingsRoute}/registration-enabled`
46
- static updateCredentialSettings = `${ServerApi.settingsRoute}/credential`
47
- static serverSettingsRoute = `${ServerApi.settingsRoute}/server`
48
- static fileCleanSettingsRoute = `${ServerApi.settingsRoute}/file-clean`
49
- static updateFrontendSettingsRoute = `${ServerApi.settingsRoute}/frontend`
50
- static updateServerWhitelistSettingRoute = `${ServerApi.settingsRoute}/whitelist`
51
- static updateTimeoutSettingRoute = `${ServerApi.settingsRoute}/timeout`
52
- static serverSentryDiagnosticsSettingRoute = `${ServerApi.settingsRoute}/sentry-diagnostics`
53
- static updateExperimentalMoonrakerSupportRoute = `${ServerApi.settingsRoute}/experimental-moonraker-support`
54
-
55
- static serverPrivateRoute = `${ServerApi.base}/server`
56
- static serverRestartCommandRoute = `${ServerApi.serverPrivateRoute}/restart`
57
-
58
- static pluginRoute = `${ServerApi.base}/plugin`
59
- static pluginFirmwareUpdateRoute = `${ServerApi.pluginRoute}/firmware-update`
60
- static pluginFirmwareReleasesRoute = `${ServerApi.pluginFirmwareUpdateRoute}/releases`
61
-
62
- static getPrinterRoute = (id: IdType) => `${ServerApi.printerRoute}/${id}`
63
- static postPrinterDisabledReasonRoute = (id: IdType) =>
64
- `${ServerApi.printerRoute}/${id}/disabled-reason`
65
- static getPrinterLoginDetailsRoute = (id: IdType) =>
66
- `${ServerApi.getPrinterRoute(id)}/login-details`
67
- static restartOctoPrintRoute = (id: IdType) =>
68
- `${ServerApi.getPrinterRoute(id)}/restart-octoprint`
69
-
70
- static refreshSocketRoute = (id: IdType) =>
71
- `${ServerApi.getPrinterRoute(id)}/refresh-socket`
72
- static getPrinterSettingsRoute = (id: IdType) =>
73
- `${ServerApi.printerSettingsRoute}/${id}`
74
- static setPrinterSettingsGCodeAnalysisRoute = (id: IdType) =>
75
- `${ServerApi.getPrinterSettingsRoute(id)}/gcode-analysis`
76
- static syncPrinterNameSettingRoute = (id: IdType) =>
77
- `${ServerApi.getPrinterSettingsRoute(id)}/sync-printername`
78
- static getFloorRoute = (id: IdType) => `${ServerApi.floorRoute}/${id}`
79
- static setSelectedFloorRoute = (floorId: IdType) =>
80
- `${ServerApi.floorRoute}/selected-floor/${floorId}`
81
- static addOrRemovePrinterFromFloorRoute = (id: IdType) =>
82
- `${ServerApi.getFloorRoute(id)}/printer`
83
- static sendQuickStopM112Route = (id: IdType) =>
84
- `${ServerApi.customGCodeRoute}/send-emergency-m112/${id}`
85
- static installFirmwareUpdatePluginRoute = (id: IdType) =>
86
- `${ServerApi.pluginFirmwareUpdateRoute}/${id}/install-firmware-update-plugin`
87
- static configurePluginSettingsRoute = (id: IdType) =>
88
- `${ServerApi.pluginFirmwareUpdateRoute}/${id}/configure-plugin-settings`
89
- static flashFirmwareRoute = (id: IdType) =>
90
- `${ServerApi.pluginFirmwareUpdateRoute}/${id}/flash-firmware`
91
- static updatePrinterFloorNameRoute = (id: IdType) =>
92
- `${ServerApi.getFloorRoute(id)}/name`
93
- static updatePrinterFloorNumberRoute = (id: IdType) =>
94
- `${ServerApi.getFloorRoute(id)}/floor-number`
95
- static printerFilesClearRoute = (id: IdType) =>
96
- `${ServerApi.printerFilesRoute}/${id}/clear`
97
- static printerFilesSelectAndPrintRoute = (id: IdType) =>
98
- `${ServerApi.printerFilesRoute}/${id}/select`
99
- static printerFilesUploadRoute = (id: IdType) =>
100
- `${ServerApi.printerFilesRoute}/${id}/upload`
101
- static printerFilesCacheRoute = (id: IdType) =>
102
- `${ServerApi.printerFilesRoute}/${id}/cache`
103
- static printerEnabledRoute = (id: IdType) =>
104
- `${ServerApi.getPrinterRoute(id)}/enabled`
105
- static printerSerialConnectRoute = (id: IdType) =>
106
- `${ServerApi.getPrinterRoute(id)}/serial-connect`
107
- static printerJogCommandRoute = (id: IdType) =>
108
- `${ServerApi.getPrinterRoute(id)}/jog`
109
- static printerHomeCommandRoute = (id: IdType) =>
110
- `${ServerApi.getPrinterRoute(id)}/home`
111
- static printerSerialDisconnectRoute = (id: IdType) =>
112
- `${ServerApi.getPrinterRoute(id)}/serial-disconnect`
113
-
114
- static printerJobRoute = (id: IdType) =>
115
- `${ServerApi.getPrinterRoute(id)}/job`
116
- static printerStopJobRoute = (id: IdType) =>
117
- `${ServerApi.printerJobRoute(id)}/stop`
118
- static printerPauseJobRoute = (id: IdType) =>
119
- `${ServerApi.printerJobRoute(id)}/pause`
120
- static printerResumeJobRoute = (id: IdType) =>
121
- `${ServerApi.printerJobRoute(id)}/resume`
122
-
123
- static userChangeUsernameRoute = (id: IdType) =>
124
- `${ServerApi.userRoute}/${id}/change-username`
125
- static userChangePasswordRoute = (id: IdType) =>
126
- `${ServerApi.userRoute}/${id}/change-password`
127
- static userDeleteRoute = (id: IdType) => `${ServerApi.userRoute}/${id}`
128
- static userSetVerifiedRoute = (id: IdType) =>
129
- `${ServerApi.userRoute}/${id}/set-verified`
130
- static userSetRootUserRoute = (id: IdType) =>
131
- `${ServerApi.userRoute}/${id}/set-root-user`
132
- }
@@ -1,85 +0,0 @@
1
- import { ServerApi } from '@/backend/server.api'
2
- import { BaseService } from '@/backend/base.service'
3
- import {
4
- FrontendSettings,
5
- SettingsDto,
6
- TimeoutSettings,
7
- SettingsSensitiveDto
8
- } from '@/models/settings/settings.model'
9
- import { FileCleanSettings } from '@/models/settings/printer-file-clean-settings.model'
10
- import { WhitelistSettings } from '@/models/settings/server-settings.dto'
11
-
12
- export class SettingsService extends BaseService {
13
- static async getSettings() {
14
- const path = ServerApi.settingsRoute
15
- return (await this.get(path)) as SettingsDto
16
- }
17
-
18
- static async getSettingsSensitive() {
19
- const path = ServerApi.settingsSensitiveRoute
20
- return (await this.get(path)) as SettingsSensitiveDto
21
- }
22
-
23
- static async updateLoginRequiredSettings(loginRequired: boolean) {
24
- const path = `${ServerApi.updateLoginRequiredRoute}`
25
-
26
- return (await this.put(path, { loginRequired })) as SettingsDto
27
- }
28
-
29
- static async updateRegistrationEnabledSettings(registrationEnabled: boolean) {
30
- const path = `${ServerApi.updateRegistrationEnabledRoute}`
31
-
32
- return (await this.put(path, { registrationEnabled })) as SettingsDto
33
- }
34
-
35
- static async updateCredentialSettings(
36
- jwtExpiresIn: number,
37
- refreshTokenAttempts: number,
38
- refreshTokenExpiry: number
39
- ) {
40
- const path = `${ServerApi.updateCredentialSettings}`
41
-
42
- return await this.put(path, {
43
- jwtExpiresIn,
44
- refreshTokenAttempts,
45
- refreshTokenExpiry
46
- })
47
- }
48
-
49
- static async updateFrontendSettings(frontendSettings: FrontendSettings) {
50
- const path = `${ServerApi.updateFrontendSettingsRoute}`
51
-
52
- return (await this.put(
53
- path,
54
- frontendSettings as FrontendSettings
55
- )) as SettingsDto
56
- }
57
-
58
- static async setSentryDiagnosticsSettings(enabled: boolean) {
59
- const path = `${ServerApi.serverSentryDiagnosticsSettingRoute}`
60
- return await this.patch(path, { enabled })
61
- }
62
-
63
- static async setWhitelistSettings(subSettings: WhitelistSettings) {
64
- const path = `${ServerApi.updateServerWhitelistSettingRoute}`
65
-
66
- await this.put(path, subSettings as WhitelistSettings)
67
- }
68
-
69
- static async updateTimeoutSettings(subSettings: TimeoutSettings) {
70
- const path = `${ServerApi.updateTimeoutSettingRoute}`
71
-
72
- return (await this.put(path, subSettings as TimeoutSettings)) as SettingsDto
73
- }
74
-
75
- static async setFileCleanSettings(subSettings: FileCleanSettings) {
76
- const path = `${ServerApi.fileCleanSettingsRoute}`
77
-
78
- return (await this.put(path, subSettings)) as SettingsDto
79
- }
80
-
81
- static async updateExperimentalMoonrakerSupport(enabled: boolean) {
82
- const path = ServerApi.updateExperimentalMoonrakerSupportRoute
83
- return (await this.put(path, { enabled })) as SettingsDto // Assuming it returns SettingsDto
84
- }
85
- }
@@ -1,51 +0,0 @@
1
- import { ServerApi } from '@/backend/server.api'
2
- import { BaseService } from '@/backend/base.service'
3
- import { Role, User } from '@/models/user.model'
4
-
5
- export class UserService extends BaseService {
6
- static async listUsers() {
7
- const path = ServerApi.userRoute
8
-
9
- return await this.get<User[]>(path)
10
- }
11
-
12
- static async listRoles() {
13
- const path = ServerApi.rolesRoute
14
-
15
- return await this.get<Role[]>(path)
16
- }
17
-
18
- static async getProfile() {
19
- const path = ServerApi.userProfileRoute
20
- return await this.get<User>(path)
21
- }
22
-
23
- static async changePassword(
24
- id: string,
25
- oldPassword: string,
26
- newPassword: string
27
- ) {
28
- const path = ServerApi.userChangePasswordRoute(id)
29
- return await this.post(path, { oldPassword, newPassword })
30
- }
31
-
32
- static async changeUsername(id: string, username: string) {
33
- const path = ServerApi.userChangeUsernameRoute(id)
34
- return await this.post(path, { username })
35
- }
36
-
37
- static async deleteUser(id: string) {
38
- const path = ServerApi.userDeleteRoute(id)
39
- return await this.delete(path)
40
- }
41
-
42
- static async setUserVerified(id: string, isVerified: boolean) {
43
- const path = ServerApi.userSetVerifiedRoute(id)
44
- return await this.post(path, { isVerified })
45
- }
46
-
47
- static async setRootUser(id: string, isRootUser: boolean) {
48
- const path = ServerApi.userSetRootUserRoute(id)
49
- return await this.post(path, { isRootUser })
50
- }
51
- }