Skip to content

Commit e95a559

Browse files
authored
Merge pull request #20516 from natefoo/web-client-static-fixes
[25.0] Fixes for static handling and the web_client package
2 parents 43feb0e + 39285ff commit e95a559

File tree

6 files changed

+136
-121
lines changed

6 files changed

+136
-121
lines changed

doc/source/admin/galaxy_options.rst

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,9 +2502,9 @@
25022502

25032503
:Description:
25042504
Serve static content, which must be enabled if you're not serving
2505-
it via a proxy server. These options should be self explanatory
2506-
and so are not documented individually. You can use these paths
2507-
(or ones in the proxy server) to point to your own styles.
2505+
it via a proxy server. You can use these paths (or ones in the
2506+
proxy server) to point to your own styles. The static_* options
2507+
that refer to paths are relative to the current working directory.
25082508
:Default: ``true``
25092509
:Type: bool
25102510

@@ -2514,10 +2514,8 @@
25142514
~~~~~~~~~~~~~~~~~~~~~
25152515

25162516
:Description:
2517-
Serve static content, which must be enabled if you're not serving
2518-
it via a proxy server. These options should be self explanatory
2519-
and so are not documented individually. You can use these paths
2520-
(or ones in the proxy server) to point to your own styles.
2517+
Value of cache time for static content served by Galaxy. Ignored
2518+
if static_enabled is false.
25212519
:Default: ``360``
25222520
:Type: int
25232521

@@ -2527,24 +2525,32 @@
25272525
~~~~~~~~~~~~~~
25282526

25292527
:Description:
2530-
Serve static content, which must be enabled if you're not serving
2531-
it via a proxy server. These options should be self explanatory
2532-
and so are not documented individually. You can use these paths
2533-
(or ones in the proxy server) to point to your own styles.
2528+
Path to the static content dir. Ignored if static_enabled is
2529+
false.
25342530
:Default: ``static/``
25352531
:Type: str
25362532

25372533

2534+
~~~~~~~~~~~~~~~~~~~
2535+
``static_dist_dir``
2536+
~~~~~~~~~~~~~~~~~~~
2537+
2538+
:Description:
2539+
Path to the built Galaxy client application, static/dist/ in the
2540+
Galaxy source code after the build is complete. Ignored if
2541+
static_enabled is false.
2542+
:Default: ``static/dist/``
2543+
:Type: str
2544+
2545+
25382546
~~~~~~~~~~~~~~~~~~~~~
25392547
``static_images_dir``
25402548
~~~~~~~~~~~~~~~~~~~~~
25412549

25422550
:Description:
2543-
Serve static content, which must be enabled if you're not serving
2544-
it via a proxy server. These options should be self explanatory
2545-
and so are not documented individually. You can use these paths
2546-
(or ones in the proxy server) to point to your own styles.
2547-
:Default: ``static/images``
2551+
Path to the static images directory. Ignored if static_enabled is
2552+
false.
2553+
:Default: ``static/images/``
25482554
:Type: str
25492555

25502556

@@ -2553,10 +2559,8 @@
25532559
~~~~~~~~~~~~~~~~~~~~~~
25542560

25552561
:Description:
2556-
Serve static content, which must be enabled if you're not serving
2557-
it via a proxy server. These options should be self explanatory
2558-
and so are not documented individually. You can use these paths
2559-
(or ones in the proxy server) to point to your own styles.
2562+
Path to favicon.ico, not the directory that contains it (the name
2563+
is a misnomer). Ignored if static_enabled is false.
25602564
:Default: ``static/favicon.ico``
25612565
:Type: str
25622566

@@ -2566,10 +2570,8 @@
25662570
~~~~~~~~~~~~~~~~~~~~~~
25672571

25682572
:Description:
2569-
Serve static content, which must be enabled if you're not serving
2570-
it via a proxy server. These options should be self explanatory
2571-
and so are not documented individually. You can use these paths
2572-
(or ones in the proxy server) to point to your own styles.
2573+
Path to the static scripts directory. Ignored if static_enabled is
2574+
false.
25732575
:Default: ``static/scripts/``
25742576
:Type: str
25752577

@@ -2579,11 +2581,9 @@
25792581
~~~~~~~~~~~~~~~~~~~~
25802582

25812583
:Description:
2582-
Serve static content, which must be enabled if you're not serving
2583-
it via a proxy server. These options should be self explanatory
2584-
and so are not documented individually. You can use these paths
2585-
(or ones in the proxy server) to point to your own styles.
2586-
:Default: ``static/style``
2584+
Path to the static style directory. Ignored if static_enabled is
2585+
false.
2586+
:Default: ``static/style/``
25872587
:Type: str
25882588

25892589

@@ -2592,10 +2592,7 @@
25922592
~~~~~~~~~~~~~~~~~~~~~
25932593

25942594
:Description:
2595-
Serve static content, which must be enabled if you're not serving
2596-
it via a proxy server. These options should be self explanatory
2597-
and so are not documented individually. You can use these paths
2598-
(or ones in the proxy server) to point to your own styles.
2595+
Path to robots.txt. Ignored if static_enabled is false.
25992596
:Default: ``static/robots.txt``
26002597
:Type: str
26012598

lib/galaxy/config/sample/galaxy.yml.sample

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,51 +1533,40 @@ galaxy:
15331533
#terms_url: null
15341534

15351535
# Serve static content, which must be enabled if you're not serving it
1536-
# via a proxy server. These options should be self explanatory and so
1537-
# are not documented individually. You can use these paths (or ones
1538-
# in the proxy server) to point to your own styles.
1536+
# via a proxy server. You can use these paths (or ones in the proxy
1537+
# server) to point to your own styles. The static_* options that refer
1538+
# to paths are relative to the current working directory.
15391539
#static_enabled: true
15401540

1541-
# Serve static content, which must be enabled if you're not serving it
1542-
# via a proxy server. These options should be self explanatory and so
1543-
# are not documented individually. You can use these paths (or ones
1544-
# in the proxy server) to point to your own styles.
1541+
# Value of cache time for static content served by Galaxy. Ignored if
1542+
# static_enabled is false.
15451543
#static_cache_time: 360
15461544

1547-
# Serve static content, which must be enabled if you're not serving it
1548-
# via a proxy server. These options should be self explanatory and so
1549-
# are not documented individually. You can use these paths (or ones
1550-
# in the proxy server) to point to your own styles.
1545+
# Path to the static content dir. Ignored if static_enabled is false.
15511546
#static_dir: static/
15521547

1553-
# Serve static content, which must be enabled if you're not serving it
1554-
# via a proxy server. These options should be self explanatory and so
1555-
# are not documented individually. You can use these paths (or ones
1556-
# in the proxy server) to point to your own styles.
1557-
#static_images_dir: static/images
1548+
# Path to the built Galaxy client application, static/dist/ in the
1549+
# Galaxy source code after the build is complete. Ignored if
1550+
# static_enabled is false.
1551+
#static_dist_dir: static/dist/
15581552

1559-
# Serve static content, which must be enabled if you're not serving it
1560-
# via a proxy server. These options should be self explanatory and so
1561-
# are not documented individually. You can use these paths (or ones
1562-
# in the proxy server) to point to your own styles.
1553+
# Path to the static images directory. Ignored if static_enabled is
1554+
# false.
1555+
#static_images_dir: static/images/
1556+
1557+
# Path to favicon.ico, not the directory that contains it (the name is
1558+
# a misnomer). Ignored if static_enabled is false.
15631559
#static_favicon_dir: static/favicon.ico
15641560

1565-
# Serve static content, which must be enabled if you're not serving it
1566-
# via a proxy server. These options should be self explanatory and so
1567-
# are not documented individually. You can use these paths (or ones
1568-
# in the proxy server) to point to your own styles.
1561+
# Path to the static scripts directory. Ignored if static_enabled is
1562+
# false.
15691563
#static_scripts_dir: static/scripts/
15701564

1571-
# Serve static content, which must be enabled if you're not serving it
1572-
# via a proxy server. These options should be self explanatory and so
1573-
# are not documented individually. You can use these paths (or ones
1574-
# in the proxy server) to point to your own styles.
1575-
#static_style_dir: static/style
1565+
# Path to the static style directory. Ignored if static_enabled is
1566+
# false.
1567+
#static_style_dir: static/style/
15761568

1577-
# Serve static content, which must be enabled if you're not serving it
1578-
# via a proxy server. These options should be self explanatory and so
1579-
# are not documented individually. You can use these paths (or ones
1580-
# in the proxy server) to point to your own styles.
1569+
# Path to robots.txt. Ignored if static_enabled is false.
15811570
#static_robots_txt: static/robots.txt
15821571

15831572
# Incremental Display Options

lib/galaxy/config/schemas/config_schema.yml

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,85 +1866,75 @@ mapping:
18661866
required: false
18671867
desc: |
18681868
Serve static content, which must be enabled if you're not serving it via a
1869-
proxy server. These options should be self explanatory and so are not
1870-
documented individually. You can use these paths (or ones in the proxy
1871-
server) to point to your own styles.
1869+
proxy server. You can use these paths (or ones in the proxy server) to point to
1870+
your own styles. The static_* options that refer to paths are relative to the
1871+
current working directory.
18721872
18731873
static_cache_time:
18741874
type: int
18751875
default: 360
18761876
required: false
18771877
desc: |
1878-
Serve static content, which must be enabled if you're not serving it via a
1879-
proxy server. These options should be self explanatory and so are not
1880-
documented individually. You can use these paths (or ones in the proxy
1881-
server) to point to your own styles.
1878+
Value of cache time for static content served by Galaxy. Ignored if
1879+
static_enabled is false.
18821880
18831881
static_dir:
18841882
type: str
18851883
default: static/
18861884
per_host: true
18871885
required: false
18881886
desc: |
1889-
Serve static content, which must be enabled if you're not serving it via a
1890-
proxy server. These options should be self explanatory and so are not
1891-
documented individually. You can use these paths (or ones in the proxy
1892-
server) to point to your own styles.
1887+
Path to the static content dir. Ignored if static_enabled is false.
1888+
1889+
static_dist_dir:
1890+
type: str
1891+
default: static/dist/
1892+
per_host: true
1893+
required: false
1894+
desc: |
1895+
Path to the built Galaxy client application, static/dist/ in the Galaxy source
1896+
code after the build is complete. Ignored if static_enabled is false.
18931897
18941898
static_images_dir:
18951899
type: str
1896-
default: static/images
1900+
default: static/images/
18971901
per_host: true
18981902
required: false
18991903
desc: |
1900-
Serve static content, which must be enabled if you're not serving it via a
1901-
proxy server. These options should be self explanatory and so are not
1902-
documented individually. You can use these paths (or ones in the proxy
1903-
server) to point to your own styles.
1904+
Path to the static images directory. Ignored if static_enabled is false.
19041905
19051906
static_favicon_dir:
19061907
type: str
19071908
default: static/favicon.ico
19081909
per_host: true
19091910
required: false
19101911
desc: |
1911-
Serve static content, which must be enabled if you're not serving it via a
1912-
proxy server. These options should be self explanatory and so are not
1913-
documented individually. You can use these paths (or ones in the proxy
1914-
server) to point to your own styles.
1912+
Path to favicon.ico, not the directory that contains it (the name is a
1913+
misnomer). Ignored if static_enabled is false.
19151914
19161915
static_scripts_dir:
19171916
type: str
19181917
default: static/scripts/
19191918
per_host: true
19201919
required: false
19211920
desc: |
1922-
Serve static content, which must be enabled if you're not serving it via a
1923-
proxy server. These options should be self explanatory and so are not
1924-
documented individually. You can use these paths (or ones in the proxy
1925-
server) to point to your own styles.
1921+
Path to the static scripts directory. Ignored if static_enabled is false.
19261922
19271923
static_style_dir:
19281924
type: str
1929-
default: static/style
1925+
default: static/style/
19301926
per_host: true
19311927
required: false
19321928
desc: |
1933-
Serve static content, which must be enabled if you're not serving it via a
1934-
proxy server. These options should be self explanatory and so are not
1935-
documented individually. You can use these paths (or ones in the proxy
1936-
server) to point to your own styles.
1929+
Path to the static style directory. Ignored if static_enabled is false.
19371930
19381931
static_robots_txt:
19391932
type: str
19401933
default: static/robots.txt
19411934
per_host: true
19421935
required: false
19431936
desc: |
1944-
Serve static content, which must be enabled if you're not serving it via a
1945-
proxy server. These options should be self explanatory and so are not
1946-
documented individually. You can use these paths (or ones in the proxy
1947-
server) to point to your own styles.
1937+
Path to robots.txt. Ignored if static_enabled is false.
19481938
19491939
display_chunk_size:
19501940
type: int

lib/galaxy/webapps/base/webapp.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@
6666
try:
6767
import galaxy.web_client
6868

69-
default_static_dir = os.path.dirname(galaxy.web_client.__file__)
69+
default_static_dist_dir = os.path.join(os.path.dirname(galaxy.web_client.__file__), "dist")
7070
except ImportError:
71-
default_static_dir = "static/"
71+
default_static_dist_dir = None # type: ignore[assignment]
7272

7373
log = logging.getLogger(__name__)
7474

@@ -1160,17 +1160,19 @@ def get_static_from_config(option_name, default_path, sample=None):
11601160
return Static(config_val, cache_time, directory_per_host=per_host_config)
11611161

11621162
# Define static mappings from config
1163-
static_dir = get_static_from_config("static_dir", default_static_dir)
1163+
static_dir = get_static_from_config("static_dir", "static/")
11641164
static_dir_bare = static_dir.directory.rstrip("/")
1165+
static_dist_dir = get_static_from_config("static_dist_dir", default_static_dist_dir or f"{static_dir_bare}/dist/")
11651166
urlmap["/static"] = static_dir
1167+
urlmap["/static/dist"] = static_dist_dir
11661168
urlmap["/images"] = get_static_from_config("static_images_dir", f"{static_dir_bare}/images")
11671169
urlmap["/static/scripts"] = get_static_from_config("static_scripts_dir", f"{static_dir_bare}/scripts/")
11681170

11691171
urlmap["/static/welcome.html"] = get_static_from_config(
11701172
"static_welcome_html", f"{static_dir_bare}/welcome.html", sample=default_url_path("static/welcome.sample.html")
11711173
)
1172-
urlmap["/static/favicon.svg"] = get_static_from_config(
1173-
"static_favicon_dir", f"{static_dir_bare}/favicon.svg", sample=default_url_path("static/favicon.svg")
1174+
urlmap["/favicon.ico"] = get_static_from_config(
1175+
"static_favicon_dir", f"{static_dir_bare}/favicon.ico", sample=default_url_path("static/favicon.ico")
11741176
)
11751177
urlmap["/robots.txt"] = get_static_from_config(
11761178
"static_robots_txt", f"{static_dir_bare}/robots.txt", sample=default_url_path("static/robots.txt")

0 commit comments

Comments
 (0)