This is an automated email from the ASF dual-hosted git repository.
vatsrahul1001 pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-4-test by this push:
new 1864344b913 [v3-4-test] Show Dag version diff values-hidden pill only
when values are hidden (#74746) (#74960)
1864344b913 is described below
commit 1864344b9136646e5144452b289ec9c86a782076
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sun Oct 18 18:05:06 2026 +0530
[v3-4-test] Show Dag version diff values-hidden pill only when values are
hidden (#74746) (#74960)
The comparison header always showed an "Observed state" pill, a "Values
shown"/"Values hidden" pill and a "Values require access to Dag code"
hint, so users who could see values were still told they needed access.
Drop the static "Observed state" and "Values shown" pills and show the
"Values hidden" pill only when values are withheld, with the access hint
as its hover tooltip. Remove the now-unused translation keys.
(cherry picked from commit 27433bf4830800f57970d4dad2b9772da2cf4e01)
Co-authored-by: Jed Cunningham
<[email protected]>
---
.../src/airflow/ui/public/i18n/locales/ca/dag.json | 4 +--
.../src/airflow/ui/public/i18n/locales/de/dag.json | 4 +--
.../src/airflow/ui/public/i18n/locales/el/dag.json | 4 +--
.../src/airflow/ui/public/i18n/locales/en/dag.json | 4 +--
.../src/airflow/ui/public/i18n/locales/fr/dag.json | 4 +--
.../src/airflow/ui/public/i18n/locales/ko/dag.json | 4 +--
.../src/airflow/ui/public/i18n/locales/pl/dag.json | 4 +--
.../airflow/ui/public/i18n/locales/zh-TW/dag.json | 4 +--
.../ui/src/pages/Dag/Versions/VersionDiff.test.tsx | 33 ++++++++++++++++++----
.../ui/src/pages/Dag/Versions/VersionDiff.tsx | 16 +++++------
10 files changed, 42 insertions(+), 39 deletions(-)
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json
b/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json
index 8f8d87e3cfa..d1b82f2692a 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/ca/dag.json
@@ -290,7 +290,6 @@
"maxChanges": "Màxim de canvis",
"maxChangesDefault": "Per defecte",
"noChanges": "Aquestes versions contenen el mateix estat.",
- "observedState": "Estat observat",
"observedStateBoundary": "Compara l'estat emmagatzemat actualment, no les
dades del moment de creació. La comparació del codi font no està disponible per
a versions històriques; utilitzeu la pestanya Codi per a comparar el codi
font.",
"operations": {
"added": "Afegit",
@@ -308,7 +307,6 @@
"title": "Comparació no disponible",
"withoutReason": "No s'han pogut comparar aquestes versions."
},
- "valuesHidden": "Valors ocults",
- "valuesShown": "Valors visibles"
+ "valuesHidden": "Valors ocults"
}
}
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/de/dag.json
b/airflow-core/src/airflow/ui/public/i18n/locales/de/dag.json
index dc95842bf68..a32da82f55f 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/de/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/de/dag.json
@@ -321,7 +321,6 @@
"maxChanges": "Maximale Änderungen",
"maxChangesDefault": "Standard",
"noChanges": "Es gibt keinen Unterschied zwischen diesen Versionen.",
- "observedState": "Beachteter Status",
"observedStateBoundary": "Vergleicht aktuell gespeichterte Dagversionen.
Quellcodevergleich ist nicht verfügbar für alte Versionen; Code-Tab nutzen um
Quellcode zu vergleichen.",
"operations": {
"added": "Hinzugefügt",
@@ -340,7 +339,6 @@
"title": "Vergleich nicht verfügbar",
"withoutReason": "Diese Versionen können nicht verglichen werden."
},
- "valuesHidden": "Werte verstecken",
- "valuesShown": "Werte anzeigen"
+ "valuesHidden": "Werte verstecken"
}
}
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/el/dag.json
b/airflow-core/src/airflow/ui/public/i18n/locales/el/dag.json
index 573ab07e7f8..5131752f687 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/el/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/el/dag.json
@@ -290,7 +290,6 @@
"maxChanges": "Μέγιστες αλλαγές",
"maxChangesDefault": "Προεπιλογή",
"noChanges": "Αυτές οι εκδόσεις έχουν την ίδια κατάσταση.",
- "observedState": "Παρατηρούμενη κατάσταση",
"observedStateBoundary": "Συγκρίνει την τρέχουσα αποθηκευμένη κατάσταση,
όχι στοιχεία από τη στιγμή της δημιουργίας. Η σύγκριση πηγαίου κώδικα δεν είναι
διαθέσιμη για ιστορικές εκδόσεις· χρησιμοποιήστε την καρτέλα Κώδικας για
σύγκριση πηγαίου κώδικα.",
"operations": {
"added": "Προστέθηκε",
@@ -308,7 +307,6 @@
"title": "Η σύγκριση δεν είναι διαθέσιμη",
"withoutReason": "Δεν ήταν δυνατή η σύγκριση αυτών των εκδόσεων."
},
- "valuesHidden": "Οι τιμές είναι κρυφές",
- "valuesShown": "Οι τιμές εμφανίζονται"
+ "valuesHidden": "Οι τιμές είναι κρυφές"
}
}
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json
b/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json
index c3ffd1c592b..db2aec35b56 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/dag.json
@@ -327,7 +327,6 @@
"maxChanges": "Max changes",
"maxChangesDefault": "Default",
"noChanges": "These versions hold the same state.",
- "observedState": "Observed state",
"observedStateBoundary": "Compares currently stored state, not
creation-time evidence. Source comparison is unavailable for historical
versions; use the Code tab to compare source.",
"operations": {
"added": "Added",
@@ -348,7 +347,6 @@
"title": "Comparison unavailable",
"withoutReason": "These versions could not be compared."
},
- "valuesHidden": "Values hidden",
- "valuesShown": "Values shown"
+ "valuesHidden": "Values hidden"
}
}
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/fr/dag.json
b/airflow-core/src/airflow/ui/public/i18n/locales/fr/dag.json
index 275a6af3dc0..9f0e0809b82 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/fr/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/fr/dag.json
@@ -299,7 +299,6 @@
"maxChanges": "Changements max.",
"maxChangesDefault": "Par défaut",
"noChanges": "Ces versions ont le même état.",
- "observedState": "État observé",
"observedStateBoundary": "Compare l'état actuellement stocké, et non les
preuves au moment de la création. La comparaison des sources n'est pas
disponible pour les versions historiques ; utilisez l'onglet Code pour comparer
les sources.",
"operations": {
"added": "Ajouté",
@@ -319,7 +318,6 @@
"title": "Comparaison indisponible",
"withoutReason": "Ces versions n'ont pas pu être comparées."
},
- "valuesHidden": "Valeurs masquées",
- "valuesShown": "Valeurs affichées"
+ "valuesHidden": "Valeurs masquées"
}
}
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/ko/dag.json
b/airflow-core/src/airflow/ui/public/i18n/locales/ko/dag.json
index 3dc1cdc451b..8c9f4073fab 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/ko/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/ko/dag.json
@@ -337,7 +337,6 @@
"maxChanges": "최대 변경 수",
"maxChangesDefault": "기본값",
"noChanges": "두 버전에 저장된 상태가 같습니다.",
- "observedState": "관측된 상태",
"observedStateBoundary": "버전 생성 시점의 기록이 아니라 현재 저장된 상태를 비교합니다. 이전 버전은 소스
비교를 지원하지 않으므로, 소스를 비교하려면 코드 탭을 사용하세요.",
"operations": {
"added": "추가됨",
@@ -355,7 +354,6 @@
"title": "비교할 수 없음",
"withoutReason": "두 버전을 비교할 수 없습니다."
},
- "valuesHidden": "값 숨김",
- "valuesShown": "값 표시"
+ "valuesHidden": "값 숨김"
}
}
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/pl/dag.json
b/airflow-core/src/airflow/ui/public/i18n/locales/pl/dag.json
index 87dbcf28ef8..6842f221cbb 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/pl/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/pl/dag.json
@@ -308,7 +308,6 @@
"maxChanges": "Maksymalna liczba zmian",
"maxChangesDefault": "Domyślna",
"noChanges": "Te wersje mają ten sam stan.",
- "observedState": "Zaobserwowany stan",
"observedStateBoundary": "Porównuje aktualnie zapisany stan, a nie dane z
chwili utworzenia. Porównanie kodu źródłowego nie jest dostępne dla wersji
historycznych; aby porównać kod źródłowy, użyj zakładki Kod.",
"operations": {
"added": "Dodano",
@@ -330,7 +329,6 @@
"title": "Porównanie niedostępne",
"withoutReason": "Nie udało się porównać tych wersji."
},
- "valuesHidden": "Wartości ukryte",
- "valuesShown": "Wartości widoczne"
+ "valuesHidden": "Wartości ukryte"
}
}
diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json
b/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json
index 94b7d8704f2..2fa6793ec4b 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/zh-TW/dag.json
@@ -337,7 +337,6 @@
"maxChanges": "變更數上限",
"maxChangesDefault": "預設",
"noChanges": "這些版本的狀態相同。",
- "observedState": "目前儲存狀態",
"observedStateBoundary":
"比較的是目前儲存的狀態,而非建立當時的證據。歷史版本無法比較原始碼;請使用「程式碼」分頁比較原始碼。",
"operations": {
"added": "新增",
@@ -355,7 +354,6 @@
"title": "無法比較",
"withoutReason": "無法比較這些版本。"
},
- "valuesHidden": "值已隱藏",
- "valuesShown": "值已顯示"
+ "valuesHidden": "值已隱藏"
}
}
diff --git
a/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.test.tsx
b/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.test.tsx
index 5a97d7c5a6e..87c28cffb23 100644
--- a/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.test.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.test.tsx
@@ -17,8 +17,8 @@
* under the License.
*/
import "@testing-library/jest-dom/vitest";
-import { render, screen, within } from "@testing-library/react";
-import { describe, expect, it } from "vitest";
+import { act, fireEvent, render, screen, within } from
"@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
import {
$DagVersionDiffCategory,
@@ -114,8 +114,6 @@ describe("VersionDiff", () => {
expect(screen.getByText("/dag/tasks/*/retries")).toBeInTheDocument();
expect(screen.queryByText("versions.columns.before")).not.toBeInTheDocument();
expect(screen.queryByText("versions.columns.after")).not.toBeInTheDocument();
- // Says what would grant them, since nothing here can.
- expect(screen.getByText("versions.codeAccess")).toBeInTheDocument();
});
it("renders every returned record", () => {
@@ -257,11 +255,34 @@ describe("VersionDiff", () => {
expect(cells[6]).toHaveTextContent("bob");
});
- it("labels the disclosure state the response reports", () => {
+ it("shows no disclosure chrome when the caller may see values", () => {
renderDiff(authorized);
- expect(screen.getByText("versions.valuesShown")).toBeInTheDocument();
expect(screen.queryByText("versions.valuesHidden")).not.toBeInTheDocument();
+ expect(screen.queryByText("versions.codeAccess")).not.toBeInTheDocument();
+ });
+
+ it("flags hidden values, saying on hover what would grant them", async () =>
{
+ vi.useFakeTimers();
+
+ try {
+ renderDiff(redacted);
+
+ const pill = screen.getByText("versions.valuesHidden");
+
+ // Only on hover: not repeated as inline text next to the pill.
+
expect(screen.queryByText("versions.codeAccess")).not.toBeInTheDocument();
+
+ await act(async () => {
+ fireEvent.focus(pill);
+ fireEvent.pointerEnter(pill);
+ await vi.advanceTimersByTimeAsync(500);
+ });
+
+
expect(screen.getByRole("tooltip")).toHaveTextContent("versions.codeAccess");
+ } finally {
+ vi.useRealTimers();
+ }
});
it("says so when two versions hold the same state", () => {
diff --git a/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.tsx
b/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.tsx
index 6aefa219149..f388e91c0c1 100644
--- a/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Dag/Versions/VersionDiff.tsx
@@ -176,15 +176,13 @@ export const VersionDiff = ({
</Text>
</Box>
<Flex alignItems="center" gap={2}>
- <Badge
colorPalette="teal">{translate("versions.observedState")}</Badge>
- <Badge colorPalette={valuesShown ? "green" : "gray"}>
- {translate(valuesShown ? "versions.valuesShown" :
"versions.valuesHidden")}
- </Badge>
- {/* Says what grants values, since the viewer cannot grant it here:
the server decides
- from the caller's access to Dag code. */}
- <Text color="fg.muted" fontSize="sm">
- {translate("versions.codeAccess")}
- </Text>
+ {/* The hover says what grants values, since the viewer cannot grant
it here: the server
+ decides from the caller's access to Dag code. */}
+ {valuesShown ? undefined : (
+ <Tooltip content={translate("versions.codeAccess")} portalled>
+ <Badge
colorPalette="gray">{translate("versions.valuesHidden")}</Badge>
+ </Tooltip>
+ )}
{/* Above the table rather than below it: a long diff would
otherwise push the caveat
off-screen exactly when it matters most. */}
<Tooltip content={translate("versions.observedStateBoundary")}
portalled>