From ee8d8e184adde57fe9b93de0425c6ff7176718b7 Mon Sep 17 00:00:00 2001 From: Andrew Tate Date: Tue, 1 Sep 2020 11:19:16 -0500 Subject: [PATCH] fix(updateSite): updateSite no longer attempts to remove unused resources AFFECTS PACKAGES: @esri/hub-sites --- .../src/layout/remove-unused-resources.ts | 4 ++++ packages/sites/src/update-site.ts | 12 ------------ packages/sites/test/update-site.test.ts | 18 ------------------ 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/packages/sites/src/layout/remove-unused-resources.ts b/packages/sites/src/layout/remove-unused-resources.ts index 54ee1f4ebcb..3c38459e9c4 100644 --- a/packages/sites/src/layout/remove-unused-resources.ts +++ b/packages/sites/src/layout/remove-unused-resources.ts @@ -8,6 +8,10 @@ import { getItemResources, removeItemResource } from "@esri/arcgis-rest-portal"; import { _getImageCropIdsFromLayout } from "./_get-image-crop-ids-from-layout"; import { ILayout, IEntry } from "./types"; +/** + * THIS UTIL IS NO LONGER IN USE BUT MAY BE IN THE FUTURE - TATE + */ + /** * Removes any image "crop" versions that are no longer * used in the site layout. diff --git a/packages/sites/src/update-site.ts b/packages/sites/src/update-site.ts index 311b9859fb4..7c41b003949 100644 --- a/packages/sites/src/update-site.ts +++ b/packages/sites/src/update-site.ts @@ -10,7 +10,6 @@ import { import { SITE_UI_VERSION } from "./site-ui-version"; import { _ensurePortalDomainKeyword } from "./_ensure-portal-domain-keyword"; import { updateItem, IUpdateItemResponse } from "@esri/arcgis-rest-portal"; -import { removeUnusedResources } from "./layout"; /** * Update an existing site item @@ -86,17 +85,6 @@ export function updateSite( params: { clearEmptyFields: true } }); }) - .then(updateResponse => { - // clean up un-used crop images. The internals of this are failSafed as it's not critical - // and we return the udpateResponse object from the previous step - return removeUnusedResources( - model.item.id, - model.data.values.layout, - hubRequestOptions - ).then(_ => { - return updateResponse; - }); - }) .catch(err => { throw Error(`updateSite: Error updating site: ${err}`); }); diff --git a/packages/sites/test/update-site.test.ts b/packages/sites/test/update-site.test.ts index 70a6a81f580..7166fa76490 100644 --- a/packages/sites/test/update-site.test.ts +++ b/packages/sites/test/update-site.test.ts @@ -7,7 +7,6 @@ import * as portalModule from "@esri/arcgis-rest-portal"; describe("update site", function() { let getModelSpy: jasmine.Spy; let updateSpy: jasmine.Spy; - let removeResourcesSpy: jasmine.Spy; beforeEach(() => { getModelSpy = spyOn(commonModule, "getModel").and.returnValue( @@ -20,11 +19,6 @@ describe("update site", function() { updateSpy = spyOn(portalModule, "updateItem").and.returnValue( Promise.resolve({ success: true, id: "3ef" }) ); - - removeResourcesSpy = spyOn( - layoutModule, - "removeUnusedResources" - ).and.returnValue(Promise.resolve()); }); it("ago with allowList and resources to remove", async function() { @@ -63,12 +57,6 @@ describe("update site", function() { expect(updateItem.properties.newProp).toBe( localSite.item.properties.newProp ); - - const resourcesArgs = removeResourcesSpy.calls.argsFor(0); - expect([resourcesArgs[0], resourcesArgs[2]]).toEqual([ - localSite.item.id, - ro - ]); }); it("ago without allowList or resources to remove", async function() { @@ -108,12 +96,6 @@ describe("update site", function() { expect(updateItem.properties.newProp).toBe( localSite.item.properties.newProp ); - - const resourcesArgs = removeResourcesSpy.calls.argsFor(0); - expect([resourcesArgs[0], resourcesArgs[2]]).toEqual([ - localSite.item.id, - ro - ]); }); it("portal", async function() {