web/admin: fix BoundPoliciesList's edit policy button not working

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-02 18:00:26 +02:00
parent 6d0e0cbe5a
commit 166b98fa34
2 changed files with 17 additions and 18 deletions

View File

@ -32,6 +32,6 @@ func (ws *WebServer) proxyErrorHandler(rw http.ResponseWriter, req *http.Request
} }
func (ws *WebServer) proxyModifyResponse(r *http.Response) error { func (ws *WebServer) proxyModifyResponse(r *http.Response) error {
r.Header.Set("X-authentik-from", "authentik") r.Header.Set("server", "authentik")
return nil return nil
} }

View File

@ -72,7 +72,7 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
<ak-proxy-form <ak-proxy-form
slot="form" slot="form"
.args=${{ .args=${{
"policyUUID": item.policy "instancePk": item.policy
}} }}
type=${ifDefined(item.policyObj?.component)}> type=${ifDefined(item.policyObj?.component)}>
</ak-proxy-form> </ak-proxy-form>
@ -174,8 +174,21 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
renderToolbar(): TemplateResult { renderToolbar(): TemplateResult {
return html` return html`
<ak-forms-modal size=${PFSize.Medium}>
<span slot="submit">
${t`Create`}
</span>
<span slot="header">
${t`Create Binding`}
</span>
<ak-policy-binding-form slot="form" targetPk=${ifDefined(this.target)} ?policyOnly=${this.policyOnly}>
</ak-policy-binding-form>
<button slot="trigger" class="pf-c-button pf-m-primary">
${t`Create Binding`}
</button>
</ak-forms-modal>
<ak-dropdown class="pf-c-dropdown"> <ak-dropdown class="pf-c-dropdown">
<button class="pf-m-primary pf-c-dropdown__toggle" type="button"> <button class="pf-m-secondary pf-c-dropdown__toggle" type="button">
<span class="pf-c-dropdown__toggle-text">${t`Create Policy`}</span> <span class="pf-c-dropdown__toggle-text">${t`Create Policy`}</span>
<i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i> <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
</button> </button>
@ -204,20 +217,6 @@ export class BoundPoliciesList extends Table<PolicyBinding> {
}), html`<ak-spinner></ak-spinner>`)} }), html`<ak-spinner></ak-spinner>`)}
</ul> </ul>
</ak-dropdown> </ak-dropdown>
<ak-forms-modal size=${PFSize.Medium}> ${super.renderToolbar()}`;
<span slot="submit">
${t`Create`}
</span>
<span slot="header">
${t`Create Binding`}
</span>
<ak-policy-binding-form slot="form" targetPk=${ifDefined(this.target)} ?policyOnly=${this.policyOnly}>
</ak-policy-binding-form>
<button slot="trigger" class="pf-c-button pf-m-secondary">
${t`Create Binding`}
</button>
</ak-forms-modal>
${super.renderToolbar()}
`;
} }
} }