feat(editor): Handle pin data edge cases and unify validation (no-changelog) (#6685)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Alex Grozav
2023-11-02 10:43:02 +02:00
committed by GitHub
parent 27f37091c8
commit 721a36637c
15 changed files with 238 additions and 142 deletions

View File

@@ -660,24 +660,12 @@ export default defineComponent({
if (shouldPinDataBeforeClosing === MODAL_CONFIRM) {
const { value } = this.outputPanelEditMode;
if (!this.isValidPinDataSize(value)) {
dataPinningEventBus.emit('data-pinning-error', {
errorType: 'data-too-large',
source: 'on-ndv-close-modal',
});
return;
}
if (!this.isValidPinDataJSON(value)) {
dataPinningEventBus.emit('data-pinning-error', {
errorType: 'invalid-json',
source: 'on-ndv-close-modal',
});
return;
}
if (this.activeNode) {
this.workflowsStore.pinData({ node: this.activeNode, data: jsonParse(value) });
try {
this.setPinData(this.activeNode, jsonParse(value), 'on-ndv-close-modal');
} catch (error) {
console.error(error);
}
}
}