Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Portal.prototype.saveApp = function (options) {
const dfd = new Deferred();
const appState = lang.getObject('items.app',false,AppStore.getState());
const defaults = appState;
const settings = $.extend(true, {}, defaults, options);
const username = this.getPortalUser().username;
const baseRequestPath = this.portalUrl.stripTrailingSlash() + '/content/users/' + (settings.item.owner ? settings.item.owner : username) + (settings.item.ownerFolder ? ('/' + settings.item.ownerFolder) : '');
// Remove properties that don't have to be committed
delete settings.item.avgRating;
delete settings.item.modified;
delete settings.item.numComments;
delete settings.item.numRatings;
delete settings.item.numViews;
delete settings.item.size;
delete settings.item.serviceProxyParams;
// TODO add serviceproxyparams
}).then((res) => {
if (res.id && res.id === settings.id) {
response.item = res;
if (settings.deferredResponseOnly) {
deferred.resolve(response);
} else if (settings.item === 'app' && response.data.values.settings) {
crowdsourceVersionUpdate(response);
} else if (settings.item === 'app') {
ArcgisActions.receiveScratchCreationAppItem(response);
} else if (settings.item === 'webmap') {
if (lang.getObject('mode.fromScratch',false,AppStore.getState()) && lang.getObject('app.portal.user.username',false,AppStore.getState()) !== res.owner) {
// If owned by another user, remove id information so app will create a copy of the original webmap in author's content
$.extend(true,response.item,{
id: '',
extent: res.extent.toString(),
orgId: '',
owner: '',
ownerFolder: ''
});
ArcgisActions.receiveWebmapItem(response);
displayDifferentWebmapOwnerMessage();
} else {
$.extend(true,response.item,{
extent: res.extent.toString()
});
ArcgisActions.receiveWebmapItem(response);
}
updateAppState() {
this.appState = AppStore.getState();
this.updateVisibleComponents();
}
export const previousFeature = function () {
const appState = AppStore.getState();
const oidField = lang.getObject('app.map.layer.objectIdField',false,appState);
const currentId = lang.getObject('app.map.selectedFeatureId',false,appState);
const featuresInExtent = lang.getObject('app.map.featuresInExtent',false,appState);
let currentIndex;
featuresInExtent.forEach((current,index) => {
if (current.attributes[oidField] === currentId) {
currentIndex = index;
}
});
let id = currentId;
if (currentIndex === 0) {
id = featuresInExtent[featuresInExtent.length - 1].attributes[oidField];
} else if (currentIndex) {
updateAppState() {
this.appState = AppStore.getState();
this.checkContributeView();
this.saveGraphic();
}
updateAppState() {
if (this.enabled) {
this.appState = AppStore.getState();
this.updateAppView();
this.checkOverlayComponentVisibility();
}
}
Portal.prototype.shareItems = function (options) {
const dfd = new Deferred();
const appState = AppStore.getState();
const defaults = {
appState,
everyone: false,
org: false
};
const settings = $.extend(true, {}, defaults, options);
const username = this.getPortalUser().username;
const url = this.portalUrl.stripTrailingSlash() + '/content/users/' + (lang.getObject('appState.items.app.item.owner',false,settings) ? lang.getObject('appState.items.app.item.owner',false,settings) : username) + '/shareItems';
const appId = lang.getObject('appState.items.app.item.id',false,settings);
const webmapId = lang.getObject('appState.items.webmap.item.id',false,settings);
const layers = [].concat(lang.getObject('appState.items.webmap.data.operationalLayers',false,settings)).concat(lang.getObject('appState.items.webmap.data.baseMap.baseMapLayers',false,settings));
let layerIds = [];
layers.forEach((layer) => {
updateAppState() {
this.appState = AppStore.getState();
this.updatePageTitle();
if (!this.environmentConfigured && lang.getObject('appState.config.sharingurl',false,this)) {
this.environmentConfigured = true;
EnvironmentConfig.configSharingUrl(lang.getObject('appState.config.sharingurl',false,this));
}
}
updateAppState() {
this.appState = AppStore.getState();
this.editReviewedFeatures();
}