New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#22418 Page Manager (first attempt) - Create Favorite Page #22424
Conversation
jdotcms
commented
Jun 16, 2022
•
edited by alfredo-dotcms
edited by alfredo-dotcms
- Adding permissions to the workflow
- Creating favorite page contentlet functionality
… into issue-22418-wfapi-permission
… into issue-22418-wfapi-permission
… into issue-22418-wfapi-permission
bea8c96
to
cc3f200
Compare
|
82137ca
to
d7f940e
Compare
.../app/portlets/dot-edit-page/components/dot-favorite-page/dot-favorite-page.component.spec.ts
Show resolved
Hide resolved
| form: FormGroup; | ||
| isFormValid$: Observable<boolean>; | ||
| pageRenderedHtml: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| loading: boolean; | ||
| closeDialog: boolean; | ||
| } | ||
|
|
||
| export const enum LoadingState { | ||
| INIT = 'INIT', | ||
| LOADING = 'LOADING', | ||
| LOADED = 'LOADED' | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should unify LoadingState and loading being a boolean, makes no sense to have two, check this post: https://indepth.dev/posts/1033/ngrx-how-and-where-to-handle-loading-and-error-states-of-ajax-calls
| // This is needed to wait until the Web Component is rendered | ||
| setTimeout(() => { | ||
| const dotHtmlToImageElement = document.querySelector('dot-html-to-image'); | ||
| dotHtmlToImageElement.addEventListener('pageThumbnail', (event: CustomEvent) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you testing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| }, '*') | ||
| }); | ||
| }).catch(function (error) { | ||
| console.error('oops, something went wrong!', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
improve this message ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we show a popup? So the user can see the message. We can also use an alert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| forkJoin([this.dotRolesService.search(), this.dotCurrentUser.getCurrentUser()]) | ||
| .pipe(take(1)) | ||
| .subscribe(([roles, currentUser]: [DotRole[], DotCurrentUser]): void => { | ||
| console.log(roles, currentUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| pageState: DotPageRenderState; | ||
| } | ||
|
|
||
| export interface DotFavoritePageFormData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move these interfaces to other file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is only used on this component due to its props and form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then export is not need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then export is not need it.
it's also used on the STORE (that's why the export), still don't think it's needed to be put on a separate file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oidacra and I are working in a structure for this... will be out soon.
| } | ||
| }); | ||
|
|
||
| // This is needed to wait until the Web Component is rendered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ca we use ngAfterViewInit ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| @@ -5,6 +5,11 @@ | |||
| [url]="pageState.page.pageURI" | |||
| [apiLink]="apiLink" | |||
| ></dot-edit-page-info> | |||
| <!-- <dot-icon-button | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is hidden while it gets ready for release
| forkJoin([this.dotRolesService.search(), this.dotCurrentUser.getCurrentUser()]) | ||
| .pipe(take(1)) | ||
| .subscribe(([roles, currentUser]: [DotRole[], DotCurrentUser]): void => { | ||
| console.log(roles, currentUser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console.log
| }); | ||
|
|
||
| // This is needed to wait until the Web Component is rendered | ||
| setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can use requestAnimationFrame instead of setTimeout. doc
| }, '*') | ||
| }); | ||
| }).catch(function (error) { | ||
| console.error('oops, something went wrong!', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we show a popup? So the user can see the message. We can also use an alert.
4730bca
to
93d651e
Compare
| pageState: DotPageRenderState; | ||
| } | ||
|
|
||
| export interface DotFavoritePageFormData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then export is not need it.
| isAdmin: props.pageState.user.admin, | ||
| imgWidth: parseInt(props.pageState.params.viewAs.device?.cssWidth, 10) || 1024, | ||
| imgHeight: | ||
| parseInt(props.pageState.params.viewAs.device?.cssHeight, 10) || | ||
| (parseInt(props.pageState.params.viewAs.device?.cssWidth, 10) || 1024) / | ||
| IMG_RATIO_43 | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still think that is an overhead send the pageState to use 3 props.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed!
...src/app/portlets/dot-edit-page/components/dot-favorite-page/store/dot-favorite-page.store.ts
Show resolved
Hide resolved
| <dot-icon-button | ||
| data-testId="addFavoritePageButton" | ||
| icon="star_outline" | ||
| (click)="addFavoritePage()" | ||
| ></dot-icon-button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to hide this at this point no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
|
||
| doc.body.append(scriptLib); | ||
|
|
||
| window.addEventListener('message', (event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at this video: https://youtu.be/YDU_3WdfkxA?t=681
I think this code will result in the same issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
5e959ca
to
94b06c7
Compare