-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy path_Host.cshtml
More file actions
152 lines (126 loc) · 5.2 KB
/
_Host.cshtml
File metadata and controls
152 lines (126 loc) · 5.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
@page "/"
@using Elsa.Studio.Branding
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@inject IConfiguration Configuration;
@inject IBrandingProvider BrandingProvider
@{
var apiUrl = Configuration["Hosting:ApiUrl"];
// Get the first segment of the request path, which represents the tenant ID.
var segments = Request.Path.Value!.Split('/', StringSplitOptions.RemoveEmptyEntries);
var tenantId = segments.Length is 1 or > 2 ? segments[0] : null;
var baseRef = tenantId != null ? $"/{tenantId}/" : "/";
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>Elsa Studio</title>
<base href="@baseRef"/>
<link rel="apple-touch-icon" sizes="180x180" href="@BrandingProvider.AppleTouchIconUrl">
<link rel="icon" type="image/png" sizes="32x32" href="@BrandingProvider.Favicon32Url">
<link rel="icon" type="image/png" sizes="16x16" href="@BrandingProvider.Favicon16Url">
<link rel="manifest" href="_content/Elsa.Studio.Shell/site.webmanifest">
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>
<link href="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.css" rel="stylesheet"/>
<link href="_content/Radzen.Blazor/css/material-base.css" rel="stylesheet">
<link href="_content/Elsa.Studio.Shell/css/shell.css" rel="stylesheet">
</head>
<body>
<!-- Initial loading screen for HostedWasm -->
<div id="hosted-wasm-loading" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #f5f5f5; display: flex; justify-content: center; align-items: center; z-index: 9999;">
<div style="text-align: center;">
<div style="width: 40px; height: 40px; border: 4px solid #e0e0e0; border-top: 4px solid #1976d2; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px;"></div>
<div id="hosted-loading-text" style="color: #666; font-family: 'Roboto', sans-serif;">Initializing...</div>
</div>
</div>
<div id="app"></div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<style>
@@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.blazor-ready #hosted-wasm-loading {
display: none !important;
}
</style>
<script src="_content/BlazorMonaco/jsInterop.js"></script>
<script src="_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.js"></script>
<script src="_content/BlazorMonaco/lib/monaco-editor/min/vs/editor/editor.main.js"></script>
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
<script src="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.js"></script>
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
<script>
window.getClientConfig = function() { return {
"apiUrl": "@apiUrl"
} };
</script>
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
<script>
let hostedWasmLoadingHidden = false;
let blazorStartAttempted = false;
function hideHostedWasmLoadingScreen() {
if (!hostedWasmLoadingHidden) {
hostedWasmLoadingHidden = true;
document.body.classList.add('blazor-ready');
}
}
function updateHostedLoadingText(text) {
const loadingTextEl = document.getElementById('hosted-loading-text');
if (loadingTextEl) {
loadingTextEl.textContent = text;
}
}
// Expose functions for Blazor components
window.hideAuthLoading = function () {
hideHostedWasmLoadingScreen();
};
window.hideWasmLoading = function () {
hideHostedWasmLoadingScreen();
};
window.updateLoadingStatus = function (status) {
updateHostedLoadingText(status);
};
// Initialize Blazor with custom configuration
function initializeBlazor() {
if (!blazorStartAttempted) {
blazorStartAttempted = true;
updateHostedLoadingText('Starting Blazor WASM...');
Blazor.start({
loadBootResource: function (type, name, defaultUri, integrity) {
if (defaultUri.startsWith('http'))
return defaultUri;
if (!defaultUri.startsWith('/'))
return `/${defaultUri}`;
return defaultUri;
}
}).then(() => {
updateHostedLoadingText('Loading application...');
}).catch((error) => {
if (error.message && error.message.includes('already started')) {
setTimeout(hideHostedWasmLoadingScreen, 100);
} else {
updateHostedLoadingText('Startup failed');
setTimeout(hideHostedWasmLoadingScreen, 2000);
}
});
}
}
// Initialize when DOM is ready
document.addEventListener('DOMContentLoaded', function () {
initializeBlazor();
});
// Safety timeout
setTimeout(() => {
if (!hostedWasmLoadingHidden) {
hideHostedWasmLoadingScreen();
}
}, 5000);
</script>
</body>
</html>