Commit f4810472 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '325824-prettify-sample-json' into 'master'

Prettify JSON of sample alert payload

See merge request gitlab-org/gitlab!58433
parents 0cc1b04b eb8769b2
......@@ -255,7 +255,7 @@ export default {
if (this.showMappingBuilder) {
this.resetPayloadAndMappingConfirmed = false;
this.parsedPayload = payloadAlertFields;
this.samplePayload.json = this.isValidNonEmptyJSON(payloadExample) ? payloadExample : null;
this.samplePayload.json = this.getPrettifiedPayload(payloadExample);
this.updateMapping(this.getCleanMapping(payloadAttributeMappings));
}
this.$el.scrollIntoView({ block: 'center' });
......@@ -288,6 +288,11 @@ export default {
}
return false;
},
getPrettifiedPayload(payload) {
return this.isValidNonEmptyJSON(payload)
? JSON.stringify(JSON.parse(payload), null, '\t')
: null;
},
triggerValidation() {
if (this.isHttp) {
this.validationState.apiUrl = true;
......
---
title: Prettify JSON of sample alert payload
merge_request: 58433
author:
type: added
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment