Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return this.getObject().then((obj: Ro.DomainObjectRepresentation) => {
if (this.isCollection()) {
const itemNo = this.argumentAsNumber(args, 0)!;
const openCollIds = this.ciceroRenderer.openCollectionIds(this.routeData());
const coll = obj.collectionMember(openCollIds[0]);
// Safe to assume always a List (Cicero doesn't support tables as such & must be open)
return this.context.getCollectionDetails(coll, CollectionViewState.List, false).then(details => this.attemptGotoLinkNumber(itemNo, details.value()));
} else {
const matchingProps = this.matchingProperties(obj, arg0);
const matchingRefProps = filter(matchingProps, p => !p.isScalar());
const matchingColls = this.matchingCollections(obj, arg0);
switch (matchingRefProps.length + matchingColls.length) {
case 0:
return this.returnResult('', Usermessages.noRefFieldMatch(arg0));
case 1:
// TODO: Check for any empty reference
if (matchingRefProps.length > 0) {
const link = matchingRefProps[0].value().link();
if (link) {
this.urlManager.setItem(link);
readonly reset = (list: Ro.ListRepresentation, routeData: PaneRouteData) => {
this.listRep = list;
this.routeData = routeData;
this.id = this.urlManager.getListCacheIndex(routeData.paneId, routeData.page, routeData.pageSize);
this.page = this.listRep.pagination()!.page;
this.pageSize = this.listRep.pagination()!.pageSize;
this.numPages = this.listRep.pagination()!.numPages;
this.state = this.listRep.hasTableData() ? CollectionViewState.Table : CollectionViewState.List;
this.updateItems(list.value());
}
private setPage(page: number) {
const pageSize = this.routeData().pageSize;
this.urlManager.setListPaging(page, pageSize, CollectionViewState.List);
}
}
constructor(
private readonly activatedRoute: ActivatedRoute,
private readonly urlManager: UrlManagerService,
private readonly context: ContextService,
private readonly viewModelFactory: ViewModelFactoryService,
private readonly error: ErrorService,
private readonly configService: ConfigService,
private readonly loggerService: LoggerService,
private readonly dragAndDrop: DragAndDropService
) {
}
collection: ListViewModel;
title = '';
currentState = CollectionViewState.List;
selectedDialogId: string;
private actionButton: IActionHolder = {
value: 'Actions',
doClick: () => this.toggleActionMenu(),
show: () => true,
disabled: () => this.disableActions(),
tempDisabled: () => null,
title: () => this.actionsTooltip,
accesskey: 'a'
};
private reloadButton: IActionHolder = {
value: 'Reload',
doClick: () => this.reloadList(),
show: () => true,
private isList = () => this.collection.currentState === CollectionViewState.List;
readonly doList = () => {
this.urlManager.setListState(CollectionViewState.List, this.onPaneId);
}
private renderCollectionItems(coll: Ro.CollectionMember, startNo: number | null, endNo: number | null) {
if (coll.value()) {
return this.renderItems(coll, startNo, endNo);
} else {
return this.context.getCollectionDetails(coll, CollectionViewState.List, false).
then(details => this.renderItems(details, startNo, endNo));
}
}