Skip to content

Commit

Permalink
Swap to vite from CRA
Browse files Browse the repository at this point in the history
  • Loading branch information
pvyParts committed Nov 19, 2023
1 parent 9cea49a commit 4a5168b
Show file tree
Hide file tree
Showing 35 changed files with 31,433 additions and 30 deletions.
1 change: 0 additions & 1 deletion authstats/static/authstats/asset-manifest.json

This file was deleted.

1 change: 1 addition & 0 deletions authstats/static/authstats/assets
1 change: 1 addition & 0 deletions authstats/static/authstats/manifest.json
2 changes: 1 addition & 1 deletion authstats/static/authstats/static
30 changes: 11 additions & 19 deletions authstats/templates/authstats/react_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@

function loadCss (cssFiles) {
cssFiles.forEach(function (css) {
console.log("Loading: ", css)

$('<link>')
.appendTo('body')
.attr({
Expand All @@ -119,34 +121,23 @@

function loadNextScript (scripts) {
if (!scripts.length) { return; }

var script = scripts.shift();
console.log("Loading: ", script)
$.ajax(script, {
dataType: 'script',
attrs: { type: "module" },
success: function () { loadNextScript(scripts) },
})
}

$.ajax(BASE_URL + 'asset-manifest.json?version={{version}}', {
$.ajax(BASE_URL + 'manifest.json?version={{version}}', {
dataType: "json",
success : function (data, textStatus, jqXHR) {

if (data && data.entrypoints && data.entrypoints.length > 0) {
var scripts =
data.entrypoints
.filter(function (resource) {
return resource.match(/.+\.js$/)
})
.map(function (script) {
return BASE_URL + script;
});
var cssFiles =
data.entrypoints
.filter(function (ressource) {
return ressource.match(/.+\.css$/)
})
.map(function (file) {
return BASE_URL + file;
if (data) {
var scripts = [BASE_URL + data["index.html"].file]
var cssFiles = data["index.html"].css.map(function (file) {
return BASE_URL +file;
});

loadCss(cssFiles);
Expand All @@ -159,7 +150,8 @@
const loading_div = document.querySelector('#loading-div');
error_div.classList.toggle('hide');
loading_div.classList.toggle('hide');
}
},
cache: false
})

</script>
Expand Down
1 change: 0 additions & 1 deletion authstats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def add_corp(request, token):

@permission_required("authstats.basic_access")
def react_main(request, rid, cid):
# get available models
return render(request, 'authstats/react_base.html', context={"version": __version__, "app_name": "authstats", "page_title": "Auth Reports"})


Expand Down
46 changes: 46 additions & 0 deletions frontend/build/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!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="">
<link rel="icon" type="image/png" href="http://localhost:8000/static/allianceauth/icons/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="http://localhost:8000/static/allianceauth/icons/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="http://localhost:8000/static/allianceauth/icons/favicon-96x96.png" sizes="96x96">
<link rel="apple-touch-icon" href="http://localhost:8000/static/allianceauth/icons/apple-touch-icon.png">
<title>React Dev Auth? WTF!</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="http://localhost:8000/static/allianceauth/css/themes/darkly/darkly.min.css" />
<!-- End Bootstrap CSS -->
<!-- Start FontAwesome CSS from cdnjs -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<!-- End FontAwesome CSS from cdnjs -->
<link href="http://localhost:8000/static/allianceauth/css/auth-base.css" type="text/css" rel="stylesheet"> <script type="module" crossorigin src="./assets/index-58ClCyIC.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-wyzNN-cK.css">
</head>
<body class="template-dark-mode">
<div id="wrapper" class="container">
<!-- Navigation -->
<nav class="navbar navbar-default navbar-static-top auth-navbar-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".auth-menus-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand">
<img src="/static/allianceauth/icons/favicon-32x32.png" style="display: inline-block;" height="32" width="32"/>
React Dev Auth
</a>
</div>
<div class="collapse navbar-collapse auth-menus-collapse">
</div>
</nav>
<div id="root"></div>

</body>
</html>
10 changes: 10 additions & 0 deletions frontend/build/static/.vite/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"index.html": {
"css": [
"assets/index-wyzNN-cK.css"
],
"file": "assets/index-58ClCyIC.js",
"isEntry": true,
"src": "index.html"
}
}
Loading

0 comments on commit 4a5168b

Please sign in to comment.