diff --git a/java/code/src/com/suse/manager/webui/Router.java b/java/code/src/com/suse/manager/webui/Router.java index 19adc6f1a3ae..ffc0dd911478 100644 --- a/java/code/src/com/suse/manager/webui/Router.java +++ b/java/code/src/com/suse/manager/webui/Router.java @@ -59,6 +59,7 @@ import com.suse.manager.webui.controllers.SetController; import com.suse.manager.webui.controllers.SsmController; import com.suse.manager.webui.controllers.StatesAPI; +import com.suse.manager.webui.controllers.StorybookController; import com.suse.manager.webui.controllers.SubscriptionMatchingController; import com.suse.manager.webui.controllers.SystemsController; import com.suse.manager.webui.controllers.TaskoTop; @@ -249,6 +250,9 @@ public void init() { // Saltboot SaltbootController.initRoutes(); + // Storybook + StorybookController.initRoutes(jade); + // if the calls above opened Hibernate session, close it now HibernateFactory.closeSession(); } diff --git a/java/code/src/com/suse/manager/webui/controllers/StorybookController.java b/java/code/src/com/suse/manager/webui/controllers/StorybookController.java new file mode 100644 index 000000000000..2d6987fc6bae --- /dev/null +++ b/java/code/src/com/suse/manager/webui/controllers/StorybookController.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 SUSE LLC + * + * This software is licensed to you under the GNU General Public License, + * version 2 (GPLv2). There is NO WARRANTY for this software, express or + * implied, including the implied warranties of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 + * along with this software; if not, see + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * + * Red Hat trademarks are not licensed under GPLv2. No permission is + * granted to use or replicate Red Hat trademarks that are incorporated + * in this software or its documentation. + */ + +package com.suse.manager.webui.controllers; + +import static com.suse.manager.webui.utils.SparkApplicationHelper.withCsrfToken; +import static com.suse.manager.webui.utils.SparkApplicationHelper.withUser; +import static com.suse.manager.webui.utils.SparkApplicationHelper.withUserPreferences; +import static spark.Spark.get; + +import com.redhat.rhn.domain.user.User; + +import java.util.HashMap; + +import spark.ModelAndView; +import spark.Request; +import spark.Response; +import spark.template.jade.JadeTemplateEngine; + +public class StorybookController { + private StorybookController() { } + + /** + * Initialize routes + * + * @param jade the Jade engine to use to render the pages + */ + public static void initRoutes(JadeTemplateEngine jade) { + get("/manager/storybook", + withUserPreferences(withCsrfToken(withUser(StorybookController::view))), jade); + } + + /** + * Returns the ui debug page + * + * @param req the request object + * @param res the response object + * @param user the authorized user + * @return the model and view + */ + public static ModelAndView view(Request req, Response res, User user) { + return new ModelAndView(new HashMap(), "templates/storybook/storybook.jade"); + } +} diff --git a/java/code/src/com/suse/manager/webui/templates/storybook/storybook.jade b/java/code/src/com/suse/manager/webui/templates/storybook/storybook.jade new file mode 100644 index 000000000000..80df7429d425 --- /dev/null +++ b/java/code/src/com/suse/manager/webui/templates/storybook/storybook.jade @@ -0,0 +1,10 @@ +include ../common.jade + +#storybook + +script(type='text/javascript'). + window.csrfToken = "#{csrf_token}"; + +script(type='text/javascript'). + spaImportReactPage('storybook') + .then(function(module) { module.renderer('storybook') }); diff --git a/java/code/src/com/suse/manager/webui/utils/ViewHelper.java b/java/code/src/com/suse/manager/webui/utils/ViewHelper.java index 03c9859d2560..bf197a37fbdb 100644 --- a/java/code/src/com/suse/manager/webui/utils/ViewHelper.java +++ b/java/code/src/com/suse/manager/webui/utils/ViewHelper.java @@ -68,14 +68,13 @@ public enum ViewHelper { "/rhn/account/EditAddress.do", "/rhn/multiorg/OrgConfigDetails.do", "/rhn/manager/notification-messages", - "rhn/channels/software/Search.do", + "/rhn/channels/software/Search.do", "/rhn/activationkeys/List.do", "/rhn/manager/systems/list/all", "/rhn/manager/contentmanagement/projects", "/rhn/kickstart/cobbler/DefaultSnippetList.do", "/rhn/systems/details/packages/PackageList.do", "/rhn/software/channels/All.do", - "rhn/channels/software/Search.do", "/rhn/manager/systems/ssm/coco/settings", "/rhn/systems/ssm/audit/ScheduleXccdf.do", "/rhn/systems/ssm/provisioning/PowerManagementConfiguration.do", @@ -103,7 +102,16 @@ public enum ViewHelper { "/rhn/manager/systems/details/recurring-actions", "/rhn/manager/cm/build", "/rhn/admin/ScheduleDetail.do", - "/rhn/manager/systems/cmd" + "/rhn/manager/systems/cmd", + "/rhn/kickstart/KickstartIpRanges.do", + "/rhn/channels/manage/repos/RepoCreate.do", + "/rhn/systems/details/Overview", + "/rhn/manager/formula-catalog", + "/rhn/errata/manage/CloneErrata.do", + "/rhn/admin/setup/ProxySettings.do", + "/rhn/admin/setup/MirrorCredentials.do", + "/rhn/manager/admin/setup/payg", + "/rhn/manager/storybook" ); ViewHelper() { } diff --git a/java/code/webapp/WEB-INF/pages/admin/setup/mirror-credentials-list.jsp b/java/code/webapp/WEB-INF/pages/admin/setup/mirror-credentials-list.jsp index 3f13a425eeb2..b31537d78888 100644 --- a/java/code/webapp/WEB-INF/pages/admin/setup/mirror-credentials-list.jsp +++ b/java/code/webapp/WEB-INF/pages/admin/setup/mirror-credentials-list.jsp @@ -12,7 +12,7 @@