fetchSnapshots: function()

in cloud-vmware-server/src/main/resources/buildServerResources/vmware-settings.js [270:307]


        fetchSnapshots: function () {
            var _image = this.$image.val();

            if (! _image || this._fetchSnapshotsInProgress()) {
                return false;
            }

            $j('#realImageInput').val(_image);
            this.fetchSnapshotsDeferred = $j.Deferred()
                .done(function (response) {
                    var $response = $j(response.responseXML);

                    this._toggleDialogSubmitButton(true);

                    if ($response.length) {
                        this._displaySnapshotSelect($response.find('Snapshots:eq(0) Snapshot'));
                    }
                    this._toggleLoadingMessage('fetchSnapshots');

                    return response;
                }.bind(this))
                .fail(function (response) {
                    BS.Log.error(response);
                });
            this._toggleLoadingMessage('fetchSnapshots', true);
            if (this._isClone()) {
                this._toggleDialogSubmitButton();
            }
            BS.ajaxRequest(this.refreshSnapshotsUrl, {
                parameters: BS.Clouds.Admin.CreateProfileForm.serializeParameters(),
                onFailure: function (response) {
                    this.fetchSnapshotsDeferred.reject(response);
                },
                onSuccess: function (response) {
                    this.fetchSnapshotsDeferred.resolve(response);
                }.bind(this)
            });
        },