-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): add recommendedTemplates to schema/uiSchema for initiative te…
…mplate workspace (#1258) * feat(): add workspace content permission * fix(): remove alpha for testing * fix(): typos * fix(): revert content pane * feat(): update schema and uiSchema * fix(): typo in typekeywords * test(): update spec test for init template ui schema * test(): remove else path * test(): move recommendedTemplatesCatalog to own module * fix(): order of thumbnail and reinstate alpha
- Loading branch information
1 parent
02d34d4
commit 339d1e6
Showing
7 changed files
with
434 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
packages/common/src/initiative-templates/_internal/getRecommendedTemplatesCatalog.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import { IHubCollection } from "../../search"; | ||
import { | ||
getWellKnownCatalog, | ||
WellKnownCatalog, | ||
} from "../../search/wellKnownCatalog"; | ||
import { IUser } from "@esri/arcgis-rest-types"; | ||
|
||
export const getRecommendedTemplatesCatalog = ( | ||
user: IUser, | ||
i18nScope: string | ||
) => { | ||
const catalogNames: WellKnownCatalog[] = [ | ||
"myContent", | ||
"favorites", | ||
"organization", | ||
"world", | ||
]; | ||
|
||
const catalogs = catalogNames.map((name: WellKnownCatalog) => { | ||
const opts = { user }; | ||
const catalog = getWellKnownCatalog( | ||
"initiativeTemplate.fields.recommendedTemplates", | ||
name, | ||
"item", | ||
opts | ||
); | ||
|
||
// manually attach recommended templates collection | ||
catalog.collections = [getRecommendedTemplatesCollection(i18nScope)]; | ||
return catalog; | ||
}); | ||
|
||
return catalogs; | ||
}; | ||
|
||
const getRecommendedTemplatesCollection = ( | ||
i18nScope: string | ||
): IHubCollection => { | ||
return { | ||
targetEntity: "item", | ||
key: "recommendedTemplates", | ||
label: `${i18nScope}.fields.recommendedTemplates.collection.label`, | ||
scope: { | ||
targetEntity: "item", | ||
filters: [ | ||
{ | ||
predicates: [ | ||
{ | ||
typekeywords: { | ||
not: ["hubSolutionType|hubSiteApplication"], | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
predicates: [ | ||
{ | ||
typekeywords: { | ||
any: [ | ||
"hubSolutionType|storymap", | ||
"hubSolutionType|webmap", | ||
"hubSolutionType|dashboard", | ||
"hubSolutionType|hubpage", | ||
"hubSolutionType|webexperience", | ||
"hubSolutionType|webmappingapplication", | ||
"hubSolutionType|form", | ||
"hubSolutionType|featureservice", | ||
"Template", | ||
], | ||
}, | ||
}, | ||
], | ||
operation: "OR", | ||
}, | ||
{ | ||
predicates: [ | ||
{ | ||
typekeywords: ["hubSolutionTemplate"], | ||
}, | ||
{ | ||
type: "Solution", | ||
typekeywords: ["Template"], | ||
}, | ||
], | ||
operation: "OR", | ||
}, | ||
], | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.