Skip to content

Commit

Permalink
feat(): initiative template workspace (#1246)
Browse files Browse the repository at this point in the history
* feat(): initial initiative template entity scaffolding

* feat(): more scaffolding with crud and editor functionality

* feat(): add schema and uiSchema logic for initiative templates

* fix(): export correctly

* test(): add tests around entity editor and fetch/update

* test(): add testing

* feat(): add more scaffolding and the assoc testing

* fix(): correct types on fromEditor

* fix(): fix type error on create

* fix(): update tests with async

* test(): fix entityEditorSchemas test

* test(): continue updating tests

* test(): update imports to get spies working

* test(): add catalog to default

* test(): fix branch coverage

* test(): additional testing

* test(): additional testing

* feat(): business logic

* feat(): add initiative template permissions to hub permissions

* fix(): typo

* feat(): add ui schema for initiative template edit

* fix(): pr feedback

* feat(): rest of pr feedback

* feat(): gate initiative template to alpha

* test(): update uischema test

* feat(): add dashboard pane

* feat(): remove alpha from initiativetemplate business rules

* feat(): update permissions

* feat(): add format url

* feat(): update edit uiSchema

* feat(): reimplement alpha gating

* test(): update uischema test

* feat(): utilize compute links

* fix(): url formatting

* test(): update uischema test
  • Loading branch information
jordantsanz authored Oct 3, 2023
1 parent cbdcbe4 commit cb385e5
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const InitiativeTemplatePermissions = [
"hub:initiativeTemplate:edit",
"hub:initiativeTemplate:view",
"hub:initiativeTemplate:workspace:overview",
"hub:initiativeTemplate:workspace:dashboard",
"hub:initiativeTemplate:workspace:details",
"hub:initiativeTemplate:workspace:collaborators",
"hub:initiativeTemplate:workspace:settings",
Expand Down Expand Up @@ -51,10 +52,20 @@ export const InitiativeTemplatePermissionPolicies: IPermissionPolicy[] = [
authenticated: true,
entityEdit: true,
},
{
permission: "hub:initiativeTemplate:delete",
dependencies: ["hub:initiativeTemplate"],
authenticated: true,
entityOwner: true,
},
{
permission: "hub:initiativeTemplate:workspace:overview",
dependencies: ["hub:initiativeTemplate:view"],
},
{
permission: "hub:initiativeTemplate:workspace:dashboard",
dependencies: ["hub:initiativeTemplate:edit"],
},
{
permission: "hub:initiativeTemplate:workspace:details",
dependencies: ["hub:initiativeTemplate:edit"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@ export const InitiativeTemplateSchema: IConfigurationSchema = {
...HubItemEntitySchema,
properties: {
...HubItemEntitySchema.properties,
previewUrl: {
type: "string",
if: { minLength: 1 },
then: { format: "uri" },
},
},
// we have to do this to allow the format: url to pass through
} as IConfigurationSchema;
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,59 @@ export const buildUiSchema = async (
],
},
},
{
type: "Control",
scope: "/properties/previewUrl",
labelKey: `${i18nScope}.fields.previewUrl.label`,
options: {
helperText: {
labelKey: `${i18nScope}.fields.previewUrl.helperText`,
},
messages: [
{
type: "ERROR",
keyword: "if",
hidden: true,
},
],
},
},
{
type: "Control",
scope: "/properties/summary",
labelKey: `${i18nScope}.fields.summary.label`,
options: {
control: "hub-field-input-input",
type: "textarea",
},
},
{
type: "Control",
scope: "/properties/description",
labelKey: `${i18nScope}.fields.description.label`,
options: {
control: "hub-field-input-input",
type: "textarea",
},
},
{
type: "Control",
scope: "/properties/_thumbnail",
labelKey: `${i18nScope}.fields._thumbnail.label`,
options: {
control: "hub-field-input-image-picker",
imgSrc: entity.thumbnailUrl,
maxWidth: 727,
maxHeight: 484,
aspectRatio: 1.5,
helperText: {
labelKey: `${i18nScope}.fields._thumbnail.helperText`,
},
sizeDescription: {
labelKey: `${i18nScope}.fields._thumbnail.sizeDescription`,
},
},
},
],
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,59 @@ describe("buildUiSchema: initiative template edit", () => {
],
},
},
{
type: "Control",
scope: "/properties/previewUrl",
labelKey: `some.scope.fields.previewUrl.label`,
options: {
helperText: {
labelKey: "some.scope.fields.previewUrl.helperText",
},
messages: [
{
type: "ERROR",
keyword: "if",
hidden: true,
},
],
},
},
{
type: "Control",
scope: "/properties/summary",
labelKey: `some.scope.fields.summary.label`,
options: {
control: "hub-field-input-input",
type: "textarea",
},
},
{
type: "Control",
scope: "/properties/description",
labelKey: `some.scope.fields.description.label`,
options: {
control: "hub-field-input-input",
type: "textarea",
},
},
{
type: "Control",
scope: "/properties/_thumbnail",
labelKey: `some.scope.fields._thumbnail.label`,
options: {
control: "hub-field-input-image-picker",
imgSrc: "https://some-thumbnail-url.com",
maxWidth: 727,
maxHeight: 484,
aspectRatio: 1.5,
helperText: {
labelKey: "some.scope.fields._thumbnail.helperText",
},
sizeDescription: {
labelKey: "some.scope.fields._thumbnail.sizeDescription",
},
},
},
],
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ describe("projects: computeProps:", () => {
expect(chk.features?.settings).toBeFalsy();
expect(spy.calls.argsFor(0)[0]).toEqual({ details: true });
});

it("generates a links hash", () => {
const computeLinksSpy = spyOn(
computeLinksModule,
Expand Down

0 comments on commit cb385e5

Please sign in to comment.