Skip to content

Conversation

@jdotcms
Copy link
Contributor

@jdotcms jdotcms commented Nov 16, 2023

Adding a jsp to render a legacy custom field

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if this is not showing in the portlets in the tools and groups

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did somebody checked this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add the partial /core/dotCMS/src/main/webapp/html/common/top_inc.jsp

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not need the top_inc?

@KevinDavilaDotCMS KevinDavilaDotCMS linked an issue Nov 20, 2023 that may be closed by this pull request
4 tasks
%>

<%--
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove this comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@KevinDavilaDotCMS KevinDavilaDotCMS self-assigned this Nov 27, 2023
@KevinDavilaDotCMS KevinDavilaDotCMS marked this pull request as ready for review November 27, 2023 21:37
Comment on lines 490 to 491


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment on lines +44 to +48
this.variables = this.field.fieldVariables.reduce((result, item) => {
result[item.key] = item.value;

return result;
}, {});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using this in multiple places. Should we create a global util?

Comment on lines 57 to 68
switch (event.data.type) {
case 'turnOnFullScreen':
this.isFullscreen = true;
break;

case 'turnOffFullScreen':
this.isFullscreen = false;
break;

default:
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid the use of switch/case ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call this toggleFullScreen? and just do !... maybe?

}
},
mockProvider(DotContentTypeService),
mockProvider(DotWorkflowActionsFireService)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just check, is because the DotEditContentService uses DotWorkflowActionsFireService and you are not mocking DotEditContentService.

But now the questions here is bigger, why are you bringing all these services to the test if at first look the component you are testing here is no use to any of those, I think.

Also, I just noticed that this component is importing BlockEditorModule and DotEditContentBinaryFieldComponent, should those not be included in the DotEditContentFieldsModule as well?

Comment on lines 57 to 68
switch (event.data.type) {
case 'turnOnFullScreen':
this.isFullscreen = true;
break;

case 'turnOffFullScreen':
this.isFullscreen = false;
break;

default:
break;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call this toggleFullScreen? and just do !... maybe?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did somebody checked this?

}
},
mockProvider(DotContentTypeService),
mockProvider(DotWorkflowActionsFireService)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should talk about this in the next meeting.

data-testId="iframe"
frameborder="0"></iframe>

<dot-icon *ngIf="isFullscreen" (click)="isFullscreen = false" name="close"></dot-icon>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a <button> to make sure sematically ie clickable. We can use the primeng button with an icon https://primeng.org/button#icons

}
},
mockProvider(DotContentTypeService),
mockProvider(DotWorkflowActionsFireService)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this test all the fields? we should be testing each field independently... I might be missing something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@fmontes fmontes linked an issue Dec 5, 2023 that may be closed by this pull request
2 tasks
Comment on lines 71 to 74
providers: [
mockProvider(DotContentTypeService),
mockProvider(DotWorkflowActionsFireService)
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird to me... I can't find any relationship between DotEditContentCustomFieldComponent and this services... there have to be something leaking somewhere or I am missing something.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me what looks like that needs to be mocked is DotEditContentService which is the only service in DotEditContentCustomFieldComponent

Comment on lines +77 to +80
[FIELD_TYPES.JSON]: {
component: DotEditContentJsonFieldComponent,
declarations: [MockComponent(DotEditContentJsonFieldComponent)]
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you pass the component and then mock it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc: @rjvelazco you have more context of this case

Comment on lines 34 to 35
mockProvider(DotContentTypeService),
mockProvider(DotWorkflowActionsFireService)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remove this 2, run the tests and passed... and also to make sure it wasn't cache or anything I changed the currentContentType from test to test123 and failed.

@dotcms-sonarqube
Copy link

Quality Gate passed Quality Gate passed

The SonarQube Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
0.0% 0.0% Coverage on New Code
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@dotcms-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@fmontes fmontes merged commit b6c1b74 into master Dec 5, 2023
@fmontes fmontes deleted the issue-26696-legacy-custom-field branch December 5, 2023 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit Content: Create a Component to Render Custom Field (Legacy) Edit Content: Create a jsp file to render a specific custom field

8 participants