Skip to content

Commit

Permalink
chore: disable values from until select data source (#5009)
Browse files Browse the repository at this point in the history
Signed-off-by: yuda <[email protected]>
  • Loading branch information
yuda110 authored Nov 6, 2024
1 parent 997b4bf commit 5cb08f2
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const state = reactive({
const _resourceType = state.selectedSourceFrom === 'asset' ? MetricDataVariableModel.meta.resourceType : CostVariableModel.meta.resourceType;
return {
method: 'dynamic',
type: 'reference',
reference: {
resourceType: _resourceType,
dataSourceId: state.selectedCostDataSourceId || state.selectedMetricId,
Expand All @@ -85,6 +86,7 @@ const state = reactive({
}
return {
method: 'dynamic',
type: 'reference',
reference: {
resourceType: state.selectedSourceFrom,
},
Expand All @@ -108,6 +110,12 @@ const state = reactive({
selectedSourceFrom: 'asset' as string|undefined,
selectedValuesFrom: undefined as string|undefined,
selectedSelectionType: 'single' as SelectionType,
disableValuesFrom: computed<boolean>(() => {
if (!state.selectedSourceFrom) return true;
if (state.selectedSourceFrom === 'asset' && !state.selectedMetricId) return true;
if (state.selectedSourceFrom === 'cost' && !state.selectedCostDataSourceId) return true;
return false;
}),
/* Asset */
// category
categoryMenuItems: computed<MenuItem[]>(() => {
Expand Down Expand Up @@ -357,6 +365,7 @@ watch(() => props.originalData, (originalData) => {
>
<p-select-dropdown :selected="state.selectedValuesFrom"
:menu="state.valuesFromMenuItems"
:disabled="state.disableValuesFrom"
use-fixed-menu-style
class="w-1/2"
@select="handleChangeValuesFrom"
Expand Down

0 comments on commit 5cb08f2

Please sign in to comment.