Commit 7ca5a3f9 authored by Filipa Lacerda's avatar Filipa Lacerda

Fixes more eslint rules

parent cbdbb645
...@@ -69,7 +69,8 @@ ...@@ -69,7 +69,8 @@
<i <i
class="fa fa-caret-down" class="fa fa-caret-down"
aria-hidden="true" aria-hidden="true"
/> >
</i>
<loading-icon v-if="isLoading" /> <loading-icon v-if="isLoading" />
</span> </span>
</button> </button>
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
import loadingIcon from '../../vue_shared/components/loading_icon.vue'; import loadingIcon from '../../vue_shared/components/loading_icon.vue';
export default { export default {
components: {
loadingIcon,
},
props: { props: {
retryUrl: { retryUrl: {
type: String, type: String,
...@@ -21,10 +25,6 @@ ...@@ -21,10 +25,6 @@
}, },
}, },
components: {
loadingIcon,
},
data() { data() {
return { return {
isLoading: false, isLoading: false,
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
:can-read-environment="canReadEnvironment" :can-read-environment="canReadEnvironment"
@onChangePage="onChangePage" @onChangePage="onChangePage"
> >
<empty-state <empty-state
slot="emptyState" slot="emptyState"
v-if="!isLoading && state.environments.length === 0" v-if="!isLoading && state.environments.length === 0"
:new-path="newEnvironmentPath" :new-path="newEnvironmentPath"
......
...@@ -31,6 +31,15 @@ export default { ...@@ -31,6 +31,15 @@ export default {
}, },
}, },
computed: {
shouldRenderFolderContent() {
return this.model.isFolder &&
this.model.isOpen &&
this.model.children &&
this.model.children.length > 0;
},
},
methods: { methods: {
folderUrl(model) { folderUrl(model) {
return `${window.location.pathname}/folders/${model.folderName}`; return `${window.location.pathname}/folders/${model.folderName}`;
...@@ -80,17 +89,21 @@ export default { ...@@ -80,17 +89,21 @@ export default {
</div> </div>
<template <template
v-for="(model, i) in environments" v-for="(model, i) in environments"
:key="i"
:model="model"> :model="model">
<div <div
is="environment-item" is="environment-item"
:model="model" :model="model"
:can-create-deployment="canCreateDeployment" :can-create-deployment="canCreateDeployment"
:can-read-environment="canReadEnvironment" :can-read-environment="canReadEnvironment"
:key="i"
/> />
<template v-if="model.isFolder && model.isOpen && model.children && model.children.length > 0"> <template
<div v-if="model.isLoadingFolderContent"> v-if="shouldRenderFolderContent"
>
<div
v-if="model.isLoadingFolderContent"
:key="i">
<loading-icon size="2" /> <loading-icon size="2" />
</div> </div>
...@@ -101,9 +114,10 @@ export default { ...@@ -101,9 +114,10 @@ export default {
:model="children" :model="children"
:can-create-deployment="canCreateDeployment" :can-create-deployment="canCreateDeployment"
:can-read-environment="canReadEnvironment" :can-read-environment="canReadEnvironment"
:key="i"
/> />
<div> <div :key="i">
<div class="text-center prepend-top-10"> <div class="text-center prepend-top-10">
<a <a
:href="folderUrl(model)" :href="folderUrl(model)"
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
> >
<h4 class="js-folder-name environments-folder-name"> <h4 class="js-folder-name environments-folder-name">
{{ s__("Environments|Environments") }} / <b>{{folderName}}</b> {{ s__("Environments|Environments") }} / <b>{{ folderName }}</b>
</h4> </h4>
<tabs <tabs
......
...@@ -86,7 +86,8 @@ ...@@ -86,7 +86,8 @@
/> />
<item-stats :item="group" /> <item-stats :item="group" />
<div <div
class="folder-toggle-wrap"> class="folder-toggle-wrap"
>
<item-caret :is-group-open="group.isOpen" /> <item-caret :is-group-open="group.isOpen" />
<item-type-icon <item-type-icon
:item-type="group.type" :item-type="group.type"
...@@ -115,7 +116,8 @@ ...@@ -115,7 +116,8 @@
</a> </a>
</div> </div>
<div <div
class="title namespace-title"> class="title namespace-title"
>
<a <a
v-tooltip v-tooltip
:href="group.relativePath" :href="group.relativePath"
......
<script> <script>
import tablePagination from '~/vue_shared/components/table_pagination.vue'; import tablePagination from '~/vue_shared/components/table_pagination.vue';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import { getParameterByName } from '../../lib/utils/common_utils'; import { getParameterByName } from '../../lib/utils/common_utils';
export default { export default {
components: { components: {
tablePagination, tablePagination,
},
props: {
groups: {
type: Array,
required: true,
}, },
pageInfo: { props: {
type: Object, groups: {
required: true, type: Array,
required: true,
},
pageInfo: {
type: Object,
required: true,
},
searchEmpty: {
type: Boolean,
required: true,
},
searchEmptyMessage: {
type: String,
required: true,
},
}, },
searchEmpty: { methods: {
type: Boolean, change(page) {
required: true, const filterGroupsParam = getParameterByName('filter_groups');
const sortParam = getParameterByName('sort');
const archivedParam = getParameterByName('archived');
eventHub.$emit('fetchPage', page, filterGroupsParam, sortParam, archivedParam);
},
}, },
searchEmptyMessage: { };
type: String,
required: true,
},
},
methods: {
change(page) {
const filterGroupsParam = getParameterByName('filter_groups');
const sortParam = getParameterByName('sort');
const archivedParam = getParameterByName('archived');
eventHub.$emit('fetchPage', page, filterGroupsParam, sortParam, archivedParam);
},
},
};
</script> </script>
<template> <template>
<div class="groups-list-tree-container"> <div class="groups-list-tree-container">
<div <div
v-if="searchEmpty" v-if="searchEmpty"
class="has-no-search-results"> class="has-no-search-results"
{{searchEmptyMessage}} >
{{ searchEmptyMessage }}
</div> </div>
<group-folder <group-folder
v-if="!searchEmpty" v-if="!searchEmpty"
...@@ -50,7 +51,7 @@ export default { ...@@ -50,7 +51,7 @@ export default {
<table-pagination <table-pagination
v-if="!searchEmpty" v-if="!searchEmpty"
:change="change" :change="change"
:pageInfo="pageInfo" :page-info="pageInfo"
/> />
</div> </div>
</template> </template>
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
import icon from '~/vue_shared/components/icon.vue'; import icon from '~/vue_shared/components/icon.vue';
export default { export default {
components: {
icon,
},
props: { props: {
isGroupOpen: { isGroupOpen: {
type: Boolean, type: Boolean,
...@@ -9,9 +12,6 @@ export default { ...@@ -9,9 +12,6 @@ export default {
default: false, default: false,
}, },
}, },
components: {
icon,
},
computed: { computed: {
iconClass() { iconClass() {
return this.isGroupOpen ? 'angle-down' : 'angle-right'; return this.isGroupOpen ? 'angle-down' : 'angle-right';
......
<script> <script>
import icon from '~/vue_shared/components/icon.vue'; import icon from '~/vue_shared/components/icon.vue';
import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import timeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import { import {
ITEM_TYPE, ITEM_TYPE,
VISIBILITY_TYPE_ICON, VISIBILITY_TYPE_ICON,
GROUP_VISIBILITY_TYPE, GROUP_VISIBILITY_TYPE,
PROJECT_VISIBILITY_TYPE PROJECT_VISIBILITY_TYPE,
} from '../constants'; } from '../constants';
import itemStatsValue from './item_stats_value.vue'; import itemStatsValue from './item_stats_value.vue';
export default { export default {
components: { components: {
icon, icon,
timeAgoTooltip, timeAgoTooltip,
itemStatsValue, itemStatsValue,
},
props: {
item: {
type: Object,
required: true,
}, },
}, props: {
computed: { item: {
visibilityIcon() { type: Object,
return VISIBILITY_TYPE_ICON[this.item.visibility]; required: true,
},
}, },
visibilityTooltip() { computed: {
if (this.item.type === ITEM_TYPE.GROUP) { visibilityIcon() {
return GROUP_VISIBILITY_TYPE[this.item.visibility]; return VISIBILITY_TYPE_ICON[this.item.visibility];
} },
return PROJECT_VISIBILITY_TYPE[this.item.visibility]; visibilityTooltip() {
if (this.item.type === ITEM_TYPE.GROUP) {
return GROUP_VISIBILITY_TYPE[this.item.visibility];
}
return PROJECT_VISIBILITY_TYPE[this.item.visibility];
},
isProject() {
return this.item.type === ITEM_TYPE.PROJECT;
},
isGroup() {
return this.item.type === ITEM_TYPE.GROUP;
},
}, },
isProject() { };
return this.item.type === ITEM_TYPE.PROJECT;
},
isGroup() {
return this.item.type === ITEM_TYPE.GROUP;
},
},
};
</script> </script>
<template> <template>
......
<script> <script>
import tooltip from '~/vue_shared/directives/tooltip'; import tooltip from '~/vue_shared/directives/tooltip';
import icon from '~/vue_shared/components/icon.vue'; import icon from '~/vue_shared/components/icon.vue';
export default { export default {
props: { components: {
title: { icon,
type: String,
required: false,
default: '',
}, },
cssClass: { directives: {
type: String, tooltip,
required: false,
default: '',
}, },
iconName: { props: {
type: String, title: {
required: true, type: String,
required: false,
default: '',
},
cssClass: {
type: String,
required: false,
default: '',
},
iconName: {
type: String,
required: true,
},
tooltipPlacement: {
type: String,
required: false,
default: 'bottom',
},
/**
* value could either be number or string
* as `memberCount` is always passed as string
* while `subgroupCount` & `projectCount`
* are always number
*/
value: {
type: [Number, String],
required: false,
default: '',
},
}, },
tooltipPlacement: { computed: {
type: String, isValuePresent() {
required: false, return this.value !== '';
default: 'bottom', },
}, },
/** };
* value could either be number or string
* as `memberCount` is always passed as string
* while `subgroupCount` & `projectCount`
* are always number
*/
value: {
type: [Number, String],
required: false,
default: '',
},
},
directives: {
tooltip,
},
components: {
icon,
},
computed: {
isValuePresent() {
return this.value !== '';
},
},
};
</script> </script>
<template> <template>
...@@ -57,12 +57,12 @@ export default { ...@@ -57,12 +57,12 @@ export default {
:class="cssClass" :class="cssClass"
:title="title" :title="title"
> >
<icon :name="iconName"/> <icon :name="iconName" />
<span <span
v-if="isValuePresent" v-if="isValuePresent"
class="stat-value" class="stat-value"
> >
{{value}} {{ value }}
</span> </span>
</span> </span>
</template> </template>
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
this.$emit('toggleCollapsed'); this.$emit('toggleCollapsed');
}, },
}, },
}; };
</script> </script>
......
...@@ -9,6 +9,15 @@ import repoPreview from './repo_preview.vue'; ...@@ -9,6 +9,15 @@ import repoPreview from './repo_preview.vue';
import repoEditor from './repo_editor.vue'; import repoEditor from './repo_editor.vue';
export default { export default {
components: {
ideSidebar,
ideContextbar,
repoTabs,
repoFileButtons,
ideStatusBar,
repoEditor,
repoPreview,
},
computed: { computed: {
...mapState([ ...mapState([
'currentBlobView', 'currentBlobView',
...@@ -19,15 +28,6 @@ export default { ...@@ -19,15 +28,6 @@ export default {
'activeFile', 'activeFile',
]), ]),
}, },
components: {
ideSidebar,
ideContextbar,
repoTabs,
repoFileButtons,
ideStatusBar,
repoEditor,
repoPreview,
},
mounted() { mounted() {
const returnValue = 'Are you sure you want to lose unsaved changes?'; const returnValue = 'Are you sure you want to lose unsaved changes?';
window.onbeforeunload = (e) => { window.onbeforeunload = (e) => {
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
</script> </script>
<template> <template>
<div <div
class="ide-view" class="ide-view"
> >
<ide-sidebar/> <ide-sidebar/>
...@@ -51,23 +51,26 @@ export default { ...@@ -51,23 +51,26 @@ export default {
class="multi-file-edit-pane" class="multi-file-edit-pane"
> >
<template <template
v-if="activeFile"> v-if="activeFile"
<repo-tabs/> >
<repo-tabs />
<component <component
class="multi-file-edit-pane-content" class="multi-file-edit-pane-content"
:is="currentBlobView" :is="currentBlobView"
/> />
<repo-file-buttons/> <repo-file-buttons />
<ide-status-bar <ide-status-bar
:file="selectedFile"/> :file="selectedFile"
/>
</template> </template>
<template <template
v-else> v-else
>
<div class="ide-empty-state"> <div class="ide-empty-state">
<h2 class="clgray">Welcome to the GitLab IDE</h2> <h2 class="clgray">Welcome to the GitLab IDE</h2>
</div> </div>
</template> </template>
</div> </div>
<ide-contextbar/> <ide-contextbar />
</div> </div>
</template> </template>
<script> <script>
import { mapGetters, mapState, mapActions } from 'vuex'; import { mapGetters, mapState, mapActions } from 'vuex';
import repoCommitSection from './repo_commit_section.vue'; import repoCommitSection from './repo_commit_section.vue';
import icon from '../../vue_shared/components/icon.vue'; import icon from '../../vue_shared/components/icon.vue';
import panelResizer from '../../vue_shared/components/panel_resizer.vue'; import panelResizer from '../../vue_shared/components/panel_resizer.vue';
export default { export default {
data() { components: {
return { repoCommitSection,
width: 290, icon,
}; panelResizer,
},
components: {
repoCommitSection,
icon,
panelResizer,
},
computed: {
...mapState([
'rightPanelCollapsed',
]),
...mapGetters([
'changedFiles',
]),
currentIcon() {
return this.rightPanelCollapsed ? 'angle-double-left' : 'angle-double-right';
}, },
maxSize() { data() {
return window.innerWidth / 2; return {
width: 290,
};
}, },
panelStyle() { computed: {
if (!this.rightPanelCollapsed) { ...mapState([
return { width: `${this.width}px` }; 'rightPanelCollapsed',
} ]),
return {}; ...mapGetters([
'changedFiles',
]),
currentIcon() {
return this.rightPanelCollapsed ? 'angle-double-left' : 'angle-double-right';
},
maxSize() {
return window.innerWidth / 2;
},
panelStyle() {
if (!this.rightPanelCollapsed) {
return { width: `${this.width}px` };
}
return {};
},
}, },
}, methods: {
methods: { ...mapActions([
...mapActions([ 'setPanelCollapsedStatus',
'setPanelCollapsedStatus', 'setResizingStatus',
'setResizingStatus', ]),
]), toggleCollapsed() {
toggleCollapsed() { this.setPanelCollapsedStatus({
this.setPanelCollapsedStatus({ side: 'right',
side: 'right', collapsed: !this.rightPanelCollapsed,
collapsed: !this.rightPanelCollapsed, });
}); },
resizingStarted() {
this.setResizingStatus(true);
},
resizingEnded() {
this.setResizingStatus(false);
},
}, },
resizingStarted() { };
this.setResizingStatus(true);
},
resizingEnded() {
this.setResizingStatus(false);
},
},
};
</script> </script>
<template> <template>
...@@ -64,17 +64,17 @@ export default { ...@@ -64,17 +64,17 @@ export default {
}" }"
:style="panelStyle" :style="panelStyle"
> >
<div <div class="multi-file-commit-panel-section">
class="multi-file-commit-panel-section">
<header <header
class="multi-file-commit-panel-header" class="multi-file-commit-panel-header"
:class="{ :class="{
'is-collapsed': rightPanelCollapsed, 'is-collapsed': rightPanelCollapsed,
}" }"
> >
<div <div
class="multi-file-commit-panel-header-title" class="multi-file-commit-panel-header-title"
v-if="!rightPanelCollapsed"> v-if="!rightPanelCollapsed"
>
<icon <icon
name="list-bulleted" name="list-bulleted"
:size="18" :size="18"
...@@ -92,8 +92,7 @@ export default { ...@@ -92,8 +92,7 @@ export default {
/> />
</button> </button>
</header> </header>
<repo-commit-section <repo-commit-section />
class=""/>
</div> </div>
<panel-resizer <panel-resizer
:size.sync="width" :size.sync="width"
...@@ -103,6 +102,7 @@ export default { ...@@ -103,6 +102,7 @@ export default {
:max-size="maxSize" :max-size="maxSize"
@resize-start="resizingStarted" @resize-start="resizingStarted"
@resize-end="resizingEnded" @resize-end="resizingEnded"
side="left"/> side="left"
/>
</div> </div>
</template> </template>
...@@ -28,20 +28,20 @@ export default { ...@@ -28,20 +28,20 @@ export default {
<div class="branch-header-title"> <div class="branch-header-title">
<icon <icon
name="branch" name="branch"
:size="12"> :size="12"
</icon> />
{{ branch.name }} {{ branch.name }}
</div> </div>
<div class="branch-header-btns"> <div class="branch-header-btns">
<new-dropdown <new-dropdown
:project-id="projectId" :project-id="projectId"
:branch="branch.name" :branch="branch.name"
path=""/> path=""
/>
</div> </div>
</div> </div>
<div> <div>
<repo-tree <repo-tree :tree-id="branch.treeId" />
:treeId="branch.treeId"/>
</div> </div>
</div> </div>
</template> </template>
...@@ -19,9 +19,10 @@ export default { ...@@ -19,9 +19,10 @@ export default {
<template> <template>
<div class="projects-sidebar"> <div class="projects-sidebar">
<div class="context-header"> <div class="context-header">
<a <a
:title="project.name" :title="project.name"
:href="project.web_url"> :href="project.web_url"
>
<div class="avatar-container s40 project-avatar"> <div class="avatar-container s40 project-avatar">
<project-avatar-image <project-avatar-image
class="avatar-container project-avatar" class="avatar-container project-avatar"
...@@ -29,7 +30,7 @@ export default { ...@@ -29,7 +30,7 @@ export default {
:img-src="project.avatar_url" :img-src="project.avatar_url"
:img-alt="project.name" :img-alt="project.name"
:img-size="40" :img-size="40"
/> />
</div> </div>
<div class="sidebar-context-title"> <div class="sidebar-context-title">
{{ project.name }} {{ project.name }}
...@@ -38,10 +39,11 @@ export default { ...@@ -38,10 +39,11 @@ export default {
</div> </div>
<div class="multi-file-commit-panel-inner-scroll"> <div class="multi-file-commit-panel-inner-scroll">
<branches-tree <branches-tree
v-for="(branch, index) in project.branches" v-for="branch in project.branches"
:key="branch.name" :key="branch.name"
:project-id="project.path_with_namespace" :project-id="project.path_with_namespace"
:branch="branch"/> :branch="branch"
/>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import RepoPreviousDirectory from './repo_prev_directory.vue'; import RepoPreviousDirectory from './repo_prev_directory.vue';
import RepoFile from './repo_file.vue'; import RepoFile from './repo_file.vue';
import RepoLoadingFile from './repo_loading_file.vue'; import RepoLoadingFile from './repo_loading_file.vue';
import { treeList } from '../stores/utils'; import { treeList } from '../stores/utils';
export default { export default {
components: { components: {
'repo-previous-directory': RepoPreviousDirectory, 'repo-previous-directory': RepoPreviousDirectory,
'repo-file': RepoFile, 'repo-file': RepoFile,
'repo-loading-file': RepoLoadingFile, 'repo-loading-file': RepoLoadingFile,
},
props: {
treeId: {
type: String,
required: true,
}, },
}, props: {
computed: { treeId: {
...mapState([ type: String,
'loading', required: true,
'isRoot',
]),
...mapState({
projectName(state) {
return state.project.name;
}, },
}),
fetchedList() {
return treeList(this.$store.state, this.treeId);
}, },
hasPreviousDirectory() { computed: {
return !this.isRoot && this.fetchedList.length; ...mapState([
}, 'loading',
showLoading() { 'isRoot',
return this.loading; ]),
...mapState({
projectName(state) {
return state.project.name;
},
}),
fetchedList() {
return treeList(this.$store.state, this.treeId);
},
hasPreviousDirectory() {
return !this.isRoot && this.fetchedList.length;
},
showLoading() {
return this.loading;
},
}, },
}, };
};
</script> </script>
<template> <template>
<div> <div>
<div class="ide-file-list"> <div class="ide-file-list">
<table class="table"> <table class="table">
<tbody <tbody
v-if="treeId"> v-if="treeId"
<repo-previous-directory >
v-if="hasPreviousDirectory" <repo-previous-directory
/> v-if="hasPreviousDirectory"
<repo-loading-file />
v-if="showLoading" <template v-if="showLoading">
v-for="n in 5" <repo-loading-file
:key="n" v-for="n in 5"
/> :key="n"
<repo-file />
v-for="file in fetchedList" </template>
:key="file.key" <repo-file
:file="file" v-for="file in fetchedList"
/> :key="file.key"
</tbody> :file="file"
</table> />
</tbody>
</table>
</div>
</div> </div>
</div>
</template> </template>
...@@ -5,16 +5,16 @@ import icon from '../../vue_shared/components/icon.vue'; ...@@ -5,16 +5,16 @@ import icon from '../../vue_shared/components/icon.vue';
import panelResizer from '../../vue_shared/components/panel_resizer.vue'; import panelResizer from '../../vue_shared/components/panel_resizer.vue';
export default { export default {
data() {
return {
width: 290,
};
},
components: { components: {
projectTree, projectTree,
icon, icon,
panelResizer, panelResizer,
}, },
data() {
return {
width: 290,
};
},
computed: { computed: {
...mapState([ ...mapState([
'projects', 'projects',
...@@ -56,17 +56,18 @@ export default { ...@@ -56,17 +56,18 @@ export default {
<template> <template>
<div <div
class="multi-file-commit-panel" class="multi-file-commit-panel"
:class="{ :class="{
'is-collapsed': leftPanelCollapsed, 'is-collapsed': leftPanelCollapsed,
}" }"
:style="panelStyle" :style="panelStyle"
> >
<div class="multi-file-commit-panel-inner"> <div class="multi-file-commit-panel-inner">
<project-tree <project-tree
v-for="(project, index) in projects" v-for="project in projects"
:key="project.id" :key="project.id"
:project="project"/> :project="project"
/>
</div> </div>
<button <button
type="button" type="button"
...@@ -80,7 +81,9 @@ export default { ...@@ -80,7 +81,9 @@ export default {
<span <span
v-if="!leftPanelCollapsed" v-if="!leftPanelCollapsed"
class="collapse-text" class="collapse-text"
>Collapse sidebar</span> >
Collapse sidebar
</span>
</button> </button>
<panel-resizer <panel-resizer
:size.sync="width" :size.sync="width"
...@@ -90,6 +93,7 @@ export default { ...@@ -90,6 +93,7 @@ export default {
:max-size="maxSize" :max-size="maxSize"
@resize-start="resizingStarted" @resize-start="resizingStarted"
@resize-end="resizingEnded" @resize-end="resizingEnded"
side="right"/> side="right"
/>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import icon from '../../vue_shared/components/icon.vue'; import icon from '../../vue_shared/components/icon.vue';
import tooltip from '../../vue_shared/directives/tooltip'; import tooltip from '../../vue_shared/directives/tooltip';
import timeAgoMixin from '../../vue_shared/mixins/timeago'; import timeAgoMixin from '../../vue_shared/mixins/timeago';
export default { export default {
props: { components: {
file: { icon,
type: Object,
required: true,
}, },
}, directives: {
components: { tooltip,
icon, },
}, mixins: [
directives: { timeAgoMixin,
tooltip, ],
}, props: {
mixins: [ file: {
timeAgoMixin, type: Object,
], required: true,
computed: { },
...mapState([ },
'selectedFile', computed: {
]), ...mapState([
}, 'selectedFile',
}; ]),
},
};
</script> </script>
<template> <template>
<div <div class="ide-status-bar">
class="ide-status-bar">
<div> <div>
<icon <icon
name="branch" name="branch"
:size="12"> :size="12"
</icon> />
{{ selectedFile.branchId }} {{ selectedFile.branchId }}
</div> </div>
<div> <div>
<div <div v-if="selectedFile.lastCommit && selectedFile.lastCommit.id">
v-if="selectedFile.lastCommit && selectedFile.lastCommit.id">
Last commit: Last commit:
<a <a
v-tooltip v-tooltip
:title="selectedFile.lastCommit.message" :title="selectedFile.lastCommit.message"
:href="selectedFile.lastCommit.url"> :href="selectedFile.lastCommit.url"
{{ timeFormated(selectedFile.lastCommit.updatedAt) }} by >
{{ timeFormated(selectedFile.lastCommit.updatedAt) }} by
{{ selectedFile.lastCommit.author }} {{ selectedFile.lastCommit.author }}
</a> </a>
</div> </div>
</div> </div>
<div <div class="text-right">
class="text-right">
{{ selectedFile.name }} {{ selectedFile.name }}
</div> </div>
<div <div class="text-right">
class="text-right">
{{ selectedFile.eol }} {{ selectedFile.eol }}
</div> </div>
<div <div class="text-right">
class="text-right">
{{ file.editorRow }}:{{ file.editorColumn }} {{ file.editorRow }}:{{ file.editorColumn }}
</div> </div>
<div <div class="text-right">
class="text-right">
{{ selectedFile.fileLanguage }} {{ selectedFile.fileLanguage }}
</div> </div>
</div> </div>
......
...@@ -21,6 +21,13 @@ ...@@ -21,6 +21,13 @@
return this.loading || this.branchName === ''; return this.loading || this.branchName === '';
}, },
}, },
created() {
// Dropdown is outside of Vue instance & is controlled by Bootstrap
this.$dropdown = $('.git-revision-dropdown');
// text element is outside Vue app
this.dropdownText = document.querySelector('.project-refs-form .dropdown-toggle-text');
},
methods: { methods: {
...mapActions([ ...mapActions([
'createNewBranch', 'createNewBranch',
...@@ -55,13 +62,6 @@ ...@@ -55,13 +62,6 @@
})); }));
}, },
}, },
created() {
// Dropdown is outside of Vue instance & is controlled by Bootstrap
this.$dropdown = $('.git-revision-dropdown');
// text element is outside Vue app
this.dropdownText = document.querySelector('.project-refs-form .dropdown-toggle-text');
},
}; };
</script> </script>
......
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
import icon from '../../../vue_shared/components/icon.vue'; import icon from '../../../vue_shared/components/icon.vue';
export default { export default {
components: {
icon,
newModal,
upload,
},
props: { props: {
branch: { branch: {
type: String, type: String,
...@@ -18,11 +23,6 @@ ...@@ -18,11 +23,6 @@
default: null, default: null,
}, },
}, },
components: {
icon,
newModal,
upload,
},
data() { data() {
return { return {
openModal: false, openModal: false,
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
import modal from '../../../vue_shared/components/modal.vue'; import modal from '../../../vue_shared/components/modal.vue';
export default { export default {
components: {
modal,
},
props: { props: {
branchId: { branchId: {
type: String, type: String,
...@@ -27,28 +30,6 @@ ...@@ -27,28 +30,6 @@
entryName: this.path !== '' ? `${this.path}/` : '', entryName: this.path !== '' ? `${this.path}/` : '',
}; };
}, },
components: {
modal,
},
methods: {
...mapActions([
'createTempEntry',
]),
createEntryInStore() {
this.createTempEntry({
projectId: this.currentProjectId,
branchId: this.branchId,
parent: this.parent,
name: this.entryName.replace(new RegExp(`^${this.path}/`), ''),
type: this.type,
});
this.hideModal();
},
hideModal() {
this.$emit('hide');
},
},
computed: { computed: {
...mapState([ ...mapState([
'currentProjectId', 'currentProjectId',
...@@ -78,6 +59,25 @@ ...@@ -78,6 +59,25 @@
mounted() { mounted() {
this.$refs.fieldName.focus(); this.$refs.fieldName.focus();
}, },
methods: {
...mapActions([
'createTempEntry',
]),
createEntryInStore() {
this.createTempEntry({
projectId: this.currentProjectId,
branchId: this.branchId,
parent: this.parent,
name: this.entryName.replace(new RegExp(`^${this.path}/`), ''),
type: this.type,
});
this.hideModal();
},
hideModal() {
this.$emit('hide');
},
},
}; };
</script> </script>
......
...@@ -18,6 +18,12 @@ ...@@ -18,6 +18,12 @@
'currentProjectId', 'currentProjectId',
]), ]),
}, },
mounted() {
this.$refs.fileUpload.addEventListener('change', this.openFile);
},
beforeDestroy() {
this.$refs.fileUpload.removeEventListener('change', this.openFile);
},
methods: { methods: {
...mapActions([ ...mapActions([
'createTempEntry', 'createTempEntry',
...@@ -59,12 +65,6 @@ ...@@ -59,12 +65,6 @@
this.$refs.fileUpload.click(); this.$refs.fileUpload.click();
}, },
}, },
mounted() {
this.$refs.fileUpload.addEventListener('change', this.openFile);
},
beforeDestroy() {
this.$refs.fileUpload.removeEventListener('change', this.openFile);
},
}; };
</script> </script>
......
...@@ -105,69 +105,69 @@ export default { ...@@ -105,69 +105,69 @@ export default {
</script> </script>
<template> <template>
<div class="multi-file-commit-panel-section"> <div class="multi-file-commit-panel-section">
<modal <modal
v-if="showNewBranchModal" v-if="showNewBranchModal"
:primary-button-label="__('Create new branch')" :primary-button-label="__('Create new branch')"
kind="primary" kind="primary"
:title="__('Branch has changed')" :title="__('Branch has changed')"
:text="__('This branch has changed since you started editing. Would you like to create a new branch?')" :text="__('This branch has changed since you started editing. Would you like to create a new branch?')"
@cancel="showNewBranchModal = false" @cancel="showNewBranchModal = false"
@submit="makeCommit(true)" @submit="makeCommit(true)"
/> />
<commit-files-list <commit-files-list
title="Staged" title="Staged"
:file-list="changedFiles" :file-list="changedFiles"
:collapsed="rightPanelCollapsed" :collapsed="rightPanelCollapsed"
@toggleCollapsed="toggleCollapsed" @toggleCollapsed="toggleCollapsed"
/> />
<form <form
class="form-horizontal multi-file-commit-form" class="form-horizontal multi-file-commit-form"
@submit.prevent="tryCommit" @submit.prevent="tryCommit"
v-if="!rightPanelCollapsed" v-if="!rightPanelCollapsed"
> >
<div class="multi-file-commit-fieldset"> <div class="multi-file-commit-fieldset">
<textarea <textarea
class="form-control multi-file-commit-message" class="form-control multi-file-commit-message"
name="commit-message" name="commit-message"
v-model="commitMessage" v-model="commitMessage"
placeholder="Commit message" placeholder="Commit message"
>
</textarea>
</div>
<div class="multi-file-commit-fieldset">
<label
v-tooltip
title="Create a new merge request with these changes"
data-container="body"
data-placement="top"
>
<input
type="checkbox"
v-model="startNewMR"
/>
Merge Request
</label>
<button
type="submit"
:disabled="commitButtonDisabled"
class="btn btn-default btn-sm append-right-10 prepend-left-10"
>
<i
v-if="submitCommitsLoading"
class="js-commit-loading-icon fa fa-spinner fa-spin"
aria-hidden="true"
aria-label="loading"
> >
</i> </textarea>
Commit
</button>
<div
class="multi-file-commit-message-count"
>
{{ commitMessageCount }}
</div> </div>
</div> <div class="multi-file-commit-fieldset">
</form> <label
</div> v-tooltip
title="Create a new merge request with these changes"
data-container="body"
data-placement="top"
>
<input
type="checkbox"
v-model="startNewMR"
/>
Merge Request
</label>
<button
type="submit"
:disabled="commitButtonDisabled"
class="btn btn-default btn-sm append-right-10 prepend-left-10"
>
<i
v-if="submitCommitsLoading"
class="js-commit-loading-icon fa fa-spinner fa-spin"
aria-hidden="true"
aria-label="loading"
>
</i>
Commit
</button>
<div
class="multi-file-commit-message-count"
>
{{ commitMessageCount }}
</div>
</div>
</form>
</div>
</template> </template>
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
aria-hidden="true"> aria-hidden="true">
</i> </i>
<span> <span>
{{buttonLabel}} {{ buttonLabel }}
</span> </span>
</button> </button>
<modal <modal
......
...@@ -6,20 +6,6 @@ import monacoLoader from '../monaco_loader'; ...@@ -6,20 +6,6 @@ import monacoLoader from '../monaco_loader';
import Editor from '../lib/editor'; import Editor from '../lib/editor';
export default { export default {
beforeDestroy() {
this.editor.dispose();
},
mounted() {
if (this.editor && monaco) {
this.initMonaco();
} else {
monacoLoader(['vs/editor/editor.main'], () => {
this.editor = Editor.create(monaco);
this.initMonaco();
});
}
},
computed: { computed: {
...mapGetters([ ...mapGetters([
'activeFile', 'activeFile',
...@@ -52,6 +38,20 @@ export default { ...@@ -52,6 +38,20 @@ export default {
} }
}, },
}, },
beforeDestroy() {
this.editor.dispose();
},
mounted() {
if (this.editor && monaco) {
this.initMonaco();
} else {
monacoLoader(['vs/editor/editor.main'], () => {
this.editor = Editor.create(monaco);
this.initMonaco();
});
}
},
methods: { methods: {
...mapActions([ ...mapActions([
'getRawFileData', 'getRawFileData',
......
...@@ -35,20 +35,24 @@ export default { ...@@ -35,20 +35,24 @@ export default {
<div <div
class="btn-group" class="btn-group"
role="group" role="group"
aria-label="File actions"> aria-label="File actions"
>
<a <a
:href="activeFile.blamePath" :href="activeFile.blamePath"
class="btn btn-default btn-sm blame"> class="btn btn-default btn-sm blame"
>
Blame Blame
</a> </a>
<a <a
:href="activeFile.commitsPath" :href="activeFile.commitsPath"
class="btn btn-default btn-sm history"> class="btn btn-default btn-sm history"
>
History History
</a> </a>
<a <a
:href="activeFile.permalink" :href="activeFile.permalink"
class="btn btn-default btn-sm permalink"> class="btn btn-default btn-sm permalink"
>
Permalink Permalink
</a> </a>
</div> </div>
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<div class="modal-header"> <div class="modal-header">
<slot name="header"> <slot name="header">
<h4 class="modal-title pull-left"> <h4 class="modal-title pull-left">
{{ this.title }} {{ title }}
</h4> </h4>
<button <button
type="button" type="button"
...@@ -111,7 +111,10 @@ ...@@ -111,7 +111,10 @@
</slot> </slot>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<slot name="body" :text="text"> <slot
name="body"
:text="text"
>
<p>{{ this.text }}</p> <p>{{ this.text }}</p>
</slot> </slot>
</div> </div>
...@@ -145,7 +148,8 @@ ...@@ -145,7 +148,8 @@
</div> </div>
<div <div
v-if="id !== ''" v-if="id !== ''"
class="modal-backdrop fade in"> class="modal-backdrop fade in"
>
</div> </div>
</div> </div>
</template> </template>
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