Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import { useQuery } from "@tanstack/react-query";
import { useRef, type ReactNode } from "react";
import { NavLink } from "react-router-dom";

import { useContainerWidth } from "src/utils";
import { lte } from "semver";
import { getLegacyRouterNavigation, useContainerWidth } from "src/utils";

type Props = {
readonly tabs: Array<{ icon?: ReactNode; label: string; value: string }>;
Expand All @@ -44,12 +43,7 @@ export const NavTabs = ({ tabs }: Props) => {
let legacyRouterNavigation: boolean | undefined = undefined;

if (data) {
const airflowCoreVersion = data.version;
if (lte(airflowCoreVersion, "3.1.6")) {
legacyRouterNavigation = true;
} else {
legacyRouterNavigation = false;
}
legacyRouterNavigation = getLegacyRouterNavigation(data.version);
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

export { autoRefreshInterval } from "./config";
export { useContainerWidth } from "./useContainerWidth";
export { getLegacyRouterNavigation } from "./versionUtils";
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

/*!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { getLegacyRouterNavigation } from "src/utils/versionUtils";
import { describe, expect, it } from "vitest";

describe("getLegacyRouterNavigation", () => {
it("returns true for versions <= 3.1.6", () => {
expect(getLegacyRouterNavigation("3.1.6")).toBe(true);
expect(getLegacyRouterNavigation("3.1.5")).toBe(true);
expect(getLegacyRouterNavigation("3.0.0")).toBe(true);
});

it("returns false for versions > 3.1.6", () => {
expect(getLegacyRouterNavigation("3.1.7")).toBe(false);
expect(getLegacyRouterNavigation("3.1.7rc1")).toBe(false);
expect(getLegacyRouterNavigation("3.2.0")).toBe(false);
expect(getLegacyRouterNavigation("4.0.0")).toBe(false);
});

it("returns undefined for invalid versions", () => {
expect(getLegacyRouterNavigation("invalid")).toBe(undefined);
expect(getLegacyRouterNavigation("")).toBe(undefined);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

/*!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { coerce, lte } from "semver";

export const getLegacyRouterNavigation = (version: string): boolean | undefined => {
const coercedVersion = coerce(version);
const airflowCoreVersion = coercedVersion?.version ?? null;

if (airflowCoreVersion) {
return lte(airflowCoreVersion, "3.1.6");
}
return undefined;
};
2 changes: 1 addition & 1 deletion providers/edge3/www-hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
94785f1784e07613622a92efb89c8462c814f73c1c8add12af2404ecd88e4820
19f521c1d0e6f65e70c05c45650ec710e5301922f9e18079529284c007cda3b9