Skip to content

Commit

Permalink
Merge pull request #1052 from nscuro/backport-pr-1039
Browse files Browse the repository at this point in the history
Backport: Fix: "Add Version" Create Button Should Be Inactive Until Version Provided
  • Loading branch information
nscuro authored Oct 9, 2024
2 parents cc5ca36 + ddc9fe8 commit 74fc944
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions src/views/portfolio/projects/ProjectAddVersionModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
label-for="input-1"
label-class="required"
>
<b-form-input id="input-1" v-model="version" class="required" trim />
<b-form-input
id="input-1"
v-model="version"
class="required"
trim
required
/>
</b-form-group>
</b-col>
<b-col cols="auto">
Expand Down Expand Up @@ -108,9 +114,13 @@
<b-button size="md" variant="secondary" @click="cancel()">{{
$t('message.cancel')
}}</b-button>
<b-button size="md" variant="primary" @click="createVersion()">{{
$t('message.create')
}}</b-button>
<b-button
size="md"
variant="primary"
:disabled="isSubmitButtonDisabled"
@click="createVersion()"
>{{ $t('message.create') }}</b-button
>
</template>
</b-modal>
</template>
Expand All @@ -137,6 +147,20 @@ export default {
makeCloneLatest: false,
};
},
computed: {
isSubmitButtonDisabled() {
const versionInputValue = this.version;
if (versionInputValue) {
/**
* * ideally we would apply the check with the input value trimmed, however, since we are already using 'trim' prop on the input value.
* * trimming the value here is not required.
*/
return versionInputValue.length === 0;
}
return true;
},
},
methods: {
createVersion: function () {
let url = `${this.$api.BASE_URL}/${this.$api.URL_PROJECT}/clone`;
Expand Down

0 comments on commit 74fc944

Please sign in to comment.