Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: "Add Version" Create Button Should Be Inactive Until Version Provided #1039

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading