Skip to content
Snippets Groups Projects
Commit bb55e33f authored by Felipe Artur's avatar Felipe Artur
Browse files

Merge master into 26723-discussion-filters

parents bf801406 d87e88a6
No related branches found
No related tags found
No related merge requests found
Showing
with 101 additions and 132 deletions
Loading
Loading
@@ -92,7 +92,7 @@ export default {
v-model="search"
:placeholder="__('Filter...')"
type="search"
class="dropdown-input-field"
class="dropdown-input-field qa-dropdown-filter-input"
/>
<i
aria-hidden="true"
Loading
Loading
Loading
Loading
@@ -24,13 +24,7 @@ export default {
IdeProjectHeader,
},
computed: {
...mapState([
'loading',
'currentActivityView',
'changedFiles',
'stagedFiles',
'lastCommitMsg',
]),
...mapState(['loading', 'currentActivityView', 'changedFiles', 'stagedFiles', 'lastCommitMsg']),
...mapGetters(['currentProject', 'someUncommitedChanges']),
showSuccessMessage() {
return (
Loading
Loading
Loading
Loading
@@ -45,7 +45,7 @@ export default {
<new-entry-button
:label="__('New file')"
:show-label="false"
class="d-flex border-0 p-0 mr-3"
class="d-flex border-0 p-0 mr-3 qa-new-file"
icon="doc-new"
@click="openNewEntryModal({ type: 'blob' })"
/>
Loading
Loading
Loading
Loading
@@ -43,7 +43,7 @@ export default {
 
<template>
<div
class="ide-file-list"
class="ide-file-list qa-file-list"
>
<template v-if="showLoading">
<div
Loading
Loading
Loading
Loading
@@ -37,14 +37,10 @@ export default {
return this.hasSearchFocus && !this.search && !this.currentSearchType;
},
type() {
return this.currentSearchType
? this.currentSearchType.type
: '';
return this.currentSearchType ? this.currentSearchType.type : '';
},
searchTokens() {
return this.currentSearchType
? [this.currentSearchType]
: [];
return this.currentSearchType ? [this.currentSearchType] : [];
},
},
watch: {
Loading
Loading
Loading
Loading
@@ -13,9 +13,7 @@ export default {
computed: {
...mapState(['currentBranchId', 'currentMergeRequestId']),
mergeRequestLabel() {
return this.currentMergeRequestId
? `!${this.currentMergeRequestId}`
: EMPTY_LABEL;
return this.currentMergeRequestId ? `!${this.currentMergeRequestId}` : EMPTY_LABEL;
},
branchLabel() {
return this.currentBranchId || EMPTY_LABEL;
Loading
Loading
Loading
Loading
@@ -110,12 +110,12 @@ export default {
ref="fieldName"
v-model="entryName"
type="text"
class="form-control"
class="form-control qa-full-file-path"
placeholder="/dir/file_name"
/>
<ul
v-if="isCreatingNew"
class="prepend-top-default list-inline"
class="prepend-top-default list-inline qa-template-list"
>
<li
v-for="(template, index) in templateTypes"
Loading
Loading
Loading
Loading
@@ -43,34 +43,25 @@ export default {
{
show: this.currentMergeRequestId,
title: __('Merge Request'),
views: [
rightSidebarViews.mergeRequestInfo,
],
views: [rightSidebarViews.mergeRequestInfo],
icon: 'text-description',
},
{
show: true,
title: __('Pipelines'),
views: [
rightSidebarViews.pipelines,
rightSidebarViews.jobsDetail,
],
views: [rightSidebarViews.pipelines, rightSidebarViews.jobsDetail],
icon: 'rocket',
},
{
show: this.showLivePreview,
title: __('Live preview'),
views: [
rightSidebarViews.clientSidePreview,
],
views: [rightSidebarViews.clientSidePreview],
icon: 'live-preview',
},
];
},
tabs() {
return this.defaultTabs
.concat(this.extensionTabs)
.filter(tab => tab.show);
return this.defaultTabs.concat(this.extensionTabs).filter(tab => tab.show);
},
tabViews() {
return _.flatten(this.tabs.map(tab => tab.views));
Loading
Loading
Loading
Loading
@@ -25,12 +25,7 @@ export default {
...mapState('rightPane', {
rightPaneIsOpen: 'isOpen',
}),
...mapState([
'rightPanelCollapsed',
'viewer',
'panelResizing',
'currentActivityView',
]),
...mapState(['rightPanelCollapsed', 'viewer', 'panelResizing', 'currentActivityView']),
...mapGetters([
'currentMergeRequest',
'getStagedFile',
Loading
Loading
Loading
Loading
@@ -30,9 +30,7 @@ export default {
},
computed: {
placeholderText() {
return this.tokens.length
? ''
: this.placeholder;
return this.tokens.length ? '' : this.placeholder;
},
},
watch: {
Loading
Loading
Loading
Loading
@@ -21,10 +21,7 @@ Vue.use(Translate);
export function initIde(el, options = {}) {
if (!el) return null;
 
const {
extraInitialData = () => ({}),
rootComponent = ide,
} = options;
const { extraInitialData = () => ({}), rootComponent = ide } = options;
 
return new Vue({
el,
Loading
Loading
Loading
Loading
@@ -11,14 +11,16 @@ export const computeDiff = (originalContent, newContent) => {
if (findOnLine) {
Object.assign(findOnLine, change, {
modified: true,
endLineNumber: (lineNumber + change.count) - 1,
endLineNumber: lineNumber + change.count - 1,
});
} else if ('added' in change || 'removed' in change) {
acc.push(Object.assign({}, change, {
lineNumber,
modified: undefined,
endLineNumber: (lineNumber + change.count) - 1,
}));
acc.push(
Object.assign({}, change, {
lineNumber,
modified: undefined,
endLineNumber: lineNumber + change.count - 1,
}),
);
}
 
if (!change.removed) {
Loading
Loading
import { computeDiff } from './diff';
 
// eslint-disable-next-line no-restricted-globals
self.addEventListener('message', (e) => {
self.addEventListener('message', e => {
const { data } = e;
 
// eslint-disable-next-line no-restricted-globals
Loading
Loading
Loading
Loading
@@ -116,57 +116,57 @@ export const openMergeRequest = (
targetProjectId,
mergeRequestId,
})
.then(mr => {
dispatch('setCurrentBranchId', mr.source_branch);
.then(mr => {
dispatch('setCurrentBranchId', mr.source_branch);
 
dispatch('getBranchData', {
projectId,
branchId: mr.source_branch,
});
dispatch('getBranchData', {
projectId,
branchId: mr.source_branch,
});
 
return dispatch('getFiles', {
projectId,
branchId: mr.source_branch,
});
})
.then(() =>
dispatch('getMergeRequestVersions', {
projectId,
targetProjectId,
mergeRequestId,
}),
)
.then(() =>
dispatch('getMergeRequestChanges', {
projectId,
targetProjectId,
mergeRequestId,
}),
)
.then(mrChanges => {
if (mrChanges.changes.length) {
dispatch('updateActivityBarView', activityBarViews.review);
}
return dispatch('getFiles', {
projectId,
branchId: mr.source_branch,
});
})
.then(() =>
dispatch('getMergeRequestVersions', {
projectId,
targetProjectId,
mergeRequestId,
}),
)
.then(() =>
dispatch('getMergeRequestChanges', {
projectId,
targetProjectId,
mergeRequestId,
}),
)
.then(mrChanges => {
if (mrChanges.changes.length) {
dispatch('updateActivityBarView', activityBarViews.review);
}
 
mrChanges.changes.forEach((change, ind) => {
const changeTreeEntry = state.entries[change.new_path];
mrChanges.changes.forEach((change, ind) => {
const changeTreeEntry = state.entries[change.new_path];
 
if (changeTreeEntry) {
dispatch('setFileMrChange', {
file: changeTreeEntry,
mrChange: change,
});
if (ind < 10) {
dispatch('getFileData', {
path: change.new_path,
makeFileActive: ind === 0,
if (changeTreeEntry) {
dispatch('setFileMrChange', {
file: changeTreeEntry,
mrChange: change,
});
if (ind < 10) {
dispatch('getFileData', {
path: change.new_path,
makeFileActive: ind === 0,
});
}
}
}
});
})
.catch(e => {
flash(__('Error while loading the merge request. Please try again.'));
throw e;
});
})
.catch(e => {
flash(__('Error while loading the merge request. Please try again.'));
throw e;
});
Loading
Loading
@@ -125,10 +125,7 @@ export const showBranchNotFoundError = ({ dispatch }, branchId) => {
});
};
 
export const openBranch = (
{ dispatch, state },
{ projectId, branchId, basePath },
) => {
export const openBranch = ({ dispatch, state }, { projectId, branchId, basePath }) => {
dispatch('setCurrentBranchId', branchId);
 
dispatch('getBranchData', {
Loading
Loading
@@ -136,23 +133,20 @@ export const openBranch = (
branchId,
});
 
return (
dispatch('getFiles', {
projectId,
branchId,
})
.then(() => {
if (basePath) {
const path = basePath.slice(-1) === '/' ? basePath.slice(0, -1) : basePath;
const treeEntryKey = Object.keys(state.entries).find(
key => key === path && !state.entries[key].pending,
);
const treeEntry = state.entries[treeEntryKey];
return dispatch('getFiles', {
projectId,
branchId,
}).then(() => {
if (basePath) {
const path = basePath.slice(-1) === '/' ? basePath.slice(0, -1) : basePath;
const treeEntryKey = Object.keys(state.entries).find(
key => key === path && !state.entries[key].pending,
);
const treeEntry = state.entries[treeEntryKey];
 
if (treeEntry) {
dispatch('handleTreeEntryAction', treeEntry);
}
if (treeEntry) {
dispatch('handleTreeEntryAction', treeEntry);
}
})
);
}
});
};
Loading
Loading
@@ -30,9 +30,9 @@ export const setLastCommitMessage = ({ rootState, commit }, data) => {
const currentProject = rootState.projects[rootState.currentProjectId];
const commitStats = data.stats
? sprintf(__('with %{additions} additions, %{deletions} deletions.'), {
additions: data.stats.additions, // eslint-disable-line indent-legacy
deletions: data.stats.deletions, // eslint-disable-line indent-legacy
}) // eslint-disable-line indent-legacy
additions: data.stats.additions,
deletions: data.stats.deletions,
})
: '';
const commitMsg = sprintf(
__('Your changes have been committed. Commit %{commitId} %{commitStats}'),
Loading
Loading
Loading
Loading
@@ -23,12 +23,12 @@ export const receiveTemplateTypesError = ({ commit, dispatch }) => {
export const receiveTemplateTypesSuccess = ({ commit }, templates) =>
commit(types.RECEIVE_TEMPLATE_TYPES_SUCCESS, templates);
 
export const fetchTemplateTypes = ({ dispatch, state }, page = 1) => {
export const fetchTemplateTypes = ({ dispatch, state, rootState }, page = 1) => {
if (!Object.keys(state.selectedTemplateType).length) return Promise.reject();
 
dispatch('requestTemplateTypes');
 
return Api.templates(state.selectedTemplateType.key, { page })
return Api.projectTemplates(rootState.currentProjectId, state.selectedTemplateType.key, { page })
.then(({ data, headers }) => {
const nextPage = parseInt(normalizeHeaders(headers)['X-NEXT-PAGE'], 10);
 
Loading
Loading
@@ -74,12 +74,16 @@ export const receiveTemplateError = ({ dispatch }, template) => {
);
};
 
export const fetchTemplate = ({ dispatch, state }, template) => {
export const fetchTemplate = ({ dispatch, state, rootState }, template) => {
if (template.content) {
return dispatch('setFileTemplate', template);
}
 
return Api.templates(`${state.selectedTemplateType.key}/${template.key || template.name}`)
return Api.projectTemplate(
rootState.currentProjectId,
state.selectedTemplateType.key,
template.key || template.name,
)
.then(({ data }) => {
dispatch('setFileTemplate', data);
})
Loading
Loading
Loading
Loading
@@ -13,6 +13,7 @@ export default {
},
[types.SET_SELECTED_TEMPLATE_TYPE](state, type) {
state.selectedTemplateType = type;
state.templates = [];
},
[types.SET_UPDATE_SUCCESS](state, success) {
state.updateSuccess = success;
Loading
Loading
Loading
Loading
@@ -3,8 +3,7 @@ import Api from '../../../../api';
import { scopes } from './constants';
import * as types from './mutation_types';
 
export const requestMergeRequests = ({ commit }) =>
commit(types.REQUEST_MERGE_REQUESTS);
export const requestMergeRequests = ({ commit }) => commit(types.REQUEST_MERGE_REQUESTS);
export const receiveMergeRequestsError = ({ commit, dispatch }, { type, search }) => {
dispatch(
'setErrorMessage',
Loading
Loading
/* eslint-disable comma-dangle, quotes, consistent-return, func-names, array-callback-return, prefer-arrow-callback, max-len, no-unused-vars */
/* eslint-disable consistent-return, func-names, array-callback-return, prefer-arrow-callback, no-unused-vars */
 
import $ from 'jquery';
import _ from 'underscore';
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment