web/admin: add button to copy saml metadata download link

closes #857

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-11 13:52:47 +02:00
parent 4e2443d60b
commit a6c6f22221
2 changed files with 10 additions and 5 deletions

View file

@ -5,11 +5,6 @@ import { MessageLevel } from "../messages/Message";
@customElement("ak-action-button")
export class ActionButton extends SpinnerButton {
@property()
url = "";
@property()
method = "POST";
@property({attribute: false})
// eslint-disable-next-line @typescript-eslint/no-explicit-any

View file

@ -14,6 +14,7 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css";
import PFButton from "@patternfly/patternfly/components/Button/button.css";
import "../../../elements/buttons/ModalButton";
import "../../../elements/buttons/ActionButton";
import "../../../elements/buttons/SpinnerButton";
import "../../../elements/CodeMirror";
import "../../../elements/Tabs";
@ -159,6 +160,15 @@ export class SAMLProviderViewPage extends LitElement {
href="/api/v2beta/providers/saml/${this.provider.pk}/metadata/?download">
${t`Download`}
</a>
<ak-action-button
class="pf-m-secondary"
.apiRequest=${() => {
const path = `/api/v2beta/providers/saml/${this.provider?.pk}/metadata/?download`;
const fullUrl = window.location.origin + path;
return navigator.clipboard.writeText(fullUrl);
}}>
${t`Copy download URL`}
</ak-action-button>
</div>
</div>
</div>