Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getFields(field: Ro.IField): Ro.IField[] {
if (field instanceof Ro.Parameter) {
const action = field.parent;
if (action instanceof Ro.InvokableActionMember || action instanceof Ro.ActionRepresentation) {
const parms = action.parameters();
return map(parms, p => p as Ro.IField);
}
}
if (field instanceof Ro.PropertyMember) {
// todo
return [];
}
return [];
}
constructor(
private readonly viewModelFactory: ViewModelFactoryService,
private readonly context: ContextService,
private readonly urlManager: UrlManagerService,
private readonly error: ErrorService,
private readonly clickHandler: ClickHandlerService,
public readonly actionRep: Ro.ActionMember | Ro.ActionRepresentation,
private readonly vm: IMessageViewModel,
private readonly routeData: PaneRouteData
) {
if (actionRep instanceof Ro.ActionRepresentation || actionRep instanceof Ro.InvokableActionMember) {
this.invokableActionRep = actionRep;
}
this.paneId = routeData.paneId;
this.title = actionRep.extensions().friendlyName();
this.presentationHint = actionRep.extensions().presentationHint();
this.menuPath = actionRep.extensions().menuPath() || '';
this.description = this.disabled() ? actionRep.disabledReason() : actionRep.extensions().description();
}
getInvokableAction = (action: Ro.ActionMember | Ro.ActionRepresentation): Promise => {
if (action instanceof Ro.InvokableActionMember || action instanceof Ro.ActionRepresentation) {
return Promise.resolve(action);
}
return this.getActionDetails(action);
}