bfg-common 1.0.8 → 1.0.9

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.
@@ -327,8 +327,8 @@ const onChangeNameAndNext = (name: string, node: UI_I_TreeNode): void => {
327
327
  'id',
328
328
  'parent'
329
329
  )
330
- vmForm.value.dataCenter = node
331
- vmFormCash.value.dataCenterId = node?.id || null
330
+ vmForm.value.dataCenter = $recursion.findParentByValue(node, 'datacenter', 'type', 'parent')
331
+ vmFormCash.value.dataCenterId = vmForm.value.dataCenter?.id || null
332
332
  onNext(true)
333
333
  }
334
334
  // Для сферы
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.0.8",
4
+ "version": "1.0.9",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -204,6 +204,21 @@ export default defineNuxtPlugin(() => {
204
204
  return (parentPath ? `${parentPath}/` : '') + node[valueProp]
205
205
  }
206
206
 
207
+ self.findParentByValue = (
208
+ node: any,
209
+ value: any,
210
+ valueProp: string,
211
+ parentProp: string
212
+ ): any | null => {
213
+ if (!node) return null
214
+
215
+ if (node[valueProp] === value) return node
216
+ const parent = node[parentProp]
217
+ if (parent) return self.findParentByValue(parent, value, valueProp, parentProp)
218
+
219
+ return null
220
+ }
221
+
207
222
  return self
208
223
  }.call({})
209
224