diff options
Diffstat (limited to 'app')
14 files changed, 114 insertions, 25 deletions
diff --git a/app/assets/javascripts/error_tracking/components/error_details.vue b/app/assets/javascripts/error_tracking/components/error_details.vue index 23a1ec4e367..43e18486ae9 100644 --- a/app/assets/javascripts/error_tracking/components/error_details.vue +++ b/app/assets/javascripts/error_tracking/components/error_details.vue @@ -30,6 +30,14 @@ export default { }, mixins: [timeagoMixin], props: { + listPath: { + type: String, + required: true, + }, + issueUpdatePath: { + type: String, + required: true, + }, issueId: { type: String, required: true, @@ -81,7 +89,14 @@ export default { }; }, computed: { - ...mapState('details', ['error', 'loading', 'loadingStacktrace', 'stacktraceData']), + ...mapState('details', [ + 'error', + 'loading', + 'loadingStacktrace', + 'stacktraceData', + 'updatingResolveStatus', + 'updatingIgnoreStatus', + ]), ...mapGetters('details', ['stacktrace']), reported() { return sprintf( @@ -137,12 +152,15 @@ export default { this.startPollingStacktrace(this.issueStackTracePath); }, methods: { - ...mapActions('details', ['startPollingDetails', 'startPollingStacktrace']), + ...mapActions('details', ['startPollingDetails', 'startPollingStacktrace', 'updateStatus']), trackClickErrorLinkToSentryOptions, createIssue() { this.issueCreationInProgress = true; this.$refs.sentryIssueForm.submit(); }, + updateIssueStatus(status) { + this.updateStatus({ endpoint: this.issueUpdatePath, redirectUrl: this.listPath, status }); + }, formatDate(date) { return `${this.timeFormatted(date)} (${dateFormat(date, 'UTC:yyyy-mm-dd h:MM:ssTT Z')})`; }, @@ -158,24 +176,42 @@ export default { <div v-else-if="showDetails" class="error-details"> <div class="top-area align-items-center justify-content-between py-3"> <span v-if="!loadingStacktrace && stacktrace" v-html="reported"></span> - <form ref="sentryIssueForm" :action="projectIssuesPath" method="POST"> - <gl-form-input class="hidden" name="issue[title]" :value="issueTitle" /> - <input name="issue[description]" :value="issueDescription" type="hidden" /> - <gl-form-input - :value="GQLerror.id" - class="hidden" - name="issue[sentry_issue_attributes][sentry_issue_identifier]" + <div class="d-inline-flex"> + <loading-button + :label="__('Ignore')" + :loading="updatingIgnoreStatus" + @click="updateIssueStatus('ignored')" /> - <gl-form-input :value="csrfToken" class="hidden" name="authenticity_token" /> <loading-button - v-if="!error.gitlab_issue" - class="btn-success" - :label="__('Create issue')" - :loading="issueCreationInProgress" - data-qa-selector="create_issue_button" - @click="createIssue" + class="btn-outline-info ml-2" + :label="__('Resolve')" + :loading="updatingResolveStatus" + @click="updateIssueStatus('resolved')" /> - </form> + <form + ref="sentryIssueForm" + :action="projectIssuesPath" + method="POST" + class="d-inline-block ml-2" + > + <gl-form-input class="hidden" name="issue[title]" :value="issueTitle" /> + <input name="issue[description]" :value="issueDescription" type="hidden" /> + <gl-form-input + :value="GQLerror.id" + class="hidden" + name="issue[sentry_issue_attributes][sentry_issue_identifier]" + /> + <gl-form-input :value="csrfToken" class="hidden" name="authenticity_token" /> + <loading-button + v-if="!error.gitlab_issue" + class="btn-success" + :label="__('Create issue')" + :loading="issueCreationInProgress" + data-qa-selector="create_issue_button" + @click="createIssue" + /> + </form> + </div> </div> <div> <tooltip-on-truncate :title="GQLerror.title" truncate-target="child" placement="top"> diff --git a/app/assets/javascripts/error_tracking/details.js b/app/assets/javascripts/error_tracking/details.js index b9761cdf2c1..c18298dec4f 100644 --- a/app/assets/javascripts/error_tracking/details.js +++ b/app/assets/javascripts/error_tracking/details.js @@ -25,6 +25,8 @@ export default () => { const { issueId, projectPath, + listPath, + issueUpdatePath, issueDetailsPath, issueStackTracePath, projectIssuesPath, @@ -34,6 +36,8 @@ export default () => { props: { issueId, projectPath, + listPath, + issueUpdatePath, issueDetailsPath, issueStackTracePath, projectIssuesPath, diff --git a/app/assets/javascripts/error_tracking/services/index.js b/app/assets/javascripts/error_tracking/services/index.js index 3b3f8311d67..3fb317c17f5 100644 --- a/app/assets/javascripts/error_tracking/services/index.js +++ b/app/assets/javascripts/error_tracking/services/index.js @@ -4,4 +4,7 @@ export default { getSentryData({ endpoint, params }) { return axios.get(endpoint, { params }); }, + updateErrorStatus(endpoint, status) { + return axios.put(endpoint, { status }); + }, }; diff --git a/app/assets/javascripts/error_tracking/store/actions.js b/app/assets/javascripts/error_tracking/store/actions.js new file mode 100644 index 00000000000..bb8b039b5df --- /dev/null +++ b/app/assets/javascripts/error_tracking/store/actions.js @@ -0,0 +1,19 @@ +import service from './../services'; +import * as types from './mutation_types'; +import createFlash from '~/flash'; +import { visitUrl } from '~/lib/utils/url_utility'; +import { __ } from '~/locale'; + +export function updateStatus({ commit }, { endpoint, redirectUrl, status }) { + const type = + status === 'resolved' ? types.SET_UPDATING_RESOLVE_STATUS : types.SET_UPDATING_IGNORE_STATUS; + commit(type, true); + + return service + .updateErrorStatus(endpoint, status) + .then(() => visitUrl(redirectUrl)) + .catch(() => createFlash(__('Failed to update issue status'))) + .finally(() => commit(type, false)); +} + +export default () => {}; diff --git a/app/assets/javascripts/error_tracking/store/details/state.js b/app/assets/javascripts/error_tracking/store/details/state.js index 95fb0ba0558..52b0297607d 100644 --- a/app/assets/javascripts/error_tracking/store/details/state.js +++ b/app/assets/javascripts/error_tracking/store/details/state.js @@ -3,4 +3,6 @@ export default () => ({ stacktraceData: {}, loading: true, loadingStacktrace: true, + updatingResolveStatus: false, + updatingIgnoreStatus: false, }); diff --git a/app/assets/javascripts/error_tracking/store/index.js b/app/assets/javascripts/error_tracking/store/index.js index ad05eecef6c..75aa78d9c07 100644 --- a/app/assets/javascripts/error_tracking/store/index.js +++ b/app/assets/javascripts/error_tracking/store/index.js @@ -1,6 +1,9 @@ import Vue from 'vue'; import Vuex from 'vuex'; +import * as actions from './actions'; +import mutations from './mutations'; + import * as listActions from './list/actions'; import listMutations from './list/mutations'; import listState from './list/state'; @@ -24,8 +27,8 @@ export const createStore = () => details: { namespaced: true, state: detailsState(), - actions: detailsActions, - mutations: detailsMutations, + actions: { ...actions, ...detailsActions }, + mutations: { ...mutations, ...detailsMutations }, getters: detailsGetters, }, }, diff --git a/app/assets/javascripts/error_tracking/store/mutation_types.js b/app/assets/javascripts/error_tracking/store/mutation_types.js new file mode 100644 index 00000000000..30aebacbedd --- /dev/null +++ b/app/assets/javascripts/error_tracking/store/mutation_types.js @@ -0,0 +1,2 @@ +export const SET_UPDATING_RESOLVE_STATUS = 'SET_UPDATING_RESOLVE_STATUS'; +export const SET_UPDATING_IGNORE_STATUS = 'SET_UPDATING_IGNORE_STATUS'; diff --git a/app/assets/javascripts/error_tracking/store/mutations.js b/app/assets/javascripts/error_tracking/store/mutations.js new file mode 100644 index 00000000000..c7a7e46df40 --- /dev/null +++ b/app/assets/javascripts/error_tracking/store/mutations.js @@ -0,0 +1,10 @@ +import * as types from './mutation_types'; + +export default { + [types.SET_UPDATING_IGNORE_STATUS](state, updating) { + state.updatingIgnoreStatus = updating; + }, + [types.SET_UPDATING_RESOLVE_STATUS](state, updating) { + state.updatingResolveStatus = updating; + }, +}; diff --git a/app/assets/stylesheets/pages/error_details.scss b/app/assets/stylesheets/pages/error_details.scss index dcd25c126c4..61e2df7ea26 100644 --- a/app/assets/stylesheets/pages/error_details.scss +++ b/app/assets/stylesheets/pages/error_details.scss @@ -2,6 +2,11 @@ li { @include gl-line-height-32; } + + .btn-outline-info { + color: $blue-500; + border-color: $blue-500; + } } .stacktrace { diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index dc06cd8c166..70c4b536854 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -222,7 +222,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController def metrics_dashboard_params params - .permit(:embedded, :group, :title, :y_label, :dashboard_path, :environment) + .permit(:embedded, :group, :title, :y_label, :dashboard_path, :environment, :sample_metrics) .merge(dashboard_path: params[:dashboard], environment: environment) end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1d9f81aaa23..76acca3b3bc 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -51,7 +51,7 @@ class ProjectsController < Projects::ApplicationController def edit @badge_api_endpoint = expose_url(api_v4_projects_badges_path(id: @project.id)) - render 'edit' + render_edit end def create @@ -85,7 +85,7 @@ class ProjectsController < Projects::ApplicationController else flash.now[:alert] = result[:message] - format.html { render 'edit' } + format.html { render_edit } end format.js @@ -387,7 +387,6 @@ class ProjectsController < Projects::ApplicationController :merge_method, :initialize_with_readme, :autoclose_referenced_issues, - :suggestion_commit_message, project_feature_attributes: %i[ builds_access_level @@ -488,6 +487,10 @@ class ProjectsController < Projects::ApplicationController def rate_limiter ::Gitlab::ApplicationRateLimiter end + + def render_edit + render 'edit' + end end ProjectsController.prepend_if_ee('EE::ProjectsController') diff --git a/app/helpers/projects/error_tracking_helper.rb b/app/helpers/projects/error_tracking_helper.rb index f2d16c30fb4..a55f99f9b19 100644 --- a/app/helpers/projects/error_tracking_helper.rb +++ b/app/helpers/projects/error_tracking_helper.rb @@ -20,6 +20,7 @@ module Projects::ErrorTrackingHelper { 'issue-id' => issue_id, 'project-path' => project.full_path, + 'list-path' => project_error_tracking_index_path(project), 'issue-details-path' => details_project_error_tracking_index_path(*opts), 'issue-update-path' => update_project_error_tracking_index_path(*opts), 'project-issues-path' => project_issues_path(project), diff --git a/app/models/concerns/protected_ref.rb b/app/models/concerns/protected_ref.rb index d9a7f0a96dc..cddca72f91f 100644 --- a/app/models/concerns/protected_ref.rb +++ b/app/models/concerns/protected_ref.rb @@ -10,6 +10,8 @@ module ProtectedRef validates :project, presence: true delegate :matching, :matches?, :wildcard?, to: :ref_matcher + + scope :for_project, ->(project) { where(project: project) } end def commit diff --git a/app/models/diff_viewer/base.rb b/app/models/diff_viewer/base.rb index 37831683555..75aa51348c8 100644 --- a/app/models/diff_viewer/base.rb +++ b/app/models/diff_viewer/base.rb @@ -4,7 +4,7 @@ module DiffViewer class Base PARTIAL_PATH_PREFIX = 'projects/diffs/viewers' - class_attribute :partial_name, :type, :extensions, :file_types, :binary, :switcher_icon, :switcher_title + class_attribute :partial_name, :type, :extensions, :binary, :switcher_icon, :switcher_title # These limits relate to the sum of the old and new blob sizes. # Limits related to the actual size of the diff are enforced in Gitlab::Diff::File. @@ -50,7 +50,6 @@ module DiffViewer return true if blob.nil? return false if verify_binary && binary? != blob.binary_in_repo? return true if extensions&.include?(blob.extension) - return true if file_types&.include?(blob.file_type) false end |