Commit 1e48b7ee authored by Phil Hughes's avatar Phil Hughes

removed need for jobs component

parent 4b461893
<script> <script>
import { mapState } from 'vuex';
import LoadingIcon from '../../../vue_shared/components/loading_icon.vue'; import LoadingIcon from '../../../vue_shared/components/loading_icon.vue';
import Stage from './stage.vue'; import Stage from './stage.vue';
...@@ -13,9 +12,10 @@ export default { ...@@ -13,9 +12,10 @@ export default {
type: Array, type: Array,
required: true, required: true,
}, },
loading: {
type: Boolean,
required: true,
}, },
computed: {
...mapState('pipelines', ['isLoadingJobs']),
}, },
}; };
</script> </script>
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
<template> <template>
<div> <div>
<loading-icon <loading-icon
v-if="isLoadingJobs && !stages.length" v-if="loading && !stages.length"
class="prepend-top-default" class="prepend-top-default"
size="2" size="2"
/> />
......
...@@ -31,6 +31,12 @@ export default { ...@@ -31,6 +31,12 @@ export default {
collapseIcon() { collapseIcon() {
return this.stage.isCollapsed ? 'angle-left' : 'angle-down'; return this.stage.isCollapsed ? 'angle-left' : 'angle-down';
}, },
showLoadingIcon() {
return this.stage.isLoading && !this.stage.jobs.length;
},
jobsCount() {
return this.stage.jobs.length;
},
}, },
created() { created() {
this.fetchJobs(this.stage); this.fetchJobs(this.stage);
...@@ -69,7 +75,7 @@ export default { ...@@ -69,7 +75,7 @@ export default {
</strong> </strong>
<div class="append-right-8"> <div class="append-right-8">
<span class="badge"> <span class="badge">
{{ stage.jobs.length }} {{ jobsCount }}
</span> </span>
</div> </div>
<icon <icon
...@@ -82,7 +88,7 @@ export default { ...@@ -82,7 +88,7 @@ export default {
v-show="!stage.isCollapsed" v-show="!stage.isCollapsed"
> >
<loading-icon <loading-icon
v-if="stage.isLoading && !stage.jobs.length" v-if="showLoadingIcon"
/> />
<template v-else> <template v-else>
<item <item
......
<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import Tabs from '../../../vue_shared/components/tabs/tabs';
import Tab from '../../../vue_shared/components/tabs/tab.vue';
import JobsList from '../jobs/list.vue';
export default {
components: {
Tabs,
Tab,
JobsList,
},
computed: {
...mapGetters('pipelines', ['jobsCount', 'failedJobsCount', 'failedStages']),
...mapState('pipelines', ['stages', 'isLoadingJobs']),
},
created() {
this.fetchStages();
},
methods: {
...mapActions('pipelines', ['fetchStages']),
},
};
</script>
<template>
<div>
<tabs>
<tab active>
<template slot="title">
Jobs
<span
v-if="!isLoadingJobs || jobsCount"
class="badge"
>
{{ jobsCount }}
</span>
</template>
<jobs-list
:stages="stages"
/>
</tab>
<tab>
<template slot="title">
Failed Jobs
<span
v-if="!isLoadingJobs || failedJobsCount"
class="badge"
>
{{ failedJobsCount }}
</span>
</template>
<jobs-list
:stages="failedStages"
/>
</tab>
</tabs>
</div>
</template>
...@@ -2,17 +2,22 @@ ...@@ -2,17 +2,22 @@
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import LoadingIcon from '../../../vue_shared/components/loading_icon.vue'; import LoadingIcon from '../../../vue_shared/components/loading_icon.vue';
import CiIcon from '../../../vue_shared/components/ci_icon.vue'; import CiIcon from '../../../vue_shared/components/ci_icon.vue';
import JobsList from './jobs.vue'; import Tabs from '../../../vue_shared/components/tabs/tabs';
import Tab from '../../../vue_shared/components/tabs/tab.vue';
import JobsList from '../jobs/list.vue';
export default { export default {
components: { components: {
LoadingIcon, LoadingIcon,
CiIcon, CiIcon,
Tabs,
Tab,
JobsList, JobsList,
}, },
computed: { computed: {
...mapGetters(['currentProject']), ...mapGetters(['currentProject']),
...mapState('pipelines', ['isLoadingPipeline', 'latestPipeline']), ...mapGetters('pipelines', ['jobsCount', 'failedJobsCount', 'failedStages']),
...mapState('pipelines', ['isLoadingPipeline', 'latestPipeline', 'stages', 'isLoadingJobs']),
statusIcon() { statusIcon() {
return { return {
group: this.latestPipeline.status, group: this.latestPipeline.status,
...@@ -21,10 +26,10 @@ export default { ...@@ -21,10 +26,10 @@ export default {
}, },
}, },
created() { created() {
this.fetchLatestPipeline(); return this.fetchLatestPipeline().then(() => this.fetchStages());
}, },
methods: { methods: {
...mapActions('pipelines', ['fetchLatestPipeline']), ...mapActions('pipelines', ['fetchLatestPipeline', 'fetchStages']),
}, },
}; };
</script> </script>
...@@ -56,7 +61,38 @@ export default { ...@@ -56,7 +61,38 @@ export default {
</a> </a>
</span> </span>
</header> </header>
<jobs-list /> <tabs>
<tab active>
<template slot="title">
Jobs
<span
v-if="!isLoadingJobs || jobsCount"
class="badge"
>
{{ jobsCount }}
</span>
</template>
<jobs-list
:loading="isLoadingJobs"
:stages="stages"
/>
</tab>
<tab>
<template slot="title">
Failed Jobs
<span
v-if="!isLoadingJobs || failedJobsCount"
class="badge"
>
{{ failedJobsCount }}
</span>
</template>
<jobs-list
:loading="isLoadingJobs"
:stages="failedStages"
/>
</tab>
</tabs>
</template> </template>
</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