Commit cbdbb645 authored by Filipa Lacerda's avatar Filipa Lacerda

[ci skip] Fix more eslint rules

parent e9c6f58e
...@@ -41,12 +41,11 @@ ...@@ -41,12 +41,11 @@
"vue/html-self-closing": ["error", { "vue/html-self-closing": ["error", {
"html": { "html": {
"void": "always", "void": "always",
"normal": "any", "normal": "never",
"component": "always" "component": "always"
}, },
"svg": "always", "svg": "always",
"math": "any" "math": "always"
}] }]
} }
} }
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
props: { props: {
items: { items: {
type: Array, type: Array,
default: [] default: () => [],
}, },
stage: { stage: {
type: Object, type: Object,
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<a <a
:href="build.branch.url" :href="build.branch.url"
class="ref-name" class="ref-name"
> >
{{ build.branch.name }} {{ build.branch.name }}
</a> </a>
<span <span
......
...@@ -28,19 +28,19 @@ ...@@ -28,19 +28,19 @@
<span> <span>
{{ n__('Time|hr', 'Time|hrs', time.hours) }} {{ n__('Time|hr', 'Time|hrs', time.hours) }}
</span> </span>
</template> </template>
<template v-if="time.mins && !time.days"> <template v-if="time.mins && !time.days">
{{ time.mins }} {{ time.mins }}
<span> <span>
{{ n__('Time|min', 'Time|mins', time.mins) }} {{ n__('Time|min', 'Time|mins', time.mins) }}
</span> </span>
</template> </template>
<template v-if="time.seconds && hasData === 1 || time.seconds === 0"> <template v-if="time.seconds && hasData === 1 || time.seconds === 0">
{{ time.seconds }} {{ time.seconds }}
<span> <span>
{{ s__('Time|s') }} {{ s__('Time|s') }}
</span> </span>
</template> </template>
</template> </template>
<template v-else> <template v-else>
-- --
......
...@@ -474,18 +474,21 @@ ...@@ -474,18 +474,21 @@
</span> </span>
<span> <span>
{{model.folderName}} {{ model.folderName }}
</span> </span>
<span class="badge"> <span class="badge">
{{model.size}} {{ model.size }}
</span> </span>
</span> </span>
</div> </div>
<div class="table-section section-10 deployment-column hidden-xs hidden-sm" role="gridcell"> <div
class="table-section section-10 deployment-column hidden-xs hidden-sm"
role="gridcell"
>
<span v-if="shouldRenderDeploymentID"> <span v-if="shouldRenderDeploymentID">
{{deploymentInternalId}} {{ deploymentInternalId }}
</span> </span>
<span v-if="!model.isFolder && deploymentHasUser"> <span v-if="!model.isFolder && deploymentHasUser">
......
<script> <script>
/** /**
* Renders the Monitoring (Metrics) link in environments table. * Renders the Monitoring (Metrics) link in environments table.
*/ */
import tooltip from '../../vue_shared/directives/tooltip'; import tooltip from '../../vue_shared/directives/tooltip';
export default { export default {
props: { directives: {
monitoringUrl: { tooltip,
type: String,
required: true,
}, },
},
directives: { props: {
tooltip, monitoringUrl: {
}, type: String,
required: true,
},
},
computed: { computed: {
title() { title() {
return 'Monitoring'; return 'Monitoring';
},
}, },
}, };
};
</script> </script>
<template> <template>
<a <a
...@@ -31,10 +31,12 @@ export default { ...@@ -31,10 +31,12 @@ export default {
rel="noopener noreferrer nofollow" rel="noopener noreferrer nofollow"
:href="monitoringUrl" :href="monitoringUrl"
:title="title" :title="title"
:aria-label="title"> :aria-label="title"
>
<i <i
class="fa fa-area-chart" class="fa fa-area-chart"
aria-hidden="true" aria-hidden="true"
/> >
</i>
</a> </a>
</template> </template>
<script> <script>
/** /**
* Renders Rollback or Re deploy button in environments table depending * Renders Rollback or Re deploy button in environments table depending
* of the provided property `isLastDeployment`. * of the provided property `isLastDeployment`.
* *
* Makes a post request when the button is clicked. * Makes a post request when the button is clicked.
*/ */
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import loadingIcon from '../../vue_shared/components/loading_icon.vue'; import loadingIcon from '../../vue_shared/components/loading_icon.vue';
export default { export default {
props: { props: {
retryUrl: { retryUrl: {
type: String, type: String,
default: '', default: '',
},
isLastDeployment: {
type: Boolean,
default: true,
},
}, },
isLastDeployment: { components: {
type: Boolean, loadingIcon,
default: true,
}, },
},
components: { data() {
loadingIcon, return {
}, isLoading: false,
};
data() { },
return {
isLoading: false,
};
},
methods: { methods: {
onClick() { onClick() {
this.isLoading = true; this.isLoading = true;
eventHub.$emit('postAction', this.retryUrl); eventHub.$emit('postAction', this.retryUrl);
},
}, },
}, };
};
</script> </script>
<template> <template>
<button <button
type="button" type="button"
class="btn hidden-xs hidden-sm" class="btn hidden-xs hidden-sm"
@click="onClick" @click="onClick"
:disabled="isLoading"> :disabled="isLoading"
>
<span v-if="isLastDeployment"> <span v-if="isLastDeployment">
{{s__("Environments|Re-deploy")}} {{ s__("Environments|Re-deploy") }}
</span> </span>
<span v-else> <span v-else>
{{s__("Environments|Rollback")}} {{ s__("Environments|Rollback") }}
</span> </span>
<loading-icon v-if="isLoading" /> <loading-icon v-if="isLoading" />
......
<script> <script>
/** /**
* Renders the stop "button" that allows stop an environment. * Renders the stop "button" that allows stop an environment.
* Used in environments table. * Used in environments table.
*/ */
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import loadingIcon from '../../vue_shared/components/loading_icon.vue'; import loadingIcon from '../../vue_shared/components/loading_icon.vue';
import tooltip from '../../vue_shared/directives/tooltip'; import tooltip from '../../vue_shared/directives/tooltip';
export default { export default {
props: { components: {
stopUrl: { loadingIcon,
type: String,
default: '',
}, },
},
directives: { directives: {
tooltip, tooltip,
}, },
data() { props: {
return { stopUrl: {
isLoading: false, type: String,
}; default: '',
}, },
},
components: { data() {
loadingIcon, return {
}, isLoading: false,
};
},
computed: { computed: {
title() { title() {
return 'Stop'; return 'Stop';
},
}, },
},
methods: { methods: {
onClick() { onClick() {
// eslint-disable-next-line no-alert // eslint-disable-next-line no-alert
if (confirm('Are you sure you want to stop this environment?')) { if (confirm('Are you sure you want to stop this environment?')) {
this.isLoading = true; this.isLoading = true;
$(this.$el).tooltip('destroy'); $(this.$el).tooltip('destroy');
eventHub.$emit('postAction', this.stopUrl); eventHub.$emit('postAction', this.stopUrl);
} }
},
}, },
}, };
};
</script> </script>
<template> <template>
<button <button
...@@ -58,10 +58,13 @@ export default { ...@@ -58,10 +58,13 @@ export default {
@click="onClick" @click="onClick"
:disabled="isLoading" :disabled="isLoading"
:title="title" :title="title"
:aria-label="title"> :aria-label="title"
>
<i <i
class="fa fa-stop stop-env-icon" class="fa fa-stop stop-env-icon"
aria-hidden="true" /> aria-hidden="true"
>
</i>
<loading-icon v-if="isLoading" /> <loading-icon v-if="isLoading" />
</button> </button>
</template> </template>
<script> <script>
/** /**
* Renders a terminal button to open a web terminal. * Renders a terminal button to open a web terminal.
* Used in environments table. * Used in environments table.
*/ */
import terminalIconSvg from 'icons/_icon_terminal.svg'; import terminalIconSvg from 'icons/_icon_terminal.svg';
import tooltip from '../../vue_shared/directives/tooltip'; import tooltip from '../../vue_shared/directives/tooltip';
export default { export default {
props: { directives: {
terminalPath: { tooltip,
type: String,
required: false,
default: '',
}, },
},
directives: { props: {
tooltip, terminalPath: {
}, type: String,
required: false,
default: '',
},
},
data() { data() {
return { return {
terminalIconSvg, terminalIconSvg,
}; };
}, },
computed: { computed: {
title() { title() {
return 'Terminal'; return 'Terminal';
},
}, },
}, };
};
</script> </script>
<template> <template>
<a <a
...@@ -40,6 +40,7 @@ export default { ...@@ -40,6 +40,7 @@ export default {
:title="title" :title="title"
:aria-label="title" :aria-label="title"
:href="terminalPath" :href="terminalPath"
v-html="terminalIconSvg"> v-html="terminalIconSvg"
>
</a> </a>
</template> </template>
...@@ -7,6 +7,15 @@ ...@@ -7,6 +7,15 @@
import CIPaginationMixin from '../../vue_shared/mixins/ci_pagination_api_mixin'; import CIPaginationMixin from '../../vue_shared/mixins/ci_pagination_api_mixin';
export default { export default {
components: {
emptyState,
},
mixins: [
CIPaginationMixin,
environmentsMixin,
],
props: { props: {
endpoint: { endpoint: {
type: String, type: String,
...@@ -37,14 +46,6 @@ ...@@ -37,14 +46,6 @@
required: true, required: true,
}, },
}, },
components: {
emptyState,
},
mixins: [
CIPaginationMixin,
environmentsMixin,
],
created() { created() {
eventHub.$on('toggleFolder', this.toggleFolder); eventHub.$on('toggleFolder', this.toggleFolder);
...@@ -95,15 +96,17 @@ ...@@ -95,15 +96,17 @@
:tabs="tabs" :tabs="tabs"
@onChangeTab="onChangeTab" @onChangeTab="onChangeTab"
scope="environments" scope="environments"
/> />
<div <div
v-if="canCreateEnvironment && !isLoading" v-if="canCreateEnvironment && !isLoading"
class="nav-controls"> class="nav-controls"
>
<a <a
:href="newEnvironmentPath" :href="newEnvironmentPath"
class="btn btn-create"> class="btn btn-create"
{{s__("Environments|New environment")}} >
{{ s__("Environments|New environment") }}
</a> </a>
</div> </div>
</div> </div>
...@@ -122,7 +125,7 @@ ...@@ -122,7 +125,7 @@
:new-path="newEnvironmentPath" :new-path="newEnvironmentPath"
:help-path="helpPagePath" :help-path="helpPagePath"
:can-create-environment="canCreateEnvironment" :can-create-environment="canCreateEnvironment"
/> />
</container> </container>
</div> </div>
</template> </template>
...@@ -39,33 +39,55 @@ export default { ...@@ -39,33 +39,55 @@ export default {
}; };
</script> </script>
<template> <template>
<div class="ci-table" role="grid"> <div
<div class="gl-responsive-table-row table-row-header" role="row"> class="ci-table"
<div class="table-section section-10 environments-name" role="columnheader"> role="grid"
{{s__("Environments|Environment")}} >
<div
class="gl-responsive-table-row table-row-header"
role="row"
>
<div
class="table-section section-10 environments-name"
role="columnheader"
>
{{ s__("Environments|Environment") }}
</div> </div>
<div class="table-section section-10 environments-deploy" role="columnheader"> <div
{{s__("Environments|Deployment")}} class="table-section section-10 environments-deploy"
role="columnheader"
>
{{ s__("Environments|Deployment") }}
</div> </div>
<div class="table-section section-15 environments-build" role="columnheader"> <div
{{s__("Environments|Job")}} class="table-section section-15 environments-build"
role="columnheader"
>
{{ s__("Environments|Job") }}
</div> </div>
<div class="table-section section-25 environments-commit" role="columnheader"> <div
{{s__("Environments|Commit")}} class="table-section section-25 environments-commit"
role="columnheader"
>
{{ s__("Environments|Commit") }}
</div> </div>
<div class="table-section section-10 environments-date" role="columnheader"> <div
{{s__("Environments|Updated")}} class="table-section section-10 environments-date"
role="columnheader"
>
{{ s__("Environments|Updated") }}
</div> </div>
</div> </div>
<template <template
v-for="model in environments" v-for="(model, i) in environments"
v-bind:model="model"> :key="i"
: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"
/> />
<template v-if="model.isFolder && model.isOpen && model.children && model.children.length > 0"> <template v-if="model.isFolder && model.isOpen && model.children && model.children.length > 0">
<div v-if="model.isLoadingFolderContent"> <div v-if="model.isLoadingFolderContent">
...@@ -79,14 +101,15 @@ export default { ...@@ -79,14 +101,15 @@ export default {
:model="children" :model="children"
:can-create-deployment="canCreateDeployment" :can-create-deployment="canCreateDeployment"
:can-read-environment="canReadEnvironment" :can-read-environment="canReadEnvironment"
/> />
<div> <div>
<div class="text-center prepend-top-10"> <div class="text-center prepend-top-10">
<a <a
:href="folderUrl(model)" :href="folderUrl(model)"
class="btn btn-default"> class="btn btn-default"
{{s__("Environments|Show all")}} >
{{ s__("Environments|Show all") }}
</a> </a>
</div> </div>
</div> </div>
......
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
import CIPaginationMixin from '../../vue_shared/mixins/ci_pagination_api_mixin'; import CIPaginationMixin from '../../vue_shared/mixins/ci_pagination_api_mixin';
export default { export default {
mixins: [
environmentsMixin,
CIPaginationMixin,
],
props: { props: {
endpoint: { endpoint: {
type: String, type: String,
...@@ -25,10 +29,6 @@ ...@@ -25,10 +29,6 @@
required: true, required: true,
}, },
}, },
mixins: [
environmentsMixin,
CIPaginationMixin,
],
methods: { methods: {
successCallback(resp) { successCallback(resp) {
this.saveData(resp); this.saveData(resp);
...@@ -40,17 +40,18 @@ ...@@ -40,17 +40,18 @@
<div :class="cssContainerClass"> <div :class="cssContainerClass">
<div <div
class="top-area" class="top-area"
v-if="!isLoading"> v-if="!isLoading"
>
<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
:tabs="tabs" :tabs="tabs"
@onChangeTab="onChangeTab" @onChangeTab="onChangeTab"
scope="environments" scope="environments"
/> />
</div> </div>
<container <container
......
...@@ -42,6 +42,26 @@ export default { ...@@ -42,6 +42,26 @@ export default {
return this.store.getPaginationInfo(); return this.store.getPaginationInfo();
}, },
}, },
created() {
this.searchEmptyMessage = this.hideProjects ?
COMMON_STR.GROUP_SEARCH_EMPTY : COMMON_STR.GROUP_PROJECT_SEARCH_EMPTY;
eventHub.$on('fetchPage', this.fetchPage);
eventHub.$on('toggleChildren', this.toggleChildren);
eventHub.$on('leaveGroup', this.leaveGroup);
eventHub.$on('updatePagination', this.updatePagination);
eventHub.$on('updateGroups', this.updateGroups);
},
mounted() {
this.fetchAllGroups();
},
beforeDestroy() {
eventHub.$off('fetchPage', this.fetchPage);
eventHub.$off('toggleChildren', this.toggleChildren);
eventHub.$off('leaveGroup', this.leaveGroup);
eventHub.$off('updatePagination', this.updatePagination);
eventHub.$off('updateGroups', this.updateGroups);
},
methods: { methods: {
fetchGroups({ parentId, page, filterGroupsBy, sortBy, archived, updatePagination }) { fetchGroups({ parentId, page, filterGroupsBy, sortBy, archived, updatePagination }) {
return this.service.getGroups(parentId, page, filterGroupsBy, sortBy, archived) return this.service.getGroups(parentId, page, filterGroupsBy, sortBy, archived)
...@@ -152,26 +172,6 @@ export default { ...@@ -152,26 +172,6 @@ export default {
} }
}, },
}, },
created() {
this.searchEmptyMessage = this.hideProjects ?
COMMON_STR.GROUP_SEARCH_EMPTY : COMMON_STR.GROUP_PROJECT_SEARCH_EMPTY;
eventHub.$on('fetchPage', this.fetchPage);
eventHub.$on('toggleChildren', this.toggleChildren);
eventHub.$on('leaveGroup', this.leaveGroup);
eventHub.$on('updatePagination', this.updatePagination);
eventHub.$on('updateGroups', this.updateGroups);
},
mounted() {
this.fetchAllGroups();
},
beforeDestroy() {
eventHub.$off('fetchPage', this.fetchPage);
eventHub.$off('toggleChildren', this.toggleChildren);
eventHub.$off('leaveGroup', this.leaveGroup);
eventHub.$off('updatePagination', this.updatePagination);
eventHub.$off('updateGroups', this.updateGroups);
},
}; };
</script> </script>
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
return n__( return n__(
'One more item', 'One more item',
'%d more items', '%d more items',
this.parentGroup.childrenCount - this.parentGroup.children.length this.parentGroup.childrenCount - this.parentGroup.children.length,
); );
}, },
}, },
...@@ -47,8 +47,9 @@ export default { ...@@ -47,8 +47,9 @@ export default {
<i <i
class="fa fa-external-link" class="fa fa-external-link"
aria-hidden="true" aria-hidden="true"
/> >
{{moreChildrenStats}} </i>
{{ moreChildrenStats }}
</a> </a>
</li> </li>
</ul> </ul>
......
<script> <script>
import { visitUrl } from '../../lib/utils/url_utility'; import { visitUrl } from '../../lib/utils/url_utility';
import tooltip from '../../vue_shared/directives/tooltip'; import tooltip from '../../vue_shared/directives/tooltip';
import identicon from '../../vue_shared/components/identicon.vue'; import identicon from '../../vue_shared/components/identicon.vue';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import itemCaret from './item_caret.vue'; import itemCaret from './item_caret.vue';
import itemTypeIcon from './item_type_icon.vue'; import itemTypeIcon from './item_type_icon.vue';
import itemStats from './item_stats.vue'; import itemStats from './item_stats.vue';
import itemActions from './item_actions.vue'; import itemActions from './item_actions.vue';
export default { export default {
directives: { directives: {
tooltip, tooltip,
},
components: {
identicon,
itemCaret,
itemTypeIcon,
itemStats,
itemActions,
},
props: {
parentGroup: {
type: Object,
required: false,
default: () => ({}),
}, },
group: { components: {
type: Object, identicon,
required: true, itemCaret,
itemTypeIcon,
itemStats,
itemActions,
}, },
}, props: {
computed: { parentGroup: {
groupDomId() { type: Object,
return `group-${this.group.id}`; required: false,
default: () => ({}),
},
group: {
type: Object,
required: true,
},
}, },
rowClass() { computed: {
return { groupDomId() {
'is-open': this.group.isOpen, return `group-${this.group.id}`;
'has-children': this.hasChildren, },
'has-description': this.group.description, rowClass() {
'being-removed': this.group.isBeingRemoved, return {
}; 'is-open': this.group.isOpen,
'has-children': this.hasChildren,
'has-description': this.group.description,
'being-removed': this.group.isBeingRemoved,
};
},
hasChildren() {
return this.group.childrenCount > 0;
},
hasAvatar() {
return this.group.avatarUrl !== null;
},
isGroup() {
return this.group.type === 'group';
},
}, },
hasChildren() { methods: {
return this.group.childrenCount > 0; onClickRowGroup(e) {
}, const NO_EXPAND_CLS = 'no-expand';
hasAvatar() { if (!(e.target.classList.contains(NO_EXPAND_CLS) ||
return this.group.avatarUrl !== null; e.target.parentElement.classList.contains(NO_EXPAND_CLS))) {
}, if (this.hasChildren) {
isGroup() { eventHub.$emit('toggleChildren', this.group);
return this.group.type === 'group'; } else {
}, visitUrl(this.group.relativePath);
}, }
methods: {
onClickRowGroup(e) {
const NO_EXPAND_CLS = 'no-expand';
if (!(e.target.classList.contains(NO_EXPAND_CLS) ||
e.target.parentElement.classList.contains(NO_EXPAND_CLS))) {
if (this.hasChildren) {
eventHub.$emit('toggleChildren', this.group);
} else {
visitUrl(this.group.relativePath);
} }
} },
}, },
}, };
};
</script> </script>
<template> <template>
...@@ -75,7 +75,7 @@ export default { ...@@ -75,7 +75,7 @@ export default {
:id="groupDomId" :id="groupDomId"
:class="rowClass" :class="rowClass"
class="group-row" class="group-row"
> >
<div <div
class="group-row-contents" class="group-row-contents"
:class="{ 'project-row-contents': !isGroup }"> :class="{ 'project-row-contents': !isGroup }">
...@@ -84,14 +84,10 @@ export default { ...@@ -84,14 +84,10 @@ export default {
:group="group" :group="group"
:parent-group="parentGroup" :parent-group="parentGroup"
/> />
<item-stats <item-stats :item="group" />
:item="group"
/>
<div <div
class="folder-toggle-wrap"> class="folder-toggle-wrap">
<item-caret <item-caret :is-group-open="group.isOpen" />
:is-group-open="group.isOpen"
/>
<item-type-icon <item-type-icon
:item-type="group.type" :item-type="group.type"
:is-group-open="group.isOpen" :is-group-open="group.isOpen"
...@@ -113,7 +109,7 @@ export default { ...@@ -113,7 +109,7 @@ export default {
<identicon <identicon
v-else v-else
size-class="s24" size-class="s24"
:entity-id=group.id :entity-id="group.id"
:entity-name="group.name" :entity-name="group.name"
/> />
</a> </a>
...@@ -135,13 +131,13 @@ export default { ...@@ -135,13 +131,13 @@ export default {
v-if="group.permission" v-if="group.permission"
class="user-access-role" class="user-access-role"
> >
{{group.permission}} {{ group.permission }}
</span> </span>
</div> </div>
<div <div
v-if="group.description" v-if="group.description"
class="description"> class="description">
{{group.description}} {{ group.description }}
</div> </div>
</div> </div>
<group-folder <group-folder
......
...@@ -20,6 +20,38 @@ export default { ...@@ -20,6 +20,38 @@ export default {
}); });
} }
}, },
computed: {
...mapGetters([
'activeFile',
'activeFileExtension',
]),
...mapState([
'leftPanelCollapsed',
'rightPanelCollapsed',
'panelResizing',
]),
shouldHideEditor() {
return this.activeFile.binary && !this.activeFile.raw;
},
},
watch: {
activeFile(oldVal, newVal) {
if (newVal && !newVal.active) {
this.initMonaco();
}
},
leftPanelCollapsed() {
this.editor.updateDimensions();
},
rightPanelCollapsed() {
this.editor.updateDimensions();
},
panelResizing(isResizing) {
if (isResizing === false) {
this.editor.updateDimensions();
}
},
},
methods: { methods: {
...mapActions([ ...mapActions([
'getRawFileData', 'getRawFileData',
...@@ -78,38 +110,6 @@ export default { ...@@ -78,38 +110,6 @@ export default {
}); });
}, },
}, },
watch: {
activeFile(oldVal, newVal) {
if (newVal && !newVal.active) {
this.initMonaco();
}
},
leftPanelCollapsed() {
this.editor.updateDimensions();
},
rightPanelCollapsed() {
this.editor.updateDimensions();
},
panelResizing(isResizing) {
if (isResizing === false) {
this.editor.updateDimensions();
}
},
},
computed: {
...mapGetters([
'activeFile',
'activeFileExtension',
]),
...mapState([
'leftPanelCollapsed',
'rightPanelCollapsed',
'panelResizing',
]),
shouldHideEditor() {
return this.activeFile.binary && !this.activeFile.raw;
},
},
}; };
</script> </script>
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
import fileIcon from '../../vue_shared/components/file_icon.vue'; import fileIcon from '../../vue_shared/components/file_icon.vue';
export default { export default {
mixins: [
timeAgoMixin,
],
components: { components: {
skeletonLoadingContainer, skeletonLoadingContainer,
newDropdown, newDropdown,
fileIcon, fileIcon,
}, },
mixins: [
timeAgoMixin,
],
props: { props: {
file: { file: {
type: Object, type: Object,
...@@ -99,8 +99,7 @@ ...@@ -99,8 +99,7 @@
:opened="file.opened" :opened="file.opened"
:style="levelIndentation" :style="levelIndentation"
:size="16" :size="16"
> />
</file-icon>
{{ file.name }} {{ file.name }}
</a> </a>
<new-dropdown <new-dropdown
...@@ -108,7 +107,8 @@ ...@@ -108,7 +107,8 @@
:project-id="file.projectId" :project-id="file.projectId"
:branch="file.branchId" :branch="file.branchId"
:path="file.path" :path="file.path"
:parent="file"/> :parent="file"
/>
<i <i
class="fa" class="fa"
v-if="changedClass" v-if="changedClass"
......
...@@ -25,15 +25,13 @@ ...@@ -25,15 +25,13 @@
/> />
</td> </td>
<template v-if="!leftPanelCollapsed"> <template v-if="!leftPanelCollapsed">
<td <td class="hidden-sm hidden-xs">
class="hidden-sm hidden-xs">
<skeleton-loading-container <skeleton-loading-container
:small="true" :small="true"
/> />
</td> </td>
<td <td class="hidden-xs">
class="hidden-xs">
<skeleton-loading-container <skeleton-loading-container
class="animation-container-right" class="animation-container-right"
:small="true" :small="true"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<h4>{{ name }}</h4> <h4>{{ name }}</h4>
</div> </div>
<div class="panel-body prometheus-graph-group"> <div class="panel-body prometheus-graph-group">
<slot /> <slot></slot>
</div> </div>
</div> </div>
</template> </template>
...@@ -45,24 +45,26 @@ ...@@ -45,24 +45,26 @@
<canvas <canvas
class="pdf-page" class="pdf-page"
ref="canvas" ref="canvas"
:data-page="number" /> :data-page="number"
>
</canvas>
</template> </template>
<style> <style>
.pdf-page { .pdf-page {
margin: 8px auto 0 auto; margin: 8px auto 0 auto;
border-top: 1px #ddd solid; border-top: 1px #ddd solid;
border-bottom: 1px #ddd solid; border-bottom: 1px #ddd solid;
width: 100%; width: 100%;
} }
.pdf-page:first-child { .pdf-page:first-child {
margin-top: 0px; margin-top: 0px;
border-top: 0px; border-top: 0px;
} }
.pdf-page:last-child { .pdf-page:last-child {
margin-bottom: 0px; margin-bottom: 0px;
border-bottom: 0px; border-bottom: 0px;
} }
</style> </style>
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
import csrf from '~/lib/utils/csrf'; import csrf from '~/lib/utils/csrf';
export default { export default {
components: {
modal,
},
props: { props: {
actionUrl: { actionUrl: {
type: String, type: String,
...@@ -24,9 +27,6 @@ ...@@ -24,9 +27,6 @@
enteredUsername: '', enteredUsername: '',
}; };
}, },
components: {
modal,
},
computed: { computed: {
csrfToken() { csrfToken() {
return csrf.token; return csrf.token;
...@@ -85,7 +85,9 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`), ...@@ -85,7 +85,9 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
@submit="onSubmit" @submit="onSubmit"
:submit-disabled="!canSubmit()"> :submit-disabled="!canSubmit()">
<template slot="body" slot-scope="props"> <template
slot="body"
slot-scope="props">
<p v-html="props.text"></p> <p v-html="props.text"></p>
<form <form
...@@ -96,13 +98,19 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`), ...@@ -96,13 +98,19 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
<input <input
type="hidden" type="hidden"
name="_method" name="_method"
value="delete" /> value="delete"
/>
<input <input
type="hidden" type="hidden"
name="authenticity_token" name="authenticity_token"
:value="csrfToken" /> :value="csrfToken"
/>
<p id="input-label" v-html="inputLabel"></p> <p
id="input-label"
v-html="inputLabel"
>
</p>
<input <input
v-if="confirmWithPassword" v-if="confirmWithPassword"
...@@ -110,14 +118,16 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`), ...@@ -110,14 +118,16 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
class="form-control" class="form-control"
type="password" type="password"
v-model="enteredPassword" v-model="enteredPassword"
aria-labelledby="input-label" /> aria-labelledby="input-label"
/>
<input <input
v-else v-else
name="username" name="username"
class="form-control" class="form-control"
type="text" type="text"
v-model="enteredUsername" v-model="enteredUsername"
aria-labelledby="input-label" /> aria-labelledby="input-label"
/>
</form> </form>
</template> </template>
......
...@@ -46,6 +46,6 @@ ...@@ -46,6 +46,6 @@
> >
{{ helpText }} {{ helpText }}
</span> </span>
<slot /> <slot></slot>
</div> </div>
</template> </template>
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
v-if="!searchQuery" v-if="!searchQuery"
class="search-icon fa fa-fw fa-search" class="search-icon fa fa-fw fa-search"
aria-hidden="true" aria-hidden="true"
/> >
</i>
</div> </div>
</template> </template>
...@@ -20,10 +20,12 @@ ...@@ -20,10 +20,12 @@
hasCi: { hasCi: {
type: Boolean, type: Boolean,
required: false, required: false,
default: false,
}, },
ciStatus: { ciStatus: {
type: String, type: String,
required: false, required: false,
default: '',
}, },
}, },
computed: { computed: {
...@@ -31,7 +33,7 @@ ...@@ -31,7 +33,7 @@
return this.pipeline && Object.keys(this.pipeline).length > 0; return this.pipeline && Object.keys(this.pipeline).length > 0;
}, },
hasCIError() { hasCIError() {
return this.hasCi && !this.ciStatus; return this.hasCi && this.ciStatus !== '';
}, },
status() { status() {
return this.pipeline.details && return this.pipeline.details &&
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
export default { export default {
name: 'MRWidgetRebase', name: 'MRWidgetRebase',
components: {
statusIcon,
loadingIcon,
},
props: { props: {
mr: { mr: {
type: Object, type: Object,
...@@ -17,10 +21,6 @@ ...@@ -17,10 +21,6 @@
required: true, required: true,
}, },
}, },
components: {
statusIcon,
loadingIcon,
},
data() { data() {
return { return {
isMakingRequest: false, isMakingRequest: false,
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
<status-icon <status-icon
:status="status" :status="status"
:show-disabled-button="showDisabledButton" :show-disabled-button="showDisabledButton"
/> />
<div class="rebase-state-find-class-convention media media-body space-children"> <div class="rebase-state-find-class-convention media media-body space-children">
<template v-if="mr.rebaseInProgress || isMakingRequest"> <template v-if="mr.rebaseInProgress || isMakingRequest">
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<span class="bold"> <span class="bold">
Fast-forward merge is not possible. Fast-forward merge is not possible.
Rebase the source branch onto Rebase the source branch onto
<span class="label-branch">{{mr.targetBranch}}</span> <span class="label-branch">{{ mr.targetBranch }}</span>
to allow this merge request to be merged. to allow this merge request to be merged.
</span> </span>
</template> </template>
...@@ -110,13 +110,15 @@ ...@@ -110,13 +110,15 @@
type="button" type="button"
class="btn btn-sm btn-reopen btn-success" class="btn btn-sm btn-reopen btn-success"
:disabled="isMakingRequest" :disabled="isMakingRequest"
@click="rebase"> @click="rebase"
>
<loading-icon v-if="isMakingRequest" /> <loading-icon v-if="isMakingRequest" />
Rebase Rebase
</button> </button>
<span <span
v-if="!rebasingError" v-if="!rebasingError"
class="bold"> class="bold"
>
Fast-forward merge is not possible. Fast-forward merge is not possible.
Rebase the source branch onto the target branch or merge target Rebase the source branch onto the target branch or merge target
branch into source branch to allow this merge request to be merged. branch into source branch to allow this merge request to be merged.
...@@ -124,7 +126,7 @@ ...@@ -124,7 +126,7 @@
<span <span
v-else v-else
class="bold danger"> class="bold danger">
{{rebasingError}} {{ rebasingError }}
</span> </span>
</div> </div>
</template> </template>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* </expand-button> * </expand-button>
*/ */
export default { export default {
name: 'expandButton', name: 'ExpandButton',
data() { data() {
return { return {
isCollapsed: true, isCollapsed: true,
......
<script> <script>
export default { export default {
name: 'modal', name: 'Modal',
props: { props: {
id: { id: {
type: String, type: String,
required: false, required: false,
default: '',
},
title: {
type: String,
required: false,
default: '',
},
text: {
type: String,
required: false,
default: '',
},
hideFooter: {
type: Boolean,
required: false,
default: false,
},
kind: {
type: String,
required: false,
default: 'primary',
},
modalDialogClass: {
type: String,
required: false,
default: '',
},
closeKind: {
type: String,
required: false,
default: 'default',
},
closeButtonLabel: {
type: String,
required: false,
default: 'Cancel',
},
primaryButtonLabel: {
type: String,
required: false,
default: '',
},
submitDisabled: {
type: Boolean,
required: false,
default: false,
},
}, },
title: {
type: String,
required: false,
},
text: {
type: String,
required: false,
},
hideFooter: {
type: Boolean,
required: false,
default: false,
},
kind: {
type: String,
required: false,
default: 'primary',
},
modalDialogClass: {
type: String,
required: false,
default: '',
},
closeKind: {
type: String,
required: false,
default: 'default',
},
closeButtonLabel: {
type: String,
required: false,
default: 'Cancel',
},
primaryButtonLabel: {
type: String,
required: false,
default: '',
},
submitDisabled: {
type: Boolean,
required: false,
default: false,
},
},
computed: { computed: {
btnKindClass() { btnKindClass() {
return { return {
[`btn-${this.kind}`]: true, [`btn-${this.kind}`]: true,
}; };
},
btnCancelKindClass() {
return {
[`btn-${this.closeKind}`]: true,
};
},
}, },
btnCancelKindClass() {
return {
[`btn-${this.closeKind}`]: true,
};
},
},
methods: { methods: {
emitCancel(event) { emitCancel(event) {
this.$emit('cancel', event); this.$emit('cancel', event);
}, },
emitSubmit(event) { emitSubmit(event) {
this.$emit('submit', event); this.$emit('submit', event);
},
}, },
}, };
};
</script> </script>
<template> <template>
<div class="modal-open"> <div class="modal-open">
<div
:id="id"
class="modal"
:class="id ? '' : 'show'"
role="dialog"
tabindex="-1"
>
<div <div
:class="modalDialogClass" :id="id"
class="modal-dialog" class="modal"
role="document" :class="id !== '' ? '' : 'show'"
role="dialog"
tabindex="-1"
> >
<div class="modal-content"> <div
<div class="modal-header"> :class="modalDialogClass"
<slot name="header"> class="modal-dialog"
<h4 class="modal-title pull-left"> role="document"
{{this.title}} >
</h4> <div class="modal-content">
<div class="modal-header">
<slot name="header">
<h4 class="modal-title pull-left">
{{ this.title }}
</h4>
<button
type="button"
class="close pull-right"
@click="emitCancel($event)"
data-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button>
</slot>
</div>
<div class="modal-body">
<slot name="body" :text="text">
<p>{{ this.text }}</p>
</slot>
</div>
<div
class="modal-footer"
v-if="!hideFooter"
>
<button <button
type="button" type="button"
class="close pull-right" class="btn pull-left"
:class="btnCancelKindClass"
@click="emitCancel($event)" @click="emitCancel($event)"
data-dismiss="modal" data-dismiss="modal"
aria-label="Close"
> >
<span aria-hidden="true">&times;</span> {{ closeButtonLabel }}
</button> </button>
</slot> <button
</div> v-if="primaryButtonLabel"
<div class="modal-body"> type="button"
<slot name="body" :text="text"> class="btn pull-right js-primary-button"
<p>{{this.text}}</p> :disabled="submitDisabled"
</slot> :class="btnKindClass"
</div> @click="emitSubmit($event)"
<div class="modal-footer" v-if="!hideFooter"> data-dismiss="modal"
<button >
type="button" {{ primaryButtonLabel }}
class="btn pull-left" </button>
:class="btnCancelKindClass" </div>
@click="emitCancel($event)"
data-dismiss="modal">
{{ closeButtonLabel }}
</button>
<button
v-if="primaryButtonLabel"
type="button"
class="btn pull-right js-primary-button"
:disabled="submitDisabled"
:class="btnKindClass"
@click="emitSubmit($event)"
data-dismiss="modal">
{{ primaryButtonLabel }}
</button>
</div> </div>
</div> </div>
</div> </div>
<div
v-if="id !== ''"
class="modal-backdrop fade in">
</div>
</div> </div>
<div
v-if="!id"
class="modal-backdrop fade in">
</div>
</div>
</template> </template>
<script> <script>
import modal from './modal.vue'; import modal from './modal.vue';
export default { export default {
name: 'recaptcha-modal', name: 'RecaptchaModal',
props: { components: {
html: { modal,
type: String,
required: false,
default: '',
}, },
},
data() { props: {
return { html: {
script: {}, type: String,
scriptSrc: 'https://www.google.com/recaptcha/api.js', required: false,
}; default: '',
}, },
},
components: { data() {
modal, return {
}, script: {},
scriptSrc: 'https://www.google.com/recaptcha/api.js',
};
},
methods: { watch: {
appendRecaptchaScript() { html() {
this.removeRecaptchaScript(); this.appendRecaptchaScript();
},
},
const script = document.createElement('script'); mounted() {
script.src = this.scriptSrc; window.recaptchaDialogCallback = this.submit.bind(this);
script.classList.add('js-recaptcha-script'); },
script.async = true;
script.defer = true;
this.script = script; methods: {
appendRecaptchaScript() {
this.removeRecaptchaScript();
document.body.appendChild(script); const script = document.createElement('script');
}, script.src = this.scriptSrc;
script.classList.add('js-recaptcha-script');
script.async = true;
script.defer = true;
removeRecaptchaScript() { this.script = script;
if (this.script instanceof Element) this.script.remove();
},
close() { document.body.appendChild(script);
this.removeRecaptchaScript(); },
this.$emit('close');
},
submit() { removeRecaptchaScript() {
this.$el.querySelector('form').submit(); if (this.script instanceof Element) this.script.remove();
}, },
},
watch: { close() {
html() { this.removeRecaptchaScript();
this.appendRecaptchaScript(); this.$emit('close');
}, },
},
mounted() { submit() {
window.recaptchaDialogCallback = this.submit.bind(this); this.$el.querySelector('form').submit();
}, },
}; },
};
</script> </script>
<template> <template>
<modal <modal
kind="warning" kind="warning"
class="recaptcha-modal js-recaptcha-modal" class="recaptcha-modal js-recaptcha-modal"
:hide-footer="true" :hide-footer="true"
:title="__('Please solve the reCAPTCHA')" :title="__('Please solve the reCAPTCHA')"
@cancel="close" @cancel="close"
> >
<div slot="body"> <div slot="body">
<p> <p>
{{__('We want to be sure it is you, please confirm you are not a robot.')}} {{ __('We want to be sure it is you, please confirm you are not a robot.') }}
</p> </p>
<div <div
ref="recaptcha" ref="recaptcha"
v-html="html" v-html="html"
></div> >
</div> </div>
</modal> </div>
</modal>
</template> </template>
...@@ -24,7 +24,11 @@ ...@@ -24,7 +24,11 @@
<i <i
aria-label="toggle collapse" aria-label="toggle collapse"
class="fa" class="fa"
:class="{ 'fa-angle-double-right': !collapsed, 'fa-angle-double-left': collapsed }" :class="{
/> 'fa-angle-double-right': !collapsed,
'fa-angle-double-left': collapsed
}"
>
</i>
</button> </button>
</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