Skip to content
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

Unable to use Templates across Multiple Sites #30660

Open
patrick-schweiger opened this issue Nov 14, 2024 · 8 comments · May be fixed by #31086
Open

Unable to use Templates across Multiple Sites #30660

patrick-schweiger opened this issue Nov 14, 2024 · 8 comments · May be fixed by #31086

Comments

@patrick-schweiger
Copy link

Parent Issue

No response

Problem Statement

This was discovered in a meeting with VOXX when trying to show them how to share templates across multiple sites. However, this would also impact other multi-tenant clients. Looking both at demo and Voxx’s instances (both on 24.11.11) we noticed we no longer have the “all sites” dropdown option when trying to select templates living on other sites.

Steps to Reproduce

For example, on demo we created a site “Pagecopycreatetest” and a “test” template
If we go to the “demo” host and try to create a page, we do not have an option to select “all sites” and are restricted to using only templates on my current site.

Acceptance Criteria

There should be the ability to drop down and select templates across sites.

dotCMS Version

The ability to select templates across sites exists in the 24.04 LTS so this must be a recent issue.

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

https://dotcms.slack.com/archives/C028Z3R2D/p1731608383050379

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

@m27iu4
Copy link

m27iu4 commented Dec 11, 2024

https://dotcms.freshdesk.com/a/tickets/28692 -> problem reported by another customer

@john-thomas-dotcms
Copy link
Contributor

@patrick-schweiger I'm not clear where you're expecting to see the selection.

Can you please give us clear steps to reproduce? Meaning:

  1. Open screen X.
  2. Click field Y and select option Z
  3. etc.

@jdotcms
Copy link
Contributor

jdotcms commented Dec 11, 2024

I have confirmed this issue, steps to reproduce

  1. Create a new site
  2. Select the new site and create a template into this new site
  3. Get back to the initial site (default for instance)
  4. try to create a page
  5. when selecting the template for the page you are able to see the system template and only the templates for the current host, the template created for the new site is not available.

@wezell
Copy link
Contributor

wezell commented Dec 11, 2024

I think we are going to need a quick UI mockup to fix this properly

@jdotcms
Copy link
Contributor

jdotcms commented Dec 11, 2024

the issue is here:
https://github.com/dotCMS/core/blob/main/dotCMS/src/main/java/com/dotcms/rest/api/v1/template/TemplateResource.java#L140

Basically there is a fallback when the hostid is null, blank or 404, the fallback in these situations will retrieve always the current host.

Probably we can do two things:

  1. send a by pass such as hostId=all that retrieves all of the hosts
  2. if the host is null, means retrieves everything instead of retrieve the current host templates

For references the call may by the UI looks such as

https://demo.dotcms.com/api/v1/templates/?filter=&page=0&per_page=1000&orderby=&host=3ba99f0e8ab5778b6139c9c6a6b742b9

@fmontes
Copy link
Member

fmontes commented Dec 13, 2024

@wezell @john-thomas-dotcms @jdotcms we use to have the selector options like this

CleanShot 2024-12-13 at 07 31 52@2x

Which included the "All Sites" functionality.

@rjvelazco
Copy link
Contributor

rjvelazco commented Jan 7, 2025

What is happening?

We lost this feature/functionality in this PR: Issue 28563 - Removing template AJAX and JS dependencies (#28618).

The relevant code where this functionality was implemented can be found here: TemplateAjax.java (Deleted).

Class: TemplateAjax
Function: fetchTemplates
Code Snippet:

//...
Template t = new Template();
t.setOwner(user.getUserId());
t.setModUser(user.getUserId());
t.setInode("0");
t.setTitle("--- " + LanguageUtil.get(user, "All-Hosts") + " ---");
t.setIdentifier("0");
fullListTemplates.add(t);
totalTemplates.add(t);
countF = count - 1;
//...

Possible Steps fix:

  • check if the /api/v1/templates endpoint can retrieve all templates regardless of the host
  • Update the templateFetchParams with the necessary params to achieve that.
  • Add an All Sites label to the dropdown as @fmontes show here. (It was deleted with the file)

How the dropdown currently work

We now use the /api/v1/templates endpoint to fetch templates. However, I'm not sure if this endpoint can retrieve all templates regardless of the host.

File: template_custom_field.vtl#L183-L195
Code Snippet:

//...
const templateFetchParams = {
    query: {
        fullTitle: '*'
    },
    queryOptions: {},
    start: 0,
    count: 1000,
    sort: [],
    onComplete: onTemplateFetchComplete
};

templateStore.fetch(templateFetchParams);
//...

@nollymar nollymar self-assigned this Jan 8, 2025
@nollymar nollymar moved this from Next 1-3 Sprints to In Progress in dotCMS - Product Planning Jan 8, 2025
Copy link

github-actions bot commented Jan 8, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Review
Development

Successfully merging a pull request may close this issue.

9 participants