Skip to content

Commit 71134ec

Browse files
authored
M #-: Make global default cluster id (#3941)
Signed-off-by: Victor Hansson <vhansson@opennebula.io>
1 parent 9b99da2 commit 71134ec

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/fireedge/src/modules/components/Tabs/Quota/Components/QuotaControls.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and *
1414
* limitations under the License. *
1515
* ------------------------------------------------------------------------- */
16-
import { memo, useMemo, useEffect, useState, useCallback } from 'react'
16+
import { memo, useMemo, useEffect, useState, useCallback, useRef } from 'react'
1717
import PropTypes from 'prop-types'
1818
import {
1919
Autocomplete,
@@ -95,6 +95,8 @@ export const QuotaControls = memo(
9595
const { data: { QUOTA_VM_ATTRIBUTE: genericQuotas = [] } = {} } =
9696
SystemAPI.useGetOneConfigQuery()
9797

98+
const initialized = useRef(false)
99+
98100
const formatGenericQuotas = (
99101
Array.isArray(genericQuotas) ? genericQuotas : [genericQuotas]
100102
)?.reduce((acc, quota) => {
@@ -156,7 +158,9 @@ export const QuotaControls = memo(
156158

157159
useEffect(() => {
158160
actions.setQuotaType(selectedType)
159-
actions.setGlobalIds([])
161+
actions.setGlobalIds(
162+
selectedType === 'VM' && !initialized.current ? ['@Global'] : []
163+
)
160164
actions.setGlobalValue('')
161165
actions.setMarkForDeletion([])
162166
}, [selectedType])

0 commit comments

Comments
 (0)