Skip to content

Remove dead maintenance mode code from SettingsView#151

Merged
vharseko merged 3 commits into
masterfrom
copilot/remove-dead-code-settings-view
Apr 8, 2026
Merged

Remove dead maintenance mode code from SettingsView#151
vharseko merged 3 commits into
masterfrom
copilot/remove-dead-code-settings-view

Conversation

Copilot AI commented Apr 8, 2026

Copy link
Copy Markdown
Contributor
  • Add "Portions copyright 2026 3A Systems, LLC" to SettingsView.js copyright header
  • Add "Portions copyright 2026 3A Systems, LLC" to SettingsTemplate.html copyright header
Original prompt

Problem

The System Preferences page (#settings/) makes a POST /openidm/maintenance?_action=status REST call in SettingsView.js on every page load. This call:

  1. Causes a "Not found error." alert banner when the maintenance endpoint returns 404 (e.g., in CI environments where the maintenance service isn't registered), because unlike ConfigDelegate, this call doesn't have errorsHandlers for 404.
  2. Is completely dead code — the Update functionality in UpdateView.js (lines 70-112) is already fully commented out, so even if maintenance mode is detected, the Update tab renders nothing useful.

This breaks the Playwright smoke test Configure dropdown - System Preferences sub-item navigates correctly in PR #145.

Required Changes

1. openidm-ui/openidm-ui-admin/src/main/js/org/forgerock/openidm/ui/admin/settings/SettingsView.js

  • Remove the AbstractDelegate import (no longer needed)
  • Remove the UpdateView import (no longer needed)
  • Remove the entire maintenanceModeDelegate.serviceCall block (lines 53-71) that does POST /openidm/maintenance?_action=status
  • Remove UpdateView.render({step: "version"}, ...) call (line 80-82)
  • Remove all maintenanceMode conditionals — just always render AuditView, SelfServiceView, EmailConfigView
  • Keep the tabdrop() call but move it out of the UpdateView callback
  • The render function should simplify to:
render: function(args, callback) {
    this.data.tabName = args[0] || "audit";

    this.parentRender(_.bind(function() {
        AuditView.render();
        SelfServiceView.render();
        EmailConfigView.render({}, _.noop);

        this.$el.find(".nav-tabs").tabdrop();

        if (callback) {
            callback();
        }
    }, this));
},

2. openidm-ui/openidm-ui-admin/src/main/resources/templates/admin/settings/SettingsTemplate.html

  • Remove the Update tab <li> element (line 26-28)
  • Remove the #updateContainer div (line 38)
  • Remove #install div (line 45)
  • Remove all {{#if maintenanceMode}}disabled{{/if}} conditionals from the remaining tab <li> elements
  • The template should become:
<!-- Copyright 2016 ForgeRock AS.
	License terms: https://forgerock.org/cddlv1-0/ -->
<div id="settingsBody">

    <div class="container">
        <div class="page-header">
            <h1>{{t "config.AppConfiguration.Navigation.links.systemPref"}}</h1>
        </div>
    </div>

    <div id="settingsTabs" class="tab-menu">
        <div class="container">
            <ul class="nav nav-tabs">
                <li class="{{#sw tabName "audit"}}active{{/sw}}">
                <a data-toggle="tab" data-route="audit" href="#auditContainer">{{t "templates.audit.audit"}}</a>
                </li>

                <li class="{{#sw tabName "selfService"}}active{{/sw}}">
                <a data-toggle="tab" data-route="selfService" href="#selfServiceContainer">{{t "templates.selfService.title"}}</a>
                </li>

                <li class="{{#sw tabName "email"}}active{{/sw}}">
                <a data-toggle="tab" data-route="email" href="#emailContainer">{{t "templates.emailConfig.title"}}</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="container">
        <div class="tab-content" id="settings">
            <div id="auditContainer" class="tab-pane{{#sw tabName "audit"}} active{{/sw}}" role="tabpanel"></div>
            <div id="selfServiceContainer" class="tab-pane{{#sw tabName "selfService"}} active{{/sw}}" role="tabpanel"></div>
            <div id="emailContainer" class="tab-pane{{#sw tabName "email"}} active{{/sw}}" role="tabpanel"></div>
        </div>
    </div>

</div>

Important Notes

  • Do NOT modify any test files — the fix is in the application code itself
  • Do NOT modify UpdateView.js — it simply won't be imported anymore
  • The socialContainer div in the template can also be removed as it has no corresponding view being rendered

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: проанализируй причину ошибки в PR

Assistant: ## Анализ причины ошибки

Тест на строке 209 переходит на страницу System Preferences (#settings/), и на странице появляется видимый alert с текстом "Not found error." (виден как на скриншоте, так и в page snapshot):

- alert [ref=e2]:
    - text: Not found error.

Это розовый баннер .alert-danger на скриншоте. Страница System Preferences при этом загрузилась корректно (заголовок "System Preferences", вкладки Audit/Self-Service UI/Email/Update отображаются), но сервер вернул ошибку "Not found" для одного из REST-запросов при загрузке конфигурации (скорее всего, отсутствует какой-то конфиг-ресурс в тестовой среде).

Функция assertNoErrors (строка 44) ждёт максимум 3 секунды для авто-скрытия .alert-danger, но этот баннер не скрывается — он остаётся видимым, и visibleErrors становится 1 вместо ожидаемого 0.

#...

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Remove dead code and unused imports in SettingsView Remove dead maintenance mode code from SettingsView Apr 8, 2026
Copilot AI requested a review from vharseko April 8, 2026 11:54
@vharseko vharseko marked this pull request as ready for review April 8, 2026 12:37
@vharseko vharseko requested review from maximthomas and removed request for vharseko April 8, 2026 12:38
@vharseko vharseko merged commit 261adbd into master Apr 8, 2026
@vharseko vharseko deleted the copilot/remove-dead-code-settings-view branch April 8, 2026 13:10
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.

3 participants