-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html.template
More file actions
120 lines (113 loc) · 4.34 KB
/
Copy pathindex.html.template
File metadata and controls
120 lines (113 loc) · 4.34 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
</head>
<body>
<div id="app"></div>
<script src="config.js"></script>
<!-- SweetAlert2 must be loaded before the inline script so it's available if window.server is not set -->
<!-- Replace the host with your assets server URL -->
<script src="http://<host>:<port>/perun-assets/js/sweetalert2.all.min.js"></script>
<script>
// If your project uses spatial features, uncomment and configure these (see README > Spatial Support):
// window.sysCrs = 'EPSG:3857'
// window.sysCenter = { lat: 41.294, lng: 74.597 }
</script>
<script>
(function () {
// If the server is unavailable (e.g. 503), window.server won't be set — alert and stop execution
if (!window.server) {
Swal.fire({ icon: 'info', title: 'The server is temporarily down for maintenance', text: 'Please try again soon', confirmButtonColor: '#7cd1f9' });
return;
}
const assetsUrl = `${window.server}/WsConf/params/get/sys/FRONTEND_ASSETS_LOCATION`
fetch(assetsUrl).then(response => response.json()).then(res => {
if (res.VALUE) {
const assetsLocation = res.VALUE
// Assign the assets location to a window variable
window.assets = assetsLocation;
// Get the current server
const server = window.server.substring(0, window.server.lastIndexOf('/'));
// Fetch the script for getting the default locale
const localeScript = Object.assign(document.createElement('script'), {
type: 'text/javascript', src: `${server}${assetsLocation}/js/locale.js`
});
document.body.appendChild(localeScript);
/**
* Dynamically loads a list of CSS files (stylesheets)
* @param {Array} stylesheets A list of CSS file names that need to be loaded as stylesheets
*/
const setStylesheets = (stylesheets) => {
stylesheets.forEach(stylesheet => {
const link = document.createElement('link');
link.type = 'text/css';
link.rel = 'stylesheet';
link.href = `${server}${assetsLocation}/styles/${stylesheet}.css`;
document.head.appendChild(link);
});
}
// Custom stylesheets — list all available stylesheets for your environment
const stylesheets = [
'datagrid',
'forms',
'logon',
'homepage',
'style',
'batch',
'toolTip',
'footer',
'loading',
'topnavmenu',
'sidelistmenu',
'adminconsole',
'buttonactions',
'reportengine',
'modal',
'userguide',
'modulemenu',
'contextmenu',
'ranking-extractions',
'persons-registry',
'not-found-page',
];
setStylesheets(stylesheets);
/**
* Dynamically loads a list of Font Awesome CSS files (stylesheets)
* @param {Array} stylesheets A list of Font Awesome CSS file names that need to be loaded as stylesheets
*/
const setFontAwesomeStylesheets = (stylesheets) => {
stylesheets.forEach(stylesheet => {
const link = document.createElement('link');
link.type = 'text/css';
link.rel = 'stylesheet';
link.href = `${server}${assetsLocation}${stylesheet}`;
document.head.appendChild(link);
});
}
// Font Awesome stylesheets
const fontAwesomeStylesheets = [
'/fonts/font-awesome.min.css',
'/fonts/fontawesome_v.5/css/all.min.css',
'/fonts/fontawesome_v.5/css/fontawesome.min.css'
];
setFontAwesomeStylesheets(fontAwesomeStylesheets);
// Fetch the script for changing the document title
const titleScript = Object.assign(document.createElement('script'), {
type: 'text/javascript', src: `${server}${assetsLocation}/js/title.js`
});
document.body.appendChild(titleScript);
}
}).catch(err => {
console.log(err)
})
})()
</script>
<!-- Replace with your project's bundle filename -->
<script src="bundle-name.js"></script>
</body>
</html>