From c0b30f5f93787a37ac7692865372984c16921a9a Mon Sep 17 00:00:00 2001 From: Ashish Patel Date: Mon, 13 Dec 2021 22:44:15 +0000 Subject: [PATCH 1/6] changes added --- airflow/www/static/js/dag.js | 7 +++++-- airflow/www/static/js/datetime_utils.js | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/airflow/www/static/js/dag.js b/airflow/www/static/js/dag.js index b716c206f11b5..28a721bd9a83f 100644 --- a/airflow/www/static/js/dag.js +++ b/airflow/www/static/js/dag.js @@ -20,7 +20,7 @@ /* global document, window, $ */ import getMetaValue from './meta_value'; -import { formatDateTime } from './datetime_utils'; +import { formatDateTime,approxTimeFromNow } from './datetime_utils'; function updateQueryStringParameter(uri, key, value) { const re = new RegExp(`([?&])${key}=.*?(&|$)`, 'i'); @@ -283,7 +283,10 @@ $('#pause_resume').on('change', function onChange() { $('#next-run').on('mouseover', () => { $('#next-run').attr('data-original-title', () => { let newTitle = ''; - if (nextRun.createAfter) newTitle += `Run After: ${formatDateTime(nextRun.createAfter)}

`; + if (nextRun.createAfter){ + newTitle += `Run After: ${formatDateTime(nextRun.createAfter)}
`; + newTitle += `Run Approximately: ${approxTimeFromNow(nextRun.createAfter)}

`; + } if (nextRun.intervalStart && nextRun.intervalEnd) { newTitle += 'Data Interval
'; newTitle += `Start: ${formatDateTime(nextRun.intervalStart)}
`; diff --git a/airflow/www/static/js/datetime_utils.js b/airflow/www/static/js/datetime_utils.js index 8efd3fde28241..e564a8131478b 100644 --- a/airflow/www/static/js/datetime_utils.js +++ b/airflow/www/static/js/datetime_utils.js @@ -109,3 +109,10 @@ export const formatDuration = (dur) => { // .as('milliseconds') is necessary for .format() to work correctly return `${days > 0 ? `${days}d` : ''}${moment.utc(duration.as('milliseconds')).format('HH:mm:ss')}`; }; + +export const approxTimeFromNow = (dur) => { + console.log(dur); + const timefromNow = moment(dur); + console.log(timefromNow); + return `${timefromNow.fromNow()}`; +}; From a45d32f66a39c67f93fb1907a9eb9e286ffec13f Mon Sep 17 00:00:00 2001 From: Ashish Patel Date: Mon, 13 Dec 2021 23:07:53 +0000 Subject: [PATCH 2/6] 19098 - approx time added in home page as well. --- airflow/www/static/js/dag.js | 2 +- airflow/www/static/js/dags.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/airflow/www/static/js/dag.js b/airflow/www/static/js/dag.js index 28a721bd9a83f..a31d333338168 100644 --- a/airflow/www/static/js/dag.js +++ b/airflow/www/static/js/dag.js @@ -20,7 +20,7 @@ /* global document, window, $ */ import getMetaValue from './meta_value'; -import { formatDateTime,approxTimeFromNow } from './datetime_utils'; +import { approxTimeFromNow ,formatDateTime } from './datetime_utils'; function updateQueryStringParameter(uri, key, value) { const re = new RegExp(`([?&])${key}=.*?(&|$)`, 'i'); diff --git a/airflow/www/static/js/dags.js b/airflow/www/static/js/dags.js index 012aa16d61ea0..2d99f31b30f6f 100644 --- a/airflow/www/static/js/dags.js +++ b/airflow/www/static/js/dags.js @@ -21,7 +21,7 @@ import getMetaValue from './meta_value'; import tiTooltip from './task_instances'; -import { formatDateTime } from './datetime_utils'; +import { approxTimeFromNow ,formatDateTime } from './datetime_utils'; const DAGS_INDEX = getMetaValue('dags_index'); const ENTER_KEY_CODE = 13; @@ -371,7 +371,8 @@ $('.js-next-run-tooltip').each((i, run) => { const nextRunData = $(run).attr('data-nextrun'); const [createAfter, intervalStart, intervalEnd] = nextRunData.split(','); let newTitle = ''; - newTitle += `Run After: ${formatDateTime(createAfter)}

`; + newTitle += `Run After: ${formatDateTime(createAfter)}
`; + newTitle += `Run Approximately: ${approxTimeFromNow(createAfter)}

`; newTitle += 'Data Interval
'; newTitle += `Start: ${formatDateTime(intervalStart)}
`; newTitle += `End: ${formatDateTime(intervalEnd)}`; From 31dfb4247588219e2a4e435ce9c4f17d20863b69 Mon Sep 17 00:00:00 2001 From: Ashish Patel Date: Mon, 13 Dec 2021 23:11:50 +0000 Subject: [PATCH 3/6] 19098 - approx time added in home page as well. --- airflow/www/static/js/dag.js | 2 +- airflow/www/static/js/dags.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airflow/www/static/js/dag.js b/airflow/www/static/js/dag.js index a31d333338168..a17dfd52f10cd 100644 --- a/airflow/www/static/js/dag.js +++ b/airflow/www/static/js/dag.js @@ -20,7 +20,7 @@ /* global document, window, $ */ import getMetaValue from './meta_value'; -import { approxTimeFromNow ,formatDateTime } from './datetime_utils'; +import { approxTimeFromNow, formatDateTime } from './datetime_utils'; function updateQueryStringParameter(uri, key, value) { const re = new RegExp(`([?&])${key}=.*?(&|$)`, 'i'); diff --git a/airflow/www/static/js/dags.js b/airflow/www/static/js/dags.js index 2d99f31b30f6f..1d834a6167b9e 100644 --- a/airflow/www/static/js/dags.js +++ b/airflow/www/static/js/dags.js @@ -21,7 +21,7 @@ import getMetaValue from './meta_value'; import tiTooltip from './task_instances'; -import { approxTimeFromNow ,formatDateTime } from './datetime_utils'; +import { approxTimeFromNow, formatDateTime } from './datetime_utils'; const DAGS_INDEX = getMetaValue('dags_index'); const ENTER_KEY_CODE = 13; From a65c018e64945ab5b4c7ea7efac03c16c203982f Mon Sep 17 00:00:00 2001 From: Ashish Patel Date: Mon, 13 Dec 2021 23:12:22 +0000 Subject: [PATCH 4/6] 19098 - approx time added in home page as well. --- airflow/www/static/js/datetime_utils.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/airflow/www/static/js/datetime_utils.js b/airflow/www/static/js/datetime_utils.js index e564a8131478b..3b89374fea7b4 100644 --- a/airflow/www/static/js/datetime_utils.js +++ b/airflow/www/static/js/datetime_utils.js @@ -111,8 +111,6 @@ export const formatDuration = (dur) => { }; export const approxTimeFromNow = (dur) => { - console.log(dur); const timefromNow = moment(dur); - console.log(timefromNow); return `${timefromNow.fromNow()}`; }; From 8d66829ed168b414d2a44a06eec183b8d6032449 Mon Sep 17 00:00:00 2001 From: Ashish Patel Date: Tue, 14 Dec 2021 13:58:22 +0000 Subject: [PATCH 5/6] 19098 - approx time added in home page as well. --- airflow/www/static/js/dag.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/www/static/js/dag.js b/airflow/www/static/js/dag.js index a17dfd52f10cd..0b4e50689d156 100644 --- a/airflow/www/static/js/dag.js +++ b/airflow/www/static/js/dag.js @@ -283,7 +283,7 @@ $('#pause_resume').on('change', function onChange() { $('#next-run').on('mouseover', () => { $('#next-run').attr('data-original-title', () => { let newTitle = ''; - if (nextRun.createAfter){ + if (nextRun.createAfter) { newTitle += `Run After: ${formatDateTime(nextRun.createAfter)}
`; newTitle += `Run Approximately: ${approxTimeFromNow(nextRun.createAfter)}

`; } From fabb4d3b86b94ba228b6d355b42e23a86d9d1877 Mon Sep 17 00:00:00 2001 From: Ashish Patel Date: Tue, 14 Dec 2021 22:38:16 +0000 Subject: [PATCH 6/6] 19098 - Next Run is used without strong --- airflow/www/static/js/dag.js | 2 +- airflow/www/static/js/dags.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airflow/www/static/js/dag.js b/airflow/www/static/js/dag.js index 0b4e50689d156..bc897c346e7d5 100644 --- a/airflow/www/static/js/dag.js +++ b/airflow/www/static/js/dag.js @@ -285,7 +285,7 @@ $('#next-run').on('mouseover', () => { let newTitle = ''; if (nextRun.createAfter) { newTitle += `Run After: ${formatDateTime(nextRun.createAfter)}
`; - newTitle += `Run Approximately: ${approxTimeFromNow(nextRun.createAfter)}

`; + newTitle += `Next Run: ${approxTimeFromNow(nextRun.createAfter)}

`; } if (nextRun.intervalStart && nextRun.intervalEnd) { newTitle += 'Data Interval
'; diff --git a/airflow/www/static/js/dags.js b/airflow/www/static/js/dags.js index 1d834a6167b9e..b9309de775fcc 100644 --- a/airflow/www/static/js/dags.js +++ b/airflow/www/static/js/dags.js @@ -372,7 +372,7 @@ $('.js-next-run-tooltip').each((i, run) => { const [createAfter, intervalStart, intervalEnd] = nextRunData.split(','); let newTitle = ''; newTitle += `Run After: ${formatDateTime(createAfter)}
`; - newTitle += `Run Approximately: ${approxTimeFromNow(createAfter)}

`; + newTitle += `Next Run: ${approxTimeFromNow(createAfter)}

`; newTitle += 'Data Interval
'; newTitle += `Start: ${formatDateTime(intervalStart)}
`; newTitle += `End: ${formatDateTime(intervalEnd)}`;