Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export enum GroupNavigationConstants {
/**
* Boolean field, that is true to use default headers configuration for case view
* */
ITEM_FIELD_ID_USE_CASE_DEFAULT_HEADERS = 'use_default_headers',
ITEM_FIELD_ID_USE_CASE_DEFAULT_HEADERS = 'use_case_default_headers',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Breaking change: verify all usages and backend field names.

The constant value changed from 'use_default_headers' to 'use_case_default_headers'. This is a breaking change that will affect:

  • Backend field IDs in the data model
  • Any existing configuration or navigation items using the old field name
  • Cached or stored references to this field

Additionally, there's an inconsistency: ITEM_FIELD_ID_USE_CASE_DEFAULT_HEADERS now uses 'use_case_default_headers' (line 126), but ITEM_FIELD_ID_USE_TASK_DEFAULT_HEADERS still uses 'use_default_headers' (line 136). If this inconsistency is intentional, consider adding a comment explaining why; otherwise, align both constants.

Run the following script to check for any remaining references to the old field name:


🏁 Script executed:

#!/bin/bash
# Description: Search for references to the old field ID 'use_default_headers' in case-related contexts

# Search for the old constant value in case-related code
rg -n "use_default_headers" --type=ts -C3 | grep -i case

Length of output: 0


Run the following to check for any remaining references to the old and new field IDs across the repository:

If neither command yields hits, manually verify any external configurations or backend mappings still expecting use_default_headers.


🏁 Script executed:

#!/bin/bash
rg -n "use_default_headers" -C2
rg -n "use_case_default_headers" -C2

Length of output: 8212


Fix and align default‐headers constants

  • Change ITEM_FIELD_ID_USE_TASK_DEFAULT_HEADERS (line 136) from 'use_default_headers' to 'use_task_default_headers'.
  • Verify that updating ITEM_FIELD_ID_USE_CASE_DEFAULT_HEADERS to 'use_case_default_headers' doesn’t break existing backend/data‐model mappings or client configurations.


/**
* Text field, that contains default header metadata separated by comma for case view as a value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function navigationItemDefaultHeadersFactory(navigationItemTaskData: DataGroup[]
return undefined;
}
} catch (e) {
console.log('Error during resolving default headers', e)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Use LoggerService instead of console.log.

Direct console logging bypasses the application's logging infrastructure and may not be captured in production monitoring systems.

Consider injecting and using LoggerService:

-        console.log('Error during resolving default headers', e)
+        // Inject LoggerService as a parameter if not already available
+        loggerService.error('Error during resolving default headers', e);

Alternatively, if LoggerService cannot be injected at the factory level, consider propagating the error instead of swallowing it:

-    } catch (e) {
-        console.log('Error during resolving default headers', e)
-        return undefined;
-    }
+    } catch (e) {
+        throw new Error(`Error during resolving default headers: ${e}`);
+    }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
projects/netgrif-components-core/src/lib/utility/navigation-item-default-headers-factory.ts
around line 27, replace the direct console.log usage with the application's
LoggerService: inject LoggerService into the factory (or accept it as a
constructor/parameter) and call logger.error('Error during resolving default
headers', e) instead of console.log; if injecting LoggerService is not possible
at this factory level, do not swallow the error—rethrow or return a rejected
Promise so the caller can handle/log it via the application's logging
infrastructure.

return undefined;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="full-height transform-div custom-scrollbar"
[ngClass]="{'overflow-div': getOverflowStatus()}" fxLayout="column" fxLayoutAlign="start stretch">
<div class="full-height transform-div max-width-fix" fxLayout="column" fxLayoutAlign="start stretch">
<nc-header #header [type]="headerType" [maxHeaderColumns]="6" [responsiveHeaders]="true" [ngStyle]="{'width': getWidth()}" [hideHeaderMenu]="!headersChangeable" [showEditButton]="isMenuOptionEnabled('edit')"
<nc-header #header [type]="headerType" [maxHeaderColumns]="headersCount" [responsiveHeaders]="true" [ngStyle]="{'width': getWidth()}" [hideHeaderMenu]="!headersChangeable" [showEditButton]="isMenuOptionEnabled('edit')"
[showSortButton]="isMenuOptionEnabled('sort')" [showSearchButton]="isMenuOptionEnabled('search')"
[showTableSection]="allowTableMode" class="case-header-padding"></nc-header>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AfterViewInit, Component, Inject, ViewChild} from '@angular/core';
import {AfterViewInit, Component, Inject, Optional, ViewChild} from '@angular/core';
import {
AbstractTabbedCaseViewComponent,
AllowedNetsService,
Expand Down Expand Up @@ -85,12 +85,14 @@ export class DefaultTabbedCaseViewComponent extends AbstractTabbedCaseViewCompon
headersMode: string[];
allowTableMode: boolean;
defaultHeadersMode: HeaderMode;
headersCount: number
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider initializing headersCount at declaration.

While headersCount is always initialized in the constructor (lines 112-116), declaring it with an initial value improves code clarity and prevents potential undefined issues if the constructor logic changes.

Apply this diff:

-    headersCount: number
+    headersCount: number = 5;

Then in the constructor, you can simplify:

-        if (this._defaultHeaders) {
-            this.headersCount = this._defaultHeaders.length;
-        } else {
-            this.headersCount = 5; // 5 meta headers
-        }
+        if (this._defaultHeaders) {
+            this.headersCount = this._defaultHeaders.length;
+        }
🤖 Prompt for AI Agents
In
projects/netgrif-components/src/lib/navigation/group-navigation-component-resolver/default-components/tabbed/default-tabbed-case-view/default-tabbed-case-view.component.ts
around line 88, initialize headersCount at declaration (e.g., set to 0) to avoid
potential undefined values; then remove the explicit assignment to headersCount
in the constructor (lines ~112-116) so the constructor logic is simplified and
relies on the declared default.


constructor(caseViewService: CaseViewService,
loggerService: LoggerService,
viewIdService: ViewIdService,
overflowService: OverflowService,
@Inject(NAE_TAB_DATA) protected _injectedTabData: InjectedTabbedCaseViewDataWithNavigationItemTaskData) {
@Inject(NAE_TAB_DATA) protected _injectedTabData: InjectedTabbedCaseViewDataWithNavigationItemTaskData,
@Optional() @Inject(NAE_DEFAULT_HEADERS) protected _defaultHeaders: Array<string> | undefined) {
super(caseViewService, loggerService, _injectedTabData, overflowService, undefined, undefined, _injectedTabData.newCaseButtonConfiguration);

this.initialSearchMode = _injectedTabData.caseViewSearchTypeConfiguration.initialSearchMode;
Expand All @@ -107,6 +109,11 @@ export class DefaultTabbedCaseViewComponent extends AbstractTabbedCaseViewCompon
const viewId = viewIdService.viewId;
localStorage.setItem(viewId + '-overflowMode', 'false');
}
if (this._defaultHeaders) {
this.headersCount = this._defaultHeaders.length;
} else {
this.headersCount = 5; // 5 meta headers
}
}

ngAfterViewInit(): void {
Expand Down
Loading