@arcgis/portal-components 5.2.0-next.147 → 5.2.0-next.149
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{ZAIRH5DL.js → 24PB4CMZ.js} +1 -1
- package/dist/cdn/{R3QN5WF2.js → 2QH66WX5.js} +1 -1
- package/dist/cdn/{4ZTWQN6Q.js → 33J7647P.js} +1 -1
- package/dist/cdn/{AE574B3G.js → 3D3X4POQ.js} +1 -1
- package/dist/cdn/{C5VUNN4M.js → 3SRD2O7D.js} +1 -1
- package/dist/cdn/{Y3YIMI2Z.js → 3WHDCXCM.js} +2 -2
- package/dist/cdn/{3R4PPD5N.js → 4NM7IXBT.js} +1 -1
- package/dist/cdn/{QSAZVVVL.js → 5GTO7PTH.js} +1 -1
- package/dist/cdn/{5FOWUL6I.js → 7EOHRU5A.js} +1 -1
- package/dist/cdn/{QUOPWSRC.js → 7G7MPSXD.js} +1 -1
- package/dist/cdn/7GHMHFBI.js +2 -0
- package/dist/cdn/{D6QHNXEH.js → A3MNR4AI.js} +1 -1
- package/dist/cdn/{LRHPL6B5.js → AOZUSTFQ.js} +1 -1
- package/dist/cdn/{DKIYHE4A.js → APVJI5AQ.js} +1 -1
- package/dist/cdn/{MCX22B23.js → AQBDDI5G.js} +1 -1
- package/dist/cdn/AYO4VV3K.js +2 -0
- package/dist/cdn/{LP4IB3PV.js → BLCHSMT7.js} +1 -1
- package/dist/cdn/{UQKT5JQZ.js → BQZ34JPU.js} +1 -1
- package/dist/cdn/{UKHCSMA4.js → BYWI4K4N.js} +1 -1
- package/dist/cdn/{WDMNL6PJ.js → D6SIWTME.js} +1 -1
- package/dist/cdn/EEGDBRHR.js +2 -0
- package/dist/cdn/{NXFE6R2N.js → EL6F7I65.js} +1 -1
- package/dist/cdn/{ZSILF72K.js → F575CWKZ.js} +1 -1
- package/dist/cdn/{6EY5GHKE.js → FAOIT32R.js} +1 -1
- package/dist/cdn/{M6BRGNH3.js → FORXD2BX.js} +1 -1
- package/dist/cdn/{2A4BYZOS.js → GQ72VSNC.js} +1 -1
- package/dist/cdn/{DF5GVVDW.js → HJE457T5.js} +1 -1
- package/dist/cdn/{MY7AYBBR.js → IFN5ZRZD.js} +1 -1
- package/dist/cdn/{G6WPLOLV.js → JDIMTYM2.js} +1 -1
- package/dist/cdn/JDUO5LCR.js +2 -0
- package/dist/cdn/JITIK4H7.js +2 -0
- package/dist/cdn/{AXNTYD46.js → JME5I4VO.js} +1 -1
- package/dist/cdn/{QKK6N2AN.js → K6PWSEML.js} +1 -1
- package/dist/cdn/LCQW3IG6.js +2 -0
- package/dist/cdn/MC3LJZSI.js +2 -0
- package/dist/cdn/{5FDUO7J4.js → MFJVE4UZ.js} +1 -1
- package/dist/cdn/{E3FQ4QWE.js → MSO7PIO4.js} +1 -1
- package/dist/cdn/{R57DISOR.js → NUEXG7VJ.js} +1 -1
- package/dist/cdn/NUQ72OYU.js +2 -0
- package/dist/cdn/{B4YHTYJB.js → OV4DNSQV.js} +1 -1
- package/dist/cdn/{47PU5HDG.js → PJGJZYBY.js} +1 -1
- package/dist/cdn/PRIG3TBV.js +2 -0
- package/dist/cdn/{ADSPENPN.js → Q6BRXAQD.js} +1 -1
- package/dist/cdn/QQ53FYON.js +2 -0
- package/dist/cdn/{XUPYBBRI.js → QU2JYXVL.js} +1 -1
- package/dist/cdn/{NDRCB2K3.js → QVMZCD3A.js} +1 -1
- package/dist/cdn/{GEZH4D32.js → R54T4WBW.js} +1 -1
- package/dist/cdn/{FFLIAQOL.js → REJN2DGR.js} +1 -1
- package/dist/cdn/{C5U7YKVI.js → RT6SXACX.js} +1 -1
- package/dist/cdn/{6MWSS5YF.js → RUTSKSEA.js} +1 -1
- package/dist/cdn/{2I5SLQC5.js → S5HIKMGQ.js} +1 -1
- package/dist/cdn/{BRJE3G3H.js → TAREB43U.js} +1 -1
- package/dist/cdn/{JUDF3TYJ.js → TMG43PBB.js} +1 -1
- package/dist/cdn/UBABQKPV.js +2 -0
- package/dist/cdn/{GTZ4LKEQ.js → V2OG75CK.js} +1 -1
- package/dist/cdn/{XNEYNX5G.js → V7GVZLEG.js} +1 -1
- package/dist/cdn/{MHNYLHFR.js → WDMKBY5P.js} +1 -1
- package/dist/cdn/WDUH4TEH.js +2 -0
- package/dist/cdn/{IXSEMBHA.js → WPZ5FJSC.js} +1 -1
- package/dist/cdn/{KOLH76KG.js → WXD774JG.js} +1 -1
- package/dist/cdn/{FSACXOM3.js → X4LJOMMF.js} +1 -1
- package/dist/cdn/{GH4VBEMN.js → XDSQPXSO.js} +1 -1
- package/dist/cdn/{ZHADFIZO.js → YEMT55I6.js} +1 -1
- package/dist/cdn/{KC4FTTKP.js → YGF6ENPU.js} +1 -1
- package/dist/cdn/{T2HQNZ36.js → YJS5PGLO.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/fieldAddDelete.js +1 -1
- package/dist/chunks/item.js +127 -33
- package/dist/chunks/item2.js +69 -126
- package/dist/chunks/portal-related-items-list-item.js +1 -1
- package/dist/chunks/query.js +10 -10
- package/dist/chunks/utils3.js +1 -1
- package/dist/components/arcgis-portal-add-gps-metadata/customElement.d.ts +6 -0
- package/dist/components/arcgis-portal-add-gps-metadata/customElement.js +10 -10
- package/dist/components/arcgis-portal-ai-assistant/customElement.js +1 -1
- package/dist/components/arcgis-portal-delete-items/customElement.js +344 -313
- package/dist/components/arcgis-portal-group-browser/customElement.js +8 -8
- package/dist/components/arcgis-portal-item-thumbnail/customElement.js +1 -1
- package/dist/components/arcgis-portal-mentionable-text-area/customElement.js +1 -1
- package/dist/components/arcgis-portal-navigation/customElement.js +1 -2
- package/dist/components/arcgis-portal-navigation/index.js +4 -4
- package/dist/components/arcgis-portal-replacement-item-redirect/customElement.js +1 -1
- package/dist/components/arcgis-portal-review-related-items/customElement.js +35 -20
- package/dist/components/portal-related-items-list-item/customElement.js +14 -14
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +1 -1
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/package.json +7 -7
- package/dist/cdn/3SO52LKS.js +0 -2
- package/dist/cdn/5EFYJYWM.js +0 -2
- package/dist/cdn/6CF3XEXH.js +0 -2
- package/dist/cdn/6EE4B3MI.js +0 -2
- package/dist/cdn/7NK6UF47.js +0 -2
- package/dist/cdn/7NTJF34Z.js +0 -2
- package/dist/cdn/EJN2JQOX.js +0 -2
- package/dist/cdn/P5SDWQYI.js +0 -2
- package/dist/cdn/QCOJMMT3.js +0 -2
- package/dist/cdn/QH7GBLDC.js +0 -2
- package/dist/cdn/QKBGX2OY.js +0 -2
- package/dist/cdn/RCCCE5IV.js +0 -2
- package/dist/cdn/T3RJKB2A.js +0 -2
- package/dist/chunks/functional.js +0 -9
- /package/dist/cdn/{TJYPEMON.js → VDOEP33G.js} +0 -0
|
@@ -1,142 +1,146 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
2
|
+
import { c as O } from "../../chunks/runtime.js";
|
|
3
3
|
import b from "@arcgis/core/portal/PortalItem.js";
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { css as
|
|
6
|
-
import
|
|
7
|
-
import { c as
|
|
8
|
-
import { r as
|
|
4
|
+
import { LitElement as E, createEvent as v, safeClassMap as $, nothing as F } from "@arcgis/lumina";
|
|
5
|
+
import { css as H, html as d } from "lit";
|
|
6
|
+
import w from "@arcgis/core/request.js";
|
|
7
|
+
import { c as N } from "../../chunks/item2.js";
|
|
8
|
+
import { r as S } from "../../chunks/request.js";
|
|
9
|
+
import { a as I } from "../../chunks/item.js";
|
|
9
10
|
import "../arcgis-portal-review-related-items/customElement.js";
|
|
10
|
-
import { f as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
11
|
+
import { f as R } from "../../chunks/portal-delete-items-review.js";
|
|
12
|
+
import { u as q } from "../../chunks/useT9n.js";
|
|
13
|
+
import { makeController as W } from "@arcgis/lumina/controllers";
|
|
14
|
+
import { a as j, e as B } from "../../chunks/portal.js";
|
|
15
|
+
import { g as z } from "../../chunks/items.js";
|
|
16
|
+
import { b as G } from "../../chunks/url.js";
|
|
17
|
+
async function C(i, t, e = !1) {
|
|
16
18
|
try {
|
|
17
19
|
const s = /* @__PURE__ */ new Map();
|
|
18
|
-
for (const
|
|
19
|
-
const { id:
|
|
20
|
-
|
|
20
|
+
for (const a of i) {
|
|
21
|
+
const { id: c, owner: l } = a, o = s.get(l) ?? [];
|
|
22
|
+
o.push(c), s.set(l, o);
|
|
21
23
|
}
|
|
22
24
|
const n = [];
|
|
23
|
-
for (const [
|
|
24
|
-
const
|
|
25
|
-
for (const
|
|
26
|
-
const m =
|
|
25
|
+
for (const [a, c] of s) {
|
|
26
|
+
const l = `${t.restUrl}/content/users/${encodeURIComponent(a)}/deleteItems`;
|
|
27
|
+
for (const o of N(c, 100)) {
|
|
28
|
+
const m = w(l, {
|
|
27
29
|
method: "post",
|
|
28
30
|
query: {
|
|
29
31
|
f: "json",
|
|
30
|
-
items:
|
|
31
|
-
permanentDelete:
|
|
32
|
+
items: o.join(","),
|
|
33
|
+
permanentDelete: e
|
|
32
34
|
}
|
|
33
35
|
});
|
|
34
36
|
n.push(m.then(({ data: h }) => h));
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
|
-
return { result: (await Promise.all(n)).flatMap(({ results:
|
|
39
|
+
return { result: (await Promise.all(n)).flatMap(({ results: a }) => a) };
|
|
38
40
|
} catch {
|
|
39
41
|
return { error: { code: "unhandledError" } };
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
async function
|
|
43
|
-
const { item:
|
|
44
|
+
async function x(i) {
|
|
45
|
+
const { item: t, portal: e, permanentlyDelete: s } = i, { id: n, owner: r } = t;
|
|
44
46
|
if (!n || !r)
|
|
45
47
|
return { error: { code: "unhandledError" } };
|
|
46
|
-
const
|
|
48
|
+
const a = e.recycleBinEnabled && !s ? "/canRecycle" : "/canDelete", c = `${e.restUrl}/content/users/${encodeURIComponent(r)}/items/${n}${a}`;
|
|
47
49
|
try {
|
|
48
|
-
return { result: (await
|
|
49
|
-
} catch (
|
|
50
|
-
const
|
|
51
|
-
switch (
|
|
50
|
+
return { result: (await w(c, { query: { f: "json" } })).data };
|
|
51
|
+
} catch (l) {
|
|
52
|
+
const o = l.details?.raw;
|
|
53
|
+
switch (o?.messageCode) {
|
|
52
54
|
case "CONT_00481":
|
|
53
55
|
case "CONT_00483":
|
|
54
56
|
case "CONT_00484":
|
|
55
57
|
return { error: { code: "itemHasDependentItems" } };
|
|
56
58
|
case "CONT_0048":
|
|
57
59
|
return { error: { code: "itemDeleteProtected" } };
|
|
60
|
+
case "CONT_0298":
|
|
61
|
+
return { error: { code: "itemNotSupportedInRecycleBin" } };
|
|
58
62
|
default:
|
|
59
|
-
return { error: { code: "unhandledError", message:
|
|
63
|
+
return { error: { code: "unhandledError", message: o?.message } };
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
|
-
async function
|
|
67
|
+
async function V(i, t) {
|
|
64
68
|
try {
|
|
65
|
-
const
|
|
66
|
-
return { result: (await
|
|
67
|
-
} catch (
|
|
68
|
-
return console.error(
|
|
69
|
+
const e = `${i.itemUrl}/setContentStatus`;
|
|
70
|
+
return { result: (await w(e, { query: { status: t ?? "", clearEmptyFields: !t, f: "json" }, method: "post" })).data };
|
|
71
|
+
} catch (e) {
|
|
72
|
+
return console.error(e), { error: { code: "unhandledError" } };
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
|
-
function
|
|
72
|
-
return (i.relatedItems ?? []).map((
|
|
75
|
+
function P(i, t) {
|
|
76
|
+
return (i.relatedItems ?? []).map((e) => K(e, t));
|
|
73
77
|
}
|
|
74
|
-
function
|
|
75
|
-
return i instanceof b ? i : new b({ ...i, portal:
|
|
78
|
+
function K(i, t) {
|
|
79
|
+
return i instanceof b ? i : new b({ ...i, portal: t });
|
|
76
80
|
}
|
|
77
|
-
async function
|
|
81
|
+
async function g({
|
|
78
82
|
itemId: i,
|
|
79
|
-
portal:
|
|
80
|
-
relationship:
|
|
83
|
+
portal: t,
|
|
84
|
+
relationship: e,
|
|
81
85
|
includeRecycleBin: s,
|
|
82
86
|
nextkey: n
|
|
83
87
|
}) {
|
|
84
|
-
const { relationshipType: r, direction:
|
|
88
|
+
const { relationshipType: r, direction: a } = e, c = `${t.restUrl}/content/items/${i}/relatedItems`;
|
|
85
89
|
try {
|
|
86
|
-
const
|
|
87
|
-
url:
|
|
88
|
-
portal:
|
|
90
|
+
const l = await S({
|
|
91
|
+
url: c,
|
|
92
|
+
portal: t,
|
|
89
93
|
params: {
|
|
90
94
|
includeRecycleBin: s,
|
|
91
95
|
f: "json",
|
|
92
96
|
relationshipType: r ? Array.isArray(r) ? r.join(",") : r : void 0,
|
|
93
|
-
direction:
|
|
97
|
+
direction: a,
|
|
94
98
|
nextkey: n
|
|
95
99
|
}
|
|
96
100
|
});
|
|
97
101
|
return {
|
|
98
102
|
success: !0,
|
|
99
|
-
result: { ...
|
|
103
|
+
result: { ...l, relatedItems: P(l, t) }
|
|
100
104
|
};
|
|
101
|
-
} catch (
|
|
102
|
-
return { success: !1, error:
|
|
105
|
+
} catch (l) {
|
|
106
|
+
return { success: !1, error: l };
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
|
-
async function
|
|
109
|
+
async function J({
|
|
106
110
|
itemId: i,
|
|
107
|
-
portal:
|
|
108
|
-
relationship:
|
|
111
|
+
portal: t,
|
|
112
|
+
relationship: e,
|
|
109
113
|
includeRecycleBin: s,
|
|
110
114
|
num: n,
|
|
111
115
|
nextkey: r
|
|
112
116
|
}) {
|
|
113
|
-
const { relationshipRules:
|
|
117
|
+
const { relationshipRules: a, direction: c } = e, l = `${t.restUrl}/content/items/${i}/relatedItems`;
|
|
114
118
|
try {
|
|
115
|
-
const
|
|
116
|
-
url:
|
|
117
|
-
portal:
|
|
119
|
+
const o = await S({
|
|
120
|
+
url: l,
|
|
121
|
+
portal: t,
|
|
118
122
|
params: {
|
|
119
123
|
includeRecycleBin: s,
|
|
120
124
|
f: "json",
|
|
121
|
-
...
|
|
125
|
+
...a?.length ? { relationshipRules: a.join(",") } : {},
|
|
122
126
|
includeSystemManaged: "true",
|
|
123
127
|
excludedFlags: "legacy,exclude",
|
|
124
128
|
num: n,
|
|
125
|
-
direction:
|
|
129
|
+
direction: c,
|
|
126
130
|
nextkey: r
|
|
127
131
|
}
|
|
128
132
|
});
|
|
129
133
|
return {
|
|
130
134
|
success: !0,
|
|
131
|
-
result: { ...
|
|
135
|
+
result: { ...o, relatedItems: P(o, t) }
|
|
132
136
|
};
|
|
133
|
-
} catch (
|
|
134
|
-
return { success: !1, error:
|
|
137
|
+
} catch (o) {
|
|
138
|
+
return { success: !1, error: o };
|
|
135
139
|
}
|
|
136
140
|
}
|
|
137
|
-
async function
|
|
138
|
-
const { id:
|
|
139
|
-
if (!
|
|
141
|
+
async function Q(i, t) {
|
|
142
|
+
const { id: e, type: s, typeKeywords: n = [] } = i;
|
|
143
|
+
if (!e)
|
|
140
144
|
return null;
|
|
141
145
|
const r = [
|
|
142
146
|
"Scene Service",
|
|
@@ -145,64 +149,64 @@ async function j(i, e) {
|
|
|
145
149
|
"OGCFeatureServer",
|
|
146
150
|
"Vector Tile Service",
|
|
147
151
|
"3DTiles Service"
|
|
148
|
-
].includes(s),
|
|
152
|
+
].includes(s), a = ["Map Service", "Vector Tile Service"].includes(s), c = (o) => o?.typeKeywords?.includes("View Service") ?? !1, l = () => r ? [
|
|
149
153
|
{ relationshipType: ["Service2Service"], direction: "reverse" },
|
|
150
154
|
{ relationshipType: ["Service2Data"], direction: "forward" }
|
|
151
155
|
] : n.includes("Bulk Published Service") ? { relationshipType: ["DataStore2BPService"], direction: "reverse" } : s === "Geoprocessing Service" && n.includes("Notebook Web Tool") ? { relationshipType: ["Notebook2WebTool"], direction: "reverse" } : n.includes("Route Layer") ? { relationshipType: ["Service2Route"], direction: "reverse" } : s === "Mobile Application" ? { relationshipType: ["MobileApp2Code"], direction: "reverse" } : s === "Map Package" ? { relationshipType: ["Area2Package"], direction: "reverse" } : s === "Feature Service" ? { relationshipType: ["Service2Layer"], direction: "reverse" } : n.includes("Document") ? { relationshipType: ["Item2Attachment"], direction: "reverse" } : s === "Application Configuration" ? { relationshipType: ["Map2AppConfig"], direction: "reverse" } : { relationshipType: ["Service2Data"], direction: "forward" };
|
|
152
156
|
try {
|
|
153
|
-
const
|
|
154
|
-
if (!
|
|
157
|
+
const o = l();
|
|
158
|
+
if (!o)
|
|
155
159
|
return null;
|
|
156
|
-
if (!Array.isArray(
|
|
160
|
+
if (!Array.isArray(o))
|
|
157
161
|
return {
|
|
158
|
-
sourceData: (await
|
|
159
|
-
itemId:
|
|
160
|
-
portal:
|
|
161
|
-
relationship:
|
|
162
|
+
sourceData: (await g({
|
|
163
|
+
itemId: e,
|
|
164
|
+
portal: t,
|
|
165
|
+
relationship: o
|
|
162
166
|
})).result?.relatedItems?.[0] ?? null,
|
|
163
|
-
relationship:
|
|
167
|
+
relationship: o
|
|
164
168
|
};
|
|
165
169
|
if (r) {
|
|
166
170
|
let m = { relationshipType: ["Service2Service"], direction: "reverse" };
|
|
167
|
-
const h = await
|
|
168
|
-
itemId:
|
|
169
|
-
portal:
|
|
171
|
+
const h = await g({
|
|
172
|
+
itemId: e,
|
|
173
|
+
portal: t,
|
|
170
174
|
relationship: m
|
|
171
175
|
}), u = h.result?.total ? h.result.relatedItems.shift() ?? null : null;
|
|
172
|
-
if (
|
|
176
|
+
if (a && !c(u) || !u) {
|
|
173
177
|
m = { relationshipType: ["Service2Data"], direction: "forward" };
|
|
174
|
-
const
|
|
175
|
-
itemId:
|
|
176
|
-
portal:
|
|
178
|
+
const y = await g({
|
|
179
|
+
itemId: e,
|
|
180
|
+
portal: t,
|
|
177
181
|
relationship: m
|
|
178
182
|
});
|
|
179
183
|
return {
|
|
180
|
-
sourceData:
|
|
184
|
+
sourceData: y.result?.total ? y.result.relatedItems.shift() ?? u : u,
|
|
181
185
|
relationship: m
|
|
182
186
|
};
|
|
183
187
|
}
|
|
184
188
|
return { sourceData: u, relationship: m };
|
|
185
189
|
}
|
|
186
190
|
return null;
|
|
187
|
-
} catch (
|
|
188
|
-
return console.error(
|
|
191
|
+
} catch (o) {
|
|
192
|
+
return console.error(o), { sourceData: null, relationship: { direction: "forward" } };
|
|
189
193
|
}
|
|
190
194
|
}
|
|
191
|
-
async function
|
|
192
|
-
const { id:
|
|
195
|
+
async function X(i, t) {
|
|
196
|
+
const { id: e, type: s, typeKeywords: n = [] } = i;
|
|
193
197
|
try {
|
|
194
|
-
const
|
|
195
|
-
itemId:
|
|
196
|
-
portal:
|
|
197
|
-
relationship:
|
|
198
|
+
const a = s === "Notebook" ? { relationshipType: ["Notebook2WebTool"], direction: "forward" } : n.includes("Has Related Route Layers") ? { relationshipType: ["Service2Route"], direction: "forward" } : n.includes("Hosted Service") || s === "Feature Service" ? { relationshipType: ["Service2Service"], direction: s === "Feed" ? "reverse" : "forward" } : s === "Data Store" || n.includes("ArcGIS Server") ? { relationshipType: ["DataStore2BPService"], direction: "forward" } : { relationshipType: ["Service2Data"], direction: "reverse" }, c = await g({
|
|
199
|
+
itemId: e,
|
|
200
|
+
portal: t,
|
|
201
|
+
relationship: a,
|
|
198
202
|
includeRecycleBin: !0
|
|
199
203
|
});
|
|
200
204
|
return {
|
|
201
205
|
resultData: {
|
|
202
|
-
items:
|
|
203
|
-
count:
|
|
206
|
+
items: c.result?.total ? c.result.relatedItems : null,
|
|
207
|
+
count: c.result?.total ?? 0
|
|
204
208
|
},
|
|
205
|
-
relationship:
|
|
209
|
+
relationship: a
|
|
206
210
|
};
|
|
207
211
|
} catch (r) {
|
|
208
212
|
return console.error(r), {
|
|
@@ -211,225 +215,243 @@ async function z(i, e) {
|
|
|
211
215
|
};
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
|
-
async function
|
|
215
|
-
const { id:
|
|
218
|
+
async function Y(i, t) {
|
|
219
|
+
const { id: e } = i;
|
|
216
220
|
try {
|
|
217
|
-
return (await
|
|
218
|
-
itemId:
|
|
219
|
-
portal:
|
|
221
|
+
return (await g({
|
|
222
|
+
itemId: e,
|
|
223
|
+
portal: t,
|
|
220
224
|
relationship: { relationshipType: ["ReplacementItem2Item"], direction: "forward" }
|
|
221
225
|
})).result?.relatedItems ?? [];
|
|
222
226
|
} catch (s) {
|
|
223
227
|
return console.error(s), [];
|
|
224
228
|
}
|
|
225
229
|
}
|
|
226
|
-
function
|
|
227
|
-
|
|
230
|
+
function Z({
|
|
231
|
+
recycleItems: i,
|
|
232
|
+
cannotDeleteItems: t,
|
|
233
|
+
permanentlyDeleteItems: e
|
|
234
|
+
}) {
|
|
235
|
+
return [...i, ...t, ...e];
|
|
236
|
+
}
|
|
237
|
+
function ee(i) {
|
|
238
|
+
return i.map(({ item: t, sourceData: e, resultData: s, replacementItemFor: n }) => ({
|
|
239
|
+
item: t,
|
|
240
|
+
sourceData: e,
|
|
241
|
+
resultData: s,
|
|
242
|
+
replacementItemFor: n
|
|
243
|
+
}));
|
|
244
|
+
}
|
|
245
|
+
function M(i, t, e) {
|
|
246
|
+
return !t && !!e?.length && !I(i);
|
|
247
|
+
}
|
|
248
|
+
function te({ item: i, sourceData: t, resultData: e }) {
|
|
249
|
+
return !e?.some((s) => !s.inRecycleBin) || M(i, t, e) ? !1 : !U(i, e) && !L(i, e);
|
|
250
|
+
}
|
|
251
|
+
function se({
|
|
252
|
+
selectedItems: i
|
|
253
|
+
}) {
|
|
254
|
+
const t = [];
|
|
255
|
+
return t.push(
|
|
256
|
+
...i.flatMap(({ item: e, sourceData: s, resultData: n, replacementItemFor: r }) => {
|
|
257
|
+
const a = M(e, s, n), c = !!(n?.some((l) => !l.inRecycleBin) && !U(e, n) && !L(e, n));
|
|
258
|
+
return a && c ? [{ item: e, reason: "dependent", offendingItems: n ?? void 0 }] : r && r?.length > 0 ? [{ item: e, reason: "replacement", offendingItems: r }] : [];
|
|
259
|
+
})
|
|
260
|
+
), t;
|
|
228
261
|
}
|
|
229
|
-
function
|
|
262
|
+
function U(i, t) {
|
|
263
|
+
const e = t[0];
|
|
264
|
+
return i.type === "Feed" && I(i) && t.length === 1 && e?.type === "Feature Service" && I(e);
|
|
265
|
+
}
|
|
266
|
+
function L(i, t) {
|
|
267
|
+
const e = t[0];
|
|
268
|
+
return i.type === "Feature Service" && I(i) && t.length === 1 && e?.type === "Feed" && I(e);
|
|
269
|
+
}
|
|
270
|
+
function k(i) {
|
|
271
|
+
return i ? i.filter((t) => t.type !== "Code Attachment") : null;
|
|
272
|
+
}
|
|
273
|
+
function _(i) {
|
|
230
274
|
return !!(i && "inRecycleBin" in i && i.inRecycleBin === !0);
|
|
231
275
|
}
|
|
232
276
|
function p(i) {
|
|
233
277
|
return i.updatedStatus ?? i.kind;
|
|
234
278
|
}
|
|
235
|
-
function
|
|
279
|
+
function D(i) {
|
|
236
280
|
return { ...i, originalStatus: i.originalStatus ?? i.kind };
|
|
237
281
|
}
|
|
238
|
-
function
|
|
282
|
+
function ie(i, t) {
|
|
239
283
|
return {
|
|
240
284
|
...i,
|
|
241
|
-
kind:
|
|
285
|
+
kind: t,
|
|
242
286
|
originalStatus: i.originalStatus ?? i.kind
|
|
243
287
|
};
|
|
244
288
|
}
|
|
245
|
-
async function
|
|
246
|
-
const
|
|
289
|
+
async function ne(i, t) {
|
|
290
|
+
const e = await x({ item: i, portal: t, permanentlyDelete: !1 });
|
|
291
|
+
if (e.error && e.error.code !== "itemNotSupportedInRecycleBin")
|
|
292
|
+
return { kind: "cannotDelete", errorCode: e.error.code };
|
|
293
|
+
if (e.result?.success)
|
|
294
|
+
return { kind: "recycle" };
|
|
295
|
+
const s = await x({ item: i, portal: t, permanentlyDelete: !0 });
|
|
296
|
+
return s.result?.success ? { kind: "permanentlyDelete" } : { kind: "cannotDelete", errorCode: s.error?.code ?? "unhandledError" };
|
|
297
|
+
}
|
|
298
|
+
function re(i) {
|
|
299
|
+
switch (i) {
|
|
300
|
+
case "itemHasDependentItems":
|
|
301
|
+
return "hasDependentItems";
|
|
302
|
+
case "itemDeleteProtected":
|
|
303
|
+
return "deleteProtected";
|
|
304
|
+
default:
|
|
305
|
+
return "uncaught";
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
async function ae(i, t) {
|
|
309
|
+
const e = await J({
|
|
247
310
|
itemId: i.id,
|
|
248
|
-
portal:
|
|
311
|
+
portal: t,
|
|
249
312
|
relationship: { direction: "forward" }
|
|
250
|
-
}), s = await
|
|
251
|
-
usedByItems:
|
|
252
|
-
usedByItemsCount:
|
|
313
|
+
}), s = await Q(i, t), n = await X(i, t), r = await Y(i, t), a = e.result?.relatedItems ?? [], c = k(a) ?? [], l = e.result?.aggregations?.total?.count, o = k(n.resultData.items), m = k(r), h = s?.sourceData, u = {
|
|
314
|
+
usedByItems: c,
|
|
315
|
+
usedByItemsCount: l == null ? c.length : Math.max(0, l - (a.length - c.length)),
|
|
253
316
|
sourceData: h?.type === "Code Attachment" ? null : h ?? null,
|
|
254
|
-
resultData:
|
|
317
|
+
resultData: o,
|
|
255
318
|
replacementItemFor: m?.length ? m : null
|
|
256
|
-
}, {
|
|
319
|
+
}, y = te({ item: i, ...u }), f = await ne(i, t);
|
|
320
|
+
return f.kind === "cannotDelete" ? D({
|
|
257
321
|
item: i,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
item: i,
|
|
273
|
-
...u,
|
|
274
|
-
kind: "cannotDelete",
|
|
275
|
-
reason: "deleteProtected"
|
|
276
|
-
});
|
|
277
|
-
default:
|
|
278
|
-
return g({
|
|
279
|
-
item: i,
|
|
280
|
-
...u,
|
|
281
|
-
kind: "cannotDelete",
|
|
282
|
-
reason: "uncaught"
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
if (!f?.success) {
|
|
286
|
-
const { result: T } = await B({
|
|
287
|
-
item: i,
|
|
288
|
-
portal: e,
|
|
289
|
-
permanentlyDelete: !0
|
|
290
|
-
});
|
|
291
|
-
return T?.success ? g({
|
|
292
|
-
item: i,
|
|
293
|
-
...u,
|
|
294
|
-
kind: "permanentlyDelete",
|
|
295
|
-
reason: "notSupported"
|
|
296
|
-
}) : g({
|
|
297
|
-
item: i,
|
|
298
|
-
...u,
|
|
299
|
-
kind: "cannotDelete",
|
|
300
|
-
reason: "uncaught"
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
return g({ item: i, ...u, kind: "recycle" });
|
|
322
|
+
...u,
|
|
323
|
+
kind: "cannotDelete",
|
|
324
|
+
reason: re(f.errorCode)
|
|
325
|
+
}) : y ? D({
|
|
326
|
+
item: i,
|
|
327
|
+
...u,
|
|
328
|
+
kind: "cannotDelete",
|
|
329
|
+
reason: "hasDependentItems"
|
|
330
|
+
}) : f.kind === "permanentlyDelete" ? D({
|
|
331
|
+
item: i,
|
|
332
|
+
...u,
|
|
333
|
+
kind: "permanentlyDelete",
|
|
334
|
+
reason: "notSupported"
|
|
335
|
+
}) : D({ item: i, ...u, kind: f.kind });
|
|
304
336
|
}
|
|
305
|
-
async function
|
|
306
|
-
const
|
|
307
|
-
return
|
|
337
|
+
async function le(i, t) {
|
|
338
|
+
const e = await Promise.all(i.map(async (s) => await ae(s, t)));
|
|
339
|
+
return ce(e);
|
|
308
340
|
}
|
|
309
|
-
function
|
|
310
|
-
const
|
|
311
|
-
for (const
|
|
312
|
-
|
|
313
|
-
return i.map((
|
|
314
|
-
if (
|
|
315
|
-
return
|
|
316
|
-
const n =
|
|
341
|
+
function ce(i) {
|
|
342
|
+
const t = /* @__PURE__ */ new Map();
|
|
343
|
+
for (const e of i)
|
|
344
|
+
e.item.id && t.set(e.item.id, e);
|
|
345
|
+
return i.map((e) => {
|
|
346
|
+
if (e.kind !== "cannotDelete" || e.reason !== "hasDependentItems" || !e.item.id)
|
|
347
|
+
return e;
|
|
348
|
+
const n = oe(e.resultData, t);
|
|
317
349
|
if (n.length === 0)
|
|
318
|
-
return
|
|
319
|
-
const r = n.every((
|
|
320
|
-
return r &&
|
|
350
|
+
return e;
|
|
351
|
+
const r = n.every((c) => t.has(c)), a = n.every((c) => !t.get(c)?.item.protected);
|
|
352
|
+
return r && a ? ie(e, "recycle") : e;
|
|
321
353
|
});
|
|
322
354
|
}
|
|
323
|
-
function
|
|
355
|
+
function oe(i, t, e = /* @__PURE__ */ new Set()) {
|
|
324
356
|
if (!i?.length)
|
|
325
357
|
return [];
|
|
326
|
-
const s = i.filter((r) => !
|
|
358
|
+
const s = i.filter((r) => !_(r)), n = /* @__PURE__ */ new Set();
|
|
327
359
|
for (; s.length > 0; ) {
|
|
328
|
-
const
|
|
329
|
-
if (!
|
|
360
|
+
const a = s.shift().id;
|
|
361
|
+
if (!a || e.has(a))
|
|
330
362
|
continue;
|
|
331
|
-
|
|
332
|
-
const
|
|
333
|
-
s.push(...
|
|
363
|
+
e.add(a), n.add(a);
|
|
364
|
+
const l = t.get(a)?.resultData ?? [];
|
|
365
|
+
s.push(...l.filter((o) => !_(o)));
|
|
334
366
|
}
|
|
335
367
|
return [...n];
|
|
336
368
|
}
|
|
337
|
-
const
|
|
338
|
-
function
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
function te(i, e, t) {
|
|
354
|
-
return !e && !!t?.length && !y(i);
|
|
355
|
-
}
|
|
356
|
-
function se({
|
|
357
|
-
selectedItems: i
|
|
358
|
-
}) {
|
|
359
|
-
const e = [];
|
|
360
|
-
return e.push(
|
|
361
|
-
...i.flatMap(({ item: t, sourceData: s, resultData: n, replacementItemFor: r }) => {
|
|
362
|
-
const l = te(t, s, n), o = !!(n?.some((a) => !a.inRecycleBin) && !ie(t, n) && !ne(t, n));
|
|
363
|
-
return l && o ? [{ item: t, reason: "dependent", offendingItems: n ?? void 0 }] : r && r?.length > 0 ? [{ item: t, reason: "replacement", offendingItems: r }] : [];
|
|
364
|
-
})
|
|
365
|
-
), e;
|
|
366
|
-
}
|
|
367
|
-
function ie(i, e) {
|
|
368
|
-
const t = e[0];
|
|
369
|
-
return i.type === "Feed" && y(i) && e.length === 1 && t?.type === "Feature Service" && y(t);
|
|
370
|
-
}
|
|
371
|
-
function ne(i, e) {
|
|
372
|
-
const t = e[0];
|
|
373
|
-
return i.type === "Feature Service" && y(i) && e.length === 1 && t?.type === "Feed" && y(t);
|
|
369
|
+
const de = H`:host{display:block}calcite-dialog{--calcite-dialog-content-space: 0;--calcite-dialog-background-color: var(--calcite-color-background)}calcite-panel{display:flex;flex-direction:column;gap:.75rem;>*{margin-inline:.75rem}}.panel__content{width:100%;box-sizing:border-box}.single-item-bucket{--calcite-block-background-color: transparent;--calcite-block-border-color: transparent}.bucket__content{display:flex;align-items:flex-start;gap:.75rem;width:100%}.bucket__icon{flex-shrink:0}.bucket__icon--danger{color:var(--calcite-color-status-danger)}.bucket__details{display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.bucket__header{font-weight:500}.bucket__label{margin-inline-end:.25rem}.bucket__checkbox{margin-top:.5rem}.bucket__description{line-height:1.35;font-size:var(--calcite-font-size--1)}.bucket__link{display:flex;align-items:center;min-height:1.5rem}.item-link-content{position:relative;>arcgis-portal-item-type{margin-inline-end:.25rem;vertical-align:middle}}.panel__checkbox{width:100%;padding-block:.75rem;padding-inline-start:.75rem;background-color:var(--calcite-color-foreground-1)}.panel__related-items{margin-top:1rem;border:1px solid var(--calcite-color-border-2)}.panel__related-items-icon{color:var(--calcite-color-status-warning)}.panel__related-items-notice{padding-bottom:.75rem}arcgis-portal-review-related-items{margin-bottom:.75rem}.discouraged-items-warning{margin-bottom:.75rem}.header-description{font-size:var(--calcite-font-size--1);font-weight:400}`, A = /* @__PURE__ */ new Map();
|
|
370
|
+
async function me(i, t) {
|
|
371
|
+
const e = j(i), s = JSON.stringify([e, t]), n = A.get(s);
|
|
372
|
+
if (n)
|
|
373
|
+
return n;
|
|
374
|
+
try {
|
|
375
|
+
const a = (await S({
|
|
376
|
+
url: `${e}portals/helpmap`,
|
|
377
|
+
portal: i,
|
|
378
|
+
params: { culture: t }
|
|
379
|
+
}))?.helpMap?.m ?? {};
|
|
380
|
+
return A.set(s, a), a;
|
|
381
|
+
} catch {
|
|
382
|
+
return {};
|
|
383
|
+
}
|
|
374
384
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
385
|
+
const ue = (i) => W((t, e) => {
|
|
386
|
+
let s, n;
|
|
387
|
+
return e.onUpdate(() => {
|
|
388
|
+
const r = i.portal(), a = i.language(), c = r?.restUrl;
|
|
389
|
+
c === s && a === n || (s = c, n = a, e.exports = {}, !(!r || !c || !a) && me(r, a).then((l) => {
|
|
390
|
+
e.exports = l;
|
|
391
|
+
}));
|
|
392
|
+
}), {};
|
|
393
|
+
});
|
|
394
|
+
function T({ id: i, linkText: t, label: e, placement: s, items: n, portal: r, user: a }) {
|
|
395
|
+
return d`<calcite-link id=${i ?? F}>${t}</calcite-link><calcite-popover .label=${e} .referenceElement=${i} .placement=${s} auto-close><calcite-list .label=${e} selection-mode=none>${n.map((c) => d`<calcite-list-item .label=${c.title ?? ""} @calciteListItemSelect=${() => {
|
|
396
|
+
const l = c.itemPageUrl;
|
|
397
|
+
l && window.open(l.replace("sharing/rest/", ""), "_blank", "noopener,noreferrer");
|
|
398
|
+
}}><span slot=content-start><arcgis-portal-item-type .item=${c} .portal=${r} .user=${a} hide-text></arcgis-portal-item-type></span><span slot=content>${c.title}</span></calcite-list-item>`)}</calcite-list></calcite-popover>`;
|
|
380
399
|
}
|
|
381
|
-
class
|
|
400
|
+
class he extends E {
|
|
382
401
|
constructor() {
|
|
383
|
-
super(...arguments), this.deleteStatusRequestId = 0, this.updatedCannotDeleteItemIds = /* @__PURE__ */ new Set(), this.messages =
|
|
402
|
+
super(...arguments), this.deleteStatusRequestId = 0, this.updatedCannotDeleteItemIds = /* @__PURE__ */ new Set(), this.messages = q({ blocking: !0 }), this.helpMap = ue({
|
|
403
|
+
portal: () => this.portal,
|
|
404
|
+
language: () => this.messages._t9nLocale
|
|
405
|
+
}), this.isLoading = !0, this.submittingAction = null, this.loadedItems = [], this.hasConfirmedReview = !1, this.hasReviewedSelectedItems = !1, this.cannotDeleteItems = [], this.recycleItems = [], this.permanentlyDeleteItems = [], this.deprecateItems = [], this.excludeItems = [], this.reviewingDirectlyUsedByItems = !1, this.reviewDecision = null, this.active = !0, this.items = [], this.itemIds = [], this.user = null, this.disableLinks = !1, this.arcgisClose = v(), this.arcgisConfirm = v(), this.arcgisError = v();
|
|
384
406
|
}
|
|
385
407
|
static {
|
|
386
408
|
this.properties = { isLoading: 16, submittingAction: 16, loadedItems: 16, hasConfirmedReview: 16, hasReviewedSelectedItems: 16, cannotDeleteItems: 16, recycleItems: 16, permanentlyDeleteItems: 16, deprecateItems: 16, excludeItems: 16, reviewingDirectlyUsedByItems: 16, reviewDecision: 16, active: 5, items: 0, itemIds: 0, portal: 0, user: 0, disableLinks: 5 };
|
|
387
409
|
}
|
|
388
410
|
static {
|
|
389
|
-
this.styles =
|
|
411
|
+
this.styles = de;
|
|
390
412
|
}
|
|
391
|
-
willUpdate(
|
|
392
|
-
const
|
|
393
|
-
this.active &&
|
|
413
|
+
willUpdate(t) {
|
|
414
|
+
const e = t.has("items") || t.has("itemIds") || t.has("portal") || t.has("user") || t.has("active");
|
|
415
|
+
this.active && e && (this.user ??= this.portal?.user || null, this.resetState(), this.initializeItems(++this.deleteStatusRequestId));
|
|
394
416
|
}
|
|
395
|
-
async initializeItems(
|
|
396
|
-
const { items:
|
|
397
|
-
|
|
417
|
+
async initializeItems(t) {
|
|
418
|
+
const { items: e, itemIds: s, portal: n } = this, r = e.length ? e : await Promise.all(s.map(async (a) => await new b({ id: a, portal: n }).load()));
|
|
419
|
+
t === this.deleteStatusRequestId && (this.loadedItems = r, await this.determineDeleteStatus(t));
|
|
398
420
|
}
|
|
399
|
-
async handleReviewDecision(
|
|
400
|
-
const
|
|
421
|
+
async handleReviewDecision(t) {
|
|
422
|
+
const e = this.itemsWithImpactedItems.map(({ item: l }) => l), s = t === "delete" ? "recycle" : t === "deprecate" ? "deprecate" : "exclude", n = this.permanentlyDeleteItems.filter((l) => this.isPermanentlyDeleteOverrideActive(l)), r = this.permanentlyDeleteItems.filter((l) => !this.isPermanentlyDeleteOverrideActive(l)), a = [
|
|
401
423
|
...this.recycleItems,
|
|
402
424
|
...this.deprecateItems,
|
|
403
425
|
...this.excludeItems,
|
|
404
426
|
...n
|
|
405
|
-
],
|
|
406
|
-
for (const
|
|
407
|
-
if (!
|
|
427
|
+
], c = t === "delete" && a.some((l) => p(l) !== "recycle" && e.some(({ id: o }) => o === l.item.id));
|
|
428
|
+
for (const l of a) {
|
|
429
|
+
if (!e.some(({ id: h }) => h === l.item.id))
|
|
408
430
|
continue;
|
|
409
|
-
const m =
|
|
410
|
-
|
|
431
|
+
const m = l.originalStatus ?? l.kind;
|
|
432
|
+
l.originalStatus = m, l.updatedStatus = s;
|
|
411
433
|
}
|
|
412
434
|
if (this.reviewDecision = {
|
|
413
|
-
action:
|
|
414
|
-
items:
|
|
415
|
-
}, this.hasConfirmedReview = !0, this.reviewingDirectlyUsedByItems = !1, this.recycleItems =
|
|
435
|
+
action: t,
|
|
436
|
+
items: e
|
|
437
|
+
}, this.hasConfirmedReview = !0, this.reviewingDirectlyUsedByItems = !1, this.recycleItems = a.filter((l) => p(l) === "recycle"), this.deprecateItems = a.filter((l) => p(l) === "deprecate"), this.excludeItems = a.filter((l) => p(l) === "exclude"), this.permanentlyDeleteItems = r, t !== "delete" || c) {
|
|
416
438
|
this.isLoading = !0;
|
|
417
|
-
const
|
|
418
|
-
await this.determineDeleteStatus(++this.deleteStatusRequestId,
|
|
439
|
+
const l = [...this.cannotDeleteItems, ...this.recycleItems, ...this.permanentlyDeleteItems].map(({ item: o }) => o);
|
|
440
|
+
await this.determineDeleteStatus(++this.deleteStatusRequestId, l);
|
|
419
441
|
}
|
|
420
442
|
}
|
|
421
|
-
async updateAllContentStatus(
|
|
422
|
-
return (await Promise.all(
|
|
443
|
+
async updateAllContentStatus(t, e) {
|
|
444
|
+
return (await Promise.all(t.map(async (n) => await V(n, e)))).flatMap(({ result: n }) => n ? [n] : []);
|
|
423
445
|
}
|
|
424
446
|
async handleDelete() {
|
|
425
447
|
if (!this.active || this.submittingAction)
|
|
426
448
|
return;
|
|
427
449
|
this.submittingAction = "delete";
|
|
428
|
-
const
|
|
450
|
+
const t = { restUrl: this.portal.restUrl }, { result: e = [] } = this.recycleItems.length ? await C(this.recycleItems.map(({ item: r }) => r), t) : { result: [] }, { result: s = [] } = this.permanentlyDeleteItems.length ? await C(this.permanentlyDeleteItems.map(({ item: r }) => r), t, !0) : { result: [] }, n = this.deprecateItems.length ? await this.updateAllContentStatus(this.deprecateItems.map(({ item: r }) => r), "deprecated") : null;
|
|
429
451
|
this.arcgisConfirm.emit({
|
|
430
|
-
deletedItems:
|
|
452
|
+
deletedItems: e,
|
|
431
453
|
permanentlyDeletedItems: s,
|
|
432
|
-
deletedItemsCount:
|
|
454
|
+
deletedItemsCount: e.length,
|
|
433
455
|
permanentlyDeletedItemsCount: s.length,
|
|
434
456
|
deprecatedItems: n
|
|
435
457
|
}), this.closeDialog();
|
|
@@ -438,13 +460,18 @@ class re extends U {
|
|
|
438
460
|
if (!this.active || this.submittingAction)
|
|
439
461
|
return;
|
|
440
462
|
this.submittingAction = "deprecate";
|
|
441
|
-
const
|
|
463
|
+
const t = [
|
|
464
|
+
...this.deprecateItems,
|
|
465
|
+
...this.recycleItems,
|
|
466
|
+
...this.cannotDeleteItems,
|
|
467
|
+
...this.permanentlyDeleteItems
|
|
468
|
+
].filter(Boolean), e = t.length ? await this.updateAllContentStatus(t.map(({ item: s }) => s), "deprecated") : null;
|
|
442
469
|
this.arcgisConfirm.emit({
|
|
443
470
|
deletedItems: null,
|
|
444
471
|
permanentlyDeletedItems: null,
|
|
445
472
|
deletedItemsCount: 0,
|
|
446
473
|
permanentlyDeletedItemsCount: 0,
|
|
447
|
-
deprecatedItems:
|
|
474
|
+
deprecatedItems: e
|
|
448
475
|
}), this.closeDialog();
|
|
449
476
|
}
|
|
450
477
|
handleDialogClose() {
|
|
@@ -456,9 +483,9 @@ class re extends U {
|
|
|
456
483
|
resetState() {
|
|
457
484
|
this.isLoading = !0, this.submittingAction = null, this.loadedItems = [], this.hasConfirmedReview = !1, this.hasReviewedSelectedItems = !1, this.cannotDeleteItems = [], this.recycleItems = [], this.permanentlyDeleteItems = [], this.deprecateItems = [], this.excludeItems = [], this.reviewingDirectlyUsedByItems = !1, this.reviewDecision = null, this.updatedCannotDeleteItemIds.clear(), ++this.deleteStatusRequestId;
|
|
458
485
|
}
|
|
459
|
-
async determineDeleteStatus(
|
|
460
|
-
const s = new Set(this.recycleItems.map(({ item: r }) => r.id).filter((r) => !!r)), n = await
|
|
461
|
-
if (
|
|
486
|
+
async determineDeleteStatus(t, e = this.loadedItems) {
|
|
487
|
+
const s = new Set(this.recycleItems.map(({ item: r }) => r.id).filter((r) => !!r)), n = await le(e, this.portal);
|
|
488
|
+
if (t === this.deleteStatusRequestId) {
|
|
462
489
|
this.cannotDeleteItems = n.filter((r) => p(r) === "cannotDelete");
|
|
463
490
|
for (const r of this.cannotDeleteItems)
|
|
464
491
|
r.item.id && s.has(r.item.id) && this.updatedCannotDeleteItemIds.add(r.item.id);
|
|
@@ -466,28 +493,28 @@ class re extends U {
|
|
|
466
493
|
}
|
|
467
494
|
}
|
|
468
495
|
get itemsWithImpactedItems() {
|
|
469
|
-
const
|
|
496
|
+
const t = new Set(this.loadedItems.map(({ id: e }) => e));
|
|
470
497
|
return [
|
|
471
498
|
...this.recycleItems,
|
|
472
499
|
...this.deprecateItems,
|
|
473
500
|
...this.excludeItems,
|
|
474
|
-
...this.permanentlyDeleteItems.filter((
|
|
475
|
-
].map((
|
|
476
|
-
...
|
|
477
|
-
usedByItems:
|
|
478
|
-
})).filter(({ usedByItems:
|
|
501
|
+
...this.permanentlyDeleteItems.filter((e) => this.isPermanentlyDeleteOverrideActive(e))
|
|
502
|
+
].map((e) => ({
|
|
503
|
+
...e,
|
|
504
|
+
usedByItems: e.usedByItems.filter(({ id: s }) => !t.has(s))
|
|
505
|
+
})).filter(({ usedByItems: e }) => e.length > 0);
|
|
479
506
|
}
|
|
480
507
|
get itemsHaveImpactedItems() {
|
|
481
508
|
return this.itemsWithImpactedItems.length > 0;
|
|
482
509
|
}
|
|
483
510
|
get itemsNeedReview() {
|
|
484
|
-
return this.itemsWithImpactedItems.some((
|
|
511
|
+
return this.itemsWithImpactedItems.some((t) => ["recycle", "permanentlyDelete"].includes(p(t)));
|
|
485
512
|
}
|
|
486
|
-
isPermanentlyDeleteOverrideActive(
|
|
487
|
-
return
|
|
513
|
+
isPermanentlyDeleteOverrideActive(t) {
|
|
514
|
+
return t.kind === "recycle" && t.updatedStatus === "permanentlyDelete";
|
|
488
515
|
}
|
|
489
|
-
handlePermanentlyDeleteOverrideChange(
|
|
490
|
-
if (
|
|
516
|
+
handlePermanentlyDeleteOverrideChange(t) {
|
|
517
|
+
if (t) {
|
|
491
518
|
const s = this.recycleItems.map((n) => ({
|
|
492
519
|
...n,
|
|
493
520
|
originalStatus: n.originalStatus ?? n.kind,
|
|
@@ -496,10 +523,10 @@ class re extends U {
|
|
|
496
523
|
this.recycleItems = [], this.permanentlyDeleteItems = [...this.permanentlyDeleteItems, ...s];
|
|
497
524
|
return;
|
|
498
525
|
}
|
|
499
|
-
const
|
|
526
|
+
const e = this.permanentlyDeleteItems.filter((s) => this.isPermanentlyDeleteOverrideActive(s));
|
|
500
527
|
this.permanentlyDeleteItems = this.permanentlyDeleteItems.filter((s) => !this.isPermanentlyDeleteOverrideActive(s)), this.recycleItems = [
|
|
501
528
|
...this.recycleItems,
|
|
502
|
-
...
|
|
529
|
+
...e.map((s) => ({ ...s, updatedStatus: "recycle" }))
|
|
503
530
|
];
|
|
504
531
|
}
|
|
505
532
|
get deleteButtonEnabled() {
|
|
@@ -514,7 +541,7 @@ class re extends U {
|
|
|
514
541
|
this.deprecateItems,
|
|
515
542
|
this.excludeItems,
|
|
516
543
|
this.permanentlyDeleteItems
|
|
517
|
-
].filter((
|
|
544
|
+
].filter((e) => e.length > 0).length > 1 ? "mixed" : this.markedForDeprecation.length > 0 ? "deprecate" : this.permanentlyDeleteItems.length > 0 ? "permanentlyDelete" : this.recycleItems.length > 0 ? "delete" : (this.cannotDeleteItems.length > 0, "none");
|
|
518
545
|
}
|
|
519
546
|
getHeaderText() {
|
|
520
547
|
return this.reviewingDirectlyUsedByItems ? this.messages.reviewItemsCount.replace("{count}", `${this.itemsWithImpactedItems.length}`) : (this.items.length ? this.items : this.itemIds).length === 1 ? this.messages.deleteItem : this.messages.deleteItems;
|
|
@@ -536,61 +563,61 @@ class re extends U {
|
|
|
536
563
|
return this.messages.delete;
|
|
537
564
|
}
|
|
538
565
|
}
|
|
539
|
-
renderBucket({ icon:
|
|
540
|
-
return d`<calcite-block class=${
|
|
566
|
+
renderBucket({ icon: t, label: e, description: s, link: n, additionalContent: r, dangerIcon: a = !1, bucket: c }) {
|
|
567
|
+
return d`<calcite-block class=${$({ "single-item-bucket": (this.items.length ? this.items : this.itemIds).length === 1 })} scale=l expanded><div class="bucket__content"><calcite-icon class=${$({ bucket__icon: !0, "bucket__icon--danger": a })} scale=l .icon=${t}></calcite-icon><div class="bucket__details"><div class="bucket__header"><span class="bucket__label">${e}</span><span>${this.renderBucketItems(c)}</span></div>${s && d`<span class="bucket__description">${s}</span>` || ""}${n && d`<div class="bucket__link"><calcite-link .href=${n.href} target=_blank icon-start=launch>${n.text ?? this.messages.moreInfo}</calcite-link></div>` || ""}${r}</div></div></calcite-block>`;
|
|
541
568
|
}
|
|
542
|
-
renderBucketItems(
|
|
543
|
-
return this.renderItemLinks(
|
|
569
|
+
renderBucketItems(t = []) {
|
|
570
|
+
return this.renderItemLinks(t.map(({ item: e }) => e));
|
|
544
571
|
}
|
|
545
|
-
renderItemLinks(
|
|
546
|
-
if (
|
|
572
|
+
renderItemLinks(t, e = `delete-items-bucket-${t.map(({ id: s }) => s).join("-")}`) {
|
|
573
|
+
if (t.length === 0)
|
|
547
574
|
return null;
|
|
548
|
-
if (
|
|
549
|
-
const s =
|
|
575
|
+
if (t.length === 1) {
|
|
576
|
+
const s = t[0], n = `${G({ portal: this.portal })}/item.html?id=${s.id}`;
|
|
550
577
|
return d`<calcite-link .href=${n} target=_blank><span class="item-link-content"><arcgis-portal-item-type .item=${s} .portal=${this.portal} .user=${this.user} hide-text></arcgis-portal-item-type><span>${s.title}</span></span></calcite-link>`;
|
|
551
578
|
}
|
|
552
|
-
return
|
|
553
|
-
id:
|
|
554
|
-
linkText:
|
|
555
|
-
label: this.messages.bucketItems.replace("{count}", String(
|
|
579
|
+
return T({
|
|
580
|
+
id: e,
|
|
581
|
+
linkText: t.length,
|
|
582
|
+
label: this.messages.bucketItems.replace("{count}", String(t.length)),
|
|
556
583
|
placement: "bottom-start",
|
|
557
|
-
items:
|
|
584
|
+
items: t,
|
|
558
585
|
portal: this.portal,
|
|
559
586
|
user: this.user
|
|
560
587
|
});
|
|
561
588
|
}
|
|
562
|
-
renderRelatedItemsPopover(
|
|
563
|
-
const
|
|
564
|
-
return
|
|
589
|
+
renderRelatedItemsPopover(t) {
|
|
590
|
+
const e = t.flatMap(({ usedByItems: n }) => n);
|
|
591
|
+
return t.length > 1 || e.length === 0 ? null : T({
|
|
565
592
|
id: "delete-items-directly-used-by",
|
|
566
|
-
linkText:
|
|
593
|
+
linkText: R(this.messages._t9nLocale, this.messages.usedByOtherItems, e.length),
|
|
567
594
|
label: this.messages.usedByPopover,
|
|
568
595
|
placement: "auto",
|
|
569
|
-
items:
|
|
596
|
+
items: e,
|
|
570
597
|
portal: this.portal,
|
|
571
598
|
user: this.user
|
|
572
599
|
});
|
|
573
600
|
}
|
|
574
601
|
renderDirectlyUsedByItems() {
|
|
575
|
-
const
|
|
602
|
+
const t = Z({
|
|
576
603
|
recycleItems: this.recycleItems,
|
|
577
604
|
cannotDeleteItems: this.cannotDeleteItems,
|
|
578
605
|
permanentlyDeleteItems: this.permanentlyDeleteItems
|
|
579
|
-
}),
|
|
580
|
-
selectedItems: ee(
|
|
581
|
-
}),
|
|
582
|
-
return d`${this.loadedItems.length === 1 && ["delete", "permanentlyDelete"].includes(this.deleteMode) && r.length > 0 ? d`<div class="discouraged-items-warning"><calcite-notice kind=warning open><div slot=message>${
|
|
606
|
+
}), e = this.cannotDeleteItems.find(({ reason: o }) => o === "hasDependentItems"), s = e ? e.resultData ?? [] : t.flatMap(({ usedByItems: o }) => o), n = e ? s.length : t[0]?.usedByItemsCount, r = se({
|
|
607
|
+
selectedItems: ee(t)
|
|
608
|
+
}), a = r.find(({ reason: o }) => o === "replacement"), c = a?.offendingItems ?? [], l = R(this.messages._t9nLocale, this.messages.replacementItem.isReplacementFor, c.length, { itemLink: "{itemLink}" });
|
|
609
|
+
return d`${this.loadedItems.length === 1 && ["delete", "permanentlyDelete"].includes(this.deleteMode) && r.length > 0 ? d`<div class="discouraged-items-warning"><calcite-notice kind=warning open><div slot=message>${a ? l.split("{itemLink}").map((o, m) => d`${m > 0 && this.renderItemLinks(c, "delete-items-replacement-for") || ""}${o}`) : this.messages.deleteDiscouraged}</div>${!a && d`<calcite-link .href=${`${B(this.portal)}${this.helpMap[120001208] || ""}`} icon-end=launch slot=link>${this.messages.learnMoreAboutDeletingSourceItems}</calcite-link>` || ""}</calcite-notice></div>` : null}${!this.cannotDeleteItems.some(({ reason: o }) => o === "deleteProtected") && d`<arcgis-portal-review-related-items .sourceItem=${this.loadedItems[0] ?? null} .relatedItems=${s} .relatedItemsCount=${n} .showDependentItems=${!!e} .portal=${this.portal} .user=${this.user}></arcgis-portal-review-related-items>` || ""}`;
|
|
583
610
|
}
|
|
584
611
|
renderDirectlyUsedByItemsNotice() {
|
|
585
|
-
const
|
|
586
|
-
return d`<div class="panel__related-items-notice"><calcite-notice .kind=${this.reviewDecision ? "brand" : "warning"} icon open><div slot=message>${this.reviewDecision ? this.messages.relatedItemsReviewed :
|
|
612
|
+
const t = new Set(this.itemsWithImpactedItems.flatMap(({ usedByItems: s }) => s.map(({ id: n }) => n))), e = this.messages.reviewRelatedItems.multiple.replace("{totalCount}", String(t.size));
|
|
613
|
+
return d`<div class="panel__related-items-notice"><calcite-notice .kind=${this.reviewDecision ? "brand" : "warning"} icon open><div slot=message>${this.reviewDecision ? this.messages.relatedItemsReviewed : e}</div><calcite-button appearance=transparent slot=actions-end @click=${() => {
|
|
587
614
|
this.hasReviewedSelectedItems = !0, this.reviewingDirectlyUsedByItems = !0;
|
|
588
615
|
}}>${this.messages.reviewItems}</calcite-button></calcite-notice></div>`;
|
|
589
616
|
}
|
|
590
617
|
renderDeleteSummary() {
|
|
591
|
-
return d`<div class="panel__content">${this.isLoading ? d`<calcite-scrim loading></calcite-scrim>` : d`<calcite-panel>${this.renderRecycleBucket()}${this.renderDeprecateBucket()}${this.renderExcludeBucket()}${this.renderCannotDeleteBucket()}${this.renderPermanentlyDeleteBucket()}${this.loadedItems.length === 1 && this.renderDirectlyUsedByItems() || ""}${this.itemsHaveImpactedItems && d`<div>${this.loadedItems.length > 1 ? this.renderDirectlyUsedByItemsNotice() : null}</div>` || ""}</calcite-panel>`}</div>${this.itemsNeedReview && !this.hasReviewedSelectedItems && d`<calcite-checkbox slot=content-bottom class="panel__checkbox" .checked=${this.hasConfirmedReview} @calciteCheckboxChange=${(
|
|
592
|
-
this.hasConfirmedReview =
|
|
593
|
-
}} .label=${this.messages.proceedWithDeletion} .labelText=${this.messages.proceedWithDeletion} required></calcite-checkbox>` || ""}${!this.isLoading && d`${this.loadedItems.length === 1 &&
|
|
618
|
+
return d`<div class="panel__content">${this.isLoading ? d`<calcite-scrim loading></calcite-scrim>` : d`<calcite-panel>${this.renderRecycleBucket()}${this.renderDeprecateBucket()}${this.renderExcludeBucket()}${this.renderCannotDeleteBucket()}${this.renderPermanentlyDeleteBucket()}${this.loadedItems.length === 1 && this.renderDirectlyUsedByItems() || ""}${this.itemsHaveImpactedItems && d`<div>${this.loadedItems.length > 1 ? this.renderDirectlyUsedByItemsNotice() : null}</div>` || ""}</calcite-panel>`}</div>${this.itemsNeedReview && !this.hasReviewedSelectedItems && d`<calcite-checkbox slot=content-bottom class="panel__checkbox" .checked=${this.hasConfirmedReview} @calciteCheckboxChange=${(t) => {
|
|
619
|
+
this.hasConfirmedReview = t.target.checked;
|
|
620
|
+
}} .label=${this.messages.proceedWithDeletion} .labelText=${this.messages.proceedWithDeletion} required></calcite-checkbox>` || ""}${!this.isLoading && d`${this.loadedItems.length === 1 && z(this.loadedItems[0]).contentStatus !== "deprecated" && d`<calcite-button slot=footer-start kind=danger appearance=outline-fill .disabled=${!!this.submittingAction} .loading=${this.submittingAction === "deprecate"} @click=${this.handleDeprecate}>${this.messages.deprecateInstead}</calcite-button>` || ""}<calcite-button slot=footer-end appearance=outline-fill @click=${this.handleDialogClose}>${this.messages.cancel}</calcite-button>${this.deleteMode !== "none" && d`<calcite-button .disabled=${!this.deleteButtonEnabled || !!this.submittingAction} .loading=${this.submittingAction === "delete"} kind=danger slot=footer-end @click=${async () => await this.handleDelete()}>${this.getConfirmButtonText()}</calcite-button>` || ""}` || ""}`;
|
|
594
621
|
}
|
|
595
622
|
renderReviewItems() {
|
|
596
623
|
return d`<div class="panel__content"><calcite-panel><arcgis-portal-delete-items-review .items=${this.itemsWithImpactedItems} .portal=${this.portal} .user=${this.user}></arcgis-portal-delete-items-review></calcite-panel></div><calcite-button slot=footer-start appearance=solid kind=neutral @click=${async () => await this.handleReviewDecision("exclude")}>${this.messages.exclude}</calcite-button><calcite-button slot=footer-end appearance=outline-fill kind=danger @click=${async () => await this.handleReviewDecision("deprecate")}>${this.messages.deprecateInstead}</calcite-button><calcite-button slot=footer-end appearance=solid kind=danger @click=${async () => await this.handleReviewDecision("delete")}>${this.messages.proceedToDelete}</calcite-button>`;
|
|
@@ -598,14 +625,14 @@ class re extends U {
|
|
|
598
625
|
renderRecycleBucket() {
|
|
599
626
|
if (!this.recycleItems || this.recycleItems.length === 0)
|
|
600
627
|
return null;
|
|
601
|
-
const
|
|
628
|
+
const t = !this.portal.recycleBinEnabled;
|
|
602
629
|
return this.renderBucket({
|
|
603
|
-
icon:
|
|
604
|
-
label:
|
|
605
|
-
description:
|
|
606
|
-
updated: this.recycleItems.some(({ kind:
|
|
630
|
+
icon: t ? "trash" : "recycle-bin",
|
|
631
|
+
label: t ? this.messages.summary.permanentDelete.delete : this.messages.summary.willBeRecycled,
|
|
632
|
+
description: t ? this.messages.summary.permanentDelete.default.single : this.messages.summary.canBeRecovered.single.replace("{days}", "14"),
|
|
633
|
+
updated: this.recycleItems.some(({ kind: e, updatedStatus: s }) => s === "recycle" && s !== e),
|
|
607
634
|
bucket: this.recycleItems,
|
|
608
|
-
additionalContent:
|
|
635
|
+
additionalContent: t ? void 0 : d`<calcite-checkbox class="bucket__checkbox" .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${(e) => this.handlePermanentlyDeleteOverrideChange(e.target.checked)}></calcite-checkbox>`
|
|
609
636
|
});
|
|
610
637
|
}
|
|
611
638
|
renderDeprecateBucket() {
|
|
@@ -613,7 +640,7 @@ class re extends U {
|
|
|
613
640
|
icon: "circle-disallowed",
|
|
614
641
|
label: this.messages.summary.deprecate.label,
|
|
615
642
|
description: this.messages.summary.deprecate.message,
|
|
616
|
-
updated: this.deprecateItems.some(({ kind:
|
|
643
|
+
updated: this.deprecateItems.some(({ kind: t, updatedStatus: e }) => e !== t && e === "deprecate"),
|
|
617
644
|
bucket: this.deprecateItems
|
|
618
645
|
});
|
|
619
646
|
}
|
|
@@ -622,18 +649,18 @@ class re extends U {
|
|
|
622
649
|
icon: "remove-from-list",
|
|
623
650
|
label: this.messages.summary.exclude.label,
|
|
624
651
|
description: this.messages.summary.exclude.message,
|
|
625
|
-
updated: this.excludeItems.some(({ kind:
|
|
652
|
+
updated: this.excludeItems.some(({ kind: t, updatedStatus: e }) => e !== t && e === "exclude"),
|
|
626
653
|
bucket: this.excludeItems
|
|
627
654
|
});
|
|
628
655
|
}
|
|
629
656
|
renderCannotDeleteBucket() {
|
|
630
657
|
if (!this.cannotDeleteItems || this.cannotDeleteItems.length === 0)
|
|
631
658
|
return null;
|
|
632
|
-
const
|
|
659
|
+
const t = this.cannotDeleteItems?.[0]?.reason, e = this.cannotDeleteItems[0]?.resultData?.length ?? 0, s = this.messages.summary.protectedGroup.hasDependentItemsDescription;
|
|
633
660
|
return this.renderBucket({
|
|
634
661
|
icon: "security",
|
|
635
662
|
label: this.messages.summary.cannotDelete,
|
|
636
|
-
description:
|
|
663
|
+
description: t === "hasDependentItems" ? e > 1 ? s.singleMultipleDependentItems : s.singleOneDependentItem : this.messages.summary.protectedGroup.deleteProtectedDescription,
|
|
637
664
|
bucket: this.cannotDeleteItems,
|
|
638
665
|
updated: this.cannotDeleteItems.some(({ item: n }) => n.id && this.updatedCannotDeleteItemIds.has(n.id))
|
|
639
666
|
});
|
|
@@ -641,22 +668,26 @@ class re extends U {
|
|
|
641
668
|
renderPermanentlyDeleteBucket() {
|
|
642
669
|
if (!this.permanentlyDeleteItems || this.permanentlyDeleteItems.length === 0)
|
|
643
670
|
return null;
|
|
644
|
-
const
|
|
671
|
+
const t = !this.portal.recycleBinEnabled;
|
|
645
672
|
return this.renderBucket({
|
|
646
673
|
icon: "trash",
|
|
647
|
-
label:
|
|
648
|
-
description:
|
|
674
|
+
label: t ? this.messages.summary.permanentDelete.delete : this.messages.summary.permanentlyDelete,
|
|
675
|
+
description: t ? this.messages.summary.permanentDelete.default.single : this.permanentlyDeleteItems.some((e) => this.isPermanentlyDeleteOverrideActive(e)) ? null : this.messages.summary.permanentDelete.notSupported.single,
|
|
676
|
+
link: {
|
|
677
|
+
href: `${B(this.portal)}${this.helpMap[120004692] || ""}`,
|
|
678
|
+
text: this.messages.moreInfo
|
|
679
|
+
},
|
|
649
680
|
bucket: this.permanentlyDeleteItems,
|
|
650
|
-
dangerIcon: this.permanentlyDeleteItems.some((
|
|
651
|
-
additionalContent: !
|
|
681
|
+
dangerIcon: this.permanentlyDeleteItems.some((e) => this.isPermanentlyDeleteOverrideActive(e)),
|
|
682
|
+
additionalContent: !t && this.permanentlyDeleteItems.some((e) => this.isPermanentlyDeleteOverrideActive(e)) ? d`<calcite-checkbox class="bucket__checkbox" checked .label=${this.messages.permanentlyDeleteInstead} .labelText=${this.messages.permanentlyDeleteInstead} @calciteCheckboxChange=${(e) => this.handlePermanentlyDeleteOverrideChange(e.target.checked)}></calcite-checkbox>` : void 0
|
|
652
683
|
});
|
|
653
684
|
}
|
|
654
685
|
render() {
|
|
655
|
-
const { loadedItems:
|
|
656
|
-
return !
|
|
686
|
+
const { loadedItems: t, portal: e } = this;
|
|
687
|
+
return !t || !e ? null : d`<calcite-dialog modal .open=${this.active} width=s .heading=${this.getHeaderText()} heading-level=2 outside-close-disabled escape-disabled kind=danger @calciteDialogClose=${this.handleDialogClose}><div slot=heading><span>${this.getHeaderText()}</span><br><span class="header-description">${this.getHeaderDescription()}</span></div>${this.reviewingDirectlyUsedByItems ? this.renderReviewItems() : this.renderDeleteSummary()}</calcite-dialog>`;
|
|
657
688
|
}
|
|
658
689
|
}
|
|
659
|
-
|
|
690
|
+
O("arcgis-portal-delete-items", he);
|
|
660
691
|
export {
|
|
661
|
-
|
|
692
|
+
he as ArcgisPortalDeleteItems
|
|
662
693
|
};
|