Esri / ago-assistant

A swiss army knife for your ArcGIS Online and Portal for ArcGIS accounts
https://ago-assistant.esri.com/
Apache License 2.0
152 stars 89 forks source link

Can't copy content #110

Closed henry296 closed 8 years ago

henry296 commented 8 years ago

I'm trying to copy content from one folder to another in my account. I can see the content in AGO Assistant in white in the new folder, but it doesn't appear in my AGO account. I did notice that the file never turns green when I try to drop it in the dotted box.

nheminger commented 8 years ago

@henry296 That's unexpected. Do you see any errors in your web browser's console?

henry296 commented 8 years ago

I see the following error:

Script5007: Unable to get property ‘description’ of undefined or null reference. Main.js, line 2 character 15603

This is using Internet Explorer.

[cid:image001.jpg@01CEB48E.2B0533C0]http://www.dickssportinggoods.com/home/index.jsp

Todd Henry Sr Technical Manager, Real Estate Market Research 345 Court Street l Coraopolis, PA 15108 todd.henry@dcsg.commailto:todd.henry@dcsg.com l o: 724.273.4026 l m: 412.522.3269

[cid:image002.png@01CEB48E.2B0533C0]http://www.facebook.com/dickssportinggoods[cid:image003.jpg@01CEB48E.2B0533C0]https://twitter.com/DICKS

From: nheminger [mailto:notifications@github.com] Sent: Monday, November 30, 2015 4:43 PM To: Esri/ago-assistant Cc: Henry, Todd Subject: Re: [ago-assistant] Can't copy content (#110)

@henry296https://github.com/henry296 That's unexpected. Do you see any errors in your web browser's console?

— Reply to this email directly or view it on GitHubhttps://github.com/Esri/ago-assistant/issues/110#issuecomment-160771005.

The information contained in this message and any attachments (collectively, the "Transmission") from Dick's Sporting Goods, Inc. or one of its subsidiaries contains confidential information and is intended solely for the named recipient(s). If you are not a named recipient, you are prohibited from copying, distributing or using this Transmission. Please contact the sender immediately by returning the e-mail and deleting the original Transmission.

nheminger commented 8 years ago

@henry296 Okay, thanks. Does the debugger highlight a certain line of text? Can you attach a screenshot?

henry296 commented 8 years ago

Here is the screenshot:

[cid:image001.png@01D12B8F.C6CC23C0]

From: nheminger [mailto:notifications@github.com] Sent: Monday, November 30, 2015 4:53 PM To: Esri/ago-assistant Cc: Henry, Todd Subject: Re: [ago-assistant] Can't copy content (#110)

@henry296https://github.com/henry296 Okay, thanks. Does the debugger highlight a certain line of text? Can you attach a screenshot?

— Reply to this email directly or view it on GitHubhttps://github.com/Esri/ago-assistant/issues/110#issuecomment-160773294.

The information contained in this message and any attachments (collectively, the "Transmission") from Dick's Sporting Goods, Inc. or one of its subsidiaries contains confidential information and is intended solely for the named recipient(s). If you are not a named recipient, you are prohibited from copying, distributing or using this Transmission. Please contact the sender immediately by returning the e-mail and deleting the original Transmission.

nheminger commented 8 years ago

@henry296 Unfortunately that screenshot got removed by github. Can you login to github and do a "reply" and paste in the screenshot there?

henry296 commented 8 years ago

Please let me know if you can see this screenshot: copy_error

nheminger commented 8 years ago

@henry296 Yes, that came through thanks. Can you click on the "main.js line 2 character 1506" line and then screenshot where it takes you? I I am trying to narrow down what line of the code may be breaking.

ecaldwell commented 8 years ago

@henry296 Are you able to test with a different browser like Chrome or Firefox? This app does not like IE. :smile:

henry296 commented 8 years ago

What was displayed is too big to screenshot, but here is the code that appeared.

/! ago-assistant 2.2.5 / require(["jquery","portal/portal","portal/info","portal/util","mustache","nprogress","esri/arcgis/Portal","esri/arcgis/OAuthInfo","esri/IdentityManager","highlight","jquery.ui","bootstrap-shim"],function(a,b,c,d,e,f,g,h,i,j){var k=new h({appId:"4E1s0Mv5r0c2l6W8",popup:!0,portalUrl:"https://www.arcgis.com/"}),l={stats:{activities:{}},portals:{arcgisOnline:new b.Portal({portalUrl:"https://www.arcgis.com/"})}},m=function(b,c){"use strict";var e=a.trim(a(b).val());d.fixUrl(e).done(function(d){a(b).val(d);var e=a("#urlErrorTemplate").html(),f=a(b).parent().parent().find("input[type='checkbox']");a(b).parent().removeClass("has-error"),a(b).next().removeClass("glyphicon-ok"),c.portalUrl=d,c.version().done(function(c){console.log("API v"+c.currentVersion),a(".alert-danger.alert-dismissable").remove(),a(b).next().addClass("glyphicon-ok")}).fail(function(){c.withCredentials=!0,c.version().done(function(c){console.log("API v"+c.currentVersion),a(".alert-danger.alert-dismissable").remove(),a(b).next().addClass("glyphicon-ok"),a(f).trigger("click")}).fail(function(){c.jsonp=!0,c.version().done(function(d){c.jsonp=!1,console.log("API v"+d.currentVersion),a(".alert-danger.alert-dismissable").remove(),a(b).next().addClass("glyphicon-ok")}).fail(function(d,f){console.log(d,f),c.withCredentials=!1,c.jsonp=!1,a(".alert-danger.alert-dismissable").remove(),a(b).parent().parent().after(e),a(b).parent().addClass("has-error")})})})})},n=function(){"use strict";var b;l.portals.sourcePortal.self().done(function(c){var d=a("#sessionTemplate").html(),g=e.to_html(d,c);l.portals.sourcePortal.username=c.user.username,l.portals.sourcePortal.portalUrl="https://"+c.portalHostname+"/",a(".nav.navbar-nav").after(g),a("#logout").show(),a("#actionDropdown").css({visibility:"visible"}),b=e.to_html(a("#searchTemplate").html(),{portal:l.portals.sourcePortal.portalUrl,name:c.name,id:c.id}),a("#actionDropdown").before(b),l.portals.sourcePortal.userProfile(c.user.username).done(function(a){var b;b=l.portals.sourcePortal.portalUrl.indexOf("arcgis.com")>-1?"ArcGIS Online":"Portal for ArcGIS",ga("send","event","portals",b,c.name),ga("send","event","Sources",b,a.role)}),a(document).on("click","i.glyphicon-search",function(){r()}),a("#searchForm").keypress(function(a){13==a.which&&r()}),f.start(),H(),f.done()})},o=function(){var b=a("#portalUsername").val(),c=a("#portalPassword").val();a("#portalLoginBtn").button("loading"),l.portals.sourcePortal.generateToken(b,c).done(function(b){if(b.token)l.portals.sourcePortal.token=b.token,a("#portalLoginModal").modal("hide"),a("#splashContainer").css("display","none"),a("#itemsContainer").css("display","block"),n();else if(400===b.error.code){var c=a("#loginErrorTemplate").html();a(".alert-danger.alert-dismissable").remove(),a("#portalLoginForm").before(c)}}).fail(function(b){console.log(b.statusText);var c=a("#loginErrorTemplate").html();a(".alert-danger.alert-dismissable").remove(),a("#portalLoginForm").before(c)}).always(function(){a("#portalLoginBtn").button("reset")})},p=function(){var c=a("#destinationUsername").val(),d=a("#destinationPassword").val(),e=a("#destinationUrl").val();l.portals.destinationPortal||(l.portals.destinationPortal=new b.Portal({portalUrl:e})),a("#destinationLoginBtn").button("loading"),a("#dropArea").empty(),l.portals.destinationPortal.generateToken(c,d).done(function(b){if(b.token)l.portals.destinationPortal.token=b.token,l.portals.destinationPortal.self().done(function(b){l.portals.destinationPortal.username=b.user.username,l.portals.destinationPortal.portalUrl="https://"+b.portalHostname+"/";var c;c=l.portals.destinationPortal.portalUrl.indexOf("arcgis.com")>-1?"ArcGIS Online":"Portal for ArcGIS",ga("send","event","Destinations",c),ga("send","event","destination_portals",c,b.name),a("#copyModal").modal("hide"),D(),f.start(),I(),f.done()});else if(400===b.error.code){var c=a("#loginErrorTemplate").html();a(".alert-danger.alert-dismissable").remove(),a("#destinationLoginForm").before(c)}}).fail(function(b){console.log(b.statusText);var c=a("#loginErrorTemplate").html();a(".alert-danger.alert-dismissable").remove(),a("#destinationLoginForm").before(c)}).always(function(){a("#destinationLoginBtn").button("reset")})},q=function(){sessionStorage.clear(),l.stats.activities={},a("#actionDropdown li").removeClass("active"),a("#itemsArea").empty(),a("#dropArea").empty(),a("#sessionDropdown").remove(),a("#searchForm").remove(),a("#actionDropdown").css({visibility:"hidden"}),i.destroyCredentials(),delete l.portals.sourcePortal,delete l.portals.destinationPortal,window.location.reload()},r=function(){var b,c=a("#searchText").val(),d=a("#searchMenu li.active").attr("data-url");a("#searchMenu li.active").attr("data-id")&&(c+=" accountid:"+a("#searchMenu li.active").attr("data-id")),"Search My Content"===a("#searchMenu li.active").text()&&(c+=" owner:"+l.portals.sourcePortal.username),b="https://www.arcgis.com/"===d&&d!==l.portals.sourcePortal.portalUrl?l.portals.arcgisOnline:l.portals.sourcePortal,f.start(),b.search(c,100,"numViews","desc").done(function(a){G(b.portalUrl,a),f.done()})},s=function(){var b,c,d,g=function(a){try{var b=JSON.parse(a);if(b&&"object"==typeof b&&null!==b)return b}catch(c){}return!1},h=function(e){e.stopImmediatePropagation();var f=a(e.currentTarget).parent().next(),h=a(e.currentTarget),i=a(e.currentTarget).parent().children("[data-action='saveEdits']");i.children("span").attr("class","fa fa-lg fa-save"),"true"!==f.attr("contentEditable")?(h.children("span").attr("class","fa fa-lg fa-undo"),h.attr("data-toggle","tooltip"),h.attr("data-placement","bottom"),h.attr("title","Discard your edits"),h.tooltip(),c=f.text(),f.attr("contentEditable","true"),f.bind("input",function(){d=g(f.text()),i.tooltip("destroy"),d?(i.removeClass("disabled"),i.css("color","green"),i.attr("data-toggle","tooltip"),i.attr("data-placement","bottom"),i.attr("title","JSON is valid. Click to save.")):(i.css("color","red"),i.attr("data-toggle","tooltip"),i.attr("data-placement","bottom"),i.attr("title","JSON is invalid. Saving not allowed.")),i.tooltip({container:"body"})}),h.attr("class","btn btn-default"),i.attr("class","btn btn-default")):(f.attr("contentEditable","false"),f.text(c),f.each(function(a,b){j.highlightBlock(b)}),h.attr("class","btn btn-default"),h.children("span").attr("class","fa fa-lg fa-pencil"),h.tooltip("destroy"),i.attr("class","btn btn-default disabled"),i.css("color","black")),i.click(function(){if(d){var c=f.text(),e=JSON.parse(a("#descriptionJson").text());h.attr("class","btn btn-default"),h.children("span").attr("class","fa fa-lg fa-pencil"),i.attr("class","btn btn-default disabled"),i.css("color","black"),f.attr("contentEditable","false"),i.children("span").attr("class","fa fa-lg fa-spinner fa-spin");var g;g=e.ownerFolder?e.ownerFolder:"/","Description"===h.attr("data-container")?b.updateDescription(e.owner,e.id,g,c).done(function(a){a.success?(ga("send","event","Actions","Edited JSON","Edited Description"),i.children("span").attr("class","fa fa-lg fa-check"),i.css("color","green")):(i.children("span").attr("class","fa fa-lg fa-times"),i.css("color","red"))}):"Data"===h.attr("data-container")&&(i.children("span").attr("class","fa fa-lg fa-spinner fa-spin"),b.updateData(e.owner,e.id,g,c).done(function(a){a.success?(ga("send","event","Actions","Edited JSON","Edited Data"),i.children("span").attr("class","fa fa-lg fa-check"),i.css("color","green")):(i.children("span").attr("class","fa fa-lg fa-times"),i.css("color","red"))}))}else i.removeClass("active")})};a(".content").addClass("data-toggle"),a(".content").removeAttr("disabled"),a(".content").attr("data-toggle","button"),a(".content").addClass("btn-info"),a("#inspectModal").modal("hide"),a("#inspectBtn").button("reset"),a(".content").click(function(){var c,d=a(this).attr("data-portal"),g=a(this).attr("data-id"),i=a(this).text();ga("send","event","Actions","Inspected Content"),b="https://www.arcgis.com/"===d&&d!==l.portals.sourcePortal.portalUrl?l.portals.arcgisOnline:l.portals.sourcePortal,f.start(),a(".content").addClass("btn-info"),a(".content").removeClass("active"),a(".content").removeClass("btn-primary"),a(this).addClass("btn-primary"),a(this).removeClass("btn-info"),b.itemDescription(g).done(function(d){b.itemData(g).done(function(a){c=a}).always(function(){var k={title:i,url:b.portalUrl,id:g,description:JSON.stringify(d,void 0,2),data:JSON.stringify(c,void 0,2)};void 0===k.data&&-1===d.typeKeywords.indexOf("Service")&&(k.downloadLink=b.portalUrl+"sharing/rest/content/items/"+g+"/data?token="+b.token);var l=e.to_html(a("#inspectTemplate").html(),k);a("#dropArea").html(l),a("pre").each(function(a,b){j.highlightBlock(b)}),a(".btn-default[data-action='startEdits']").click(function(b){if(localStorage.hasOwnProperty("editsAllowed"))h(b);else{var c=a("#editJsonBtn");a("#editJsonModal").modal("show"),a(".acknowledgeRisk").click(function(b){a(b.currentTarget).prop("checked")?c.removeClass("disabled"):c.addClass("disabled")})}a("#editJsonBtn").click(function(){a("#editJsonModal").modal("hide"),localStorage.setItem("editsAllowed",!0),h(b)})}),f.done()})})})},t=function(){var b,c,d,f=a.merge(a(".content[data-type='Web Map']"),a(".content[data-type='Web Scene']")),g=l.portals.sourcePortal;f.addClass("data-toggle btn-info"),f.removeAttr("disabled"),f.attr("data-toggle","button"),a(".content").click(function(){var f=a(this).attr("data-id"),h=a(this).text();a(".content[data-type='Web Map']").addClass("btn-info"),a(".content").removeClass("active"),a(".content").removeClass("btn-primary"),a(this).addClass("btn-primary"),a(this).removeClass("btn-info"),g.itemDescription(f).done(function(a){c=a.owner,d=a.ownerFolder?a.ownerFolder:""}),g.itemData(f).done(function(f){b=JSON.stringify(f);var i=[];a.each(f.operationalLayers,function(a){f.operationalLayers[a].hasOwnProperty("url")&&i.push(f.operationalLayers[a])});var j=[];f.tables&&a.each(f.tables,function(a){f.tables[a].hasOwnProperty("url")&&j.push(f.tables[a])});var k=f.baseMap.title,l=[];a.each(f.baseMap.baseMapLayers,function(a){f.baseMap.baseMapLayers[a].hasOwnProperty("url")&&l.push(f.baseMap.baseMapLayers[a])});var m=a("#webmapServicesTemplate").html(),n={webmapTitle:h,operationalLayers:i,tables:j,basemapTitle:k,basemapLayers:l},o=e.to_html(m,n);a("#dropArea").html(o),a("#btnUpdateWebmapServices").click(function(){var f=a("[data-original]");a.each(f,function(c){var d=a(f[c]).attr("data-original"),e=a(f[c]).val();b=b.replace('"'+d+'"','"'+e+'"'),a(f[c]).val(e)});var h=a(".content.active.btn-primary").attr("data-id"),i=JSON.parse(b);g.updateWebmapData(c,d,h,i).done(function(b){var c;b.success?(a.each(f,function(b){a(f[b]).attr("data-original",a(f[b]).val())}),c=e.to_html(a("#updateSuccessTemplate").html()),a("#btnResetWebmapServices").before(c),ga("send","event","Actions","Updated web map services")):(400===b.error.code||403===b.error.code)&&(a("#btnResetWebmapServices").click(),c=e.to_html(a("#updateErrorTemplate").html(),b),a("#btnResetWebmapServices").before(c))})}),a("#btnResetWebmapServices").click(function(){var b=a("[data-original]");a.each(b,function(c){var d=a(b[c]).attr("data-original");a(b[c]).val(d)})})})})},u=function(){var b,c,d=a(".content[data-type='Feature Service'], .content[data-type='Map Service'], .content[data-type='Image Service'], .content[data-type='KML'], .content[data-type='WMS'], .content[data-type='Geodata Service'], .content[data-type='Globe Service'], .content[data-type='Geometry Service'], .content[data-type='Geocoding Service'], .content[data-type='Network Analysis Service'], .content[data-type='Geoprocessing Service'], .content[data-type='Web Mapping Application'], .content[data-type='Mobile Application'], .content[data-type='Scene Service']"),f=l.portals.sourcePortal;d.addClass("data-toggle btn-info"),d.removeAttr("disabled"),d.attr("data-toggle","button"),a(".content").click(function(){var g=a(this).attr("data-id");d.addClass("btn-info"),a(".content").removeClass("active"),a(".content").removeClass("btn-primary"),a(this).addClass("btn-primary"),a(this).removeClass("btn-info"),f.itemDescription(g).done(function(d){b=d.owner,c=d.ownerFolder?d.ownerFolder:"";var g=e.to_html(a("#itemContentTemplate").html(),d);a("#dropArea").html(g),a("#btnUpdateContentUrl").click(function(){var d=a(".content.active.btn-primary").attr("data-id"),g=a("[data-original]").val();f.updateUrl(b,c,d,g).done(function(b){var c;b.success?(a("[data-original]").attr("data-original",g),c=e.to_html(a("#updateSuccessTemplate").html()),a("#btnResetContentUrl").before(c),ga("send","event","Actions","Updated a registered URL")):(400===b.error.code||403===b.error.code)&&(a("#btnResetContentUrl").click(),c=e.to_html(a("#updateErrorTemplate").html(),b),a("#btnResetContentUrl").before(c))})}),a("#btnResetContentUrl").click(function(){var b=a("[data-original]").attr("data-original");a("[data-original]").val(b)})})})},v=function(){var b=l.portals.sourcePortal,c=function(a){require(["d3","cal-heatmap"],function(b,c){var d=new Date,e=new Date;e.setMonth(d.getMonth()-2),d.getMonth()<2&&e.setYear(d.getFullYear()-1);var f=new c;f.init({itemSelector:"#statsCalendar",domain:"month",subDomain:"day",data:a,start:e,cellSize:10,domainGutter:10,range:3,legend:[1,2,5,10],displayLegend:!1,tooltip:!0,itemNamespace:"cal",previousSelector:"#calPrev",nextSelector:"#calNext",domainLabelFormat:"%b '%y",subDomainTitleFormat:{empty:"No activity on {date}",filled:"Saved {count} {name} {connector} {date}"},domainDynamicDimension:!1})})};b.userProfile(b.username).done(function(d){var f,g=a("#statsTemplate").html();f=d.thumbnail?b.portalUrl+"sharing/rest/community/users/"+d.username+"/info/"+d.thumbnail+"?token="+b.token:"assets/images/no-user-thumb.jpg";var h={username:d.username,thumbnail:f},i=e.to_html(g,h);a("body").append(i),c(l.stats.activities),a("#statsModal").modal("show"),ga("send","event","Actions","Viewed stats");var j="owner:"+b.username;b.search(j,3,"numViews","desc").done(function(c){a.each(c.results,function(a){c.results[a].numViews=c.results[a].numViews.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),c.results[a].itemUrl=b.portalUrl+"home/item.html?id="+c.results[a].id});var d=a("#mostViewedContentTemplate").html();a("#mostViewedContent").html(e.to_html(d,{searchResults:c.results}))}),a("#statsModal").on("shown.bs.modal",function(){var b=a(".calContainer").height();a(".cal-heatmap-container").css("margin","auto"),a(".calArrow").css("margin-top",b-20+"px")}),a("#statsModal").on("hidden.bs.modal",function(){a("#statsModal").remove()})})},w=function(b){var c=new a.Deferred,d=a("#serviceName");return a("#serviceName").off("blur"),d.blur(function(){var f=d.val();b.self().then(function(g){b.checkServiceName(g.user.orgId,f,"Feature Service").then(function(b){if(b.available!==!0){var g=e.to_html(a("#serviceNameErrorTemplate").html(),{name:f});a(".alert-danger.alert-dismissable").remove(),d.parent().parent().after(g),d.parent().addClass("has-error"),d.next().removeClass("glyphicon-ok")}else f=d.val(),a(".alert-danger.alert-dismissable").remove(),d.parent().removeClass("has-error"),d.next().addClass("glyphicon-ok"),a("#btnCopyService").removeClass("disabled"),c.resolve(f)})})}),c.promise()},x=function(b,c){var d=e.to_html(a("#contentCopyErrorTemplate").html(),{id:b,message:c});a("#"+b+"_clone").before(d),ga("send","event","Actions","Deep Copied Feature Service",c)},y=function(b,c){var d,f=a("#"+b).attr("data-portal");d="https://www.arcgis.com/"===f&&f!==l.portals.sourcePortal.portalUrl?l.portals.arcgisOnline:l.portals.sourcePortal;var g=l.portals.destinationPortal,h=a.grep(d.items,function(a){return a.id===b}),i=h[0].description,j=d.portalUrl+"sharing/rest/content/items/"+b+"/info/"+i.thumbnail+"?token="+d.token;d.itemData(b).always(function(d){g.addItem(g.username,c,i,d,j).done(function(c){var d;if(c.success===!0)if(i.url.indexOf("id=")>-1){var f=i.url.substring(i.url.indexOf("/apps/"));f=f.replace("id="+i.id,"id="+c.id);var h=c.folder||"";g.updateUrl(g.username,h,c.id,f).done(function(){a("#"+b+"_clone").addClass("btn-success"),ga("send","event","Actions","Copied content",type)})}else a("#"+b+"_clone").addClass("btn-success"),ga("send","event","Actions","Copied content",type);else c.error&&(a("#"+b+"_clone").addClass("btn-danger"),d=e.to_html(a("#contentCopyErrorTemplate").html(),{id:b,message:c.error.message}),a("#"+b+"_clone").before(d))}).fail(function(){x(b,"Something went wrong.")})})},z=function(b,c){var e,f=a("#"+b).attr("data-portal");e="https://www.arcgis.com/"===f&&f!==l.portals.sourcePortal.portalUrl?l.portals.arcgisOnline:l.portals.sourcePortal;var g=l.portals.destinationPortal,h=a("#serviceName").val(),i=a.grep(e.items,function(a){return a.id===b}),j=i[0].description,k=i[0].serviceDescription,m=k.layers,n=a("#"+b+"_clone > span");a("#"+b+"_clone").text(h),a("#"+b+"_clone").prepend(n),k.name=h;var o=k;delete o.layers,g.createService(g.username,c,JSON.stringify(o)).then(function(f){var h=a("#"+b+"_clone");h.addClass("btn-info"),h.append(""),h.attr("data-id",f.itemId),h.attr("data-portal",g.portalUrl),f.serviceurl=d.upgradeUrl(f.serviceurl);var i=j.tags;i.push("source-"+j.id),g.updateDescription(g.username,f.itemId,c,JSON.stringify({tags:i})),e.serviceLayers(j.url).then(function(c){a.each(c.layers,function(a,b){b.adminLayerInfo={geometryField:{name:"Shape",srid:102100}}}),g.addToServiceDefinition(f.serviceurl,JSON.stringify(c)).then(function(d){if("error"in d){a("#"+b+"_clone > img").remove(),a("#"+b+"_clone").removeClass("btn-info"),a("#"+b+"_clone").addClass("btn-danger");var h=d.error.message;x(b,h)}else a.each(m,function(d,h){var i=h.id;e.layerRecordCount(j.url,i).then(function(d){for(var h=0,k=c.layers[i].maxRecordCount<1?1e3:c.layers[i].maxRecordCount,l=0,m=1;h<=d.count;)m++,e.harvestRecords(j.url,i,h).then(function(c){g.addFeatures(f.serviceurl,i,JSON.stringify(c.features)).then(function(){l+=k,l>=d.count&&(a("#"+b+"_clone > img").remove(),a("#"+b+"_clone").removeClass("btn-info"),a("#"+b+"_clone").addClass("btn-success"),ga("send","event","Actions","Deep Copied Feature Service","OK"))})}),h+=k})})}).fail(function(){a("#"+b+"_clone > img").remove(),a("#"+b+"_clone").removeClass("btn-info"),a("#"+b+"_clone").addClass("btn-danger");var c="Something went wrong.";x(b,c)})})})},A=function(b){var c,f=l.portals.destinationPortal,g=function(b,g){var h=a("#"+b).attr("data-type"),i=a("#"+b).attr("data-portal");if(c="https://www.arcgis.com/"===i&&i!==l.portals.sourcePortal.portalUrl?l.portals.arcgisOnline:l.portals.sourcePortal,F(h))c.itemDescription(b).done(function(e){switch(h){case"Feature Service":e.url=d.upgradeUrl(e.url),c.cacheItem(e),c.serviceDescription(e.url).done(function(d){var g=a.grep(c.items,function(a){return a.id===b}),h=e.name;null===h&&(h=e.title),a("#serviceName").val(h),g[0].serviceDescription=d,a("#btnCancelCopy").attr("data-id",e.id),a("#btnCopyService").attr("data-id",e.id),a("#deepCopyModal").modal("show"),a("#btnCopyService").removeClass("disabled"),w(f)});break;default:y(b,g)}});else{a("#"+b).addClass("btn-warning");var j=e.to_html(a("#contentTypeErrorTemplate").html(),{id:b,type:h});a("#"+b).before(j),a("#"+b+"_alert").fadeOut(6e3)}},h=function(b,c){"use strict";var d=a(b).attr("data-id"),e=a(b).clone();e.attr("id",d+"clone"),e.addClass("clone"),e.css("max-width",""),e.insertAfter(c.children(".dropArea")),e.removeClass("active btn-primary btn-info");var f=e.parent().attr("data-folder");g(d,f)};a("#dropFolder"+b).droppable({accept:".content",activeClass:"ui-state-hover",hoverClass:"ui-state-active",drop:function(b,c){h(c.draggable,a(this).parent().parent())}})},B=function(){a("#dropArea").empty(),a(".content").unbind("click"),a(".content").removeClass("active btn-primary btn-info ui-draggable"),a(".content").attr("disabled","disabled")},C=function(){a("#itemsArea").empty()},D=function(){var b=function(b){var c=a("#itemsArea .in").width()?a("#itemsArea .in").width():400;a(b).css("max-width",c)};a("#itemsArea .content").each(function(){var c=function(a){a.draggable({cancel:!1,helper:"clone",appendTo:"body",revert:!0,opacity:.7}),a.removeAttr("disabled")},d=a(this).attr("data-type");F(d)&&(a(this).addClass("btn-info"),b(this),c(a(this)))})},E=function(){switch(a("#actionDropdown li.active").attr("data-action")){case"copyContent":D();break;case"updateWebmapServices":B(),t();break;case"updateContentUrl":B(),u();break;case"inspectContent":B(),s()}},F=function(b){var c=["Web Map","Web Scene","Map Service","Image Service","Scene Service","WMS","Feature Collection","Feature Collection Template","Geodata Service","Globe Service","Geometry Service","Geocoding Service","Network Analysis Service","Geoprocessing Service","Web Mapping Application","Mobile Application","Operation View","Symbol Set","Color Set","Document Link","Feature Service"];return a.inArray(b,c)>-1?!0:void 0},G=function(b,d){"use strict";C();var f={title:"Search Results ("+d.query+")",id:"search",count:d.total},g=e.to_html(a("#folderTemplate").html(),f);a("#itemsArea").append(g),a.each(d.results,function(){var d={id:this.id,title:this.title,type:this.type,icon:c.items(this.type).icon,portal:b},f=e.to_html(a("#contentTemplate").html(),d);a("#collapse_search").append(f).addClass("in")}),E()},H=function(){"use strict";function b(a){var b=a/1e3;l.stats.activities[b]=1}function d(b){var c=b.children(".panel").get();c.sort(function(b,c){return a(b).children("div.panel-heading").attr("data-title").toUpperCase().localeCompare(a(c).children("div.panel-heading").attr("data-title").toUpperCase())}),a.each(c,function(a,c){b.append(c)}),b.prepend(a("[data-title='Root']").parent())}function f(b){var c=b.children("button").get();c.sort(function(b,c){return a(b).text().toUpperCase().localeCompare(a(c).text().toUpperCase())}),a.each(c,function(a,c){b.append(c)})}var g=l.portals.sourcePortal;B(),C(),g.userContent(g.username,"/").done(function(h){var i={title:"Root",id:"",count:h.items.length},j=e.to_html(a("#folderTemplate").html(),i);a("#itemsArea").append(j),a.each(h.items,function(d){var f={id:this.id,title:this.title,type:this.type,icon:c.items(this.type).icon,portal:g.portalUrl},i=e.tohtml(a("#contentTemplate").html(),f);a("#collapse").append(i),b(h.items[d].modified)}),f(a("#collapse_")),a.each(h.folders,function(i){d(a("#itemsArea")),g.userContent(g.username,h.folders[i].id).done(function(d){var h={title:d.currentFolder.title,id:d.currentFolder.id,count:d.items.length},i=e.to_html(a("#folderTemplate").html(),h);a("#itemsArea").append(i),a.each(d.items,function(f){var h={id:this.id,title:this.title,type:this.type,icon:c.items(this.type).icon,portal:g.portalUrl},i=e.tohtml(a("#contentTemplate").html(),h);a("#collapse"+d.currentFolder.id).append(i),b(d.items[f].modified)}),f(a("#collapse_"+d.currentFolder.id))})}),setTimeout(function(){d(a("#itemsArea")),E()},1e3)})},I=function(){"use strict";function b(b){var c=b.children("button").get();c.sort(function(b,c){return a(b).text().toUpperCase().localeCompare(a(c).text().toUpperCase())}),a.each(c,function(a,c){b.append(c)})}var d=l.portals.destinationPortal;d.userContent(d.username,"/").done(function(f){var g={title:"Root",id:"",count:f.items.length},h=e.to_html(a("#dropFolderTemplate").html(),g);a("#dropArea").append(h),a.each(f.items,function(){var b={id:this.id,title:this.title,type:this.type,icon:c.items(this.type).icon,portal:d.portalUrl},f=e.tohtml(a("#contentTemplate").html(),b);a("#collapseDest").append(f)}),b(a("#collapseDest_")),A(""),a.each(f.folders,function(g){d.userContent(d.username,f.folders[g].id).done(function(f){var g={title:f.currentFolder.title,id:f.currentFolder.id,count:f.items.length},h=a("#dropFolderTemplate").html(),i=e.to_html(h,g);a("#dropArea").append(i),a.each(f.items,function(){var b={id:this.id,title:this.title,type:this.type,icon:c.items(this.type).icon,portal:d.portalUrl},g=e.tohtml(a("#contentTemplate").html(),b);a("#collapseDest"+f.currentFolder.id).append(g)}),a("#collapseDest"+f.currentFolder.id).collapse("hide"),b(a("#collapseDest"+f.currentFolder.id)),A(f.currentFolder.id)})})})};a(document).ready(function(){a.get("templates.html",function(c){a("body").append(c),a(".jumbotron > p > [data-action='login']").removeAttr("disabled"),a("a.portal-signin").attr("href","#portalLoginModal"),i.registerOAuthInfos([k]),i.checkSignInStatus(k.portalUrl).then(function(c){a("#splashContainer").css("display","none"),a("#itemsContainer").css("display","block"),l.portals.sourcePortal=new b.Portal({portalUrl:c.server+"/",username:c.userId,token:c.token}),n()}).otherwise(function(){a("#itemsContainer").css("display","none"),a("#splashContainer").css("display","block")})});var c=function(){"use strict";a(".itemArea").height(a(window).height()-50)};c();var d=function(){"use strict";a("html").bind("keypress",function(b){return 13===b.keyCode&&"true"!==a(b.target).attr("contenteditable")?!1:void 0})};d(),a("#destinationAgolBtn").button("toggle"),a("#destinationAgolBtn").addClass("btn-primary"),a("#destinationUrl").css({display:"none"}),a("#destinationWebTierAuth").css({display:"none"}),a("#destinationAgolBtn").click(function(){a(".alert-danger.alert-dismissable").remove(),a("#destinationUrl").next().removeClass("glyphicon-ok"),a("#destinationUrl").parent().removeClass("has-error"),a("#destinationUrl").attr({placeholder:"",value:"https://www.arcgis.com/"}),a("#destinationUrl").val("https://www.arcgis.com/"),a("#destinationUrl").css({display:"none"}),a("#destinationWebTierAuth").css({display:"none"}),a("#destinationAgolBtn").addClass("btn-primary active"),a("#destinationPortalBtn").removeClass("btn-primary active"),l.portals.destinationPortal&&(l.portals.destinationPortal.portalUrl="https://www.arcgis.com/")}),a("#destinationPortalBtn").click(function(){a("#destinationUrl").attr({placeholder:"https://myportal.com/",value:""}),a("#destinationUrl").val(""),a("#destinationUrl").css({display:"block"}),a("#destinationWebTierAuth").css({display:"block"}),a("#destinationPortalBtn").addClass("btn-primary active"),a("#destinationAgolBtn").removeClass("btn-primary active")}),a(window).resize(function(){c()}),a("#portalUrl").blur(function(){l.portals.sourcePortal||(l.portals.sourcePortal=new b.Portal),setTimeout(function(){m("#portalUrl",l.portals.sourcePortal)},500)}),a("#destinationUrl").blur(function(){l.portals.destinationPortal||(l.portals.destinationPortal=new b.Portal),setTimeout(function(){a("#destinationPortalBtn").hasClass("active")&&m("#destinationUrl",l.portals.destinationPortal)},500)}),a("#sourceWebTierAuth").click(function(b){var c=a(b.currentTarget).prop("checked");c===!0?(a("#portalUsername").attr("disabled",!0),a("#portalPassword").attr("disabled",!0),a("#portalLoginBtn").text("Proceed"),l.portals.sourcePortal.withCredentials=!0):(a("#portalUsername").removeAttr("disabled"),a("#portalPassword").removeAttr("disabled"),a("#portalLoginBtn").text("Log in"),l.portals.sourcePortal.withCredentials=!1)}),a("#destWebTierAuthChk").click(function(b){var c=a(b.currentTarget).prop("checked");c===!0?(a("#destinationUsername").attr("disabled",!0),a("#destinationPassword").attr("disabled",!0),a("#destinationLoginBtn").text("Proceed"),l.portals.destinationPortal.withCredentials=!0):(a("#destinationUsername").removeAttr("disabled"),a("#destinationPassword").removeAttr("disabled"),a("#destinationLoginBtn").text("Log in"),l.portals.destinationPortal.withCredentials=!1)}),a("[data-action='login']").click(function(){i.getCredential(k.portalUrl,{oAuthPopupConfirmation:!1}).then(function(c){a("#splashContainer").css("display","none"),a("#itemsContainer").css("display","block"),l.portals.sourcePortal=new b.Portal({portalUrl:c.server+"/",username:c.userId,token:c.token}),n()})}),a("#portalLoginBtn").click(function(){o()}),a("[data-action='copyMyAccount']").click(function(){l.portals.destinationPortal=l.portals.sourcePortal,a("#copyModal").modal("hide"),D(),f.start(),I(),f.done()}),a("[data-action='copyOtherAccount']").click(function(){a("#destinationChoice").css("display","none"),a("#destinationForm").css("display","block")}),a("#destinationLoginBtn").click(function(){p()}),a("#destinationLoginBtn").click(function(){a("#destinationLoginBtn").button("reset")}),a("#destinationCancelBtn").click(function(){a("#actionDropdown li").removeClass("active")}),a("#destinationLoginForm").keypress(function(b){13==b.which&&a("#destinationLoginBtn").focus().click()}),a(document).on("click","#searchMenu li",function(b){var c=a(b.target).parent().attr("data-action");"viewMyContent"!==c?(a("#searchMenu li").removeClass("active"),a(b.target).parent().addClass("active"),a("#searchText").val()?r():a("#searchText").attr("placeholder",a(b.currentTarget).text())):(f.start(),H(),f.done())}),a(document).on("click","#btnSimpleCopy",function(){a("#serviceNameForm").hide(),a(".alert-danger.alert-dismissable").remove(),a("#btnCopyService").removeClass("disabled"),a("#btnSimpleCopy").addClass("btn-primary active"),a("#btnFullCopy").removeClass("btn-primary active"),a("#btnFullCopy").addClass("btn-default")}),a(document).on("click","#btnFullCopy",function(){a("#serviceNameForm").show(),a("#btnCopyService").addClass("disabled"),a("#btnFullCopy").addClass("btn-primary active"),a("#btnSimpleCopy").removeClass("btn-primary active"),a("#btnSimpleCopy").addClass("btn-default"),a("#serviceName").blur()}),a(document).on("click","#btnCancelCopy",function(b){var c=a(b.currentTarget).attr("data-id");a(".clone[data-id='"+c+"']").remove(),a("#btnCancelCopy").attr("data-id",""),a("#serviceName").attr("value",""),a("#btnSimpleCopy").click(),a("#deepCopyModal").modal("hide")}),a(document).on("click","#btnCopyService",function(b){var c=a(b.currentTarget).attr("data-id"),d=a(".clone[data-id='"+c+"']").parent().attr("data-folder"),e=a("#copySelector > .btn-primary").text();switch(e){case"Simple":y(c,d);break;case"Full":z(c,d)}a("#btnCancelCopy").attr("data-id",""),a("#serviceName").attr("value",""),a("#btnSimpleCopy").click(),a("#deepCopyModal").modal("hide")}),a(document).on("click","li [data-action]",function(b){var c=a(b.target).parent().attr("data-action");switch("stats"!==c&&(a("#actionDropdown li").removeClass("active"),a(b.target).parent().addClass("active")),c){case"inspectContent":B(),s();break;case"updateWebmapServices":B(),t();break;case"updateContentUrl":B(),u();break;case"stats":v();break;case"logout":q()}}),a("#copyModal").on("show.bs.modal",function(){B(),a("#destinationChoice").css("display","block"),a("#destinationForm").css("display","none")})})});

From: Henry, Todd Sent: Monday, November 30, 2015 4:54 PM To: 'Esri/ago-assistant'; Esri/ago-assistant Subject: RE: [ago-assistant] Can't copy content (#110)

Here is the screenshot:

[cid:image001.png@01D12B91.149F94F0]

From: nheminger [mailto:notifications@github.com] Sent: Monday, November 30, 2015 4:53 PM To: Esri/ago-assistant Cc: Henry, Todd Subject: Re: [ago-assistant] Can't copy content (#110)

@henry296https://github.com/henry296 Okay, thanks. Does the debugger highlight a certain line of text? Can you attach a screenshot?

— Reply to this email directly or view it on GitHubhttps://github.com/Esri/ago-assistant/issues/110#issuecomment-160773294.

The information contained in this message and any attachments (collectively, the "Transmission") from Dick's Sporting Goods, Inc. or one of its subsidiaries contains confidential information and is intended solely for the named recipient(s). If you are not a named recipient, you are prohibited from copying, distributing or using this Transmission. Please contact the sender immediately by returning the e-mail and deleting the original Transmission.

nheminger commented 8 years ago

@henry296 Yes as @ecaldwell wrote, trying it in Chrome or Firefox would be helpful and might give us a better error message.

Also, what OS are you using? If you are using a recent version of windows, try going to "Start" and then using the search bar to search for "Snipping Tool". Then you can do a screenshot snip of just the part of the code that is highlighted in red so that the screenshot isn't too large. That way I can tell which part of the code has the error.

henry296 commented 8 years ago

I enabled de-bugging and this section was highlighted.

I'm trying to run it on Chrome, but I can't seem to login with my enterprise account. I also have a request for Firefox, but that might take a couple of days to be installed by our IT department. capture

nheminger commented 8 years ago

@henry296 Great, I think that is enough information for now in order for me to investigate. Thanks!

ecaldwell commented 8 years ago

Are you trying to copy a Feature Service by chance? I patched a bug today (#109) where copying Feature Services would silently fail.

henry296 commented 8 years ago

No, I’m trying to copy a Web Map.

[cid:image001.jpg@01CEB48E.2B0533C0]http://www.dickssportinggoods.com/home/index.jsp

Todd Henry Sr Technical Manager, Real Estate Market Research 345 Court Street l Coraopolis, PA 15108 todd.henry@dcsg.commailto:todd.henry@dcsg.com l o: 724.273.4026 l m: 412.522.3269

[cid:image002.png@01CEB48E.2B0533C0]http://www.facebook.com/dickssportinggoods[cid:image003.jpg@01CEB48E.2B0533C0]https://twitter.com/DICKS

From: Evan Caldwell [mailto:notifications@github.com] Sent: Monday, November 30, 2015 5:32 PM To: Esri/ago-assistant Cc: Henry, Todd Subject: Re: [ago-assistant] Can't copy content (#110)

Are you trying to copy a Feature Service by chance? I patched a bug today (#109https://github.com/Esri/ago-assistant/pull/109) where copying Feature Services would silently fail.

— Reply to this email directly or view it on GitHubhttps://github.com/Esri/ago-assistant/issues/110#issuecomment-160782786.

The information contained in this message and any attachments (collectively, the "Transmission") from Dick's Sporting Goods, Inc. or one of its subsidiaries contains confidential information and is intended solely for the named recipient(s). If you are not a named recipient, you are prohibited from copying, distributing or using this Transmission. Please contact the sender immediately by returning the e-mail and deleting the original Transmission.

ecaldwell commented 8 years ago

I'm also curious about your workflow. You're just trying to duplicate a web map that you own (copy from one folder to another). You could open the web map in the web viewer, then save as to make a duplicate.

henry296 commented 8 years ago

Evan,

I always forgetting about doing a save as with my web map. The next step of my workflow is to update the service URLs so I’ve defaulted to AGO Assistant. Also, when I normally do this process, I’m migrating multiple items but for today, it is just the one item.

[cid:image001.jpg@01CEB48E.2B0533C0]http://www.dickssportinggoods.com/home/index.jsp

Todd Henry Sr Technical Manager, Real Estate Market Research 345 Court Street l Coraopolis, PA 15108 todd.henry@dcsg.commailto:todd.henry@dcsg.com l o: 724.273.4026 l m: 412.522.3269

[cid:image002.png@01CEB48E.2B0533C0]http://www.facebook.com/dickssportinggoods[cid:image003.jpg@01CEB48E.2B0533C0]https://twitter.com/DICKS

From: Evan Caldwell [mailto:notifications@github.com] Sent: Monday, November 30, 2015 5:37 PM To: Esri/ago-assistant Cc: Henry, Todd Subject: Re: [ago-assistant] Can't copy content (#110)

I'm also curious about your workflow. You're just trying to duplicate a web map that you own (copy from one folder to another). You could open the web map in the web viewer, then save as to make a duplicate.

— Reply to this email directly or view it on GitHubhttps://github.com/Esri/ago-assistant/issues/110#issuecomment-160783911.

The information contained in this message and any attachments (collectively, the "Transmission") from Dick's Sporting Goods, Inc. or one of its subsidiaries contains confidential information and is intended solely for the named recipient(s). If you are not a named recipient, you are prohibited from copying, distributing or using this Transmission. Please contact the sender immediately by returning the e-mail and deleting the original Transmission.

nheminger commented 8 years ago

@ecaldwell Could it be #4ba6890178a684d3fa826cea94a41c4cb2fd1f4e on line 1068 where the call to portal.cacheItem(description); is removed have something to do with the error?

ecaldwell commented 8 years ago

Definitely. It appears I introduced a new bug with #109. Working on a fix now.

ecaldwell commented 8 years ago

It's live now on the site, but you may need to clear your cache. GIve it a shot.

henry296 commented 8 years ago

Evan,

Thanks for the quick fix. I was able to copy the web map today.

[cid:image001.jpg@01CEB48E.2B0533C0]http://www.dickssportinggoods.com/home/index.jsp

Todd Henry Sr Technical Manager, Real Estate Market Research 345 Court Street l Coraopolis, PA 15108 todd.henry@dcsg.commailto:todd.henry@dcsg.com l o: 724.273.4026 l m: 412.522.3269

[cid:image002.png@01CEB48E.2B0533C0]http://www.facebook.com/dickssportinggoods[cid:image003.jpg@01CEB48E.2B0533C0]https://twitter.com/DICKS

From: Evan Caldwell [mailto:notifications@github.com] Sent: Monday, November 30, 2015 7:59 PM To: Esri/ago-assistant Cc: Henry, Todd Subject: Re: [ago-assistant] Can't copy content (#110)

It's live now on the site, but you may need to clear your cache. GIve it a shot.

— Reply to this email directly or view it on GitHubhttps://github.com/Esri/ago-assistant/issues/110#issuecomment-160812695.

The information contained in this message and any attachments (collectively, the "Transmission") from Dick's Sporting Goods, Inc. or one of its subsidiaries contains confidential information and is intended solely for the named recipient(s). If you are not a named recipient, you are prohibited from copying, distributing or using this Transmission. Please contact the sender immediately by returning the e-mail and deleting the original Transmission.

ecaldwell commented 8 years ago

Thanks for bringing it to my attention. I'll try to stop breaking existing features.