import VersionManagementViewModel from "@arcgis/core/widgets/VersionManagement/VersionManagementViewModel.js";
const VersionManagementViewModel = await $arcgis.import("@arcgis/core/widgets/VersionManagement/VersionManagementViewModel.js");
@arcgis/core/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 |
|---|---|---|---|
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. | VersionManagementViewModel | ||
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 | ||
This property contains metadata about the versioning state. | VersionManagementViewModel | ||
| VersionManagementViewModel | |||
The view from which the widget will operate. | VersionManagementViewModel |
Property Details
-
featureServiceLookup
PropertyfeatureServiceLookup Map<string, FeatureServiceResourcesBundle> -
A key-value pair of FeatureServiceResourcesBundle.
-
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
Propertystate Stringreadonly -
The viewModel's state.
Possible Values:"loading" |"failed" |"ready" |"disabled" |"success" |"executing"
-
This property determines if a user has version admin privileges.
-
versioningStateLookup
PropertyversioningStateLookup Map<string, VersioningState> -
This property contains metadata about the versioning state.
-
versioningStates
PropertyversioningStates Collection<VersioningState> -
-
view
Propertyview 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 | |
Promise<VersionInfo[]> | Returns all versions accessible to the currently logged-in user. | VersionManagementViewModel | |
Returns true if a named group of handles exist. | Accessor | ||
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
MethodalterVersion(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.
Parameterparameters AlterVersionParametersParameters used to alter a version.
ReturnsType Description Promise<Boolean> - When resolved, returns
trueif 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
MethodchangeVersion(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
MethodcreateVersion(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
MethoddeleteVersion(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.
ParametersReturnsType Description Promise<Boolean> - When resolved, returns
trueif 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
MethodgetVersionInfos(featureServerUrl){Promise<VersionInfo[]>} -
Returns all versions accessible to the currently logged-in user.
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 trueif 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"); }
-
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
Type DefinitionAlterVersionParameters Object -
Parameters used to alter a version.
- Properties
-
featureServerUrl String
The url of a feature service.
versionIdentifier VersionIdentifierThe Identifier of a version.
optionalownerName StringThe new owner name of the version.
optionalversionName StringThe new name for the version.
optionalaccess StringThe new access permissions of the version.
Possible Values:"hidden"|"private"|"protected"|"public"
optionaldescription StringThe new description for the version.
-
CreateVersionParameters
Type DefinitionCreateVersionParameters 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"
optionaldescription StringThe description of the new version.
optionalownerName StringThe version owner.
-
FeatureServiceResourcesBundle
Type DefinitionFeatureServiceResourcesBundle Object -
Contains FeatureService and array of Layer.
- Properties
-
featureService FeatureService
The feature service.
An array of layers from the feature service.
-
VersionInfo
Type DefinitionVersionInfo Object -
Contains info about a Version.
- Properties
-
versionIdentifier VersionIdentifier
The Identifier of a version.
optionaldescription StringDescription of the version.
optionalaccess StringThe access type permissions of the version.
Possible Values:"hidden"|"private"|"protected"|"public"
optionalversionId StringThe id of the version that was edited.
optionalcreationDate NumberThe date the version was created on.
-
VersionInfoExtendedJSON
Type DefinitionVersionInfoExtendedJSON Object -
This contains extended information about a given version.
- Properties
-
versionIdentifier Object
The identifier of a version.
optionaldescription StringDescription of the version.
optionalaccess StringThe access type permissions of the version.
Possible Values:"hidden"|"private"|"protected"|"public"
optionalversionId StringThe id of the version that was edited.
optionalcreationDate NumberThe date the version was created on.
optionalmodifiedDate NumberThe date when the version was last modified or changed.
optionalreconcileDate NumberThe date when the version was last reconciled with the parent version or the default version.
optionalevaluationDate NumberThe date when the version was last evaluated for conflicts or discrepancies during the reconciliation process.
optionalpreviousAncestorDate NumberThe date of the most recent ancestor version, if applicable.
optionalcommonAncestorDate NumberThe date of the common ancestor version, which is the shared ancestor between two or more versions during the reconciliation process.
optionalisBeingEdited BooleanSpecifies if the version is currently being edited.
optionalisBeingRead BooleanSpecifies if the version is currently being read.
optionalhasConflicts BooleanSpecifies if the version is has conflicts.
optionalhasUninspectedConflicts BooleanSpecifies if the version has UninspectedConflicts.
optionalisLocked BooleanSpecifies if the version currently has a lock.
optionallockOwner StringSpecifies which user is the current lock owner.
optionallockDate NumberSpecifies the date at which the version was locked.