_initImagesData: function()

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


        _initImagesData: function () {
            var self = this,
                rawImagesData = this.$imagesDataElem.val() || '[]',
                imagesData;

            try {
                imagesData = JSON.parse(rawImagesData);
            } catch (e) {
                imagesData = [];
                BS.Log.error('Bad images data: ' + rawImagesData);
            }
            this.imagesData = imagesData.reduce(function (accumulator, imageDataStr) {
                // drop images without sourceVmName
                if (imageDataStr.sourceVmName) {
                    accumulator[self._lastImageId++] = imageDataStr;
                    self._imagesDataLength++;
                }

                return accumulator;
            }, {});
            this.fetchOptionsDeferred && this.fetchOptionsDeferred.done(function () {
                Object.keys(this.imagesData).forEach(function (i, key) {
                    this.imagesData[key].$image = this._getSourceByName(this.imagesData[key].sourceVmName);
                }.bind(this))
            }.bind(this));
        },