-
Notifications
You must be signed in to change notification settings - Fork 801
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature (migration): migrating backoffice to new structure
- Loading branch information
1 parent
f14a07e
commit 7405adb
Showing
15 changed files
with
283 additions
and
228 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
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,52 @@ | ||
<!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.0"> | ||
<link rel="stylesheet" href="/assets/css/reset.css"> | ||
<script type="module" src="/components/loader.js"></script> | ||
<title></title> | ||
</head> | ||
<body> | ||
<div role="main" id="app"> | ||
<component-loader delay="500"></component-loader> | ||
</div> | ||
<script type="module"> | ||
import main from "/lib/skeleton/index.js"; | ||
const routes = { | ||
"/login": "/pages/ctrl_connectpage.js", | ||
"/logout": "/pages/ctrl_logout.js", | ||
|
||
"/": "/pages/ctrl_homepage.js", | ||
"/files/.*": "/pages/ctrl_filespage.js", | ||
"/view/.*": "/pages/ctrl_viewerpage.js", | ||
// /tags/.* -> "pages/ctrl_tags.js", | ||
// /s/.* -> "/pages/ctrl_share.js", | ||
|
||
"/admin/backend": "/pages/adminpage/ctrl_backend.js", | ||
"/admin/settings": "/pages/adminpage/ctrl_settings.js", | ||
"/admin/logs": "/pages/adminpage/ctrl_logger.js", | ||
"/admin/about": "/pages/adminpage/ctrl_about.js", | ||
"/admin/setup": "/pages/adminpage/ctrl_setup.js", | ||
"/admin/": "/pages/ctrl_adminpage.js", | ||
|
||
"": "/pages/ctrl_notfound.js", | ||
}; | ||
main(document.getElementById("app"), routes, { | ||
spinner: `<component-loader></component-loader>`, | ||
beforeStart: import("/pages/ctrl_boot.js"), | ||
}); | ||
</script> | ||
|
||
<script type="module" src="/components/modal.js"></script> | ||
<component-modal></component-modal> | ||
|
||
<noscript> | ||
<div> | ||
<h2>Error: Javascript is off</h2> | ||
<p>You need to enable Javascript to run this application</p> | ||
</div> | ||
</noscript> | ||
</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
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
47 changes: 47 additions & 0 deletions
47
public/pages/adminpage/ctrl_backend_component_authentication.js
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,47 @@ | ||
import { createElement } from "../../lib/skeleton/index.js"; | ||
|
||
export default function(render) { | ||
const $page = createElement(` | ||
<div class="box-container"> | ||
<div class="box-item pointer no-select"> | ||
<div>admin <span class="no-select"> | ||
<span class="icon">+</span> | ||
</span> | ||
</div> | ||
</div> | ||
<div class="box-item pointer no-select"> | ||
<div>htpasswd <span class="no-select"> | ||
<span class="icon">+</span> | ||
</span> | ||
</div> | ||
</div> | ||
<div class="box-item pointer no-select"> | ||
<div>ldap <span class="no-select"> | ||
<span class="icon">+</span> | ||
</span> | ||
</div> | ||
</div> | ||
<div class="box-item pointer no-select active"> | ||
<div>openid <span class="no-select"> | ||
<span class="icon"> | ||
<img class="component_icon" draggable="false" src="/assets/icons/delete.svg" alt="delete"> | ||
</span> | ||
</span> | ||
</div> | ||
</div> | ||
<div class="box-item pointer no-select"> | ||
<div>passthrough <span class="no-select"> | ||
<span class="icon">+</span> | ||
</span> | ||
</div> | ||
</div> | ||
<div class="box-item pointer no-select"> | ||
<div>saml <span class="no-select"> | ||
<span class="icon">+</span> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
`); | ||
render($page); | ||
} |
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,30 @@ | ||
import { createElement } from "../../lib/skeleton/index.js"; | ||
import rxjs, { effect, applyMutation } from "../../lib/rx.js"; | ||
import { qs } from "../../lib/dom.js"; | ||
import backend$ from "../connectpage/model_backend.js"; | ||
|
||
export default function(render) { | ||
const $page = createElement(` | ||
<div class="component_storagebackend"> | ||
<h2>Storage Backend</h2> | ||
<div class="box-container" data-bind="backend-available"></div> | ||
<form data-bind="backend-enabled"></form> | ||
</div> | ||
`); | ||
render($page); | ||
|
||
effect(backend$.pipe( | ||
rxjs.mergeMap((specs) => Object.keys(specs)), | ||
rxjs.map((label) => [createElement(` | ||
<div class="box-item pointer no-select"> | ||
<div> | ||
${label} | ||
<span class="no-select"> | ||
<span class="icon">+</span> | ||
</span> | ||
</div> | ||
</div> | ||
`)]), | ||
applyMutation(qs($page, "[data-bind=\"backend-available\"]"), "appendChild") | ||
)); | ||
} |
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,29 @@ | ||
import { createElement, createRender } from "../../lib/skeleton/index.js"; | ||
import rxjs, { effect, stateMutation, applyMutation } from "../../lib/rx.js"; | ||
import { qs } from "../../lib/dom.js"; | ||
|
||
import componentLogForm from "./ctrl_log_form.js"; | ||
import componentLogViewer from "./ctrl_log_viewer.js"; | ||
import componentAuditor from "./ctrl_log_audit.js"; | ||
import transition from "./animate.js"; | ||
import AdminHOC from "./decorator.js"; | ||
|
||
function Page(render) { | ||
const $page = createElement(` | ||
<div class="component_logpage sticky"> | ||
<h2>Logging</h2> | ||
<div class="component_logviewer"></div> | ||
<div class="component_logger"></div> | ||
<h2>Activity Report</h2> | ||
<div class="component_reporter"></div> | ||
<div> | ||
`); | ||
render(transition($page)); | ||
|
||
componentLogForm(createRender($page.querySelector(".component_logger"))); | ||
componentLogViewer(createRender($page.querySelector(".component_logviewer"))); | ||
componentAuditor(createRender($page.querySelector(".component_reporter"))); | ||
} | ||
|
||
export default AdminHOC(Page); |
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,32 @@ | ||
import { createElement } from "../../lib/skeleton/index.js"; | ||
import rxjs, { effect, stateMutation, applyMutation } from "../../lib/rx.js"; | ||
import { qs } from "../../lib/dom.js"; | ||
import { createForm } from "../../lib/form.js"; | ||
import { formTmpl } from "../../components/form.js"; | ||
|
||
import Audit from "./model_audit.js"; | ||
|
||
export default function(render) { | ||
const $page = createElement(` | ||
<div> | ||
<form></form> | ||
<div data-bind="auditor"></div> | ||
</div> | ||
`); | ||
render($page); | ||
|
||
// setup the form | ||
effect(Audit.get().pipe( | ||
rxjs.map(({ form }) => form), | ||
rxjs.map((formSpec) => createForm(formSpec, formTmpl())), | ||
rxjs.mergeMap((promise) => rxjs.from(promise)), | ||
rxjs.map(($form) => [$form]), | ||
applyMutation(qs($page, "form"), "appendChild") | ||
)); | ||
|
||
// setup the result | ||
effect(Audit.get().pipe( | ||
rxjs.map(({ render }) => render), | ||
stateMutation(qs($page, "[data-bind=\"auditor\"]"), "innerHTML") | ||
)); | ||
} |
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,29 @@ | ||
import { createElement } from "../../lib/skeleton/index.js"; | ||
import rxjs, { effect, applyMutation } from "../../lib/rx.js"; | ||
import { generateSkeleton } from "../../components/skeleton.js"; | ||
import { createForm } from "../../lib/form.js"; | ||
import { formTmpl } from "../../components/form.js"; | ||
|
||
import { get as getConfig } from "./model_config.js"; | ||
import { renderLeaf } from "./helper_form.js"; | ||
|
||
export default function(render) { | ||
const $form = createElement(` | ||
<form style="min-height: 240px; margin-top:20px;"> | ||
${generateSkeleton(4)} | ||
</form> | ||
`); | ||
|
||
render($form); | ||
|
||
// feature1: render the form | ||
effect(getConfig().pipe( | ||
rxjs.map(({ log }) => ({ params: log })), | ||
rxjs.map((formSpec) => createForm(formSpec, formTmpl({ renderLeaf }))), | ||
rxjs.mergeMap((promise) => rxjs.from(promise)), | ||
rxjs.map(($form) => [$form]), | ||
applyMutation($form, "replaceChildren") | ||
)); | ||
|
||
// TODO feature2: response to form change | ||
} |
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,13 @@ | ||
import { createElement } from "../../lib/skeleton/index.js"; | ||
import rxjs, { effect, stateMutation } from "../../lib/rx.js"; | ||
|
||
import Log from "./model_log.js"; | ||
|
||
export default function(render) { | ||
const $page = createElement(`<pre style="height:350px; max-height: 350px">…</pre>`); | ||
render($page); | ||
|
||
effect(Log.get().pipe( | ||
stateMutation($page, "textContent") | ||
)); | ||
} |
Oops, something went wrong.