This is part of GoCloudStorage and not part of the main GoJS library. Storage can be found in the GoJS kit under the projects
folder. See the Storage intro page for more information.
An array of GoJS Diagrams whose model(s) will be saved to / loaded from a cloud storage service. Can also be a single Diagram.
String representation of the default model data for new diagrams. If this is null, default new diagrams will be empty. Usually a value given by calling Model.toJson on a GoJS Diagram's Model.
The client ID of the cloud storage application to use (given by the cloud storage service to developer). Not needed for all subclasses.
The directory path relative to the page in which this instance of GoCloudStorage exists, in which the storage service brand icons can be found. The default value is "../goCloudStorageIcons/".
Get the name of the class; i.e. "GoDropbox"
Get the clientId for the app using the cloud storage service. This is usually given by the cloud storage provider's dev console or similar. Set with a parameter during construction.
Get or set the currently open DiagramFile. By default, currentDiagramFile is set when a file is loaded from storage, saved to storage (if saved to a different path from the currentDiagramFile.path), or deleted from storage (if the deleted file is the currently open one). The default value is a DiagramFile with null id, name, and path values.
Get / set the defaultModel data for the app used by an instance of GoCloudStorage. defaultModel is used when creating new diagrams. See create.
Get / set iconsRelativeDirectory, the directory path relative to the page in which this instance of GoCloudStorage exists, in which the storage service brand icons can be found. The default value is "../goCloudStorageIcons/".
Get or set isAutoSaving property. If true, the managedDiagrams will be saved to storage after every
Transaction (only if currentDiagramFile holds a non-null path value).
Additionally, if isAutoSaving is true, users will be prompted to save newly created
diagrams when created with create.
The default value for isAutoSaving is true
.
Get / set the GoJS Diagrams associated with this instance of GoCloudStorage. Set with a parameter during construction.
Get the name of the cloud storage service being used; i.e. "Dropbox"
Get the UI element associated with this instance of GoCloudStorage. This is a custom filepicker window for GoDropBox and GoLocalStorage. It is a save prompt for GoOneDrive and GoGoogleDrive (both these classes use third party UI for storage navigation, provided by Microsoft and Google, respectively). The UI element is created during construction.
Explicitly authorize a currently-signed in user of the storage service to use the application associated with this instance of GoCloudStorage (via clientId. If no currently signed-in user exists, prompt user to sign into their account, then authorize that account.
Note: Authorization does not occur (and is not possible or necessary) with GoLocalStorage. Instead, GoLocalStorage.authorize ensures localStorage exists in the browser.
Whether to get a new access token (true) or try to find / use an existing one. Exact behavior varies from subclass to subclass. See:
Returns a Promise that resolves with a boolean stating whether authorization was succesful (true) or failed (false).
Check whether a file exists at a given path.
A valid filepath. What is meant by this varies from subclass to subclass. Rules for valid filepaths by subclass:
example.diagram
/{path-to-file}/{filename}
; i.e. /Public/example.diagram
/drive/root:/{path-to-file}/{filename}
; i.e. /drive/root:/Documents/example.diagram
Returns a Promise that resolves with a boolean stating whether a file exists at a given path.
Set each of managedDiagrams' .model to defaultModel (if defaultModel is null, each model will be set to a new GraphLinksModel by default). If isAutoSaving is true and no path parameter is supplied, users will be immediately prompted to save their new diagrams to cloud storage.
Optional. If a valid filepath is supplied, save each of managedDiagrams' model data to this path. No UI of any sort appears. What is meant by "valid filepath" varies from subclass to subclass. Rules for valid filepaths by subclass:
example.diagram
/{path-to-file}/{filename}
; i.e. /Public/example.diagram
/drive/root:/{path-to-file}/{filename}
; i.e. /drive/root:/Documents/example.diagram
Optional. If true, the user will be prompted to save their current diagram(s) before GoCloudStorage makes a new one. The default value is false.
Returns a Promise that resolves with a DiagramFile representing the newly created file.
Get the file at a given path in storage. The exact file data given varies from storage service to storage service, though all include name, path, id data. The exact syntax of these data fields may vary. See subclass-specific documentation for more details.
A valid filepath. What is meant by this varies from subclass to subclass. Rules for valid filepaths by subclass:
example.diagram
/{path-to-file}/{filename}
; i.e. /Public/example.diagram
/drive/root:/{path-to-file}/{filename}
; i.e. /drive/root:/Documents/example.diagram
Return a Promise that resolves with the file at a given path in storage(or null).
Get information about the currently logged in user. This information varies from subclass to subclass. For more info, see:
Returns a Promise that resolves with information about the currently logged in user
Hide the ui element associated with this instance of GoCloudStorage. Used in some UI element onclicks.
If action (save, delete, load) is canceled, resolve Promise (returned previously in showUI) with a 'Canceled' notification. Default value is false.
Load diagram model data from a given cloud storage-specific file path into managedDiagrams.
A valid filepath. What is meant by this varies from subclass to subclass. Rules for valid filepaths by subclass:
example.diagram
/{path-to-file}/{filename}
; i.e. /Public/example.diagram
/drive/root:/{path-to-file}/{filename}
; i.e. /drive/root:/Documents/example.diagram
Returns a Promise that resolves with a DiagramFile
Load diagram model data from cloud storage into managedDiagrams using the ui for this class.
Returns a Promise that resolves with a DiagramFile representing the loaded file
Remove a file containing diagram model data at a given cloud storage-specific file path.
A valid filepath. What is meant by this varies from subclass to subclass. Rules for valid filepaths by subclass:
example.diagram
/{path-to-file}/{filename}
; i.e. /Public/example.diagram
/drive/root:/{path-to-file}/{filename}
; i.e. /drive/root:/Documents/example.diagram
Returns a Promise that resolves with a DiagramFile representing the deleted file.
Remove a given diagram from cloud storage using the ui for this class.
Returns a Promise that resolves with a DiagramFile representing the deleted file
Save managedDiagrams' model data to storage. If path is supplied save to that path. If no path is supplied but currentDiagramFile has non-null, valid properties, update saved diagram file content at the path in storage corresponding to currentDiagramFile.path with current managedDiagrams' model data.
Rules for valid filepaths by subclass:
example.diagram
/{path-to-file}/{filename}
; i.e. /Public/example.diagram
/drive/root:/{path-to-file}/{filename}
; i.e. /drive/root:/Documents/example.diagram
Returns a Promise that resolves with a DiagramFile representing the saved file
Save the current diagram's model data to cloud storage with the ui for this class.
Returns a Promise that resolves with a DiagramFile representing the saved file.
Show the ui element associated with this instance of GoCloudStorage.
Clarify what action is being done after file selection. Acceptable values: Save, Delete, Load
Returns a Promise that resolves (in save, load, or remove with an DiagramFile representing the saved/loaded/deleted file
An abstract class for storing GoJS Models in various cloud storage services.
GoCloudStorage is never used on its own. Its subclasses can be used to manage diagram model storage programatically, or any subset of GoCloudStorage subclasses can be bundled and used graphically with the GoCloudStorageManager.
Note: With the exception of GoLocalStorage, all GoCloudStorage subclasses must be used in pages served on a web server.