You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ep...@apache.org on 2022/07/05 18:11:07 UTC

[airflow] 02/03: improve grid date tick spacing (#24849)

This is an automated email from the ASF dual-hosted git repository.

ephraimanierobi pushed a commit to branch v2-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit a8762fca890e1cbb9182d28afd2c386cf93ad495
Author: Brent Bovenzi <br...@gmail.com>
AuthorDate: Tue Jul 5 14:01:54 2022 -0400

    improve grid date tick spacing (#24849)
    
    (cherry picked from commit 6caaf476d3ca53f2e53701b21de1d4f828e8b8b1)
---
 airflow/www/static/js/grid/dagRuns/Bar.tsx        | 5 +++--
 airflow/www/static/js/grid/dagRuns/index.test.tsx | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/airflow/www/static/js/grid/dagRuns/Bar.tsx b/airflow/www/static/js/grid/dagRuns/Bar.tsx
index 7e9b2ef353..660619f5b7 100644
--- a/airflow/www/static/js/grid/dagRuns/Bar.tsx
+++ b/airflow/www/static/js/grid/dagRuns/Bar.tsx
@@ -70,8 +70,9 @@ const DagRunBar = ({
   };
 
   // show the tick on the 4th DagRun and then every 10th tick afterwards
-  const shouldShowTick = index === totalRuns - 4
-    || (index < totalRuns - 4 && (index + 4) % 10 === 0);
+  const inverseIndex = totalRuns - index;
+  const shouldShowTick = inverseIndex === 4
+    || (inverseIndex > 4 && (inverseIndex - 4) % 10 === 0);
 
   return (
     <Box
diff --git a/airflow/www/static/js/grid/dagRuns/index.test.tsx b/airflow/www/static/js/grid/dagRuns/index.test.tsx
index 612c96eb27..c91e15f59f 100644
--- a/airflow/www/static/js/grid/dagRuns/index.test.tsx
+++ b/airflow/www/static/js/grid/dagRuns/index.test.tsx
@@ -106,7 +106,7 @@ describe('Test DagRuns', () => {
   test('Show 1 date tick when there are less than 14 runs', () => {
     const data = {
       groups: {},
-      dagRuns: generateRuns(8),
+      dagRuns: generateRuns(11),
     };
     const spy = jest.spyOn(useGridDataModule, 'default').mockImplementation(() => ({
       data,