From da7cd4812d9bf9baf3c4623122d827a84aff2838 Mon Sep 17 00:00:00 2001 From: Evan Sutherland Date: Thu, 28 Oct 2021 16:01:33 -0500 Subject: [PATCH 1/5] implemented new custom inputs in automations dashboard and pager-duty integration --- src/pages/Dashboard/Automations/AddAction.vue | 21 +++++++----------- src/pages/Integrations/PagerDuty.vue | 22 ++++++++++++------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/pages/Dashboard/Automations/AddAction.vue b/src/pages/Dashboard/Automations/AddAction.vue index 941548d9a..fc96f4f77 100644 --- a/src/pages/Dashboard/Automations/AddAction.vue +++ b/src/pages/Dashboard/Automations/AddAction.vue @@ -2,8 +2,8 @@ import { actionTypes, jsonPlacehold } from '@/utils/automations' import { mapGetters } from 'vuex' import ListInput from '@/components/CustomInputs/ListInput' -import JsonInput from '@/components/CustomInputs/JsonInput' -import jsBeautify from 'js-beautify' +import JsonInput from '@/components/CustomInputs/JsonInput2' +import { formatJson, isValidJson } from '@/utils/json' export default { components: { @@ -43,7 +43,6 @@ export default { accountSid: '', apiToken: '', jsonPayload: null, - validJson: true, routingKey: '', webhookURLString: null, severity: '', @@ -220,6 +219,9 @@ export default { }, isMSTeams() { return this.actionType.type === 'MS_TEAMS' + }, + validJson() { + return isValidJson(this.jsonPayload) } // needsNext() { // if ( @@ -243,7 +245,7 @@ export default { methods: { jsonPlaceholder() { this.jsonPlacehold.message = this.messagePlaceholder - return jsBeautify(JSON.stringify(this.jsonPlacehold)) + return formatJson(this.jsonPlacehold) }, buttonColor(selectedStep) { return this.step.name === selectedStep ? 'codePink' : 'utilGrayDark' @@ -262,9 +264,6 @@ export default { this.steps['openMessageText'].complete = true this.step = this.steps[selectedStep] }, - handleJsonValidation(event) { - this.validJson = !event - }, handleNext() { if (this.step.name === 'openMessageText') { this.steps['openMessageText'].complete = true @@ -646,14 +645,10 @@ export default { @keydown.enter="saveMessage" /> - diff --git a/src/pages/Integrations/PagerDuty.vue b/src/pages/Integrations/PagerDuty.vue index b6404c299..4ff56ab62 100644 --- a/src/pages/Integrations/PagerDuty.vue +++ b/src/pages/Integrations/PagerDuty.vue @@ -1,6 +1,7 @@