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 {
type: Boolean,
required: true,
},
projectPath: {
type: String,
required: true,
},
listPath: {
type: String,
required: true,
},
},
hasLocalStorage: AccessorUtils.isLocalStorageAccessSafe(),
data() {
......@@ -172,8 +180,11 @@ export default {
isCurrentSortField(field) {
return field === this.sortField;
},
updateIssueStatus(status) {
this.updateStatus({ endpoint: this.issueUpdatePath, redirectUrl: this.listPath, status });
getIssueUpdatePath(errorId) {
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 {
</div>
</template>
<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-button>
</template>
......
......@@ -13,7 +13,13 @@ export default () => {
store,
render(createElement) {
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;
errorTrackingEnabled = parseBoolean(errorTrackingEnabled);
......@@ -26,6 +32,8 @@ export default () => {
errorTrackingEnabled,
illustrationPath,
userCanEnableErrorTracking,
projectPath,
listPath,
},
});
},
......
......@@ -21,8 +21,8 @@ export const createStore = () =>
list: {
namespaced: true,
state: listState(),
actions: listActions,
mutations: listMutations,
actions: { ...actions, ...listActions },
mutations: { ...mutations, ...listMutations },
},
details: {
namespaced: true,
......
......@@ -10,6 +10,8 @@ module Projects::ErrorTrackingHelper
'user-can-enable-error-tracking' => can?(current_user, :admin_operations, project).to_s,
'enable-error-tracking-link' => project_settings_operations_path(project),
'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')
}
end
......
......@@ -31,6 +31,8 @@ describe('ErrorTrackingList', () => {
store,
propsData: {
indexPath: '/path',
listPath: '/error_tracking',
projectPath: 'project/test',
enableErrorTrackingLink: '/link',
userCanEnableErrorTracking,
errorTrackingEnabled,
......@@ -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', () => {
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