Skip to content

Commit

Permalink
fix(): update recommended templates slightly in initiative template w…
Browse files Browse the repository at this point in the history
…orkspace (#1280)

* 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

* fix(): update query and update recommendedTemplates section

* test(): update tests

* test(): fix where section goes

* refactor(): change to pickerTitle from modalTitle
  • Loading branch information
jordantsanz authored Oct 17, 2023
1 parent eea4368 commit f7fd636
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 214 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,15 @@ export const buildUiSchema = async (
},
},
getThumbnailUiSchemaElement(i18nScope, entity),
],
},
{
type: "Section",
labelKey: `${i18nScope}.fields.recommendedTemplates.label`,
elements: [
{
type: "Control",
scope: "/properties/recommendedTemplates",
labelKey: `${i18nScope}.fields.recommendedTemplates.label`,
options: {
control: "hub-field-input-gallery-picker",
targetEntity: "item",
Expand All @@ -112,6 +117,9 @@ export const buildUiSchema = async (
],
canReorder: false,
linkTarget: "workspaceRelative",
pickerTitle: {
labelKey: `${i18nScope}.fields.recommendedTemplates.pickerTitle`,
},
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ export const getRecommendedTemplatesCatalog = (
user: IUser,
i18nScope: string
) => {
const catalogNames: WellKnownCatalog[] = [
"myContent",
"favorites",
"organization",
"world",
];
const catalogNames: WellKnownCatalog[] = ["myContent", "organization"];

const catalogs = catalogNames.map((name: WellKnownCatalog) => {
const opts = { user };
Expand Down Expand Up @@ -46,39 +41,16 @@ const getRecommendedTemplatesCollection = (
{
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",
],
},
type: "Solution",
},
],
operation: "OR",
},
{
predicates: [
{
typekeywords: ["hubSolutionTemplate"],
},
{
type: "Solution",
typekeywords: ["Template"],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,16 @@ describe("buildUiSchema: initiative template edit", () => {
messages: [],
},
},
],
},
{
type: "Section",
labelKey: `some.scope.fields.recommendedTemplates.label`,
elements: [
{
type: "Control",
scope: "/properties/recommendedTemplates",
labelKey: `some.scope.fields.recommendedTemplates.label`,

options: {
control: "hub-field-input-gallery-picker",
targetEntity: "item",
Expand All @@ -124,6 +130,9 @@ describe("buildUiSchema: initiative template edit", () => {
],
canReorder: false,
linkTarget: "workspaceRelative",
pickerTitle: {
labelKey: `some.scope.fields.recommendedTemplates.pickerTitle`,
},
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,108 +32,17 @@ describe("getRecommendedTemplatesCatalog", () => {
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",
},
],
},
},
],
},
{
schemaVersion: 1,
title:
"{{initiativeTemplate.fields.recommendedTemplates.catalog.favorites:translate}}",
scopes: {
item: {
targetEntity: "item",
filters: [
{
predicates: [{ group: "456abc" }],
},
],
},
},
collections: [
{
targetEntity: "item",
key: "recommendedTemplates",
label: "some.scope.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"],
},
],
Expand Down Expand Up @@ -168,108 +77,17 @@ describe("getRecommendedTemplatesCatalog", () => {
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",
},
],
},
},
],
},
{
schemaVersion: 1,
title:
"{{initiativeTemplate.fields.recommendedTemplates.catalog.world:translate}}",
scopes: {
item: {
targetEntity: "item",
filters: [
{
predicates: [{ type: { not: ["code attachment"] } }],
},
],
},
},
collections: [
{
targetEntity: "item",
key: "recommendedTemplates",
label: "some.scope.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"],
},
],
Expand Down

0 comments on commit f7fd636

Please sign in to comment.