You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "pierrejeambrun (via GitHub)" <gi...@apache.org> on 2025/02/20 17:51:35 UTC
[PR] AIP-38 Injectable path for static files [airflow]
pierrejeambrun opened a new pull request, #46933:
URL: https://github.com/apache/airflow/pull/46933
Solves https://github.com/apache/airflow/issues/46548
Built on top of https://github.com/apache/airflow/pull/46900, only the last commit is relevant.
First draft, you should be able to edit the `fastapi.base_url` parameter, for instance set `http://localhost:29091/d12345`, and the UI should render at: `http://localhost:29091/d12345/webapp`

I need to fix the pin.
For future request, I noticed that the tasksdk client might be not using the `base_url` param and reach the wrong endpoints when this is configured.
--
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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #46933:
URL: https://github.com/apache/airflow/pull/46933#discussion_r1965863877
##########
airflow/ui/vite.config.ts:
##########
@@ -30,7 +30,7 @@ export default defineConfig({
{
name: "transform-url-src",
transformIndexHtml: (html) =>
- html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="/webapp/`),
+ html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="./`),
Review Comment:
`<base href="">` might be a fix for that?
--
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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #46933:
URL: https://github.com/apache/airflow/pull/46933#discussion_r1965897647
##########
airflow/ui/src/router.tsx:
##########
@@ -168,4 +168,8 @@ export const routerConfig = [
},
];
-export const router = createBrowserRouter(routerConfig, { basename: "/webapp" });
+const locationPath = globalThis.window.location.pathname;
+const indexOf = locationPath.indexOf("webapp/");
Review Comment:
Now that we are adding a base tag, is it worth using that instead of the path based guessing approach? (What we have is probably fine, but we could not have to guess at all)
--
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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #46933:
URL: https://github.com/apache/airflow/pull/46933#discussion_r1965819344
##########
airflow/ui/vite.config.ts:
##########
@@ -30,7 +30,7 @@ export default defineConfig({
{
name: "transform-url-src",
transformIndexHtml: (html) =>
- html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="/webapp/`),
+ html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="./`),
Review Comment:
Question: What path does the browser request for when you click a link directly to a sub-page? i.e. if you navigate to a TI page etc, and then open a new tab directly at that URL, does the browser see the base as `/webapp/` or the current url and try to request `/webapp/dag/<dag>/.../static/pin_32.png`? Maybe not for that file, but other images. that's my concern.
--
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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #46933:
URL: https://github.com/apache/airflow/pull/46933#discussion_r1965852574
##########
airflow/ui/vite.config.ts:
##########
@@ -30,7 +30,7 @@ export default defineConfig({
{
name: "transform-url-src",
transformIndexHtml: (html) =>
- html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="/webapp/`),
+ html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="./`),
Review Comment:
You're right, that's not handled properly at the moment.
Let me take a look.
--
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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #46933:
URL: https://github.com/apache/airflow/pull/46933#discussion_r1965893374
##########
airflow/ui/vite.config.ts:
##########
@@ -30,7 +30,7 @@ export default defineConfig({
{
name: "transform-url-src",
transformIndexHtml: (html) =>
- html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="/webapp/`),
+ html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="./`),
Review Comment:
https://github.com/apache/airflow/pull/46933/commits/9adf8628a1086438cf2c7848d3525299dc793092
--
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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #46933:
URL: https://github.com/apache/airflow/pull/46933#discussion_r1965898866
##########
airflow/ui/src/router.tsx:
##########
@@ -168,4 +168,8 @@ export const routerConfig = [
},
];
-export const router = createBrowserRouter(routerConfig, { basename: "/webapp" });
+const locationPath = globalThis.window.location.pathname;
+const indexOf = locationPath.indexOf("webapp/");
Review Comment:
Oh, it want's the path, nm, probably not worth 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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun merged PR #46933:
URL: https://github.com/apache/airflow/pull/46933
--
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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on PR #46933:
URL: https://github.com/apache/airflow/pull/46933#issuecomment-2672269602
Noticed an issue, working on 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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #46933:
URL: https://github.com/apache/airflow/pull/46933#discussion_r1965872657
##########
airflow/ui/vite.config.ts:
##########
@@ -30,7 +30,7 @@ export default defineConfig({
{
name: "transform-url-src",
transformIndexHtml: (html) =>
- html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="/webapp/`),
+ html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="./`),
Review Comment:
Yes base might be good.
--
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
Re: [PR] AIP-38 Injectable path for static files [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #46933:
URL: https://github.com/apache/airflow/pull/46933#discussion_r1965893692
##########
airflow/ui/vite.config.ts:
##########
@@ -30,7 +30,7 @@ export default defineConfig({
{
name: "transform-url-src",
transformIndexHtml: (html) =>
- html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="/webapp/`),
+ html.replace(`src="./assets/`, `src="./static/assets/`).replace(`href="/`, `href="./`),
Review Comment:
Base is working nicely
--
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