Do not include a component sling exporter data in page sling exporter - AEM - jackson

We have developed a sling exporter for our Page component which exports all the data for the child components as well (using the ContainerExporter method getExportedItems). I don't want to include some components in the data, so, for that I have mentioned #JsonIgnoreType on the model class of the component which is under a parsys/responsivegrid under my page's jcr:content. But still, the component's data is getting included. How can I skip a component completely? Is there any annotation available which I can add to my class?

Related

Spartacus | Best practise to add some details in existing component where outletRef not available

This question is more on best practise for including some more details in existing component where outlet ref is not available.
For ex. In checkout, during review-order step, I need to add some custom details with delivery-mode and i want to use the complete component as is.
Do i need to
copy all the html & component logic from spartacus code
create my custom component and use all copied code
add the little detail with my delivery mode section
replace the existing component by my custom component using COMPONENT as outlet-ref
There is lot of duplicate code to implement this.
Is there a better way like just inherit all the component detail by importing the component in my module and override the specific section (i am not sure but i was thinking that would be helpful. ).
Here is what I would do:
create new component
copy all the html from spartacus to this component
extend the original component instead of copying all the logic
replace component in configuration
We're working on better way to extend templates, but that's not gonna be available soon. In the approach I recommended when updating spartacus you would only need to validate if the template changed, as the component logic will be automatically updated when you extend it.

SAP Spartacus - How to show the custom components in Spartacus UI

I have a custom component to display the images as tile in my UI.
I am getting the response as follows for the created custom component from the backend.
components: "Test1Component Test2Component Test3Component Test4Component Test5Component Test6Component Test7Component Test8Component"
container: "false"
modifiedtime: "2020-09-29T20:52:40.454+05:30"
name: "Tiles Component"
typeCode: "TileCollectionComponent"
uid: "TilesCollectionComponent"
uuid: "eyJpdGVtSWQiOiJUaWxlc0NvbGxlY3Rpb25Db21wb25lbnQiLCJjYXRhbG9nSWQiOiJhbHNheWVyLXNwYUNvbnRlbnRDYXRhbG9nIiwiY2F0YWxvZ1ZlcnNpb24iOiJPbmxpbmUifQ=="
How can I retrieve the data and show it in the UI.
The component data indicates that this component is a so-called container component. Container components do only response the component UIDs. This is a bit unfortunate, as you'd need to interact with the cms service in Spartacus to resolve the component types. before you can start rendering them.
We do have an example in our code base that you can use to render these nested components. You see in https://github.com/SAP/spartacus/blob/532603fbcfcf7c21c3abbf4e342fcda03652b61e/projects/storefrontlib/src/cms-components/content/banner-carousel/banner-carousel.component.ts#L25 that we're taken the component data and switchMap this to an array of CmsComponentData. (using cmsService.getComponentData). Spartacus will merge the different parallel requests in the loop automatically to a single backend for the component data.
You can use the CmsComponentData array in an ngFor loop, and leverage the cxComponentWrapper to iterate over all the CmsComponentData objects. The cxComponentWrapper will map to the right component and adds other stuff like smartedit integration.
<ng-container [cxComponentWrapper]="component"></ng-container>
Although this is all available, your question make me think to build a more easy solution that does the heavy lifting.

Nuxt layout and getting static content

I have a header on every page thats generally static — besides the button that needs to update based on the page. Ideally I would like to have a variable called link in static/content/xxx
and then to call it from layouts/default. However it does not seem that I have access to any of the variables in my static content. Being new to vue and nuxt I was hoping for some guidance. I tried using asyncData however, it doesn't seem to get called at all in my layout.
a layout is a static wrapper that will wrap your main content. the main idea behind using layout is to not write the same content again and again. If you work with Vue only project than this type of functionality can be accessed by the using the child routes.
just add the common layout as the parent Component and the changed or different content as the child components.
back to the point, if you have different button content depending upon the pages than don't place it in the layout instead pass through the components individually.
whereas the static folder in the nuxt application holds the data that should not be changed such as the css files or external script files just take and example of bootstrap and jquery these are the libraries that are embeded in the application, instead of changing their internals we just use them. this type of content is placed in static directory (folder)
I hope it helps

Lazy loading components in angular2

I am having three components that load simultaneously when angular app load. Is there any way that we can load component only when specific route navigate to.
This is what the Angular 2 Router is all about. I strongly suggest you read the documentation on Router thoroughly.
https://angular.io/docs/ts/latest/guide/router.html
The steps you need to do are roughly the following:
Create a main component (ex: my-app) for your app with a <router-outlet> placeholder within its template.
Create your routes
Register those routes in your main application module
Add a reference to your main component (<my-app></my-app>) in your index.html file
Open up one of the URLs you registered as a route and the component you associated with that route will get created and inserted in place of your <router-outlet> element.

Aurelia: Deriving a component from another and reusing HTML

In Aurelia, how do I derive a component from another component reusing the HTML view from the source component?
I have a component BarGraph that renders simple bar graphs. This component has files bar-graph.js and bar-graph.html. I want to derive a set of components from BarGraph. Each *BarGraph class will have custom logic, but all of the derived components will have the same HTML as the original component. I want to store the HTML for the components in one file and reuse it in each *BarGraph class.
You can use #useView. For example:
import {useView} from 'aurelia-framework';
#useView('./bar-graph.html')
export class AnotherBarGraph {
// Your logic here
}
Documentation here
EDIT: Extending custom element using inheritance is currently not supported. An important point is "Inheritance of Bindables doesn't work". See this issue.