web: fix more special API Calls
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		@ -37,7 +37,7 @@ export class OutpostStatusChart extends AKChart<OutpostStats> {
 | 
			
		||||
        let outdated = 0;
 | 
			
		||||
        let unhealthy = 0;
 | 
			
		||||
        await Promise.all(outposts.results.map(async (element) => {
 | 
			
		||||
            const health = await api.outpostsOutpostsHealthList({
 | 
			
		||||
            const health = await api.outpostsInstancesHealthList({
 | 
			
		||||
                uuid: element.pk || "",
 | 
			
		||||
            });
 | 
			
		||||
            if (health.length === 0) {
 | 
			
		||||
 | 
			
		||||
@ -55,7 +55,7 @@ export class TransportListPage extends TablePage<NotificationTransport> {
 | 
			
		||||
            html`
 | 
			
		||||
            <ak-action-button
 | 
			
		||||
                .apiRequest=${() => {
 | 
			
		||||
                    return new EventsApi(DEFAULT_CONFIG).eventsTransportsTest({
 | 
			
		||||
                    return new EventsApi(DEFAULT_CONFIG).eventsTransportsTestCreate({
 | 
			
		||||
                        uuid: item.pk || "",
 | 
			
		||||
                    });
 | 
			
		||||
                }}>
 | 
			
		||||
 | 
			
		||||
@ -18,7 +18,7 @@ export class FlowDiagram extends LitElement {
 | 
			
		||||
    @property()
 | 
			
		||||
    set flowSlug(value: string) {
 | 
			
		||||
        this._flowSlug = value;
 | 
			
		||||
        new FlowsApi(DEFAULT_CONFIG).flowsInstancesDiagram({
 | 
			
		||||
        new FlowsApi(DEFAULT_CONFIG).flowsInstancesDiagramRetrieve({
 | 
			
		||||
            slug: value,
 | 
			
		||||
        }).then((data) => {
 | 
			
		||||
            this.diagram = FlowChart.parse(data.diagram || "");
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ export class FlowImportForm extends Form<Flow> {
 | 
			
		||||
        if (!file) {
 | 
			
		||||
            throw new Error("No form data");
 | 
			
		||||
        }
 | 
			
		||||
        return new FlowsApi(DEFAULT_CONFIG).flowsInstancesImportFlow({
 | 
			
		||||
        return new FlowsApi(DEFAULT_CONFIG).flowsInstancesImportFlowCreate({
 | 
			
		||||
            file: file
 | 
			
		||||
        });
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
@ -89,7 +89,7 @@ export class FlowListPage extends TablePage<Flow> {
 | 
			
		||||
            <button
 | 
			
		||||
                class="pf-c-button pf-m-secondary"
 | 
			
		||||
                @click=${() => {
 | 
			
		||||
                    new FlowsApi(DEFAULT_CONFIG).flowsInstancesExecute({
 | 
			
		||||
                    new FlowsApi(DEFAULT_CONFIG).flowsInstancesExecuteRetrieve({
 | 
			
		||||
                        slug: item.slug
 | 
			
		||||
                    }).then(link => {
 | 
			
		||||
                        window.location.assign(`${link.link}?next=/%23${window.location.href}`);
 | 
			
		||||
 | 
			
		||||
@ -71,7 +71,7 @@ export class FlowViewPage extends LitElement {
 | 
			
		||||
                                                <button
 | 
			
		||||
                                                    class="pf-c-button pf-m-secondary"
 | 
			
		||||
                                                    @click=${() => {
 | 
			
		||||
                                                    new FlowsApi(DEFAULT_CONFIG).flowsInstancesExecute({
 | 
			
		||||
                                                    new FlowsApi(DEFAULT_CONFIG).flowsInstancesExecuteRetrieve({
 | 
			
		||||
                                                        slug: this.flow.slug
 | 
			
		||||
                                                    }).then(link => {
 | 
			
		||||
                                                        const finalURL = `${link.link}?next=/%23${window.location.href}`;
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,7 @@ export class GroupForm extends ModelForm<Group, string> {
 | 
			
		||||
                groupRequest: data
 | 
			
		||||
            });
 | 
			
		||||
        } else {
 | 
			
		||||
            data.users = Array.from(this.instance?.users || []) as unknown as Set<number>;
 | 
			
		||||
            data.users = Array.from(this.instance?.users || []);
 | 
			
		||||
            return new CoreApi(DEFAULT_CONFIG).coreGroupsCreate({
 | 
			
		||||
                groupRequest: data
 | 
			
		||||
            });
 | 
			
		||||
@ -83,7 +83,7 @@ export class GroupForm extends ModelForm<Group, string> {
 | 
			
		||||
                            // Because the model only has the IDs, map the user list to IDs
 | 
			
		||||
                            const ids = items.map(u => u.pk || 0);
 | 
			
		||||
                            if (!this.instance) this.instance = {} as Group;
 | 
			
		||||
                            this.instance.users = new Set(Array.from(this.instance?.users || []).concat(ids));
 | 
			
		||||
                            this.instance.users = Array.from(this.instance?.users || []).concat(ids);
 | 
			
		||||
                            this.requestUpdate();
 | 
			
		||||
                            return Promise.resolve();
 | 
			
		||||
                        }}>
 | 
			
		||||
@ -109,7 +109,7 @@ export class GroupForm extends ModelForm<Group, string> {
 | 
			
		||||
                                            const users = Array.from(this.instance?.users || []);
 | 
			
		||||
                                            const idx = users.indexOf(user.pk || 0);
 | 
			
		||||
                                            users.splice(idx, 1);
 | 
			
		||||
                                            this.instance.users = new Set(users);
 | 
			
		||||
                                            this.instance.users = users;
 | 
			
		||||
                                            this.requestUpdate();
 | 
			
		||||
                                        }}>
 | 
			
		||||
                                        ${user.username}
 | 
			
		||||
 | 
			
		||||
@ -29,12 +29,12 @@ export class OutpostForm extends ModelForm<Outpost, string> {
 | 
			
		||||
 | 
			
		||||
    send = (data: Outpost): Promise<Outpost> => {
 | 
			
		||||
        if (this.instance) {
 | 
			
		||||
            return new OutpostsApi(DEFAULT_CONFIG).outpostsOutpostsUpdate({
 | 
			
		||||
            return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesUpdate({
 | 
			
		||||
                uuid: this.instance.pk || "",
 | 
			
		||||
                outpostRequest: data
 | 
			
		||||
            });
 | 
			
		||||
        } else {
 | 
			
		||||
            return new OutpostsApi(DEFAULT_CONFIG).outpostsOutpostsCreate({
 | 
			
		||||
            return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesCreate({
 | 
			
		||||
                outpostRequest: data
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
@ -108,7 +108,7 @@ export class OutpostForm extends ModelForm<Outpost, string> {
 | 
			
		||||
            <ak-form-element-horizontal
 | 
			
		||||
                label=${t`Configuration`}
 | 
			
		||||
                name="config">
 | 
			
		||||
                <ak-codemirror mode="yaml" value="${until(new OutpostsApi(DEFAULT_CONFIG).outpostsOutpostsDefaultSettings({}).then(config => {
 | 
			
		||||
                <ak-codemirror mode="yaml" value="${until(new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesDefaultSettingsRetrieve().then(config => {
 | 
			
		||||
                        let fc = config.config;
 | 
			
		||||
                        if (this.instance) {
 | 
			
		||||
                            fc = this.instance.config;
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ export class OutpostHealthElement extends LitElement {
 | 
			
		||||
 | 
			
		||||
    firstUpdated(): void {
 | 
			
		||||
        if (!this.outpostId) return;
 | 
			
		||||
        new OutpostsApi(DEFAULT_CONFIG).outpostsOutpostsHealth({
 | 
			
		||||
        new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesHealthList({
 | 
			
		||||
            uuid: this.outpostId
 | 
			
		||||
        }).then(health => {
 | 
			
		||||
            this.outpostHealth = health;
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ export class OutpostListPage extends TablePage<Outpost> {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    apiEndpoint(page: number): Promise<AKResponse<Outpost>> {
 | 
			
		||||
        return new OutpostsApi(DEFAULT_CONFIG).outpostsOutpostsList({
 | 
			
		||||
        return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesList({
 | 
			
		||||
            ordering: this.order,
 | 
			
		||||
            page: page,
 | 
			
		||||
            pageSize: PAGE_SIZE,
 | 
			
		||||
@ -76,7 +76,7 @@ export class OutpostListPage extends TablePage<Outpost> {
 | 
			
		||||
                .obj=${item}
 | 
			
		||||
                objectLabel=${t`Outpost`}
 | 
			
		||||
                .delete=${() => {
 | 
			
		||||
                    return new OutpostsApi(DEFAULT_CONFIG).outpostsOutpostsDestroy({
 | 
			
		||||
                    return new OutpostsApi(DEFAULT_CONFIG).outpostsInstancesDestroy({
 | 
			
		||||
                        uuid: item.pk || ""
 | 
			
		||||
                    });
 | 
			
		||||
                }}>
 | 
			
		||||
 | 
			
		||||
@ -63,7 +63,7 @@ export class OutpostServiceConnectionListPage extends TablePage<ServiceConnectio
 | 
			
		||||
            html`${item.verboseName}`,
 | 
			
		||||
            html`${item.local ? t`Yes` : t`No`}`,
 | 
			
		||||
            html`${until(
 | 
			
		||||
                new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllState({
 | 
			
		||||
                new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllStateRetrieve({
 | 
			
		||||
                    uuid: item.pk || ""
 | 
			
		||||
                }).then((state) => {
 | 
			
		||||
                    if (state.healthy) {
 | 
			
		||||
@ -113,7 +113,7 @@ export class OutpostServiceConnectionListPage extends TablePage<ServiceConnectio
 | 
			
		||||
                <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
 | 
			
		||||
            </button>
 | 
			
		||||
            <ul class="pf-c-dropdown__menu" hidden>
 | 
			
		||||
                ${until(new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllTypes().then((types) => {
 | 
			
		||||
                ${until(new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllTypesList().then((types) => {
 | 
			
		||||
                    return types.map((type) => {
 | 
			
		||||
                        return html`<li>
 | 
			
		||||
                            <ak-forms-modal>
 | 
			
		||||
 | 
			
		||||
@ -72,7 +72,7 @@ export class EventMatcherPolicyForm extends ModelForm<EventMatcherPolicy, string
 | 
			
		||||
                        name="action">
 | 
			
		||||
                        <select class="pf-c-form-control">
 | 
			
		||||
                            <option value="" ?selected=${this.instance?.action === undefined}>---------</option>
 | 
			
		||||
                            ${until(new EventsApi(DEFAULT_CONFIG).eventsEventsActions().then(actions => {
 | 
			
		||||
                            ${until(new EventsApi(DEFAULT_CONFIG).eventsEventsActionsList().then(actions => {
 | 
			
		||||
                                return actions.map(action => {
 | 
			
		||||
                                    return html`<option value=${action.component} ?selected=${this.instance?.action === action.component}>${action.name}</option>`;
 | 
			
		||||
                                });
 | 
			
		||||
 | 
			
		||||
@ -46,7 +46,7 @@ export class PropertyMappingListPage extends TablePage<PropertyMapping> {
 | 
			
		||||
            page: page,
 | 
			
		||||
            pageSize: PAGE_SIZE,
 | 
			
		||||
            search: this.search || "",
 | 
			
		||||
            managedIsnull: this.hideManaged ? "true" : undefined,
 | 
			
		||||
            managedIsnull: this.hideManaged ? true : undefined,
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -117,7 +117,7 @@ export class PropertyMappingListPage extends TablePage<PropertyMapping> {
 | 
			
		||||
                <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
 | 
			
		||||
            </button>
 | 
			
		||||
            <ul class="pf-c-dropdown__menu" hidden>
 | 
			
		||||
                ${until(new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllTypes().then((types) => {
 | 
			
		||||
                ${until(new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsAllTypesList().then((types) => {
 | 
			
		||||
                    return types.map((type) => {
 | 
			
		||||
                        return html`<li>
 | 
			
		||||
                            <ak-forms-modal>
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ export class OAuth2ProviderViewPage extends LitElement {
 | 
			
		||||
        }).then((prov) => {
 | 
			
		||||
            this.provider = prov;
 | 
			
		||||
        });
 | 
			
		||||
        api.providersOauth2SetupUrls({
 | 
			
		||||
        api.providersOauth2SetupUrlsRetrieve({
 | 
			
		||||
            id: value
 | 
			
		||||
        }).then((prov) => {
 | 
			
		||||
            this.providerUrls = prov;
 | 
			
		||||
 | 
			
		||||
@ -117,7 +117,7 @@ export class SourceListPage extends TablePage<Source> {
 | 
			
		||||
                <i class="fas fa-caret-down pf-c-dropdown__toggle-icon" aria-hidden="true"></i>
 | 
			
		||||
            </button>
 | 
			
		||||
            <ul class="pf-c-dropdown__menu" hidden>
 | 
			
		||||
                ${until(new SourcesApi(DEFAULT_CONFIG).sourcesAllTypes().then((types) => {
 | 
			
		||||
                ${until(new SourcesApi(DEFAULT_CONFIG).sourcesAllTypesList().then((types) => {
 | 
			
		||||
                    return types.map((type) => {
 | 
			
		||||
                        return html`<li>
 | 
			
		||||
                            <ak-forms-modal>
 | 
			
		||||
 | 
			
		||||
@ -196,7 +196,7 @@ export class OAuthSourceForm extends ModelForm<OAuthSource, string> {
 | 
			
		||||
                            }
 | 
			
		||||
                            this.instance.providerType = selected.value;
 | 
			
		||||
                        }}>
 | 
			
		||||
                            ${until(new SourcesApi(DEFAULT_CONFIG).sourcesOauthSourceTypes().then(types => {
 | 
			
		||||
                            ${until(new SourcesApi(DEFAULT_CONFIG).sourcesOauthSourceTypesList().then(types => {
 | 
			
		||||
                                return types.map(type => {
 | 
			
		||||
                                    let selected = this.instance?.providerType === type.slug;
 | 
			
		||||
                                    if (!this.instance?.pk) {
 | 
			
		||||
 | 
			
		||||
@ -76,7 +76,7 @@ export class EmailStageForm extends ModelForm<EmailStage, string> {
 | 
			
		||||
                        label=${t`SMTP Password`}
 | 
			
		||||
                        ?writeOnly=${this.instance !== undefined}
 | 
			
		||||
                        name="password">
 | 
			
		||||
                        <input type="text" value="${ifDefined(this.instance?.password || "")}" class="pf-c-form-control">
 | 
			
		||||
                        <input type="text" value="" class="pf-c-form-control">
 | 
			
		||||
                    </ak-form-element-horizontal>
 | 
			
		||||
                    <ak-form-element-horizontal name="useTls">
 | 
			
		||||
                        <div class="pf-c-check">
 | 
			
		||||
@ -156,7 +156,7 @@ export class EmailStageForm extends ModelForm<EmailStage, string> {
 | 
			
		||||
                        ?required=${true}
 | 
			
		||||
                        name="template">
 | 
			
		||||
                        <select name="users" class="pf-c-form-control">
 | 
			
		||||
                            ${until(new StagesApi(DEFAULT_CONFIG).stagesEmailTemplates().then(templates => {
 | 
			
		||||
                            ${until(new StagesApi(DEFAULT_CONFIG).stagesEmailTemplatesList().then(templates => {
 | 
			
		||||
                                return templates.map(template => {
 | 
			
		||||
                                    const selected = this.instance?.template === template.name;
 | 
			
		||||
                                    return html`<option value=${ifDefined(template.name)} ?selected=${selected}>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user