Skip to content

Commit

Permalink
fix: disabled in progress and size error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrund14 committed Jan 26, 2021
1 parent e9e4d1f commit 34724e5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
21 changes: 14 additions & 7 deletions src/public/components/EditReserveCategoryModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
]"
@click="saveCategory"
>
{{ `${mode === 'add' ? 'Add' : 'Edit'}` }}
{{ `${mode === 'add' ? 'Add' : 'Save'}` }}
</button>
</div>
</div>
Expand Down Expand Up @@ -181,13 +181,20 @@ export default {
},
computed: {
availableSupply() {
const defaultCategory = this.$store.state.currentConfig.reserveCategories.find(
(cat) => !!cat.isDefault
const totalAllocation = this.$store.state.currentConfig.reserveCategories.reduce(
(total, cat) => {
// we are allowed to take units from the default category
if (!cat.isDefault) {
return total + parseInt(cat.size)
}
return total
},
0
)
return (
parseInt(this.initialSize) +
parseInt(this.$store.state.currentConfig.supply - totalAllocation)
)
if (defaultCategory) {
return parseInt(this.initialSize) + parseInt(defaultCategory.size)
}
return this.$store.state.currentConfig.supply
},
CATEGORY_TYPE() {
return CATEGORY_TYPE
Expand Down
20 changes: 16 additions & 4 deletions src/public/pages/reserve-instances.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@
<button @click="() => viewConfig(instance)">
View Configuration
</button>
<div class="exportResultsButtonWrapper">
<div
:class="[
'exportResultsButtonWrapper',
{ isDisabled: instance.status !== 'FINISHED' },
]"
>
<button class="exportResultsBtn">Export Results ▼</button>
<span class="resultsOptions">
<button @click="() => exportAll(instance)">
Expand Down Expand Up @@ -548,9 +553,16 @@ export default {
}
.exportResultsButtonWrapper {
position: relative;
&:hover {
& > .resultsOptions {
display: block;
&.isDisabled {
& > .exportResultsBtn {
cursor: not-allowed;
}
}
&:not(.isDisabled) {
&:hover {
& > .resultsOptions {
display: block;
}
}
}
}
Expand Down

0 comments on commit 34724e5

Please sign in to comment.