VersionManagementViewModel

AMD: require(["esri/widgets/VersionManagement/VersionManagementViewModel"], (VersionManagementViewModel) => { /* code goes here */ });
ESM: import VersionManagementViewModel from "@arcgis/core/widgets/VersionManagement/VersionManagementViewModel.js";
Class: esri/widgets/VersionManagement/VersionManagementViewModel
Inheritance: VersionManagementViewModel Accessor
Since: ArcGIS Maps SDK for JavaScript 4.29

This class allows you to manage versions from a variety of feature services. The VersionManagementViewModel allows you to alter, create, delete versions etc. provided that a featureServiceUrl is provided for these operations.

See also
Example
const webMap = new WebMap({
    portalItem: {
    id: "webmapID"
  }
});

const view = new MapView({
    map: webMap
});

featureLayer = new FeatureLayer({
    url: "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0",
});

webMap.layers.add(featureLayer);

const viewModel = new VersionManagementViewModel({ view });
await whenOnce(() => viewModel.state === "ready");

Constructors

VersionManagementViewModel

Constructor
new VersionManagementViewModel(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class

Map of Service URLs and user type extensions.

VersionManagementViewModel

The name of the class.

Accessor

Displays execution errors.

VersionManagementViewModel

A key-value pair of FeatureServiceResourcesBundle.

VersionManagementViewModel

Displays an error if loading fails.

VersionManagementViewModel

Map of Service URLs and enterprise versions.

serverVersionLookup

Map of Service URLs and service names.

VersionManagementViewModel

The viewModel's state.

VersionManagementViewModel

Map of Service URLs and logged in users .

VersionManagementViewModel

A Map of current version identifiers keyed on the map service url.

VersionManagementViewModel

Contains information about the versions in the versionmanagementservice such as name, guid, etc

VersionManagementViewModel

This class contains metadata about the versioning state.

VersionManagementViewModel
VersionManagementViewModel

This class contains metadata about the version management service.

VersionManagementViewModel

The view from which the widget will operate.

VersionManagementViewModel

Property Details

advancedEditingUserTypeExtensionLookup

Property
advancedEditingUserTypeExtensionLookup Map<string, boolean>

Map of Service URLs and user type extensions.

declaredClass

Inherited
Property
declaredClass Stringreadonly
Inherited from Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

executionError

Property
executionError Stringreadonly

Displays execution errors.

featureServiceLookup

Property
featureServiceLookup Map<string, FeatureServiceResourcesBundle>

A key-value pair of FeatureServiceResourcesBundle.

loadError

Property
loadError Stringreadonly

Displays an error if loading fails.

serverVersionLookup

Property
serverVersionLookup Map<string, number>inner

Map of Service URLs and enterprise versions.

serviceNameLookup

Property
serviceNameLookup Map<string, string>

Map of Service URLs and service names. Keeps track of all the FeatureService instances in the VersionManagementService class instance.

state

Property
state Stringreadonly

The viewModel's state.

Possible Values:"disabled" |"executing" |"failed" |"loading" |"ready"

userLookup

Property
userLookup Map<string, string>

Map of Service URLs and logged in users .

versionIdentifierLookup

Property
versionIdentifierLookup Map<string, VersionIdentifier>
Deprecated since version 4.30. Use VersioningState instead.

A Map of current version identifiers keyed on the map service url.

versionInfoLookup

Property
versionInfoLookup Map<string, VersionInfo[]>
Deprecated since version 4.30. Use VersioningState instead.

Contains information about the versions in the versionmanagementservice such as name, guid, etc

versioningStateLookup

Property
versioningStateLookup Map<string, VersioningState>

This class contains metadata about the versioning state.

versioningStates

Property
versioningStates Collection<VersioningState>

versionManagementServiceLookup

Property
versionManagementServiceLookup Map<string, VersionManagementService>
Deprecated since version 4.30. Use VersioningState instead.

This class contains metadata about the version management service.

view

Property
view MapView

The view from which the widget will operate.

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

Accessor

The alter operation allows you to change the geodatabase version's name, description, owner, and access permissions.

VersionManagementViewModel

Method used to change a version using a featureServerUrl, name, and guid of a version.

VersionManagementViewModel

Creates a new version given the following parameters.

VersionManagementViewModel

Deletes a version given the following parameters.

VersionManagementViewModel

Emits an event on the instance.

VersionManagementViewModel

Returns an array of versions.

VersionManagementViewModel

Indicates whether there is an event listener on the instance that matches the provided event name.

VersionManagementViewModel

Returns true if a named group of handles exist.

Accessor

Registers an event handler on the instance.

VersionManagementViewModel

Removes a group of handles owned by the object.

Accessor

Method Details

addHandles

Inherited
Method
addHandles(handleOrHandles, groupKey)
Inherited from Accessor

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

alterVersion

Method
alterVersion(parameters){Promise<boolean>}

The alter operation allows you to change the geodatabase version's name, description, owner, and access permissions.

License

Parameter

Parameters used to alter a version.

Returns
Type Description
Promise<boolean>
  • When resolved, returns true if the alter operation completes successfully.
Example
await versionManagementViewModel.alterVersion({
  featureServiceUrl: "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0",
  versionIdentifier: {
  guid: myVersion.versionIdentifier.guid,
  name: myVersion.versionIdentifier.name,
},
  versionName: "updatedVersionName"
});

changeVersion

Method
changeVersion(featureServerUrl, toVersionName, toVersionGuid){Promise<Map<VersionAdapter, ServiceResult>>}

Method used to change a version using a featureServerUrl, name, and guid of a version.

Parameters
featureServerUrl String

The url of a feature service.

toVersionName String

Incoming version name.

toVersionGuid String

Incoming version guid.

Returns
Type Description
Promise<Map<VersionAdapter, ServiceResult>>
  • When resolved, returns a map of version adapter to result.
Example
await versionManagementViewModel.changeVersion(
   "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0",
   "incomingVersionName",
   "incomingVersionGuid"
 )

createVersion

Method
createVersion(parameters){Promise<VersionInfoExtendedJSON>}

Creates a new version given the following parameters.

Parameter

Parameters used to create a new version.

Returns
Type Description
Promise<VersionInfoExtendedJSON>
  • When the promise is resolved, the VersionInfoExtendedJSON will be returned once the create operation is successfully completed.
Example
await viewModel.createVersion({
    featureServerUrl: "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0",
    versionName: "NewVersionName",
    description: "New Version Description",
    access: "public",
});

deleteVersion

Method
deleteVersion(featureServerUrl, versionName, versionGuid){Promise<boolean>}

Deletes a version given the following parameters.

License

Parameters
featureServerUrl String

The url of a feature service.

versionName String

The name of the version that is to be deleted.

versionGuid String

The guid of the version that is to be deleted.

Returns
Type Description
Promise<boolean>
  • When resolved, returns true if the delete operation completes successfully.
Example
await versionManagementViewModel.deleteVersion(
  "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0",
  "versionName",
  "{45A4CF5B-69FB-4D94-96F7-25F92EB4C0EC}"
);

emit

Method
emit(type, event){Boolean}

Emits an event on the instance. This method should only be used when creating subclasses of this class.

Parameters
type String

The name of the event.

event Object
optional

The event payload.

Returns
Type Description
Boolean true if a listener was notified

getVersionInfos

Method
getVersionInfos(featureServerUrl){Promise<VersionInfo[]>}

Returns an array of versions.

Parameter
featureServerUrl String

The url of a feature service.

Returns
Type Description
Promise<VersionInfo[]>
  • When resolved, returns an array of VersionInfo.
Example
const versionInfos = await versionManagementViewModel.getVersionInfos("https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0");

hasEventListener

Method
hasEventListener(type){Boolean}

Indicates whether there is an event listener on the instance that matches the provided event name.

Parameter
type String

The name of the event.

Returns
Type Description
Boolean Returns true if the class supports the input event.

hasHandles

Inherited
Method
hasHandles(groupKey){Boolean}
Inherited from Accessor

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}

on

Method
on(type, listener){Object}

Registers an event handler on the instance. Call this method to hook an event with a listener.

Parameters

An event or an array of events to listen for.

listener Function

The function to call when the event fires.

Returns
Type Description
Object Returns an event handler with a remove() method that should be called to stop listening for the event(s).
Property Type Description
remove Function When called, removes the listener from the event.
Example
view.on("click", function(event){
  // event is the event handle returned after the event fires.
  console.log(event.mapPoint);
});

removeHandles

Inherited
Method
removeHandles(groupKey)
Inherited from Accessor

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

Type Definitions

AlterVersionParameters

Type Definition
AlterVersionParameters Object

Parameters used to alter a version.

Properties
featureServerUrl String

The url of a feature service.

versionIdentifier VersionIdentifier

The Identifier of a version.

ownerName String
optional

The new owner name of the version.

versionName String
optional

The new name for the version.

access String
optional

The new access permissions of the version.

Possible Values:"hidden"|"private"|"protected"|"public"

description String
optional

The new description for the version.

CreateVersionParameters

Type Definition
CreateVersionParameters Object

Parameters used to create a new version.

Properties
featureServerUrl String

The url of a feature service.

versionName String

The name of the new version.

access String

The access type of the new version.

Possible Values:"hidden"|"private"|"protected"|"public"

description String
optional

The description of the new version.

ownerName String
optional

The version owner.

FeatureServiceResourcesBundle

Type Definition
FeatureServiceResourcesBundle Object

Contains FeatureService and array of Layer.

Properties
featureService FeatureService

The feature service.

layers Layer[]

An array of layers from the feature service.

VersionInfo

Type Definition
VersionInfo Object

Contains info about a Version.

Properties
versionIdentifier VersionIdentifier

The Identifier of a version.

description String
optional

Description of the version.

access String
optional

The access type permissions of the version.

Possible Values:"hidden"|"private"|"protected"|"public"

versionId String
optional

The id of the version that was edited.

creationDate Number
optional

The date the version was created on.

VersionInfoExtendedJSON

Type Definition
VersionInfoExtendedJSON Object

This contains extended information about a given version.

Properties
versionIdentifier Object

The identifier of a version.

Specification
name String

The name of the version.

guid String

The guid of a version.

description String
optional

Description of the version.

access String
optional

The access type permissions of the version.

Possible Values:"hidden"|"private"|"protected"|"public"

versionId String
optional

The id of the version that was edited.

creationDate Number
optional

The date the version was created on.

modifiedDate Number
optional

The date when the version was last modified or changed.

reconcileDate Number
optional

The date when the version was last reconciled with the parent version or the default version.

evaluationDate Number
optional

The date when the version was last evaluated for conflicts or discrepancies during the reconciliation process.

previousAncestorDate Number
optional

The date of the most recent ancestor version, if applicable.

commonAncestorDate Number
optional

The date of the common ancestor version, which is the shared ancestor between two or more versions during the reconciliation process.

isBeingEdited Boolean
optional

Specifies if the version is currently being edited.

isBeingRead Boolean
optional

Specifies if the version is currently being read.

hasConflicts Boolean
optional

Specifies if the version is has conflicts.

hasUninspectedConflicts Boolean
optional

Specifies if the version has UninspectedConflicts.

isLocked Boolean
optional

Specifies if the version currently has a lock.

lockOwner String
optional

Specifies which user is the current lock owner.

lockDate Number
optional

Specifies the date at which the version was locked.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.