mirror of
https://github.com/1f349/admin.1f349.com.git
synced 2024-11-13 23:21:32 +00:00
Some refactoring and styles
This commit is contained in:
parent
90397a5022
commit
804f88f098
@ -171,7 +171,6 @@
|
|||||||
|
|
||||||
#option-view {
|
#option-view {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 16px;
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
@ -30,8 +30,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
tr:nth-child(2n) {
|
tr.created {
|
||||||
background-color: #2a2a2a;
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.desc textarea {
|
.desc textarea {
|
||||||
|
@ -41,10 +41,6 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
tr:nth-child(2n) {
|
|
||||||
background-color: #2a2a2a;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr.created {
|
tr.created {
|
||||||
background-color: #1a5100;
|
background-color: #1a5100;
|
||||||
|
|
||||||
|
@ -28,8 +28,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
tr:nth-child(2n) {
|
tr.created {
|
||||||
background-color: #2a2a2a;
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.desc textarea {
|
.desc textarea {
|
||||||
|
@ -38,10 +38,6 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
tr:nth-child(2n) {
|
|
||||||
background-color: #2a2a2a;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr.created {
|
tr.created {
|
||||||
background-color: #1a5100;
|
background-color: #1a5100;
|
||||||
|
|
||||||
|
@ -136,16 +136,23 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div class="wrapper">
|
||||||
<div style="padding:8px;background-color:#bb7900;">
|
<div style="padding:8px;background-color:#bb7900;">
|
||||||
Warning: This is currently still under development, however it DOES update the real server routes and redirects
|
Warning: This is currently still under development, however it DOES update the real server routes and redirects
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Routes</h2>
|
<div class="scrolling-area">
|
||||||
{#await promiseForRoutes}
|
{#await promiseForRoutes}
|
||||||
|
<div class="text-padding">
|
||||||
|
<h2>Routes</h2>
|
||||||
<div>Loading...</div>
|
<div>Loading...</div>
|
||||||
|
</div>
|
||||||
{:then}
|
{:then}
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="6"><h2>Routes</h2></th>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Source</th>
|
<th>Source</th>
|
||||||
<th>Destination</th>
|
<th>Destination</th>
|
||||||
@ -154,6 +161,14 @@
|
|||||||
<th>Active</th>
|
<th>Active</th>
|
||||||
<th>Option</th>
|
<th>Option</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<RouteCreator
|
||||||
|
on:make={e => {
|
||||||
|
const x = e.detail;
|
||||||
|
routeData[x.src] = {client: x, server: routeData[x.src]?.server};
|
||||||
|
routeSrcs.push(x.src);
|
||||||
|
routeSrcs = routeSrcs;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each routeSrcs as src (src)}
|
{#each routeSrcs as src (src)}
|
||||||
@ -163,27 +178,27 @@
|
|||||||
<tr><td colspan="5">Error loading row for {src}</td></tr>
|
<tr><td colspan="5">Error loading row for {src}</td></tr>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
<RouteCreator
|
|
||||||
on:make={e => {
|
|
||||||
const x = e.detail;
|
|
||||||
routeData[x.src] = {client: x, server: routeData[x.src]?.server};
|
|
||||||
routeSrcs.push(x.src);
|
|
||||||
routeSrcs = routeSrcs;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{:catch err}
|
{:catch err}
|
||||||
|
<div class="text-padding">
|
||||||
|
<h2>Routes</h2>
|
||||||
|
<div>Administrator... I hardly know her?</div>
|
||||||
<div>{err}</div>
|
<div>{err}</div>
|
||||||
|
</div>
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
<h2>Redirects</h2>
|
|
||||||
{#await promiseForRedirects}
|
{#await promiseForRedirects}
|
||||||
|
<div class="text-padding">
|
||||||
|
<h2>Redirects</h2>
|
||||||
<div>Loading...</div>
|
<div>Loading...</div>
|
||||||
|
</div>
|
||||||
{:then}
|
{:then}
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th colspan="8"><h2>Redirects</h2></th>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Source</th>
|
<th>Source</th>
|
||||||
<th>Destination</th>
|
<th>Destination</th>
|
||||||
@ -193,6 +208,14 @@
|
|||||||
<th>Active</th>
|
<th>Active</th>
|
||||||
<th>Option</th>
|
<th>Option</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<RedirectCreator
|
||||||
|
on:make={e => {
|
||||||
|
const x = e.detail;
|
||||||
|
redirectData[x.src] = {client: x, server: redirectData[x.src]?.server};
|
||||||
|
redirectSrcs.push(x.src);
|
||||||
|
redirectSrcs = redirectSrcs;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each redirectSrcs as src (src)}
|
{#each redirectSrcs as src (src)}
|
||||||
@ -202,26 +225,21 @@
|
|||||||
<tr><td colspan="5">Error loading row for {src}</td></tr>
|
<tr><td colspan="5">Error loading row for {src}</td></tr>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
<RedirectCreator
|
|
||||||
on:make={e => {
|
|
||||||
const x = e.detail;
|
|
||||||
redirectData[x.src] = {client: x, server: redirectData[x.src]?.server};
|
|
||||||
redirectSrcs.push(x.src);
|
|
||||||
redirectSrcs = redirectSrcs;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{:catch err}
|
{:catch err}
|
||||||
|
<div class="text-padding">
|
||||||
|
<h2>Redirects</h2>
|
||||||
|
<div>Administrator... I hardly know her?</div>
|
||||||
<div>{err}</div>
|
<div>{err}</div>
|
||||||
|
</div>
|
||||||
{/await}
|
{/await}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="footer-fake" />
|
<div class="footer">
|
||||||
|
|
||||||
<footer>
|
|
||||||
<button on:click={() => saveChanges()}>Save Changes</button>
|
<button on:click={() => saveChanges()}>Save Changes</button>
|
||||||
</footer>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
table {
|
table {
|
||||||
@ -230,7 +248,25 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
thead {
|
thead {
|
||||||
background-color: #04aa6d;
|
background-color: #333333;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 9999;
|
||||||
|
box-shadow: 0 4px 8px #0003, 0 6px 20px #00000030;
|
||||||
|
|
||||||
|
th h2 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody :global(tr) {
|
||||||
|
&:nth-child(2n) {
|
||||||
|
background-color: #2a2a2a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(2n + 1) {
|
||||||
|
background-color: #242424;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(th),
|
:global(th),
|
||||||
@ -240,16 +276,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-fake {
|
.wrapper {
|
||||||
height: 50px;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.scrolling-area {
|
||||||
|
overflow: auto;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
.text-padding {
|
||||||
position: absolute;
|
padding: 4px 16px;
|
||||||
bottom: 0;
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
background-color: #2c2c2c;
|
background-color: #2c2c2c;
|
||||||
width: calc(100% - 150px - 32px);
|
|
||||||
box-shadow: 0 -4px 8px #0003, 0 -6px 20px #00000030;
|
box-shadow: 0 -4px 8px #0003, 0 -6px 20px #00000030;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@ -262,8 +308,8 @@
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
width: calc(100%);
|
|
||||||
height: 50px;
|
height: 50px;
|
||||||
|
padding: 4px 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -105,72 +105,50 @@ var serveApiCors = cors.New(cors.Options{
|
|||||||
func apiServer(verify mjwt.Verifier) {
|
func apiServer(verify mjwt.Verifier) {
|
||||||
r := http.NewServeMux()
|
r := http.NewServeMux()
|
||||||
r.Handle("/v1/violet/route", hasPerm(verify, "violet:route", func(rw http.ResponseWriter, req *http.Request) {
|
r.Handle("/v1/violet/route", hasPerm(verify, "violet:route", func(rw http.ResponseWriter, req *http.Request) {
|
||||||
json.NewEncoder(rw).Encode([]map[string]any{
|
m := make([]map[string]any, 0, 40)
|
||||||
{
|
for i := 0; i < 20; i++ {
|
||||||
"src": "example.com",
|
m = append(m, map[string]any{
|
||||||
|
"src": uuid.NewString() + ".example.com",
|
||||||
"dst": "127.0.0.1:8080",
|
"dst": "127.0.0.1:8080",
|
||||||
"desc": "This is a test description",
|
"desc": "This is a test description",
|
||||||
"flags": 181,
|
"flags": 181,
|
||||||
"active": true,
|
"active": true,
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "test.example.com",
|
|
||||||
"dst": "127.0.0.1:8081",
|
|
||||||
"desc": "This is a test description",
|
|
||||||
"flags": 17,
|
|
||||||
"active": true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "example.org/hello",
|
|
||||||
"dst": "127.0.0.1:8082",
|
|
||||||
"desc": "This is a test description",
|
|
||||||
"flags": 16,
|
|
||||||
"active": true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "test.example.org/hello",
|
|
||||||
"dst": "127.0.0.1:8083",
|
|
||||||
"desc": "This is a test description",
|
|
||||||
"flags": 15,
|
|
||||||
"active": true,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}))
|
}
|
||||||
r.Handle("/v1/violet/redirect", hasPerm(verify, "violet:redirect", func(rw http.ResponseWriter, req *http.Request) {
|
for i := 0; i < 20; i++ {
|
||||||
json.NewEncoder(rw).Encode([]map[string]any{
|
m = append(m, map[string]any{
|
||||||
{
|
"src": uuid.NewString() + ".example.org",
|
||||||
"src": "example.org",
|
|
||||||
"dst": "127.0.0.1:8084",
|
|
||||||
"desc": "This is a test description",
|
|
||||||
"flags": 181,
|
|
||||||
"code": 307,
|
|
||||||
"active": true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "test.example.org",
|
|
||||||
"dst": "127.0.0.1:8085",
|
"dst": "127.0.0.1:8085",
|
||||||
"desc": "This is a test description",
|
"desc": "This is a test description",
|
||||||
"flags": 17,
|
"flags": 17,
|
||||||
"code": 302,
|
|
||||||
"active": true,
|
"active": true,
|
||||||
},
|
})
|
||||||
{
|
}
|
||||||
"src": "example.org/hello",
|
json.NewEncoder(rw).Encode(m)
|
||||||
"dst": "127.0.0.1:8086",
|
}))
|
||||||
|
r.Handle("/v1/violet/redirect", hasPerm(verify, "violet:redirect", func(rw http.ResponseWriter, req *http.Request) {
|
||||||
|
m := make([]map[string]any, 0, 40)
|
||||||
|
for i := 0; i < 20; i++ {
|
||||||
|
m = append(m, map[string]any{
|
||||||
|
"src": uuid.NewString() + ".example.com",
|
||||||
|
"dst": "test1.example.com",
|
||||||
"desc": "This is a test description",
|
"desc": "This is a test description",
|
||||||
"flags": 16,
|
"flags": 1,
|
||||||
"code": 308,
|
"code": 308,
|
||||||
"active": true,
|
"active": true,
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "test.example.org/hello",
|
|
||||||
"dst": "127.0.0.1:8087",
|
|
||||||
"desc": "This is a test description",
|
|
||||||
"flags": 15,
|
|
||||||
"code": 301,
|
|
||||||
"active": true,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
for i := 0; i < 20; i++ {
|
||||||
|
m = append(m, map[string]any{
|
||||||
|
"src": uuid.NewString() + ".example.org",
|
||||||
|
"dst": "test2.example.org",
|
||||||
|
"desc": "This is a test description",
|
||||||
|
"flags": 3,
|
||||||
|
"code": 307,
|
||||||
|
"active": true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
json.NewEncoder(rw).Encode(m)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
logger := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
logger := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user