require(["esri/widgets/VersionManagement/VersionManagementViewModel"], (VersionManagementViewModel) => { /* code goes here */ });
import VersionManagementViewModel from "@arcgis/core/widgets/VersionManagement/VersionManagementViewModel.js";
esri/widgets/VersionManagement/VersionManagementViewModel
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
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
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
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 | ||
This property determines if a user has version admin privileges. | VersionManagementViewModel | ||
A Map of current version identifiers keyed on the map service url. | VersionManagementViewModel | ||
Contains information about versions contained in version management service such as name, guid, etc. | VersionManagementViewModel | ||
This property contains metadata about the version management service. | VersionManagementViewModel | ||
This property contains metadata about the versioning state. | VersionManagementViewModel | ||
VersionManagementViewModel | |||
The view from which the widget will operate. | VersionManagementViewModel |
Property Details
-
Map of Service URLs and user type extensions.
-
executionError
executionError Stringreadonly
-
Displays execution errors.
-
featureServiceLookup
featureServiceLookup Map<string, FeatureServiceResourcesBundle>
-
A key-value pair of FeatureServiceResourcesBundle.
-
loadError
loadError Stringreadonly
-
Displays an error if loading fails.
-
Map of Service URLs and enterprise versions.
-
Map of Service URLs and service names. Keeps track of all the FeatureService instances in the VersionManagementService class instance.
-
state
state Stringreadonly
-
The viewModel's state.
Possible Values:"disabled" |"executing" |"failed" |"loading" |"ready"
-
This property determines if a user has version admin privileges.
-
versionIdentifierLookup
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
versionInfoLookup Map<string, VersionInfo[]>
Deprecated since version 4.30. Use VersioningState instead. -
Contains information about versions contained in version management service such as name, guid, etc.
-
versionManagementServiceLookup
versionManagementServiceLookup Map<string, VersionManagementService>
Deprecated since version 4.30. Use VersioningState instead. -
This property contains metadata about the version management service.
-
versioningStateLookup
versioningStateLookup Map<string, VersioningState>
-
This property contains metadata about the versioning state.
-
versioningStates
versioningStates Collection<VersioningState>
-
-
view
view MapView
-
The view from which the widget will operate.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Promise<Boolean> | The alter operation allows you to change the geodatabase version's name, description, owner, and access permissions. | VersionManagementViewModel | |
Promise<Map<VersionAdapter, ServiceResult>> | Method used to change a version using a featureServerUrl, name, and guid of a version. | VersionManagementViewModel | |
Promise<VersionInfoExtendedJSON> | Creates a new version given the following parameters. | VersionManagementViewModel | |
Promise<Boolean> | Deletes a version given the following parameters. | VersionManagementViewModel | |
Emits an event on the instance. | VersionManagementViewModel | ||
Promise<VersionInfo[]> | 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
-
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();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey 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
alterVersion(parameters){Promise<Boolean>}
-
The alter operation allows you to change the geodatabase version's name, description, owner, and access permissions.
License
- This method requires the feature service and version management service to be published with ArcGIS Enterprise version 11.2 or higher.
- Organization members must be assigned a license for the ArcGIS Advanced Editing user type extension to use this method.
Parameterparameters AlterVersionParametersParameters used to alter a version.
ReturnsType Description Promise<Boolean> - When resolved, returns
true
if the alter operation completes successfully.
Exampleawait 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
changeVersion(featureServerUrl, toVersionName, toVersionGuid){Promise<Map<VersionAdapter, ServiceResult>>}
-
Method used to change a version using a featureServerUrl, name, and guid of a version.
ParametersReturnsType Description Promise<Map<VersionAdapter, ServiceResult>> - When resolved, returns a map of version adapter to result.
Exampleawait versionManagementViewModel.changeVersion( "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0", "incomingVersionName", "incomingVersionGuid" )
-
createVersion
createVersion(parameters){Promise<VersionInfoExtendedJSON>}
-
Creates a new version given the following parameters.
Parameterparameters CreateVersionParametersParameters used to create a new version.
ReturnsType Description Promise<VersionInfoExtendedJSON> - When the promise is resolved, the VersionInfoExtendedJSON will be returned once the create operation is successfully completed.
Exampleawait viewModel.createVersion({ featureServerUrl: "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0", versionName: "NewVersionName", description: "New Version Description", access: "public", });
-
deleteVersion
deleteVersion(featureServerUrl, versionName, versionGuid){Promise<Boolean>}
-
Deletes a version given the following parameters.
License
- This method requires the feature service and version management service to be published with ArcGIS Enterprise version 11.2 or higher.
- Organization members must be assigned a license for the ArcGIS Advanced Editing user type extension to use this method.
ParametersReturnsType Description Promise<Boolean> - When resolved, returns
true
if the delete operation completes successfully.
Exampleawait versionManagementViewModel.deleteVersion( "https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0", "versionName", "{45A4CF5B-69FB-4D94-96F7-25F92EB4C0EC}" );
-
getVersionInfos
getVersionInfos(featureServerUrl){Promise<VersionInfo[]>}
-
Returns an array of versions.
ParameterfeatureServerUrl StringThe url of a feature service.
ReturnsType Description Promise<VersionInfo[]> - When resolved, returns an array of
VersionInfo
.
Exampleconst versionInfos = await versionManagementViewModel.getVersionInfos("https://myHostName.domain.com/arcgis/rest/services/TestService_11_2/FeatureServer/0");
- When resolved, returns an array of
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from Accessor -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType 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
on(type, listener){Object}
-
Registers an event handler on the instance. Call this method to hook an event with a listener.
ParametersReturnsType 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. Exampleview.on("click", function(event){ // event is the event handle returned after the event fires. console.log(event.mapPoint); });
-
Inherited from Accessor
-
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
Type Definitions
-
AlterVersionParameters
AlterVersionParameters Object
-
Parameters used to alter a version.
- Properties
-
featureServerUrl String
The url of a feature service.
versionIdentifier VersionIdentifierThe Identifier of a version.
ownerName StringThe new owner name of the version.
versionName StringThe new name for the version.
access StringThe new access permissions of the version.
Possible Values:"hidden"|"private"|"protected"|"public"
description StringThe new description for the version.
-
CreateVersionParameters
CreateVersionParameters Object
-
Parameters used to create a new version.
- Properties
-
featureServerUrl String
The url of a feature service.
versionName StringThe name of the new version.
access StringThe access type of the new version.
Possible Values:"hidden"|"private"|"protected"|"public"
description StringThe description of the new version.
ownerName StringThe version owner.
-
FeatureServiceResourcesBundle
FeatureServiceResourcesBundle Object
-
Contains FeatureService and array of Layer.
- Properties
-
featureService FeatureService
The feature service.
An array of layers from the feature service.
-
VersionInfo
VersionInfo Object
-
Contains info about a Version.
- Properties
-
versionIdentifier VersionIdentifier
The Identifier of a version.
description StringDescription of the version.
access StringThe access type permissions of the version.
Possible Values:"hidden"|"private"|"protected"|"public"
versionId StringThe id of the version that was edited.
creationDate NumberThe date the version was created on.
-
VersionInfoExtendedJSON
VersionInfoExtendedJSON Object
-
This contains extended information about a given version.
- Properties
-
versionIdentifier Object
The identifier of a version.
description StringDescription of the version.
access StringThe access type permissions of the version.
Possible Values:"hidden"|"private"|"protected"|"public"
versionId StringThe id of the version that was edited.
creationDate NumberThe date the version was created on.
modifiedDate NumberThe date when the version was last modified or changed.
reconcileDate NumberThe date when the version was last reconciled with the parent version or the default version.
evaluationDate NumberThe date when the version was last evaluated for conflicts or discrepancies during the reconciliation process.
previousAncestorDate NumberThe date of the most recent ancestor version, if applicable.
commonAncestorDate NumberThe date of the common ancestor version, which is the shared ancestor between two or more versions during the reconciliation process.
isBeingEdited BooleanSpecifies if the version is currently being edited.
isBeingRead BooleanSpecifies if the version is currently being read.
hasConflicts BooleanSpecifies if the version is has conflicts.
hasUninspectedConflicts BooleanSpecifies if the version has UninspectedConflicts.
isLocked BooleanSpecifies if the version currently has a lock.
lockOwner StringSpecifies which user is the current lock owner.
lockDate NumberSpecifies the date at which the version was locked.