Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-21 03:08:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-21 03:08:06 +0300
commit5abd2b70c81fbba71ea51994b325ddebc54b53db (patch)
tree7e0453beaadd143127c7c4f97f24deaa1b04ba30 /app
parent1902e256266822bc94e1a69debd79fb256de2d79 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/alert_management/components/alert_details.vue80
-rw-r--r--app/assets/javascripts/alert_management/details.js4
-rw-r--r--app/assets/javascripts/alert_management/graphql/fragments/listItem.fragment.graphql1
-rw-r--r--app/assets/javascripts/alert_management/graphql/mutations/create_issue_from_alert.graphql8
-rw-r--r--app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue2
-rw-r--r--app/assets/stylesheets/pages/alert_management/details.scss2
-rw-r--r--app/controllers/projects/alert_management_controller.rb2
-rw-r--r--app/controllers/projects/pipelines_controller.rb1
-rw-r--r--app/controllers/projects/refs_controller.rb2
-rw-r--r--app/helpers/projects/alert_management_helper.rb2
-rw-r--r--app/models/ci/job_artifact.rb1
11 files changed, 86 insertions, 19 deletions
diff --git a/app/assets/javascripts/alert_management/components/alert_details.vue b/app/assets/javascripts/alert_management/components/alert_details.vue
index 89db7db77d5..bb9f092a9ae 100644
--- a/app/assets/javascripts/alert_management/components/alert_details.vue
+++ b/app/assets/javascripts/alert_management/components/alert_details.vue
@@ -20,6 +20,8 @@ import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { ALERTS_SEVERITY_LABELS } from '../constants';
import updateAlertStatus from '../graphql/mutations/update_alert_status.graphql';
+import createIssueQuery from '../graphql/mutations/create_issue_from_alert.graphql';
+import { visitUrl, joinPaths } from '~/lib/utils/url_utility';
export default {
statuses: {
@@ -60,7 +62,7 @@ export default {
type: String,
required: true,
},
- newIssuePath: {
+ projectIssuesPath: {
type: String,
required: true,
},
@@ -85,7 +87,13 @@ export default {
},
},
data() {
- return { alert: null, errored: false, isErrorDismissed: false };
+ return {
+ alert: null,
+ errored: false,
+ isErrorDismissed: false,
+ createIssueError: '',
+ issueCreationInProgress: false,
+ };
},
computed: {
loading() {
@@ -122,6 +130,33 @@ export default {
);
});
},
+ createIssue() {
+ this.issueCreationInProgress = true;
+
+ this.$apollo
+ .mutate({
+ mutation: createIssueQuery,
+ variables: {
+ iid: this.alert.iid,
+ projectPath: this.projectPath,
+ },
+ })
+ .then(({ data: { createAlertIssue: { errors, issue } } }) => {
+ if (errors?.length) {
+ [this.createIssueError] = errors;
+ this.issueCreationInProgress = false;
+ } else if (issue) {
+ visitUrl(this.issuePath(issue.iid));
+ }
+ })
+ .catch(error => {
+ this.createIssueError = error;
+ this.issueCreationInProgress = false;
+ });
+ },
+ issuePath(issueId) {
+ return joinPaths(this.projectIssuesPath, issueId);
+ },
},
};
</script>
@@ -130,6 +165,14 @@ export default {
<gl-alert v-if="showErrorMsg" variant="danger" @dismiss="dismissError">
{{ $options.i18n.errorMsg }}
</gl-alert>
+ <gl-alert
+ v-if="createIssueError"
+ variant="danger"
+ data-testid="issueCreationError"
+ @dismiss="createIssueError = null"
+ >
+ {{ createIssueError }}
+ </gl-alert>
<div v-if="loading"><gl-loading-icon size="lg" class="gl-mt-5" /></div>
<div v-if="alert" class="alert-management-details gl-relative">
<div
@@ -158,16 +201,29 @@ export default {
<template #tool>{{ alert.monitoringTool }}</template>
</gl-sprintf>
</div>
- <gl-button
- v-if="glFeatures.createIssueFromAlertEnabled"
- class="gl-mt-3 mt-sm-0 align-self-center align-self-sm-baseline alert-details-create-issue-button"
- data-testid="createIssueBtn"
- :href="newIssuePath"
- category="primary"
- variant="success"
- >
- {{ s__('AlertManagement|Create issue') }}
- </gl-button>
+ <div v-if="glFeatures.alertManagementCreateAlertIssue">
+ <gl-button
+ v-if="alert.issueIid"
+ class="gl-mt-3 mt-sm-0 align-self-center align-self-sm-baseline alert-details-issue-button"
+ data-testid="viewIssueBtn"
+ :href="issuePath(alert.issueIid)"
+ category="primary"
+ variant="success"
+ >
+ {{ s__('AlertManagement|View issue') }}
+ </gl-button>
+ <gl-button
+ v-else
+ class="gl-mt-3 mt-sm-0 align-self-center align-self-sm-baseline alert-details-issue-button"
+ data-testid="createIssueBtn"
+ :loading="issueCreationInProgress"
+ category="primary"
+ variant="success"
+ @click="createIssue()"
+ >
+ {{ s__('AlertManagement|Create issue') }}
+ </gl-button>
+ </div>
</div>
<div
v-if="alert"
diff --git a/app/assets/javascripts/alert_management/details.js b/app/assets/javascripts/alert_management/details.js
index d3523e0a29d..aa8a839ea3f 100644
--- a/app/assets/javascripts/alert_management/details.js
+++ b/app/assets/javascripts/alert_management/details.js
@@ -8,7 +8,7 @@ Vue.use(VueApollo);
export default selector => {
const domEl = document.querySelector(selector);
- const { alertId, projectPath, newIssuePath } = domEl.dataset;
+ const { alertId, projectPath, projectIssuesPath } = domEl.dataset;
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(
@@ -39,7 +39,7 @@ export default selector => {
props: {
alertId,
projectPath,
- newIssuePath,
+ projectIssuesPath,
},
});
},
diff --git a/app/assets/javascripts/alert_management/graphql/fragments/listItem.fragment.graphql b/app/assets/javascripts/alert_management/graphql/fragments/listItem.fragment.graphql
index fffe07b0cfd..22adfc9800c 100644
--- a/app/assets/javascripts/alert_management/graphql/fragments/listItem.fragment.graphql
+++ b/app/assets/javascripts/alert_management/graphql/fragments/listItem.fragment.graphql
@@ -6,4 +6,5 @@ fragment AlertListItem on AlertManagementAlert {
startedAt
endedAt
eventCount
+ issueIid
}
diff --git a/app/assets/javascripts/alert_management/graphql/mutations/create_issue_from_alert.graphql b/app/assets/javascripts/alert_management/graphql/mutations/create_issue_from_alert.graphql
new file mode 100644
index 00000000000..664596ab88f
--- /dev/null
+++ b/app/assets/javascripts/alert_management/graphql/mutations/create_issue_from_alert.graphql
@@ -0,0 +1,8 @@
+mutation ($projectPath: ID!, $iid: String!) {
+ createAlertIssue(input: { iid: $iid, projectPath: $projectPath }) {
+ errors
+ issue {
+ iid
+ }
+ }
+}
diff --git a/app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue b/app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue
index b22fbf6b833..8bb093da771 100644
--- a/app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue
+++ b/app/assets/javascripts/pages/admin/projects/index/components/delete_project_modal.vue
@@ -92,7 +92,7 @@ export default {
@submit="onSubmit"
@cancel="onCancel"
>
- <template slot="body" slot-scope="props">
+ <template #body="props">
<p v-html="props.text"></p>
<p v-html="confirmationTextLabel"></p>
<form ref="form" :action="deleteProjectUrl" method="post">
diff --git a/app/assets/stylesheets/pages/alert_management/details.scss b/app/assets/stylesheets/pages/alert_management/details.scss
index 89219e41644..6d807227b30 100644
--- a/app/assets/stylesheets/pages/alert_management/details.scss
+++ b/app/assets/stylesheets/pages/alert_management/details.scss
@@ -35,7 +35,7 @@
}
@include media-breakpoint-down(xs) {
- .alert-details-create-issue-button {
+ .alert-details-issue-button {
width: 100%;
}
}
diff --git a/app/controllers/projects/alert_management_controller.rb b/app/controllers/projects/alert_management_controller.rb
index 32e0b2c3fb6..429ae7390c5 100644
--- a/app/controllers/projects/alert_management_controller.rb
+++ b/app/controllers/projects/alert_management_controller.rb
@@ -4,7 +4,7 @@ class Projects::AlertManagementController < Projects::ApplicationController
before_action :authorize_read_alert_management_alert!
before_action do
push_frontend_feature_flag(:alert_list_status_filtering_enabled)
- push_frontend_feature_flag(:create_issue_from_alert_enabled)
+ push_frontend_feature_flag(:alert_management_create_alert_issue)
push_frontend_feature_flag(:alert_assignee, project)
end
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index 678d0862f48..6e59f742bf0 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -14,6 +14,7 @@ class Projects::PipelinesController < Projects::ApplicationController
push_frontend_feature_flag(:junit_pipeline_view, project)
push_frontend_feature_flag(:filter_pipelines_search, default_enabled: true)
push_frontend_feature_flag(:dag_pipeline_tab)
+ push_frontend_feature_flag(:pipelines_security_report_summary, project)
end
before_action :ensure_pipeline, only: [:show]
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index fcbeb5c840c..a2581e72257 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -53,7 +53,7 @@ class Projects::RefsController < Projects::ApplicationController
format.json do
logs, next_offset = tree_summary.fetch_logs
- response.headers["More-Logs-Offset"] = next_offset if next_offset
+ response.headers["More-Logs-Offset"] = next_offset.to_s if next_offset
render json: logs
end
diff --git a/app/helpers/projects/alert_management_helper.rb b/app/helpers/projects/alert_management_helper.rb
index af86ef715c2..bc585899591 100644
--- a/app/helpers/projects/alert_management_helper.rb
+++ b/app/helpers/projects/alert_management_helper.rb
@@ -15,7 +15,7 @@ module Projects::AlertManagementHelper
{
'alert-id' => alert_id,
'project-path' => project.full_path,
- 'new-issue-path' => new_project_issue_path(project)
+ 'project-issues-path' => project_issues_path(project)
}
end
end
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb
index d931428dccd..9aa8526a9cb 100644
--- a/app/models/ci/job_artifact.rb
+++ b/app/models/ci/job_artifact.rb
@@ -5,6 +5,7 @@ module Ci
include AfterCommitQueue
include ObjectStorage::BackgroundMove
include UpdateProjectStatistics
+ include UsageStatistics
include Sortable
extend Gitlab::Ci::Model