various different performance improvements
[ci skip]
This commit is contained in:
parent
4d18e20011
commit
5c0c345a3a
10 changed files with 24 additions and 37 deletions
|
@ -11,7 +11,6 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'currentBlobView',
|
'currentBlobView',
|
||||||
'editMode',
|
|
||||||
]),
|
]),
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'isMini',
|
'isMini',
|
||||||
|
@ -45,13 +44,14 @@ export default {
|
||||||
<div class="repository-view">
|
<div class="repository-view">
|
||||||
<div class="tree-content-holder" :class="{'tree-content-holder-mini' : isMini}">
|
<div class="tree-content-holder" :class="{'tree-content-holder-mini' : isMini}">
|
||||||
<repo-sidebar/>
|
<repo-sidebar/>
|
||||||
<div v-if="isMini"
|
<div
|
||||||
class="panel-right"
|
v-if="isMini"
|
||||||
:class="{'edit-mode': editMode}">
|
class="panel-right"
|
||||||
|
>
|
||||||
<repo-tabs/>
|
<repo-tabs/>
|
||||||
<component
|
<component
|
||||||
:is="currentBlobView"
|
:is="currentBlobView"
|
||||||
class="blob-viewer-container"/>
|
/>
|
||||||
<repo-file-buttons/>
|
<repo-file-buttons/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="editable-mode">
|
||||||
<button
|
<button
|
||||||
v-if="canEditFile"
|
v-if="canEditFile"
|
||||||
class="btn btn-default"
|
class="btn btn-default"
|
||||||
|
|
|
@ -52,12 +52,13 @@ export default {
|
||||||
},
|
},
|
||||||
setupEditor() {
|
setupEditor() {
|
||||||
if (!this.activeFile) return;
|
if (!this.activeFile) return;
|
||||||
|
const content = this.activeFile.content !== '' ? this.activeFile.content : this.activeFile.raw;
|
||||||
|
|
||||||
const foundLang = this.languages.find(lang =>
|
const foundLang = this.languages.find(lang =>
|
||||||
lang.extensions && lang.extensions.indexOf(this.activeFileExtension) === 0,
|
lang.extensions && lang.extensions.indexOf(this.activeFileExtension) === 0,
|
||||||
);
|
);
|
||||||
const newModel = this.monaco.editor.createModel(
|
const newModel = this.monaco.editor.createModel(
|
||||||
this.activeFile.raw, foundLang ? foundLang.id : 'plaintext',
|
content, foundLang ? foundLang.id : 'plaintext',
|
||||||
);
|
);
|
||||||
|
|
||||||
this.monacoInstance.setModel(newModel);
|
this.monacoInstance.setModel(newModel);
|
||||||
|
@ -91,5 +92,5 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="ide" v-if='!shouldHideEditor'></div>
|
<div id="ide" v-if='!shouldHideEditor' class="blob-viewer-container blob-editor-container"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions([
|
...mapActions([
|
||||||
'getTreeData',
|
|
||||||
'clickedTreeRow',
|
'clickedTreeRow',
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="blob-viewer-container">
|
||||||
<div
|
<div
|
||||||
v-if="!activeFile.renderError"
|
v-if="!activeFile.renderError"
|
||||||
v-html="activeFile.html">
|
v-html="activeFile.html">
|
||||||
|
|
|
@ -5,13 +5,13 @@ import Repo from './components/repo.vue';
|
||||||
import RepoEditButton from './components/repo_edit_button.vue';
|
import RepoEditButton from './components/repo_edit_button.vue';
|
||||||
import newBranchForm from './components/new_branch_form.vue';
|
import newBranchForm from './components/new_branch_form.vue';
|
||||||
import newDropdown from './components/new_dropdown/index.vue';
|
import newDropdown from './components/new_dropdown/index.vue';
|
||||||
import vStore from './stores';
|
import store from './stores';
|
||||||
import Translate from '../vue_shared/translate';
|
import Translate from '../vue_shared/translate';
|
||||||
|
|
||||||
function initRepo(el) {
|
function initRepo(el) {
|
||||||
return new Vue({
|
return new Vue({
|
||||||
el,
|
el,
|
||||||
store: vStore,
|
store,
|
||||||
components: {
|
components: {
|
||||||
repo: Repo,
|
repo: Repo,
|
||||||
},
|
},
|
||||||
|
@ -53,17 +53,20 @@ function initRepo(el) {
|
||||||
function initRepoEditButton(el) {
|
function initRepoEditButton(el) {
|
||||||
return new Vue({
|
return new Vue({
|
||||||
el,
|
el,
|
||||||
store: vStore,
|
store,
|
||||||
components: {
|
components: {
|
||||||
repoEditButton: RepoEditButton,
|
repoEditButton: RepoEditButton,
|
||||||
},
|
},
|
||||||
|
render(createElement) {
|
||||||
|
return createElement('repo-edit-button');
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initNewDropdown(el) {
|
function initNewDropdown(el) {
|
||||||
return new Vue({
|
return new Vue({
|
||||||
el,
|
el,
|
||||||
store: vStore,
|
store,
|
||||||
components: {
|
components: {
|
||||||
newDropdown,
|
newDropdown,
|
||||||
},
|
},
|
||||||
|
@ -83,7 +86,7 @@ function initNewBranchForm() {
|
||||||
components: {
|
components: {
|
||||||
newBranchForm,
|
newBranchForm,
|
||||||
},
|
},
|
||||||
store: vStore,
|
store,
|
||||||
render(createElement) {
|
render(createElement) {
|
||||||
return createElement('new-branch-form');
|
return createElement('new-branch-form');
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,9 +10,7 @@ export const setInitialData = ({ commit }, data) => commit(types.SET_INITIAL_DAT
|
||||||
|
|
||||||
export const closeDiscardPopup = ({ commit }) => commit(types.TOGGLE_DISCARD_POPUP, false);
|
export const closeDiscardPopup = ({ commit }) => commit(types.TOGGLE_DISCARD_POPUP, false);
|
||||||
|
|
||||||
export const discardAllChanges = ({ state, commit, getters, dispatch }) => {
|
export const discardAllChanges = ({ commit, getters, dispatch }) => {
|
||||||
if (state.editMode) return;
|
|
||||||
|
|
||||||
const changedFiles = getters.changedFiles;
|
const changedFiles = getters.changedFiles;
|
||||||
|
|
||||||
changedFiles.forEach((file) => {
|
changedFiles.forEach((file) => {
|
||||||
|
@ -82,6 +80,8 @@ export const commitChanges = ({ commit, state, dispatch }, { payload, newMr }) =
|
||||||
dispatch('discardAllChanges');
|
dispatch('discardAllChanges');
|
||||||
dispatch('closeAllFiles');
|
dispatch('closeAllFiles');
|
||||||
dispatch('toggleEditMode');
|
dispatch('toggleEditMode');
|
||||||
|
|
||||||
|
window.scrollTo(0, 0);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => flash('Error committing changes. Please try again.'));
|
.catch(() => flash('Error committing changes. Please try again.'));
|
||||||
|
|
|
@ -72,10 +72,6 @@
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cursor {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.blob-no-preview {
|
.blob-no-preview {
|
||||||
|
@ -85,18 +81,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.edit-mode {
|
&.blob-editor-container {
|
||||||
.blob-viewer-container {
|
overflow: hidden;
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.monaco-editor.vs {
|
|
||||||
.cursor {
|
|
||||||
background: $black;
|
|
||||||
border-color: $black;
|
|
||||||
display: block !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.blob-viewer-container {
|
.blob-viewer-container {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
.tree-controls
|
.tree-controls
|
||||||
- if show_new_repo?
|
- if show_new_repo?
|
||||||
= render 'shared/repo/editable_mode'
|
.editable-mode
|
||||||
- else
|
- else
|
||||||
= link_to s_('Commits|History'), project_commits_path(@project, @id), class: 'btn'
|
= link_to s_('Commits|History'), project_commits_path(@project, @id), class: 'btn'
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
.editable-mode
|
|
||||||
%repo-edit-button
|
|
Loading…
Reference in a new issue