BigW Consortium Gitlab

removed unused computed prop

remove object.assign instead directly assign to state created new constants
parent 58c27033
...@@ -10,7 +10,6 @@ export default { ...@@ -10,7 +10,6 @@ export default {
}, },
computed: { computed: {
...mapState(['currentBranchId', 'changedFiles', 'stagedFiles']), ...mapState(['currentBranchId', 'changedFiles', 'stagedFiles']),
...mapGetters(['hasChanges']),
commitToCurrentBranchText() { commitToCurrentBranchText() {
return sprintf( return sprintf(
__('Commit to %{branchName} branch'), __('Commit to %{branchName} branch'),
...@@ -18,6 +17,9 @@ export default { ...@@ -18,6 +17,9 @@ export default {
false, false,
); );
}, },
disableMergeRequestRadio() {
return this.changedFiles.length > 0 && this.stagedFiles.length > 0;
},
}, },
commitToCurrentBranch: consts.COMMIT_TO_CURRENT_BRANCH, commitToCurrentBranch: consts.COMMIT_TO_CURRENT_BRANCH,
commitToNewBranch: consts.COMMIT_TO_NEW_BRANCH, commitToNewBranch: consts.COMMIT_TO_NEW_BRANCH,
...@@ -45,7 +47,7 @@ export default { ...@@ -45,7 +47,7 @@ export default {
:value="$options.commitToNewBranchMR" :value="$options.commitToNewBranchMR"
:label="__('Create a new branch and merge request')" :label="__('Create a new branch and merge request')"
:show-input="true" :show-input="true"
:disabled="!!changedFiles.length && !!stagedFiles.length" :disabled="disableMergeRequestRadio"
/> />
</div> </div>
</template> </template>
...@@ -4,7 +4,7 @@ import { sprintf, __ } from '~/locale'; ...@@ -4,7 +4,7 @@ import { sprintf, __ } from '~/locale';
import LoadingButton from '~/vue_shared/components/loading_button.vue'; import LoadingButton from '~/vue_shared/components/loading_button.vue';
import CommitMessageField from './message_field.vue'; import CommitMessageField from './message_field.vue';
import Actions from './actions.vue'; import Actions from './actions.vue';
import { activityBarViews } from '../../constants'; import { activityBarViews, MAX_WINDOW_HEIGHT_COMPACT, COMMIT_ITEM_PADDING } from '../../constants';
export default { export default {
components: { components: {
...@@ -38,7 +38,8 @@ export default { ...@@ -38,7 +38,8 @@ export default {
watch: { watch: {
currentActivityView() { currentActivityView() {
this.isCompact = !( this.isCompact = !(
this.currentActivityView === activityBarViews.commit && window.innerHeight >= 750 this.currentActivityView === activityBarViews.commit &&
window.innerHeight >= MAX_WINDOW_HEIGHT_COMPACT
); );
}, },
}, },
...@@ -59,7 +60,7 @@ export default { ...@@ -59,7 +60,7 @@ export default {
? this.$refs.formEl && this.$refs.formEl.offsetHeight ? this.$refs.formEl && this.$refs.formEl.offsetHeight
: this.$refs.compactEl && this.$refs.compactEl.offsetHeight; : this.$refs.compactEl && this.$refs.compactEl.offsetHeight;
this.componentHeight = elHeight + 32; this.componentHeight = elHeight + COMMIT_ITEM_PADDING;
}, },
enterTransition() { enterTransition() {
this.$nextTick(() => { this.$nextTick(() => {
...@@ -67,7 +68,7 @@ export default { ...@@ -67,7 +68,7 @@ export default {
? this.$refs.compactEl && this.$refs.compactEl.offsetHeight ? this.$refs.compactEl && this.$refs.compactEl.offsetHeight
: this.$refs.formEl && this.$refs.formEl.offsetHeight; : this.$refs.formEl && this.$refs.formEl.offsetHeight;
this.componentHeight = elHeight + 32; this.componentHeight = elHeight + COMMIT_ITEM_PADDING;
}); });
}, },
afterEndTransition() { afterEndTransition() {
......
...@@ -3,6 +3,10 @@ export const MAX_FILE_FINDER_RESULTS = 40; ...@@ -3,6 +3,10 @@ export const MAX_FILE_FINDER_RESULTS = 40;
export const FILE_FINDER_ROW_HEIGHT = 55; export const FILE_FINDER_ROW_HEIGHT = 55;
export const FILE_FINDER_EMPTY_ROW_HEIGHT = 33; export const FILE_FINDER_EMPTY_ROW_HEIGHT = 33;
export const MAX_WINDOW_HEIGHT_COMPACT = 750;
export const COMMIT_ITEM_PADDING = 32;
// Commit message textarea // Commit message textarea
export const MAX_TITLE_LENGTH = 50; export const MAX_TITLE_LENGTH = 50;
export const MAX_BODY_LENGTH = 72; export const MAX_BODY_LENGTH = 72;
......
/* eslint-disable no-param-reassign */
import * as types from '../mutation_types'; import * as types from '../mutation_types';
export default { export default {
...@@ -169,26 +170,18 @@ export default { ...@@ -169,26 +170,18 @@ export default {
}); });
}, },
[types.ADD_PENDING_TAB](state, { file, keyPrefix = 'pending' }) { [types.ADD_PENDING_TAB](state, { file, keyPrefix = 'pending' }) {
const key = `${keyPrefix}-${file.key}`; state.entries[file.path].opened = false;
state.entries[file.path].active = false;
Object.assign(state, { state.entries[file.path].lastOpenedAt = new Date().getTime();
entries: Object.assign(state.entries, { state.openFiles = [
[file.path]: Object.assign(state.entries[file.path], {
opened: false,
active: false,
lastOpenedAt: new Date().getTime(),
}),
}),
openFiles: [
{ {
...file, ...file,
key, key: `${keyPrefix}-${file.key}`,
pending: true, pending: true,
opened: true, opened: true,
active: true, active: true,
}, },
], ];
});
}, },
[types.REMOVE_PENDING_TAB](state, file) { [types.REMOVE_PENDING_TAB](state, file) {
Object.assign(state, { Object.assign(state, {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment