web: add close button to messages

This commit is contained in:
Jens Langhammer 2021-03-12 12:27:57 +01:00
parent fd864655f6
commit a63702ef90
2 changed files with 11 additions and 3 deletions

View File

@ -46,6 +46,15 @@ export class Message extends LitElement {
<p class="pf-c-alert__title"> <p class="pf-c-alert__title">
${this.message?.message} ${this.message?.message}
</p> </p>
<div class="pf-c-alert__action">
<button class="pf-c-button pf-m-plain" type="button" @click=${() => {
if (!this.message) return;
if (!this.onRemove) return;
this.onRemove(this.message);
}}>
<i class="fas fa-times" aria-hidden="true"></i>
</button>
</div>
</div> </div>
</li>`; </li>`;
} }

View File

@ -50,18 +50,17 @@ export class RouterOutlet extends LitElement {
if (activeUrl === "") { if (activeUrl === "") {
activeUrl = this.defaultUrl || "/"; activeUrl = this.defaultUrl || "/";
window.location.hash = `#${activeUrl}`; window.location.hash = `#${activeUrl}`;
console.debug(`authentik/router: set to ${window.location.hash}`); console.debug(`authentik/router: defaulted URL to ${window.location.hash}`);
return; return;
} }
let matchedRoute: RouteMatch | null = null; let matchedRoute: RouteMatch | null = null;
ROUTES.some((route) => { ROUTES.some((route) => {
console.debug(`authentik/router: matching ${activeUrl} against ${route.url}`);
const match = route.url.exec(activeUrl); const match = route.url.exec(activeUrl);
if (match != null) { if (match != null) {
matchedRoute = new RouteMatch(route); matchedRoute = new RouteMatch(route);
matchedRoute.arguments = match.groups || {}; matchedRoute.arguments = match.groups || {};
matchedRoute.fullUrl = activeUrl; matchedRoute.fullUrl = activeUrl;
console.debug(`authentik/router: found match ${matchedRoute}`); console.debug("authentik/router: found match ", matchedRoute);
return true; return true;
} }
}); });