Commit 1465f858 authored by lauraMon's avatar lauraMon Committed by Tristan Read

Adds props, modifies store

* Constructs the issueUpdatePath
* Modifies store index to enable sharing of actions /mutations
* Adds spec
parent 371a9973
...@@ -102,6 +102,14 @@ export default { ...@@ -102,6 +102,14 @@ export default {
type: Boolean, type: Boolean,
required: true, required: true,
}, },
projectPath: {
type: String,
required: true,
},
listPath: {
type: String,
required: true,
},
}, },
hasLocalStorage: AccessorUtils.isLocalStorageAccessSafe(), hasLocalStorage: AccessorUtils.isLocalStorageAccessSafe(),
data() { data() {
...@@ -172,8 +180,11 @@ export default { ...@@ -172,8 +180,11 @@ export default {
isCurrentSortField(field) { isCurrentSortField(field) {
return field === this.sortField; return field === this.sortField;
}, },
updateIssueStatus(status) { getIssueUpdatePath(errorId) {
this.updateStatus({ endpoint: this.issueUpdatePath, redirectUrl: this.listPath, status }); return `/${this.projectPath}/-/error_tracking/${errorId}.json`;
},
updateIssueStatus(errorId, status) {
this.updateStatus({ endpoint: this.getIssueUpdatePath(errorId), redirectUrl: this.listPath, status });
}, },
}, },
}; };
...@@ -309,7 +320,7 @@ export default { ...@@ -309,7 +320,7 @@ export default {
</div> </div>
</template> </template>
<template v-slot:ignore="errors"> <template v-slot:ignore="errors">
<gl-button @click="updateIssueStatus('ignored')"> <gl-button @click="updateIssueStatus(errors.item.id, 'ignored')">
<gl-icon name="eye-slash" :size=12 /> <gl-icon name="eye-slash" :size=12 />
</gl-button> </gl-button>
</template> </template>
......
...@@ -13,7 +13,13 @@ export default () => { ...@@ -13,7 +13,13 @@ export default () => {
store, store,
render(createElement) { render(createElement) {
const domEl = document.querySelector(this.$options.el); const domEl = document.querySelector(this.$options.el);
const { indexPath, enableErrorTrackingLink, illustrationPath } = domEl.dataset; const {
indexPath,
enableErrorTrackingLink,
illustrationPath,
projectPath,
listPath,
} = domEl.dataset;
let { errorTrackingEnabled, userCanEnableErrorTracking } = domEl.dataset; let { errorTrackingEnabled, userCanEnableErrorTracking } = domEl.dataset;
errorTrackingEnabled = parseBoolean(errorTrackingEnabled); errorTrackingEnabled = parseBoolean(errorTrackingEnabled);
...@@ -26,6 +32,8 @@ export default () => { ...@@ -26,6 +32,8 @@ export default () => {
errorTrackingEnabled, errorTrackingEnabled,
illustrationPath, illustrationPath,
userCanEnableErrorTracking, userCanEnableErrorTracking,
projectPath,
listPath,
}, },
}); });
}, },
......
...@@ -21,8 +21,8 @@ export const createStore = () => ...@@ -21,8 +21,8 @@ export const createStore = () =>
list: { list: {
namespaced: true, namespaced: true,
state: listState(), state: listState(),
actions: listActions, actions: { ...actions, ...listActions },
mutations: listMutations, mutations: { ...mutations, ...listMutations },
}, },
details: { details: {
namespaced: true, namespaced: true,
......
...@@ -10,6 +10,8 @@ module Projects::ErrorTrackingHelper ...@@ -10,6 +10,8 @@ module Projects::ErrorTrackingHelper
'user-can-enable-error-tracking' => can?(current_user, :admin_operations, project).to_s, 'user-can-enable-error-tracking' => can?(current_user, :admin_operations, project).to_s,
'enable-error-tracking-link' => project_settings_operations_path(project), 'enable-error-tracking-link' => project_settings_operations_path(project),
'error-tracking-enabled' => error_tracking_enabled.to_s, 'error-tracking-enabled' => error_tracking_enabled.to_s,
'project-path' => project.full_path,
'list-path' => project_error_tracking_index_path(project),
'illustration-path' => image_path('illustrations/cluster_popover.svg') 'illustration-path' => image_path('illustrations/cluster_popover.svg')
} }
end end
......
...@@ -31,6 +31,8 @@ describe('ErrorTrackingList', () => { ...@@ -31,6 +31,8 @@ describe('ErrorTrackingList', () => {
store, store,
propsData: { propsData: {
indexPath: '/path', indexPath: '/path',
listPath: '/error_tracking',
projectPath: 'project/test',
enableErrorTrackingLink: '/link', enableErrorTrackingLink: '/link',
userCanEnableErrorTracking, userCanEnableErrorTracking,
errorTrackingEnabled, errorTrackingEnabled,
...@@ -139,6 +141,14 @@ describe('ErrorTrackingList', () => { ...@@ -139,6 +141,14 @@ describe('ErrorTrackingList', () => {
}); });
}); });
it('each error in the list should have an ignore button', () => {
const error = wrapper.findAll('tbody tr');
error.wrappers.forEach((_, index) => {
expect(error.at(index).exists('glicon-stub[name="eye-slash"]')).toBe(true);
});
});
describe('filtering', () => { describe('filtering', () => {
const findSearchBox = () => wrapper.find(GlFormInput); const findSearchBox = () => wrapper.find(GlFormInput);
......
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