-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(loading): enable loading screen to be overriden
For that just provide your own ./loading/index.html Then in vue3, you can also override dynamically the error view for disconnect or disconnect-with-reconnect. You just need to define layout for "error" and "error_reconnect". Also a variable "trame_error_report_msg" will be available for you to leverage in your custom template.
- Loading branch information
Showing
10 changed files
with
355 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
loading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os | ||
from trame.app import get_server | ||
from trame.widgets import html | ||
from trame.ui.html import DivLayout | ||
import time | ||
|
||
server = get_server(client_type=os.environ.get("TRAME_CLIENT_TYPE", "vue3")) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Only with Vue3 | ||
# ----------------------------------------------------------------------------- | ||
with DivLayout(server, template_name="error") as layout: | ||
html.Div("App disconnected: {{ trame_error_report_msg }}") | ||
|
||
with DivLayout(server, template_name="error_reconnect") as layout: | ||
html.Div("App disconnected but you can reconnect: {{ trame_error_report_msg }}") | ||
# ----------------------------------------------------------------------------- | ||
|
||
with DivLayout(server) as layout: | ||
html.Div("App is fully loaded") | ||
|
||
# Busy wait | ||
time.sleep(5) | ||
|
||
server.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
{ | ||
"configuration": { | ||
"host" : "localhost", | ||
"port" : 8080, | ||
"endpoint": "paraview", | ||
"content": "loading/loading_www", | ||
"proxy_file" : "loading/proxy-mapping.txt", | ||
"sessionURL" : "ws://${host}:${port}/ws", | ||
"timeout" : 50, | ||
"log_dir" : "loading", | ||
"fields" : [] | ||
}, | ||
"resources" : [ { "host" : "localhost", "port_range" : [9001, 9020] } ], | ||
"properties" : {}, | ||
"apps" : { | ||
"trame" : { | ||
"cmd" : ["python", "loading.py", "--port", "$port", "--server", "--authKey", "${secret}"], | ||
"ready_line" : "App running at" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# export TRAME_CLIENT_TYPE=vue2 | ||
export TRAME_CLIENT_TYPE=vue3 | ||
|
||
rm -rf ./loading/ | ||
mkdir -p ./loading/loading_www | ||
python -m trame.tools.www --client-type "$TRAME_CLIENT_TYPE" --output ./loading/loading_www | ||
python -m wslink.launcher ./loading_launcher.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1"> | ||
<title>Loading...</title> | ||
<style> | ||
.text-no-select { | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
-ms-user-select: none; | ||
user-select: none; | ||
} | ||
.trame__loader { | ||
display: block; | ||
position: relative; | ||
left: 50%; | ||
top: calc(50% - 50px); | ||
width: 150px; | ||
height: 150px; | ||
margin: -75px 0 0 -75px; | ||
border-radius: 50%; | ||
border: 10px solid transparent; | ||
border-top-color: #ac262c; | ||
|
||
-webkit-animation: spin 2s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ | ||
animation: spin 2s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */ | ||
} | ||
|
||
.trame__loader:before { | ||
content: ""; | ||
position: absolute; | ||
top: 5px; | ||
left: 5px; | ||
right: 5px; | ||
bottom: 5px; | ||
border-radius: 50%; | ||
border: 10px solid transparent; | ||
border-top-color: #258e44; | ||
|
||
-webkit-animation: spin 3s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ | ||
animation: spin 3s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */ | ||
} | ||
|
||
.trame__loader:after { | ||
content: ""; | ||
position: absolute; | ||
top: 20px; | ||
left: 20px; | ||
right: 20px; | ||
bottom: 20px; | ||
border-radius: 50%; | ||
border: 10px solid transparent; | ||
border-top-color: #1c4678; | ||
|
||
-webkit-animation: spin 1.5s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ | ||
animation: spin 1.5s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */ | ||
} | ||
|
||
.trame__message { | ||
position: absolute; | ||
text-align: center; | ||
width: 100%; | ||
top: calc(50% + 50px); | ||
font-size: 200%; | ||
user-select: none; | ||
} | ||
|
||
@-webkit-keyframes spin { | ||
0% { | ||
-webkit-transform: rotate(0deg); /* Chrome, Opera 15+, Safari 3.1+ */ | ||
-ms-transform: rotate(0deg); /* IE 9 */ | ||
transform: rotate(0deg); /* Firefox 16+, IE 10+, Opera */ | ||
} | ||
100% { | ||
-webkit-transform: rotate(360deg); /* Chrome, Opera 15+, Safari 3.1+ */ | ||
-ms-transform: rotate(360deg); /* IE 9 */ | ||
transform: rotate(360deg); /* Firefox 16+, IE 10+, Opera */ | ||
} | ||
} | ||
@keyframes spin { | ||
0% { | ||
-webkit-transform: rotate(0deg); /* Chrome, Opera 15+, Safari 3.1+ */ | ||
-ms-transform: rotate(0deg); /* IE 9 */ | ||
transform: rotate(0deg); /* Firefox 16+, IE 10+, Opera */ | ||
} | ||
100% { | ||
-webkit-transform: rotate(360deg); /* Chrome, Opera 15+, Safari 3.1+ */ | ||
-ms-transform: rotate(360deg); /* IE 9 */ | ||
transform: rotate(360deg); /* Firefox 16+, IE 10+, Opera */ | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div style="position:absolute;top:0;left:0;width:100%;height:100%;z-index:1000;"> | ||
<div class="trame__loader"></div> | ||
<div class="trame__message">Loading...</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.