Commit efed5aed authored by Phil Hughes's avatar Phil Hughes

removed unused computed prop

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