rfellows commented on code in PR #11262: URL: https://github.com/apache/nifi/pull/11262#discussion_r3320209019
########## nifi-frontend/src/main/frontend/libs/shared/src/assets/themes/components/_status-variant.scss: ########## @@ -0,0 +1,116 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@use '@angular/material' as mat; + +@mixin generate-material-theme() { + :root { + // NOTE: The following styles are for the status badge and status banner components. The `.status-variant` class should only be applied to a div or span element that should adhear to the variant color and background. + .status-variant { + &.neutral { + color: var(--mat-sys-on-surface); + background-color: var(--mat-sys-surface-dim); + } + &.critical { + color: var(--mat-sys-on-error); + background-color: var(--mat-sys-error); + } + &.caution { + color: var(--nf-caution-contrast); + background-color: var(--nf-caution-default); + } + &.success { + color: var(--nf-success-contrast); + background-color: var(--nf-success-default); + } + &.info { + color: var(--nf-success-contrast); + background-color: var(--nf-success-variant); + } + + .fa { + &.neutral { + color: var(--mat-sys-on-surface); + } + + &.critical { + color: var(--mat-sys-on-error); + } + + &.caution { + color: var(--nf-caution-contrast); + } + + &.success { + color: var(--nf-success-contrast); + } + + &.info { + color: var(--nf-success-contrast); + } + } + } + } + + .darkMode { Review Comment: The `.darkMode { ... }` block on lines 69–115 is byte-for-byte identical to the `:root { ... }` block on lines 21–67 — every value uses `--mat-sys-*` or `--nf-*` custom properties, all of which are already rebound under `.darkMode` at the `material.scss` level. Duplicating the rules under a `.darkMode` selector emits the same CSS twice and doesn't change any computed values. This appears to be the most visible artifact of porting the openflow-ui runtime's per-partial pattern — runtime needs separate `.darkMode` blocks because Balto tokens sometimes need different *values* per mode at the consumer level, but NiFi's mode-aware values are reassigned at the variable level inside `material.scss`, so any rule that uses one of those custom properties is automatically mode-aware. The same redundancy exists in: - `_drag-and-drop.scss` (lines 84–106) - `_option.scss` (lines 28–32) - `_paginator.scss` (lines 27–31) - `_progress-bar.scss` (lines 47–71) - `_searchable-overlay.scss` (lines 93–107) - `_skeleton.scss` (lines 27–31) - `_tree.scss` (lines 28–32) - `_typography.scss` (lines 134–140) Suggest dropping the `.darkMode { ... }` block from each of these partials. Files where the dark-mode block is genuinely needed (different raw palette indices per mode) and should stay: `_button.scss`, `_checkbox.scss`, `_progress-spinner.scss`, `_snackbar.scss`. ########## nifi-frontend/src/main/frontend/libs/shared/src/assets/themes/components/_tree.scss: ########## @@ -0,0 +1,33 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@use '@angular/material' as mat; + +@mixin generate-material-theme() { + :root { + .mat-tree { + display: inline !important; + background-color: unset !important; + } + } + + .darkMode { Review Comment: Light/dark asymmetry: the `:root` block sets `display: inline !important;` (line 23) but the `.darkMode` block omits it — so a `mat-tree` rendered with a `.darkMode` ancestor loses the `display: inline` override. Either restore symmetry, or (preferred, see the broader `.darkMode` redundancy comment on `_status-variant.scss`) drop the `.darkMode { ... }` block entirely since both `:root` rules use no color tokens that vary by mode. ########## nifi-frontend/src/main/frontend/libs/shared/src/assets/themes/components/_date-picker.scss: ########## @@ -0,0 +1,33 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@use '@angular/material' as mat; + +@mixin generate-material-theme() { + :root { + mat-datepicker-toggle .mat-mdc-icon-button.mat-mdc-button-base.mdc-icon-button { + padding: 11px; Review Comment: The original `_app.scss` had an inline comment explaining this magic number: `padding: 11px; //center the mat-icon-button inside the date picker form field`. That comment was dropped during the move — please restore it so `11px` doesn't read as an unexplained magic number. ########## nifi-frontend/src/main/frontend/libs/shared/src/assets/themes/components/_option.scss: ########## @@ -0,0 +1,33 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@use '@angular/material' as mat; + +@mixin generate-material-theme() { + :root { + .mat-mdc-option[disabled] { Review Comment: General observation about the `.mat-mdc-option` narrowing called out in the PR description. The PR description lists narrowing `.mat-mdc-option`'s general sizing/padding (`min-height`, `padding`, font-weight, `.fa` icon sizing) from global scope to `.searchable-overlay` as an Intentional Scope Change, on the basis that the previously-global rules were "tightly coupled to the searchable-overlay pattern." That assumption appears to be incorrect empirically — testing the resulting build, the two `<mat-select>` dropdowns on the **Scheduling tab of the Processor Configuration dialog** now render with visibly different option padding/sizing than before. They aren't searchable selects and don't carry the `.searchable-overlay` class wrapper, so they no longer pick up the `min-height: 32px; padding: 8px 12px; ...` rules that were globally applied before. Almost certainly there are other surfaces in the same situation — any non-searchable `<mat-select>` / `<mat-autocomplete>` panel in the controller-services view, parameter-contexts dialog, processor properties drawer, etc. The same concern probably applies to the `.mat-mdc-form-field-icon-prefix .fa` and outlined-form-field padding that were narrowed for the same reason; an audit of `<mat-select>` usages outside `.searchable-overlay` is worth doing before merge. Two ways to fix without giving up the modularization win: 1. Re-add the general `.mat-mdc-option { min-height: 32px; padding: 8px 12px; font-weight: 400; ... }` rules to this partial's `:root` block (alongside the existing `[disabled]` rule), and let `.searchable-overlay` further narrow as needed — most of its current values are the same anyway, so the override would mostly just be reinstating the global baseline. 2. Keep `_searchable-overlay.scss` as the only owner of those rules and explicitly walk the app to apply the `.searchable-overlay` class wrapper to every panel that should pick them up — likely a much larger and riskier change than (1). (1) seems lower-risk for a refactor PR and matches the spirit of "behavior-preserving modularization." Recommend doing it before merge so we don't ship a visual regression. Before PR: <img width="1033" height="676" alt="Image" src="https://github.com/user-attachments/assets/f519563a-e656-48e4-9917-18002c9d13e3" /> After: <img width="1030" height="646" alt="Image" src="https://github.com/user-attachments/assets/a5a68f70-616e-416d-89b5-603ae2a1ecca" /> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
