mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 09:32:41 +00:00
feat: add action chips to search results
This commit is contained in:
@@ -42,12 +42,14 @@ export class ThingTranslatePipe implements PipeTransform, OnDestroy {
|
||||
this.value = this.thingTranslate.get(thing, key);
|
||||
}
|
||||
|
||||
transform(query: unknown, thing: SCThings): unknown {
|
||||
transform<T extends SCThings, P extends string[] | keyof T>(query: P, thing: T):
|
||||
P extends keyof T ? T[P] : P | unknown {
|
||||
if (typeof query !== 'string' || query.length <= 0) {
|
||||
return query;
|
||||
// tslint:disable-next-line:no-any
|
||||
return query as any;
|
||||
}
|
||||
|
||||
if (!isThing(thing)){
|
||||
if (!isThing(thing)) {
|
||||
throw new SyntaxError(`Wrong parameter in ThingTranslatePipe. Expected a valid SCThing, received: ${thing}`);
|
||||
}
|
||||
|
||||
@@ -69,7 +71,8 @@ export class ThingTranslatePipe implements PipeTransform, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
return this.value;
|
||||
// tslint:disable-next-line:no-any
|
||||
return this.value as any;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,13 +114,13 @@ export class ThingPropertyNameTranslatePipe implements PipeTransform, OnDestroy
|
||||
return query;
|
||||
}
|
||||
|
||||
if (!isThing(thingOrType) && typeof thingOrType !== 'string'){
|
||||
if (!isThing(thingOrType) && typeof thingOrType !== 'string') {
|
||||
throw new SyntaxError(`Wrong parameter in ThingTranslatePipe. Expected a valid SCThing or String, received: ${thingOrType}`);
|
||||
}
|
||||
|
||||
// store the params, in case they change
|
||||
this.lastKey = query;
|
||||
this.lastType= typeof thingOrType === 'string' ? thingOrType : thingOrType.type;
|
||||
this.lastType = typeof thingOrType === 'string' ? thingOrType : thingOrType.type;
|
||||
|
||||
this.updateValue(query, this.lastType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user