bfg-common 1.4.414 → 1.4.415

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.
@@ -87,6 +87,7 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
87
87
  import type { UI_I_FeedbackForm } from '~/components/common/feedback/lib/models/interfaces'
88
88
  import type { UI_T_FeedbackTab } from '~/components/common/layout/theHeader/feedback/new/tabs/lib/models/types'
89
89
  import type { UI_I_FeedbackCanvasOptions } from '~/components/common/layout/theHeader/feedback/new/lib/models/interfaces'
90
+ import { UI_E_FeedbackType } from '~/components/common/layout/theHeader/feedback/new/tabs/lib/models/enums'
90
91
 
91
92
  const feedbackForm = defineModel<UI_I_FeedbackForm>({ required: true })
92
93
  const emits = defineEmits<{
@@ -132,6 +133,11 @@ const onHideModal = (): void => {
132
133
  : (options.value.isAnnotateImage = false)
133
134
  }
134
135
  const onSubmit = (): void => {
136
+ if (options.value.isAnnotateImage) {
137
+ options.value.isAnnotateImage = false
138
+ return
139
+ }
140
+
135
141
  if (selectedTab.value === 'light-bulb') {
136
142
  const targetUrl = 'https://customer.aobfg.ru/' // Ваш URL
137
143
  window.open(targetUrl, '_blank')
@@ -141,6 +147,17 @@ const onSubmit = (): void => {
141
147
  isValidForm.value = !!feedbackForm.value.description
142
148
 
143
149
  if (!isValidForm.value) return
150
+ const canvasData = (
151
+ document.getElementById('feedbackImg') as HTMLCanvasElement
152
+ ).toDataURL()
153
+ const canvasBlankData = (
154
+ document.getElementById('feedbackImgBlank') as HTMLCanvasElement
155
+ ).toDataURL()
156
+
157
+ const image = canvasData.match(/base64,(.+)/)?.[1] || ''
158
+ feedbackForm.value.image = canvasData === canvasBlankData ? '' : image
159
+ feedbackForm.value.type = UI_E_FeedbackType[selectedTab.value]
160
+
144
161
  emits('submit')
145
162
  }
146
163
  </script>
@@ -208,8 +208,7 @@ const memoryParentModalDialog = ref<string>('')
208
208
  const memoryParentMain = ref<string>('')
209
209
 
210
210
  const drawingArray: any = []
211
- // const indexArray = 0 // index of feedbackImg itself
212
- const indexArray = ref<number>(0) // index of feedbackImg itself
211
+ let indexArray = 0 // index of feedbackImg itself
213
212
  let isDrawing = false
214
213
  let startDrawingX: number | null = null
215
214
  let startDrawingY: number | null = null
@@ -248,7 +247,7 @@ const onTakeScreenshot = (): void => {
248
247
  feedbackImg.value.height
249
248
  )
250
249
  drawingArray.length = 0
251
- indexArray.value = 0
250
+ indexArray = 0
252
251
  drawingArray.push(
253
252
  context.getImageData(
254
253
  0,
@@ -277,7 +276,7 @@ const onUploadFile = (): void => {
277
276
  feedbackImg.value.height = img.height
278
277
  context.drawImage(img, 0, 0, img.width, img.height)
279
278
  drawingArray.length = 0
280
- indexArray.value = 0
279
+ indexArray = 0
281
280
  drawingArray.push(
282
281
  context.getImageData(
283
282
  0,
@@ -358,7 +357,7 @@ const stop = (event: MouseEvent): void => {
358
357
  feedbackImg.value.height
359
358
  )
360
359
  )
361
- indexArray.value += 1
360
+ indexArray += 1
362
361
  }
363
362
  }
364
363
  const onRemoveScreenshot = (): void => {
@@ -387,11 +386,11 @@ const clearAll = (): void => {
387
386
  const context = feedbackImg.value.getContext('2d')
388
387
  // drawColor = ''
389
388
  // drawWidth = ''
390
- if (indexArray.value <= 0) return
391
- while (indexArray.value > 0) {
389
+ if (indexArray <= 0) return
390
+ while (indexArray > 0) {
392
391
  drawingArray.pop()
393
- indexArray.value -= 1
394
- context.putImageData(drawingArray[indexArray.value], 0, 0)
392
+ indexArray -= 1
393
+ context.putImageData(drawingArray[indexArray], 0, 0)
395
394
  }
396
395
  }
397
396
 
@@ -408,10 +407,10 @@ const onUndoLast = (): void => {
408
407
  drawColor = ''
409
408
  drawWidth = ''
410
409
  const context = feedbackImg.value.getContext('2d')
411
- if (indexArray.value > 0) {
412
- indexArray.value -= 1
410
+ if (indexArray > 0) {
411
+ indexArray -= 1
413
412
  drawingArray.pop()
414
- context.putImageData(drawingArray[indexArray.value], 0, 0)
413
+ context.putImageData(drawingArray[indexArray], 0, 0)
415
414
  }
416
415
  }
417
416
 
@@ -0,0 +1,6 @@
1
+ export enum UI_E_FeedbackType {
2
+ 'warning-outline',
3
+ 'heart-outline',
4
+ WARNING,
5
+ 'light-bulb',
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.414",
4
+ "version": "1.4.415",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -1,17 +0,0 @@
1
- import type {
2
- T_MetricTab
3
- } from '~/components/common/pages/integration/zabbix/content/hosts/details/metrics/lib/models/types'
4
-
5
- export interface I_Metric {
6
- iconName: T_MetricTab
7
- label: string
8
- isSelected: boolean
9
- on: {
10
- label: string
11
- color: '#239332' | '#BDC3C7'
12
- }
13
- off: {
14
- label: string
15
- color: '#EA3223' | '#BDC3C7'
16
- }
17
- }