Fix error case in filter comparison

pull/6272/head
Oliver Günther 7 years ago
parent 1acccb444a
commit 51aee957cf
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 15
      frontend/app/components/wp-table/configuration-modal/wp-table-configuration.modal.ts
  2. 33
      frontend/app/modules/hal/hal-link/hal-link.ts

@ -25,6 +25,7 @@ import {WorkPackageStatesInitializationService} from 'core-components/wp-list/wp
import {TableState} from 'core-components/wp-table/table-state/table-state';
import {QueryFormResource} from 'core-app/modules/hal/resources/query-form-resource';
import {LoadingIndicatorService} from 'core-components/common/loading-indicator/loading-indicator.service';
import {WorkPackageNotificationService} from "core-components/wp-edit/wp-notification.service";
@Component({
template: require('!!raw-loader!./wp-table-configuration.modal.html')
@ -72,6 +73,7 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme
readonly tableState:TableState,
readonly queryFormDm:QueryFormDmService,
readonly wpStatesInitialization:WorkPackageStatesInitializationService,
readonly wpNotificationsService:WorkPackageNotificationService,
readonly wpTableColumns:WorkPackageTableColumnsService,
readonly ConfigurationService:ConfigurationService,
readonly elementRef:ElementRef) {
@ -144,10 +146,13 @@ export class WpTableConfigurationModalComponent extends OpModalComponent impleme
protected async loadForm() {
const query = this.tableState.query.value!;
return this.queryFormDm.load(query).then((form:QueryFormResource) => {
this.wpStatesInitialization.updateStatesFromForm(query, form);
return form;
});
return this.queryFormDm
.load(query)
.then((form:QueryFormResource) => {
this.wpStatesInitialization.updateStatesFromForm(query, form);
return form;
})
.catch((error) => this.wpNotificationsService.handleRawError(error));
}
}

@ -33,7 +33,7 @@ import {
import {HalResourceService} from 'core-app/modules/hal/services/hal-resource.service';
export interface HalLinkInterface {
href:string|null;
href:string | null;
method:HTTPSupportedMethods;
title?:string;
templated?:boolean;
@ -47,8 +47,8 @@ export interface CallableHalLink extends HalLinkInterface {
}
export class HalLink implements HalLinkInterface {
constructor(public halResourceService:HalResourceService,
public href:string|null = null,
constructor(public requestMethod:(method:HTTPSupportedMethods, href:string, data:any, headers:any) => Promise<HalResource>,
public href:string | null = null,
public title:string = '',
public method:HTTPSupportedMethods = 'get',
public templated:boolean = false,
@ -62,7 +62,8 @@ export class HalLink implements HalLinkInterface {
*/
public static fromObject(halResourceService:HalResourceService, link:HalLinkInterface):HalLink {
return new HalLink(
halResourceService,
(method:HTTPSupportedMethods, href:string, data:any, headers:any) =>
halResourceService.request(method, href, data, headers).toPromise(),
link.href,
link.title,
link.method,
@ -78,9 +79,7 @@ export class HalLink implements HalLinkInterface {
*/
public async $fetch(...params:any[]):Promise<HalResource> {
const [data, headers] = params;
return this.halResourceService
.request(this.method, this.href as string, data, headers)
.toPromise();
return this.requestMethod(this.method, this.href as string, data, headers);
}
/**
@ -99,17 +98,15 @@ export class HalLink implements HalLinkInterface {
href = href.replace(regexp, value);
});
return HalLink.fromObject(
this.halResourceService,
{
href: href,
title: this.title,
method: this.method,
templated: false,
payload: this.payload,
type: this.type,
identifier: this.identifier
}
return new HalLink(
this.requestMethod,
href,
this.title,
this.method,
false,
this.payload,
this.type,
this.identifier
).$callable();
}

Loading…
Cancel
Save