Commit e3251a40 authored by Filipa Lacerda's avatar Filipa Lacerda

Changes after review

parent 8ec0fd0a
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
<svg-blank-state <svg-blank-state
v-else-if="shouldRenderErrorState" v-else-if="shouldRenderErrorState"
:svg-path="errorStateSvgPath" :svg-path="errorStateSvgPath"
:message="s__(`Pipelines|There was an error with fetching the pipelines. :message="s__(`Pipelines|There was an error fetching the pipelines.
Try again in a few moments or contact your support team.`)" Try again in a few moments or contact your support team.`)"
/> />
......
...@@ -12,14 +12,13 @@ document.addEventListener('DOMContentLoaded', () => new Vue({ ...@@ -12,14 +12,13 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
pipelinesComponent, pipelinesComponent,
}, },
data() { data() {
const store = new PipelinesStore();
return { return {
store, store: new PipelinesStore(),
dataset: document.querySelector(this.$options.el).dataset,
}; };
}, },
created() {
this.dataset = document.querySelector(this.$options.el).dataset;
},
render(createElement) { render(createElement) {
return createElement('pipelines-component', { return createElement('pipelines-component', {
props: { props: {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<div class="text-center"> <div class="text-center">
<a <a
:href="helpPagePath" :href="helpPagePath"
class="btn btn-info js-get-started-pipelines" class="btn btn-primary js-get-started-pipelines"
> >
{{ s__('Pipelines|Get started with Pipelines') }} {{ s__('Pipelines|Get started with Pipelines') }}
</a> </a>
......
...@@ -323,7 +323,7 @@ ...@@ -323,7 +323,7 @@
<svg-blank-state <svg-blank-state
v-else-if="stateToRender === $options.stateMap.error" v-else-if="stateToRender === $options.stateMap.error"
:svg-path="errorStateSvgPath" :svg-path="errorStateSvgPath"
:message="s__(`Pipelines|There was an error with fetching the pipelines. :message="s__(`Pipelines|There was an error fetching the pipelines.
Try again in a few moments or contact your support team.`)" Try again in a few moments or contact your support team.`)"
/> />
......
...@@ -5,12 +5,7 @@ export default class PipelinesStore { ...@@ -5,12 +5,7 @@ export default class PipelinesStore {
this.state = {}; this.state = {};
this.state.pipelines = []; this.state.pipelines = [];
this.state.count = { this.state.count = {};
all: 0,
finished: 0,
pending: 0,
running: 0,
};
this.state.pageInfo = {}; this.state.pageInfo = {};
} }
......
...@@ -183,10 +183,10 @@ describe('Pipelines', () => { ...@@ -183,10 +183,10 @@ describe('Pipelines', () => {
}); });
it('does not render tabs nor buttons', () => { it('does not render tabs nor buttons', () => {
expect(vm.$el.querySelector('.js-pipelines-tab-all')).toBe(null); expect(vm.$el.querySelector('.js-pipelines-tab-all')).toBeNull();
expect(vm.$el.querySelector('.js-run-pipeline')).toBe(null); expect(vm.$el.querySelector('.js-run-pipeline')).toBeNull();
expect(vm.$el.querySelector('.js-ci-lint')).toBe(null); expect(vm.$el.querySelector('.js-ci-lint')).toBeNull();
expect(vm.$el.querySelector('.js-clear-cache')).toBe(null); expect(vm.$el.querySelector('.js-clear-cache')).toBeNull();
}); });
}); });
...@@ -222,7 +222,7 @@ describe('Pipelines', () => { ...@@ -222,7 +222,7 @@ describe('Pipelines', () => {
}); });
it('renders error state', () => { it('renders error state', () => {
expect(vm.$el.querySelector('.empty-state').textContent.trim()).toContain('There was an error with fetching the pipelines.'); expect(vm.$el.querySelector('.empty-state').textContent.trim()).toContain('There was an error fetching the pipelines.');
}); });
}); });
}); });
...@@ -254,9 +254,9 @@ describe('Pipelines', () => { ...@@ -254,9 +254,9 @@ describe('Pipelines', () => {
}); });
it('does not render buttons', () => { it('does not render buttons', () => {
expect(vm.$el.querySelector('.js-run-pipeline')).toBe(null); expect(vm.$el.querySelector('.js-run-pipeline')).toBeNull();
expect(vm.$el.querySelector('.js-ci-lint')).toBe(null); expect(vm.$el.querySelector('.js-ci-lint')).toBeNull();
expect(vm.$el.querySelector('.js-clear-cache')).toBe(null); expect(vm.$el.querySelector('.js-clear-cache')).toBeNull();
}); });
it('renders pipelines table', () => { it('renders pipelines table', () => {
...@@ -291,9 +291,9 @@ describe('Pipelines', () => { ...@@ -291,9 +291,9 @@ describe('Pipelines', () => {
}); });
it('does not render buttons', () => { it('does not render buttons', () => {
expect(vm.$el.querySelector('.js-run-pipeline')).toBe(null); expect(vm.$el.querySelector('.js-run-pipeline')).toBeNull();
expect(vm.$el.querySelector('.js-ci-lint')).toBe(null); expect(vm.$el.querySelector('.js-ci-lint')).toBeNull();
expect(vm.$el.querySelector('.js-clear-cache')).toBe(null); expect(vm.$el.querySelector('.js-clear-cache')).toBeNull();
}); });
it('renders tab empty state', () => { it('renders tab empty state', () => {
...@@ -324,14 +324,14 @@ describe('Pipelines', () => { ...@@ -324,14 +324,14 @@ describe('Pipelines', () => {
it('renders empty state without button to set CI', () => { it('renders empty state without button to set CI', () => {
expect(vm.$el.querySelector('.js-empty-state').textContent.trim()).toEqual('This project is not currently set up to run pipelines.'); expect(vm.$el.querySelector('.js-empty-state').textContent.trim()).toEqual('This project is not currently set up to run pipelines.');
expect(vm.$el.querySelector('.js-get-started-pipelines')).toBe(null); expect(vm.$el.querySelector('.js-get-started-pipelines')).toBeNull();
}); });
it('does not render tabs nor buttons', () => { it('does not render tabs or buttons', () => {
expect(vm.$el.querySelector('.js-pipelines-tab-all')).toBe(null); expect(vm.$el.querySelector('.js-pipelines-tab-all')).toBeNull();
expect(vm.$el.querySelector('.js-run-pipeline')).toBe(null); expect(vm.$el.querySelector('.js-run-pipeline')).toBeNull();
expect(vm.$el.querySelector('.js-ci-lint')).toBe(null); expect(vm.$el.querySelector('.js-ci-lint')).toBeNull();
expect(vm.$el.querySelector('.js-clear-cache')).toBe(null); expect(vm.$el.querySelector('.js-clear-cache')).toBeNull();
}); });
}); });
...@@ -361,13 +361,13 @@ describe('Pipelines', () => { ...@@ -361,13 +361,13 @@ describe('Pipelines', () => {
}); });
it('does not renders buttons', () => { it('does not renders buttons', () => {
expect(vm.$el.querySelector('.js-run-pipeline')).toBe(null); expect(vm.$el.querySelector('.js-run-pipeline')).toBeNull();
expect(vm.$el.querySelector('.js-ci-lint')).toBe(null); expect(vm.$el.querySelector('.js-ci-lint')).toBeNull();
expect(vm.$el.querySelector('.js-clear-cache')).toBe(null); expect(vm.$el.querySelector('.js-clear-cache')).toBeNull();
}); });
it('renders error state', () => { it('renders error state', () => {
expect(vm.$el.querySelector('.empty-state').textContent.trim()).toContain('There was an error with fetching the pipelines.'); expect(vm.$el.querySelector('.empty-state').textContent.trim()).toContain('There was an error fetching the pipelines.');
}); });
}); });
}); });
...@@ -527,10 +527,10 @@ describe('Pipelines', () => { ...@@ -527,10 +527,10 @@ describe('Pipelines', () => {
describe('tabs', () => { describe('tabs', () => {
it('returns default tabs', () => { it('returns default tabs', () => {
expect(vm.tabs).toEqual([ expect(vm.tabs).toEqual([
{ name: 'All', scope: 'all', count: 0, isActive: true }, { name: 'All', scope: 'all', count: undefined, isActive: true },
{ name: 'Pending', scope: 'pending', count: 0, isActive: false }, { name: 'Pending', scope: 'pending', count: undefined, isActive: false },
{ name: 'Running', scope: 'running', count: 0, isActive: false }, { name: 'Running', scope: 'running', count: undefined, isActive: false },
{ name: 'Finished', scope: 'finished', count: 0, isActive: false }, { name: 'Finished', scope: 'finished', count: undefined, isActive: false },
{ name: 'Branches', scope: 'branches', isActive: false }, { name: 'Branches', scope: 'branches', isActive: false },
{ name: 'Tags', scope: 'tags', isActive: false }, { name: 'Tags', scope: 'tags', isActive: false },
]); ]);
...@@ -646,7 +646,7 @@ describe('Pipelines', () => { ...@@ -646,7 +646,7 @@ describe('Pipelines', () => {
}); });
}); });
it('returs true when state is empty tab & has already made the first request', (done) => { it('returns true when state is empty tab & has already made the first request', (done) => {
vm.isLoading = false; vm.isLoading = false;
vm.state.count.all = 10; vm.state.count.all = 10;
vm.hasMadeRequest = true; vm.hasMadeRequest = true;
......
...@@ -9,12 +9,7 @@ describe('Pipelines Store', () => { ...@@ -9,12 +9,7 @@ describe('Pipelines Store', () => {
it('should be initialized with an empty state', () => { it('should be initialized with an empty state', () => {
expect(store.state.pipelines).toEqual([]); expect(store.state.pipelines).toEqual([]);
expect(store.state.count).toEqual({ expect(store.state.count).toEqual({});
all: 0,
finished: 0,
pending: 0,
running: 0,
});
expect(store.state.pageInfo).toEqual({}); expect(store.state.pageInfo).toEqual({});
}); });
......
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