Commit 9867eaf3 authored by Mike Greiling's avatar Mike Greiling

Prettify issue_show and jobs modules

parent 550f5574
<script>
import Visibility from 'visibilityjs';
import { visitUrl } from '../../lib/utils/url_utility';
import Poll from '../../lib/utils/poll';
import eventHub from '../event_hub';
import Service from '../services/index';
import Store from '../stores';
import titleComponent from './title.vue';
import descriptionComponent from './description.vue';
import editedComponent from './edited.vue';
import formComponent from './form.vue';
import recaptchaModalImplementor from '../../vue_shared/mixins/recaptcha_modal_implementor';
import Visibility from 'visibilityjs';
import { visitUrl } from '../../lib/utils/url_utility';
import Poll from '../../lib/utils/poll';
import eventHub from '../event_hub';
import Service from '../services/index';
import Store from '../stores';
import titleComponent from './title.vue';
import descriptionComponent from './description.vue';
import editedComponent from './edited.vue';
import formComponent from './form.vue';
import recaptchaModalImplementor from '../../vue_shared/mixins/recaptcha_modal_implementor';
export default {
export default {
components: {
descriptionComponent,
titleComponent,
editedComponent,
formComponent,
},
mixins: [
recaptchaModalImplementor,
],
mixins: [recaptchaModalImplementor],
props: {
endpoint: {
required: true,
......@@ -158,10 +156,8 @@
return !!this.state.updatedAt;
},
issueChanged() {
const descriptionChanged =
this.initialDescriptionText !== this.store.formState.description;
const titleChanged =
this.initialTitleText !== this.store.formState.title;
const descriptionChanged = this.initialDescriptionText !== this.store.formState.description;
const titleChanged = this.initialTitleText !== this.store.formState.title;
return descriptionChanged || titleChanged;
},
},
......@@ -227,10 +223,11 @@
},
updateIssuable() {
return this.service.updateIssuable(this.store.formState)
return this.service
.updateIssuable(this.store.formState)
.then(res => res.data)
.then(data => this.checkForSpam(data))
.then((data) => {
.then(data => {
if (window.location.pathname !== data.web_url) {
visitUrl(data.web_url);
}
......@@ -238,11 +235,11 @@
return this.service.getData();
})
.then(res => res.data)
.then((data) => {
.then(data => {
this.store.updateState(data);
eventHub.$emit('close.form');
})
.catch((error) => {
.catch(error => {
if (error && error.name === 'SpamError') {
this.openRecaptcha();
} else {
......@@ -261,9 +258,10 @@
},
deleteIssuable() {
this.service.deleteIssuable()
this.service
.deleteIssuable()
.then(res => res.data)
.then((data) => {
.then(data => {
// Stop the poll so we don't get 404's with the issuable not existing
this.poll.stop();
......@@ -275,7 +273,7 @@
});
},
},
};
};
</script>
<template>
......
<script>
import $ from 'jquery';
import animateMixin from '../mixins/animate';
import TaskList from '../../task_list';
import recaptchaModalImplementor from '../../vue_shared/mixins/recaptcha_modal_implementor';
import $ from 'jquery';
import animateMixin from '../mixins/animate';
import TaskList from '../../task_list';
import recaptchaModalImplementor from '../../vue_shared/mixins/recaptcha_modal_implementor';
export default {
mixins: [
animateMixin,
recaptchaModalImplementor,
],
export default {
mixins: [animateMixin, recaptchaModalImplementor],
props: {
canUpdate: {
......@@ -94,9 +91,7 @@
if (taskRegexMatches) {
$tasks.text(this.taskStatus);
$tasksShort.text(
`${taskRegexMatches[1]}/${taskRegexMatches[2]} task${taskRegexMatches[2] > 1 ?
's' :
''}`,
`${taskRegexMatches[1]}/${taskRegexMatches[2]} task${taskRegexMatches[2] > 1 ? 's' : ''}`,
);
} else {
$tasks.text('');
......@@ -104,7 +99,7 @@
}
},
},
};
};
</script>
<template>
......
<script>
import { __, sprintf } from '~/locale';
import updateMixin from '../mixins/update';
import eventHub from '../event_hub';
import { __, sprintf } from '~/locale';
import updateMixin from '../mixins/update';
import eventHub from '../event_hub';
const issuableTypes = {
const issuableTypes = {
issue: __('Issue'),
epic: __('Epic'),
};
};
export default {
export default {
mixins: [updateMixin],
props: {
canDestroy: {
......@@ -58,7 +58,7 @@
}
},
},
};
};
</script>
<template>
......
<script>
import timeAgoTooltip from '../../vue_shared/components/time_ago_tooltip.vue';
import timeAgoTooltip from '../../vue_shared/components/time_ago_tooltip.vue';
export default {
export default {
components: {
timeAgoTooltip,
},
......@@ -27,7 +27,7 @@
return this.updatedByName && this.updatedByPath;
},
},
};
};
</script>
<template>
......@@ -53,4 +53,3 @@
</span>
</small>
</template>
<script>
import updateMixin from '../../mixins/update';
import markdownField from '../../../vue_shared/components/markdown/field.vue';
import updateMixin from '../../mixins/update';
import markdownField from '../../../vue_shared/components/markdown/field.vue';
export default {
export default {
components: {
markdownField,
},
......@@ -39,7 +39,7 @@
mounted() {
this.$refs.textarea.focus();
},
};
};
</script>
<template>
......
<script>
import $ from 'jquery';
import IssuableTemplateSelectors from '../../../templates/issuable_template_selectors';
import $ from 'jquery';
import IssuableTemplateSelectors from '../../../templates/issuable_template_selectors';
export default {
export default {
props: {
formState: {
type: Object,
......@@ -30,7 +30,7 @@
mounted() {
// Create the editor for the template
const editor = document.querySelector('.detail-page-description .note-textarea') || {};
editor.setValue = (val) => {
editor.setValue = val => {
this.formState.description = val;
};
editor.getValue = () => this.formState.description;
......@@ -40,7 +40,7 @@
editor,
});
},
};
};
</script>
<template>
......
<script>
import updateMixin from '../../mixins/update';
import updateMixin from '../../mixins/update';
export default {
export default {
mixins: [updateMixin],
props: {
formState: {
......@@ -9,7 +9,7 @@
required: true,
},
},
};
};
</script>
<template>
......
<script>
import lockedWarning from './locked_warning.vue';
import titleField from './fields/title.vue';
import descriptionField from './fields/description.vue';
import editActions from './edit_actions.vue';
import descriptionTemplate from './fields/description_template.vue';
import lockedWarning from './locked_warning.vue';
import titleField from './fields/title.vue';
import descriptionField from './fields/description.vue';
import editActions from './edit_actions.vue';
import descriptionTemplate from './fields/description_template.vue';
export default {
export default {
components: {
lockedWarning,
titleField,
......@@ -73,7 +73,7 @@
return this.issuableTemplates.length;
},
},
};
};
</script>
<template>
......
<script>
export default {
export default {
computed: {
currentPath() {
return window.location.pathname;
},
},
};
};
</script>
<template>
......
......@@ -25,8 +25,10 @@ export default class Store {
}
stateShouldUpdate(data) {
return this.state.titleText !== data.title_text ||
this.state.descriptionText !== data.description_text;
return (
this.state.titleText !== data.title_text ||
this.state.descriptionText !== data.description_text
);
}
setFormState(state) {
......
<script>
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';
export default {
export default {
components: {
TimeagoTooltip,
},
mixins: [
timeagoMixin,
],
mixins: [timeagoMixin],
props: {
artifact: {
type: Object,
......@@ -24,7 +22,7 @@
return this.artifact.expired === false;
},
},
};
};
</script>
<template>
<div class="block">
......
<script>
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
export default {
export default {
components: {
ClipboardButton,
},
......@@ -20,7 +20,7 @@
required: true,
},
},
};
};
</script>
<template>
<div
......
<script>
export default {
export default {
props: {
illustrationPath: {
type: String,
......@@ -32,7 +32,7 @@
},
},
},
};
};
</script>
<template>
<div class="row empty-state">
......
<script>
import _ from 'underscore';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import { sprintf, __ } from '../../locale';
import _ from 'underscore';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import { sprintf, __ } from '../../locale';
export default {
export default {
components: {
CiIcon,
},
......@@ -107,7 +107,9 @@
return !_.isEmpty(this.deploymentStatus.environment);
},
lastDeploymentPath() {
return !_.isEmpty(this.lastDeployment.deployable) ? this.lastDeployment.deployable.build_path : '';
return !_.isEmpty(this.lastDeployment.deployable)
? this.lastDeployment.deployable.build_path
: '';
},
},
methods: {
......@@ -123,7 +125,7 @@
);
},
},
};
};
</script>
<template>
<div class="prepend-top-default js-environment-container">
......
<script>
import _ from 'underscore';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import _ from 'underscore';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
export default {
export default {
components: {
TimeagoTooltip,
},
......@@ -22,7 +22,7 @@
return !_.isEmpty(this.user);
},
},
};
};
</script>
<template>
<div class="prepend-top-default js-build-erased">
......
<script>
export default {
export default {
name: 'JobLog',
props: {
trace: {
......@@ -11,7 +11,7 @@
required: true,
},
},
};
};
</script>
<template>
<pre class="build-trace">
......
<script>
import { polyfillSticky } from '~/lib/utils/sticky';
import Icon from '~/vue_shared/components/icon.vue';
import tooltip from '~/vue_shared/directives/tooltip';
import { numberToHumanSize } from '~/lib/utils/number_utils';
import { sprintf } from '~/locale';
import { polyfillSticky } from '~/lib/utils/sticky';
import Icon from '~/vue_shared/components/icon.vue';
import tooltip from '~/vue_shared/directives/tooltip';
import { numberToHumanSize } from '~/lib/utils/number_utils';
import { sprintf } from '~/locale';
export default {
export default {
components: {
Icon,
},
......@@ -62,8 +62,7 @@
this.$emit('scrollJobLogBottom');
},
},
};
};
</script>
<template>
<div class="top-bar">
......
<script>
import _ from 'underscore';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import Icon from '~/vue_shared/components/icon.vue';
import tooltip from '~/vue_shared/directives/tooltip';
import _ from 'underscore';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import Icon from '~/vue_shared/components/icon.vue';
import tooltip from '~/vue_shared/directives/tooltip';
export default {
export default {
components: {
CiIcon,
Icon,
......@@ -30,7 +30,7 @@
return `${_.escape(job.name)} - ${job.status.tooltip}`;
},
},
};
};
</script>
<template>
<div class="js-jobs-container builds-container">
......
<script>
import _ from 'underscore';
import { mapActions, mapState } from 'vuex';
import timeagoMixin from '~/vue_shared/mixins/timeago';
import { timeIntervalInWords } from '~/lib/utils/datetime_utility';
import Icon from '~/vue_shared/components/icon.vue';
import DetailRow from './sidebar_detail_row.vue';
import ArtifactsBlock from './artifacts_block.vue';
import TriggerBlock from './trigger_block.vue';
import CommitBlock from './commit_block.vue';
import StagesDropdown from './stages_dropdown.vue';
import JobsContainer from './jobs_container.vue';
import _ from 'underscore';
import { mapActions, mapState } from 'vuex';
import timeagoMixin from '~/vue_shared/mixins/timeago';
import { timeIntervalInWords } from '~/lib/utils/datetime_utility';
import Icon from '~/vue_shared/components/icon.vue';
import DetailRow from './sidebar_detail_row.vue';
import ArtifactsBlock from './artifacts_block.vue';
import TriggerBlock from './trigger_block.vue';
import CommitBlock from './commit_block.vue';
import StagesDropdown from './stages_dropdown.vue';
import JobsContainer from './jobs_container.vue';
export default {
export default {
name: 'JobSidebar',
components: {
ArtifactsBlock,
......@@ -106,7 +106,7 @@
methods: {
...mapActions(['fetchJobsForStage']),
},
};
};
</script>
<template>
<aside
......
<script>
export default {
export default {
name: 'SidebarDetailRow',
props: {
title: {
......@@ -25,7 +25,7 @@
return this.helpUrl.length > 0;
},
},
};
};
</script>
<template>
<p class="build-detail-row">
......
<script>
import _ from 'underscore';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import Icon from '~/vue_shared/components/icon.vue';
import { __ } from '~/locale';
import _ from 'underscore';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import Icon from '~/vue_shared/components/icon.vue';
import { __ } from '~/locale';
export default {
export default {
components: {
CiIcon,
Icon,
......@@ -44,7 +44,7 @@
this.selectedStage = stage.name;
},
},
};
};
</script>
<template>
<div class="block-last dropdown">
......
<script>
export default {
export default {
props: {
trigger: {
type: Object,
......@@ -21,7 +21,7 @@
this.areVariablesVisible = true;
},
},
};
};
</script>
<template>
......
......@@ -7,9 +7,10 @@ import mutations from './mutations';
Vue.use(Vuex);
export default () => new Vuex.Store({
export default () =>
new Vuex.Store({
actions,
mutations,
getters,
state: 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