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

Prettify issue_show and jobs modules

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