Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
readonly reset = (routeData: PaneRouteData, resetting: boolean) => {
let state = routeData.collections[this.collectionRep.collectionId()];
// collections are always shown as summary on transient
if (routeData.interactionMode === InteractionMode.Transient) {
state = CollectionViewState.Summary;
}
function getDefaultTableState(exts: Ro.Extensions) {
if (exts.renderEagerly()) {
return exts.tableViewColumns() || exts.tableViewTitle() ? CollectionViewState.Table : CollectionViewState.List;
}
return CollectionViewState.Summary;
}
if (state == null) {
state = getDefaultTableState(this.collectionRep.extensions());
}
this.editing = routeData.interactionMode === InteractionMode.Edit;
.then((object: Ro.DomainObjectRepresentation) => {
// only change the object property if the object has changed
if (isChanging || wasDirty) {
this.object = this.viewModelFactory.domainObjectViewModel(object, routeData, wasDirty);
}
if (modeChanging || isChanging || wasDirty) {
if (this.mode === InteractionMode.Edit ||
this.mode === InteractionMode.Form ||
this.mode === InteractionMode.Transient) {
this.createForm(this.object!); // will never be null
}
}
})
.catch((reject: ErrorWrapper) => {
this.domainObject = obj;
this.onPaneId = routeData.paneId;
this.routeData = routeData;
const iMode = this.domainObject.extensions().interactionMode();
this.isInEdit = routeData.interactionMode !== InteractionMode.View || iMode === 'form' || iMode === 'transient';
this.props = routeData.interactionMode !== InteractionMode.View ? this.contextService.getObjectCachedValues(this.domainObject.id(), routeData.paneId) : {};
const actions = values(this.domainObject.actionMembers()) as Ro.ActionMember[];
this.actions = map(actions, action => this.viewModelFactory.actionViewModel(action, this, this.routeData)).filter(avm => !avm.returnsScalar());
this.menuItems = Helpers.createMenuItems(this.actions);
this.properties = map(this.domainObject.propertyMembers(), (property, id) => this.viewModelFactory.propertyViewModel(property, id!, this.props[id!], this.onPaneId, this.propertyMap));
this.collections = map(this.domainObject.collectionMembers(), collection => this.viewModelFactory.collectionViewModel(collection, this.routeData, resetting));
this.unsaved = routeData.interactionMode === InteractionMode.Transient;
this.title = this.unsaved ? `Unsaved ${this.domainObject.extensions().friendlyName()}` : this.domainObject.title();
this.title = this.title + Helpers.dirtyMarker(this.contextService, this.configService, obj.getOid());
this.friendlyName = this.domainObject.extensions().friendlyName();
this.presentationHint = this.domainObject.extensions().presentationHint();
this.domainType = this.domainObject.domainType()!;
this.instanceId = this.domainObject.instanceId()!;
this.draggableType = this.domainObject.domainType()!;
const selfAsValue = (): Ro.Value | null => {
const link = this.domainObject.selfLink();
if (link) {
// not transient - can't drag transients so no need to set up IDraggable members on transients
link.setTitle(this.title);