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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-06 00:10:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-06 00:10:00 +0300
commitee2aa09a2417755bc9efbedaec48fc62b498f672 (patch)
tree1b85413dc5cc23efef319f96dc8bdb5fb94564a0
parentad41744a177d11ead3268b1ec706e9c26f593060 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/integrations/constants.js5
-rw-r--r--app/assets/javascripts/integrations/edit/components/active_checkbox.vue3
-rw-r--r--app/assets/javascripts/integrations/edit/components/dynamic_field.vue5
-rw-r--r--app/assets/javascripts/integrations/edit/components/integration_form.vue5
-rw-r--r--app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue10
-rw-r--r--app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue5
-rw-r--r--app/assets/javascripts/integrations/integration_settings_form.js23
-rw-r--r--db/migrate/20210929115340_add_security_policy_configurations_management_project_id_foreign_key.rb18
-rw-r--r--db/schema_migrations/202109291153401
-rw-r--r--db/structure.sql6
-rw-r--r--spec/frontend/integrations/edit/components/jira_issues_fields_spec.js3
11 files changed, 61 insertions, 23 deletions
diff --git a/app/assets/javascripts/integrations/constants.js b/app/assets/javascripts/integrations/constants.js
new file mode 100644
index 00000000000..1644f35459b
--- /dev/null
+++ b/app/assets/javascripts/integrations/constants.js
@@ -0,0 +1,5 @@
+export const TEST_INTEGRATION_EVENT = 'testIntegration';
+export const SAVE_INTEGRATION_EVENT = 'saveIntegration';
+export const GET_JIRA_ISSUE_TYPES_EVENT = 'getJiraIssueTypes';
+export const TOGGLE_INTEGRATION_EVENT = 'toggleIntegration';
+export const VALIDATE_INTEGRATION_FORM_EVENT = 'validateIntegrationForm';
diff --git a/app/assets/javascripts/integrations/edit/components/active_checkbox.vue b/app/assets/javascripts/integrations/edit/components/active_checkbox.vue
index f7d7f4aa010..9804a9e15f6 100644
--- a/app/assets/javascripts/integrations/edit/components/active_checkbox.vue
+++ b/app/assets/javascripts/integrations/edit/components/active_checkbox.vue
@@ -1,6 +1,7 @@
<script>
import { GlFormGroup, GlFormCheckbox } from '@gitlab/ui';
import { mapGetters } from 'vuex';
+import { TOGGLE_INTEGRATION_EVENT } from '~/integrations/constants';
import eventHub from '../event_hub';
export default {
@@ -26,7 +27,7 @@ export default {
},
methods: {
onChange(e) {
- eventHub.$emit('toggle', e);
+ eventHub.$emit(TOGGLE_INTEGRATION_EVENT, e);
},
},
};
diff --git a/app/assets/javascripts/integrations/edit/components/dynamic_field.vue b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue
index 1fd4083b920..f30298676df 100644
--- a/app/assets/javascripts/integrations/edit/components/dynamic_field.vue
+++ b/app/assets/javascripts/integrations/edit/components/dynamic_field.vue
@@ -9,6 +9,7 @@ import {
} from '@gitlab/ui';
import { capitalize, lowerCase, isEmpty } from 'lodash';
import { mapGetters } from 'vuex';
+import { VALIDATE_INTEGRATION_FORM_EVENT } from '~/integrations/constants';
import eventHub from '../event_hub';
export default {
@@ -121,10 +122,10 @@ export default {
if (this.isNonEmptyPassword) {
this.model = null;
}
- eventHub.$on('validateForm', this.validateForm);
+ eventHub.$on(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
beforeDestroy() {
- eventHub.$off('validateForm', this.validateForm);
+ eventHub.$off(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
methods: {
validateForm() {
diff --git a/app/assets/javascripts/integrations/edit/components/integration_form.vue b/app/assets/javascripts/integrations/edit/components/integration_form.vue
index 63f007170d0..707666f11d2 100644
--- a/app/assets/javascripts/integrations/edit/components/integration_form.vue
+++ b/app/assets/javascripts/integrations/edit/components/integration_form.vue
@@ -2,6 +2,7 @@
import { GlButton, GlModalDirective, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import { mapState, mapActions, mapGetters } from 'vuex';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
+import { TEST_INTEGRATION_EVENT, SAVE_INTEGRATION_EVENT } from '~/integrations/constants';
import { integrationLevels } from '../constants';
import eventHub from '../event_hub';
@@ -75,11 +76,11 @@ export default {
]),
onSaveClick() {
this.setIsSaving(true);
- eventHub.$emit('saveIntegration');
+ eventHub.$emit(SAVE_INTEGRATION_EVENT);
},
onTestClick() {
this.setIsTesting(true);
- eventHub.$emit('testIntegration');
+ eventHub.$emit(TEST_INTEGRATION_EVENT);
},
onResetClick() {
this.fetchResetIntegration();
diff --git a/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue b/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue
index 1242493fb57..0521e1eeea5 100644
--- a/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue
+++ b/app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue
@@ -1,6 +1,10 @@
<script>
import { GlFormGroup, GlFormCheckbox, GlFormInput, GlSprintf, GlLink } from '@gitlab/ui';
import { mapGetters } from 'vuex';
+import {
+ VALIDATE_INTEGRATION_FORM_EVENT,
+ GET_JIRA_ISSUE_TYPES_EVENT,
+} from '~/integrations/constants';
import eventHub from '../event_hub';
import JiraUpgradeCta from './jira_upgrade_cta.vue';
@@ -77,17 +81,17 @@ export default {
},
},
created() {
- eventHub.$on('validateForm', this.validateForm);
+ eventHub.$on(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
beforeDestroy() {
- eventHub.$off('validateForm', this.validateForm);
+ eventHub.$off(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
methods: {
validateForm() {
this.validated = true;
},
getJiraIssueTypes() {
- eventHub.$emit('getJiraIssueTypes');
+ eventHub.$emit(GET_JIRA_ISSUE_TYPES_EVENT);
},
},
};
diff --git a/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue b/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue
index 1cc5a185f03..249a3e105b1 100644
--- a/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue
+++ b/app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue
@@ -9,6 +9,7 @@ import {
} from '@gitlab/ui';
import { mapGetters } from 'vuex';
import { helpPagePath } from '~/helpers/help_page_helper';
+import { VALIDATE_INTEGRATION_FORM_EVENT } from '~/integrations/constants';
import { s__ } from '~/locale';
import eventHub from '../event_hub';
@@ -118,10 +119,10 @@ export default {
},
},
created() {
- eventHub.$on('validateForm', this.validateForm);
+ eventHub.$on(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
beforeDestroy() {
- eventHub.$off('validateForm', this.validateForm);
+ eventHub.$off(VALIDATE_INTEGRATION_FORM_EVENT, this.validateForm);
},
methods: {
validateForm() {
diff --git a/app/assets/javascripts/integrations/integration_settings_form.js b/app/assets/javascripts/integrations/integration_settings_form.js
index dd10caecf28..f33364d5545 100644
--- a/app/assets/javascripts/integrations/integration_settings_form.js
+++ b/app/assets/javascripts/integrations/integration_settings_form.js
@@ -4,6 +4,13 @@ import toast from '~/vue_shared/plugins/global_toast';
import axios from '../lib/utils/axios_utils';
import initForm from './edit';
import eventHub from './edit/event_hub';
+import {
+ TEST_INTEGRATION_EVENT,
+ SAVE_INTEGRATION_EVENT,
+ GET_JIRA_ISSUE_TYPES_EVENT,
+ TOGGLE_INTEGRATION_EVENT,
+ VALIDATE_INTEGRATION_FORM_EVENT,
+} from './constants';
export default class IntegrationSettingsForm {
constructor(formSelector) {
@@ -22,21 +29,19 @@ export default class IntegrationSettingsForm {
document.querySelector('.js-vue-integration-settings'),
document.querySelector('.js-vue-default-integration-settings'),
);
- eventHub.$on('toggle', (active) => {
+ eventHub.$on(TOGGLE_INTEGRATION_EVENT, (active) => {
this.formActive = active;
this.toggleServiceState();
});
- eventHub.$on('testIntegration', () => {
+ eventHub.$on(TEST_INTEGRATION_EVENT, () => {
this.testIntegration();
});
- eventHub.$on('saveIntegration', () => {
+ eventHub.$on(SAVE_INTEGRATION_EVENT, () => {
this.saveIntegration();
});
- eventHub.$on('getJiraIssueTypes', () => {
+ eventHub.$on(GET_JIRA_ISSUE_TYPES_EVENT, () => {
this.getJiraIssueTypes(new FormData(this.$form));
});
-
- eventHub.$emit('formInitialized');
}
saveIntegration() {
@@ -52,7 +57,7 @@ export default class IntegrationSettingsForm {
this.$form.submit();
}, 100);
} else {
- eventHub.$emit('validateForm');
+ eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
this.vue.$store.dispatch('setIsSaving', false);
}
}
@@ -66,7 +71,7 @@ export default class IntegrationSettingsForm {
if (this.$form.checkValidity()) {
this.testSettings(new FormData(this.$form));
} else {
- eventHub.$emit('validateForm');
+ eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
this.vue.$store.dispatch('setIsTesting', false);
}
}
@@ -106,7 +111,7 @@ export default class IntegrationSettingsForm {
},
}) => {
if (error || !issuetypes?.length) {
- eventHub.$emit('validateForm');
+ eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
throw new Error(message);
}
diff --git a/db/migrate/20210929115340_add_security_policy_configurations_management_project_id_foreign_key.rb b/db/migrate/20210929115340_add_security_policy_configurations_management_project_id_foreign_key.rb
new file mode 100644
index 00000000000..1335c06cf1f
--- /dev/null
+++ b/db/migrate/20210929115340_add_security_policy_configurations_management_project_id_foreign_key.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddSecurityPolicyConfigurationsManagementProjectIdForeignKey < Gitlab::Database::Migration[1.0]
+ CONSTRAINT_NAME = 'fk_security_policy_configurations_management_project_id'
+ OLD_CONSTRAINT_NAME = 'fk_rails_42ed6c25ec'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key(:security_orchestration_policy_configurations, :projects, column: :security_policy_management_project_id, on_delete: :cascade, name: CONSTRAINT_NAME)
+ remove_foreign_key_if_exists(:security_orchestration_policy_configurations, column: :security_policy_management_project_id, on_delete: :restrict, name: OLD_CONSTRAINT_NAME)
+ end
+
+ def down
+ add_concurrent_foreign_key(:security_orchestration_policy_configurations, :projects, column: :security_policy_management_project_id, on_delete: :restrict, name: OLD_CONSTRAINT_NAME)
+ remove_foreign_key_if_exists(:security_orchestration_policy_configurations, column: :security_policy_management_project_id, on_delete: :cascade, name: CONSTRAINT_NAME)
+ end
+end
diff --git a/db/schema_migrations/20210929115340 b/db/schema_migrations/20210929115340
new file mode 100644
index 00000000000..2f6bf226e09
--- /dev/null
+++ b/db/schema_migrations/20210929115340
@@ -0,0 +1 @@
+0de2844fdec43eca860648bdb1a5b184bcc0f79b51086b16d8ef398f32cfd5de \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index c99f82db164..8bae9a06707 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -28643,9 +28643,6 @@ ALTER TABLE ONLY epic_issues
ALTER TABLE ONLY ci_refs
ADD CONSTRAINT fk_rails_4249db8cc3 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
-ALTER TABLE ONLY security_orchestration_policy_configurations
- ADD CONSTRAINT fk_rails_42ed6c25ec FOREIGN KEY (security_policy_management_project_id) REFERENCES projects(id) ON DELETE RESTRICT;
-
ALTER TABLE ONLY ci_resources
ADD CONSTRAINT fk_rails_430336af2d FOREIGN KEY (resource_group_id) REFERENCES ci_resource_groups(id) ON DELETE CASCADE;
@@ -29825,6 +29822,9 @@ ALTER TABLE ONLY resource_label_events
ALTER TABLE ONLY ci_builds_metadata
ADD CONSTRAINT fk_rails_ffcf702a02 FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY security_orchestration_policy_configurations
+ ADD CONSTRAINT fk_security_policy_configurations_management_project_id FOREIGN KEY (security_policy_management_project_id) REFERENCES projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY integrations
ADD CONSTRAINT fk_services_inherit_from_id FOREIGN KEY (inherit_from_id) REFERENCES integrations(id) ON DELETE CASCADE;
diff --git a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
index 2860d3cc37a..119afbfecfe 100644
--- a/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
+++ b/spec/frontend/integrations/edit/components/jira_issues_fields_spec.js
@@ -1,6 +1,7 @@
import { GlFormCheckbox, GlFormInput } from '@gitlab/ui';
import { mountExtended } from 'helpers/vue_test_utils_helper';
+import { GET_JIRA_ISSUE_TYPES_EVENT } from '~/integrations/constants';
import JiraIssuesFields from '~/integrations/edit/components/jira_issues_fields.vue';
import eventHub from '~/integrations/edit/event_hub';
import { createStore } from '~/integrations/edit/store';
@@ -207,7 +208,7 @@ describe('JiraIssuesFields', () => {
await setEnableCheckbox(true);
await findJiraForVulnerabilities().vm.$emit('request-get-issue-types');
- expect(eventHubEmitSpy).toHaveBeenCalledWith('getJiraIssueTypes');
+ expect(eventHubEmitSpy).toHaveBeenCalledWith(GET_JIRA_ISSUE_TYPES_EVENT);
});
});
});