You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/01 15:16:10 UTC
[GitHub] [airflow] bbovenzi commented on a diff in pull request #27805: Automatically save and allow restore of recent DAG run configs
bbovenzi commented on code in PR #27805:
URL: https://github.com/apache/airflow/pull/27805#discussion_r1037236111
##########
airflow/www/static/js/trigger.js:
##########
@@ -20,13 +20,32 @@
/* global document, CodeMirror, window */
const textArea = document.getElementById('json');
+const recentConfigList = document.getElementById('recent_configs');
const minHeight = 300;
const maxHeight = window.innerHeight - 450;
const height = maxHeight > minHeight ? maxHeight : minHeight;
CodeMirror.fromTextArea(textArea, {
lineNumbers: true,
- mode: { name: 'javascript', json: true },
+ mode: {
+ name: 'javascript',
+ json: true,
+ },
gutters: ['CodeMirror-lint-markers'],
lint: true,
-}).setSize(null, height);
+})
+ .setSize(null, height);
+
+function setRecentConfig(e) {
+ let { value } = e.target;
+ try {
+ const json = JSON.parse(value);
+ value = JSON.stringify(json, null, 2);
+ } catch (err) {
+ // any error is non-json parseable
+ value = 'Error: config could not be parsed';
Review Comment:
We can throw a `console.error()` here, but lets leave the value as a single string if we can't parse it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org