Commit 4056fa7e authored by Jérome Perrin's avatar Jérome Perrin

software/theia: include a CSS to enable more fonts

parent 7803ee1c
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
[instance] [instance]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = f95354d4af4a78ad7fd11ebc9281ed19 md5sum = 3bc174f9ec19721ab21491eb51cc45b7
[yarn.lock] [yarn.lock]
filename = yarn.lock filename = yarn.lock
...@@ -24,3 +24,11 @@ md5sum = d058e73c3d90ac3da44734c2d47eac95 ...@@ -24,3 +24,11 @@ md5sum = d058e73c3d90ac3da44734c2d47eac95
[python-language-server-requirements.txt] [python-language-server-requirements.txt]
filename = python-language-server-requirements.txt filename = python-language-server-requirements.txt
md5sum = d2ce161244ce9ebce5295302a1b2a7df md5sum = d2ce161244ce9ebce5295302a1b2a7df
[preloadTemplate.html]
filename = preloadTemplate.html
md5sum = 8157c22134200bd862a07c6521ebf799
[slapos.css.in]
filename = slapos.css.in
md5sum = 456dd5931e7c86456c69af062a2d2368
...@@ -54,7 +54,7 @@ template = inline: ...@@ -54,7 +54,7 @@ template = inline:
root $${directory:frontend-static} root $${directory:frontend-static}
browse browse
proxy / $${theia-instance:base-url} { proxy / $${theia-instance:base-url} {
except public $${favicon.ico:filename} except $${frontend-instance-fonts:folder-name} $${frontend-instance-slapos.css:folder-name} public $${favicon.ico:filename}
} }
proxy /services $${theia-instance:base-url} { proxy /services $${theia-instance:base-url} {
websocket websocket
...@@ -83,6 +83,24 @@ port = $${frontend-instance-config:port} ...@@ -83,6 +83,24 @@ port = $${frontend-instance-config:port}
pidfile = $${directory:pidfiles}/$${:_buildout_section_name_}.pid pidfile = $${directory:pidfiles}/$${:_buildout_section_name_}.pid
url = https://$${:hostname}:$${:port}/ url = https://$${:hostname}:$${:port}/
[frontend-instance-fonts]
; XXX caddy 1 does not seem to serve different folders at different locations
; so we link fonts in static folder
recipe = plone.recipe.command
location = $${directory:frontend-static}/$${:folder-name}
folder-name = fonts
command =
mkdir $${:location}
ln -s ${source-code-pro-fonts:location} $${:location}/source-code-pro
ln -s ${jetbrains-mono-fonts:location} $${:location}/jetbrains-mono
stop-on-error = true
[frontend-instance-slapos.css]
recipe = slapos.recipe.template:jinja2
template = ${slapos.css.in:output}
rendered = $${directory:frontend-static}/$${:folder-name}/slapos.css
folder-name = css
[frontend-reload] [frontend-reload]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
wrapper-path = $${directory:services}/$${:_buildout_section_name_} wrapper-path = $${directory:services}/$${:_buildout_section_name_}
...@@ -323,3 +341,4 @@ project = $${:srv}/project ...@@ -323,3 +341,4 @@ project = $${:srv}/project
slapos = $${:srv}/slapos slapos = $${:srv}/slapos
frontend-static = $${:srv}/frontend-static frontend-static = $${:srv}/frontend-static
frontend-static-public = $${:frontend-static}/public frontend-static-public = $${:frontend-static}/public
frontend-static-css = $${:frontend-static}/css
<script>
let link = document.createElement('link');
link.rel = "stylesheet";
link.href = "/css/slapos.css";
document.head.appendChild(link);
</script>
\ No newline at end of file
This diff is collapsed.
...@@ -11,6 +11,7 @@ extends = ...@@ -11,6 +11,7 @@ extends =
../../component/curl/buildout.cfg ../../component/curl/buildout.cfg
../../component/coreutils/buildout.cfg ../../component/coreutils/buildout.cfg
../../component/java-jdk/buildout.cfg ../../component/java-jdk/buildout.cfg
../../component/fonts/buildout.cfg
../../stack/slapos.cfg ../../stack/slapos.cfg
../../stack/monitor/buildout.cfg ../../stack/monitor/buildout.cfg
../../component/defaults.cfg ../../component/defaults.cfg
...@@ -116,6 +117,12 @@ eggs = ...@@ -116,6 +117,12 @@ eggs =
supervisor supervisor
setuptools setuptools
[template-base]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 0644
[python-language-server] [python-language-server]
version = 0.19.0 version = 0.19.0
recipe = plone.recipe.command recipe = plone.recipe.command
...@@ -127,11 +134,7 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_} ...@@ -127,11 +134,7 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true stop-on-error = true
[python-language-server-requirements.txt] [python-language-server-requirements.txt]
recipe = slapos.recipe.template <= template-base
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 0644
[theia] [theia]
recipe = plone.recipe.command recipe = plone.recipe.command
...@@ -152,10 +155,13 @@ uses = ${yarn.lock:recipe} ...@@ -152,10 +155,13 @@ uses = ${yarn.lock:recipe}
THEIA_DEFAULT_PLUGINS = ${:location}/plugins/ THEIA_DEFAULT_PLUGINS = ${:location}/plugins/
[yarn.lock] [yarn.lock]
recipe = slapos.recipe.template <= template-base
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:parts-directory}/${:_buildout_section_name_} [preloadTemplate.html]
mode = 0644 <= template-base
[slapos.css.in]
<= template-base
[package.json] [package.json]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
...@@ -193,6 +199,11 @@ template = ...@@ -193,6 +199,11 @@ template =
"java.home": "${java-jdk:location}" "java.home": "${java-jdk:location}"
} }
} }
},
"generator": {
"config": {
"preloadTemplate": "${preloadTemplate.html:output}"
}
} }
}, },
"dependencies": { "dependencies": {
...@@ -345,9 +356,7 @@ template = ...@@ -345,9 +356,7 @@ template =
[instance] [instance]
recipe = slapos.recipe.template <= template-base
url = ${:_profile_base_location_}/${:filename}
mode = 0644
output = ${buildout:directory}/instance.cfg output = ${buildout:directory}/instance.cfg
[versions] [versions]
......
...@@ -32,6 +32,7 @@ import logging ...@@ -32,6 +32,7 @@ import logging
import subprocess import subprocess
import tempfile import tempfile
import time import time
import re
from six.moves.urllib.parse import urlparse, urljoin from six.moves.urllib.parse import urlparse, urljoin
import pexpect import pexpect
...@@ -81,6 +82,16 @@ class TestTheia(SlapOSInstanceTestCase): ...@@ -81,6 +82,16 @@ class TestTheia(SlapOSInstanceTestCase):
self.assertEqual(requests.codes.ok, resp.status_code) self.assertEqual(requests.codes.ok, resp.status_code)
self.assertTrue(resp.raw) self.assertTrue(resp.raw)
# there is a CSS referencing fonts
css_text = requests.get(urljoin(authenticated_url, '/css/slapos.css'), verify=False).text
css_urls = re.findall(r'url\([\'"]+([^\)]+)[\'"]+\)', css_text)
self.assertTrue(css_urls)
# and fonts are served
for url in css_urls:
resp = requests.get(urljoin(authenticated_url, url), verify=False)
self.assertEqual(requests.codes.ok, resp.status_code)
self.assertTrue(resp.raw)
def test_theia_slapos(self): def test_theia_slapos(self):
# Make sure we can use the shell and the integrated slapos command # Make sure we can use the shell and the integrated slapos command
process = pexpect.spawnu( process = pexpect.spawnu(
...@@ -134,7 +145,7 @@ class TestTheia(SlapOSInstanceTestCase): ...@@ -134,7 +145,7 @@ class TestTheia(SlapOSInstanceTestCase):
process.wait() process.wait()
def test_theia_shell_execute_tasks(self): def test_theia_shell_execute_tasks(self):
# shell needs to understand -c "comamnd" arguments for theia tasks feature # shell needs to understand -c "command" arguments for theia tasks feature
test_file = '{}/test file'.format(self.computer_partition_root_path) test_file = '{}/test file'.format(self.computer_partition_root_path)
subprocess.check_call([ subprocess.check_call([
'{}/bin/theia-shell'.format(self.computer_partition_root_path), '{}/bin/theia-shell'.format(self.computer_partition_root_path),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment