Skip to content

Commit

Permalink
fix(cspell): typo spelling :-)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-rocket committed Aug 29, 2024
1 parent 4085a9a commit 29a4b2d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class JobEmployeeComponent extends PaginationFilterBaseComponent implemen
registerDataTableColumns(_pageDataTableRegistryService: PageDataTableRegistryService): void {
// Register the data table column
_pageDataTableRegistryService.registerPageDataTableColumn({
datatableId: 'job-employee', // The identifier for the data table location
dataTableId: 'job-employee', // The identifier for the data table location
columnId: 'name', // The identifier for the column
order: 0, // The order of the column in the table
title: () => this.getTranslation('JOB_EMPLOYEE.EMPLOYEE'), // The title of the column
Expand All @@ -163,7 +163,7 @@ export class JobEmployeeComponent extends PaginationFilterBaseComponent implemen

// Register the data table column
_pageDataTableRegistryService.registerPageDataTableColumn({
datatableId: 'job-employee', // The identifier for the data table location
dataTableId: 'job-employee', // The identifier for the data table location
columnId: 'availableJobs', // The identifier for the column
order: 1, // The order of the column in the table
title: () => this.getTranslation('JOB_EMPLOYEE.AVAILABLE_JOBS'), // The title of the column
Expand All @@ -176,7 +176,7 @@ export class JobEmployeeComponent extends PaginationFilterBaseComponent implemen

// Register the data table column
_pageDataTableRegistryService.registerPageDataTableColumn({
datatableId: 'job-employee', // The identifier for the data table location
dataTableId: 'job-employee', // The identifier for the data table location
columnId: 'appliedJobs', // The identifier for the column
order: 2, // The order of the column in the table
title: () => this.getTranslation('JOB_EMPLOYEE.APPLIED_JOBS'), // The title of the column
Expand All @@ -189,7 +189,7 @@ export class JobEmployeeComponent extends PaginationFilterBaseComponent implemen

// Register the data table column
_pageDataTableRegistryService.registerPageDataTableColumn({
datatableId: 'job-employee', // The identifier for the data table location
dataTableId: 'job-employee', // The identifier for the data table location
columnId: 'billRateValue', // The identifier for the column
order: 3, // The order of the column in the table
title: () => this.getTranslation('JOB_EMPLOYEE.BILLING_RATE'), // The title of the column
Expand All @@ -211,7 +211,7 @@ export class JobEmployeeComponent extends PaginationFilterBaseComponent implemen

// Register the data table column
_pageDataTableRegistryService.registerPageDataTableColumn({
datatableId: 'job-employee', // The identifier for the data table location
dataTableId: 'job-employee', // The identifier for the data table location
columnId: 'minimumBillingRate', // The identifier for the column
order: 4, // The order of the column in the table
title: () => this.getTranslation('JOB_EMPLOYEE.MINIMUM_BILLING_RATE'), // The title of the column
Expand All @@ -231,7 +231,7 @@ export class JobEmployeeComponent extends PaginationFilterBaseComponent implemen

// Register the data table column
_pageDataTableRegistryService.registerPageDataTableColumn({
datatableId: 'job-employee', // The identifier for the data table location
dataTableId: 'job-employee', // The identifier for the data table location
columnId: 'isJobSearchActive', // The identifier for the column
order: 5, // The order of the column in the table
title: () => this.getTranslation('JOB_EMPLOYEE.JOB_SEARCH_STATUS'), // The title of the column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ export class PageDataTableRegistryService implements IPageDataTableRegistry {
* @throws Will throw an error if a column with the same location and id has already been registered.
*/
public registerPageDataTableColumn(config: PageDataTableRegistryConfig): void {
if (!config.datatableId) {
throw new Error('A data table column configuration must have a datatableId property');
if (!config.dataTableId) {
throw new Error('A data table column configuration must have a dataTableId property');
}

// Get all registered columns for the specified location
const columns = this.registry.get(config.datatableId) || [];
const columns = this.registry.get(config.dataTableId) || [];

// Find the index of the column with the same location and columnId
const existing = columns.findIndex(
(column: PageDataTableRegistryConfig) =>
column.datatableId === config.datatableId && column.columnId === config.columnId
column.dataTableId === config.dataTableId && column.columnId === config.columnId
);

if (existing !== -1) {
Expand All @@ -48,7 +48,7 @@ export class PageDataTableRegistryService implements IPageDataTableRegistry {
}

// Update the registry with the new list of columns for the specified location
this.registry.set(config.datatableId, columns);
this.registry.set(config.dataTableId, columns);
}

/**
Expand Down Expand Up @@ -94,25 +94,25 @@ export class PageDataTableRegistryService implements IPageDataTableRegistry {
* @param registryId - The identifier used to look up the data table column configurations for a specific page location.
* @returns An array of `IColumn` objects representing the unique columns for the specified page location.
*/
public getPageDataTableColumns(datatableId: PageDataTableRegistryId): IColumns {
public getPageDataTableColumns(dataTableId: PageDataTableRegistryId): IColumns {
// Get all registered columns for the specified location
let columns = this.getDataTableColumnsByOrder(datatableId);
let columns = this.getDataTableColumnsByOrder(dataTableId);

// Use a Set to track unique location-id combinations
const datatableIds = new Set<string>();
const dataTableIds = new Set<string>();

// Filter the configurations to remove duplicates based on the unique identifier
columns = columns.filter((config: PageDataTableRegistryConfig) => {
// Create a unique identifier for the combination of location and id
const identifier = `${config.datatableId}-${config.columnId}`;
const identifier = `${config.dataTableId}-${config.columnId}`;

// Check if the unique identifier is already in the Set
if (datatableIds.has(identifier)) {
if (dataTableIds.has(identifier)) {
return false; // Duplicate found, filter it out
}

// Add the unique identifier to the Set
datatableIds.add(identifier);
dataTableIds.add(identifier);
return true; // Not a duplicate, keep it
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface PageDataTableRegistryConfig extends Omit<IColumn, 'title'> {
* @description
* The location identifier for the page route.
*/
datatableId: PageDataTableRegistryId;
dataTableId: PageDataTableRegistryId;

/**
* @description
Expand Down

0 comments on commit 29a4b2d

Please sign in to comment.