Skip to content

Commit e175c40

Browse files
committed
Set Jira URL for Jira notifications globally rather than in alerts
Signed-off-by: Mvld3r <[email protected]>
1 parent 5ca18bc commit e175c40

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

src/i18n/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,10 +719,10 @@
719719
"task_scheduler_component_analysis_cache_clear": "Component analysis cache clear",
720720
"jira": "Jira",
721721
"jira_desc": "Jira service authentication",
722+
"jira_url": "Jira base URL",
722723
"jira_username": "Jira user (service account). The user must be provisioned to the appropriate jira instance and permitted to create issues.",
723724
"jira_password": "Jira password",
724725
"jira_ticket_type": "Jira ticket type",
725-
"jira_project_key": "Jira project key",
726726
"reindex_projects": "Projects",
727727
"reindex_components": "Components",
728728
"reindex_service_components": "Service components",

src/views/administration/configuration/JiraConfig.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
<p>
55
{{ $t('admin.jira_desc') }}
66
</p>
7+
<b-validated-input-group-form-input
8+
id="jira-url"
9+
:label="$t('admin.jira_url')"
10+
input-group-size="mb-3"
11+
rules="required"
12+
type="text"
13+
v-model="jiraUrl"
14+
lazy="true"
15+
/>
716
<b-validated-input-group-form-input
817
id="jira-username"
918
:label="$t('admin.jira_username')"
@@ -41,13 +50,15 @@ export default {
4150
},
4251
data() {
4352
return {
53+
jiraUrl: "",
4454
jiraUsername: "",
4555
jiraPassword: "",
4656
}
4757
},
4858
methods: {
4959
saveChanges: function() {
5060
this.updateConfigProperties([
61+
{groupName: 'jira', propertyName: 'jira.url', propertyValue: this.jiraUrl},
5162
{groupName: 'jira', propertyName: 'jira.username', propertyValue: this.jiraUsername}
5263
]);
5364
if (this.jiraPassword !== "HiddenDecryptedPropertyPlaceholder") {
@@ -61,6 +72,8 @@ export default {
6172
for (let i=0; i<configItems.length; i++) {
6273
let item = configItems[i];
6374
switch (item.propertyName) {
75+
case "jira.url":
76+
this.jiraUrl = item.propertyValue; break;
6477
case "jira.username":
6578
this.jiraUsername = item.propertyValue; break;
6679
case "jira.password":

src/views/administration/notifications/Alerts.vue

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@
141141
<b-input-group-form-input v-if="this.publisherClass === 'org.dependencytrack.notification.publisher.JiraPublisher'" id="input-jira-ticket-type"
142142
:label="$t('admin.jira_ticket_type')" :required="true" type="text" v-model="jiraTicketType" lazy="true"
143143
v-debounce:750ms="updateNotificationRule" :debounce-events="'keyup'" />
144-
<b-input-group-form-input v-if="this.publisherClass === 'org.dependencytrack.notification.publisher.JiraPublisher'" id="input-jira-project"
145-
:label="$t('admin.jira_project_key')" :required="true" type="text" v-model="jiraProjectKey" lazy="true"
146-
v-debounce:750ms="updateNotificationRule" :debounce-events="'keyup'" />
147144
<b-form-group v-if="this.publisherClass === 'org.dependencytrack.notification.publisher.SendMailPublisher'"
148145
id="teamDestinationList" :label="this.$t('admin.select_team_as_recipient')">
149146
<div class="list group">
@@ -224,7 +221,6 @@
224221
notificationLevel: row.notificationLevel,
225222
destination: this.parseDestination(row),
226223
jiraTicketType: this.parseJiraTicketType(row),
227-
jiraProjectKey: this.parseJiraProjectKey(row),
228224
scope: row.scope,
229225
notifyOn: row.notifyOn,
230226
projects: row.projects,
@@ -239,7 +235,6 @@
239235
created() {
240236
this.parseDestination(this.alert);
241237
this.parseJiraTicketType(this.alert);
242-
this.parseJiraProjectKey(this.alert);
243238
},
244239
watch: {
245240
enabled() {
@@ -281,15 +276,6 @@
281276
return null;
282277
}
283278
},
284-
parseJiraProjectKey: function(alert) {
285-
if (alert.publisherConfig) {
286-
let value = JSON.parse(alert.publisherConfig);
287-
if (value) {
288-
return value.jiraProjectKey;
289-
}
290-
return null;
291-
}
292-
},
293279
updateNotificationRule: function () {
294280
let url = `${this.$api.BASE_URL}/${this.$api.URL_NOTIFICATION_RULE}`;
295281
this.axios.post(url, {
@@ -298,13 +284,12 @@
298284
enabled: this.enabled,
299285
notifyChildren: this.notifyChildren,
300286
notificationLevel: this.notificationLevel,
301-
publisherConfig: JSON.stringify({ destination: this.destination, jiraTicketType: this.jiraTicketType, jiraProjectKey: this.jiraProjectKey }),
287+
publisherConfig: JSON.stringify({ destination: this.destination, jiraTicketType: this.jiraTicketType }),
302288
notifyOn: this.notifyOn
303289
}).then((response) => {
304290
this.alert = response.data;
305291
this.destination = this.parseDestination(this.alert);
306292
this.jiraTicketType = this.parseJiraTicketType(this.alert);
307-
this.jiraProjectKey = this.parseJiraProjectKey(this.alert);
308293
EventBus.$emit('admin:alerts:rowUpdate', index, this.alert);
309294
this.$toastr.s(this.$t('message.updated'));
310295
}).catch((error) => {

0 commit comments

Comments
 (0)