Skip to content

Commit

Permalink
Add Log
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruimeng-Ye committed Oct 21, 2023
1 parent 62139bc commit 0c3cd6e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def objectify = "com.googlecode.objectify:objectify:6.0.7"
def testng = "org.testng:testng:7.6.1"

dependencies {
implementation 'org.junit.jupiter:junit-jupiter:5.8.1'
staticAnalysis("com.puppycrawl.tools:checkstyle:${checkstyleVersion}")
staticAnalysis("net.sourceforge.pmd:pmd-java:${pmdVersion}")
staticAnalysis("com.github.spotbugs:spotbugs:${spotbugsVersion}")
Expand Down
39 changes: 39 additions & 0 deletions src/web/app/components/sortable-table/sortable-table.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
import { Component, Input, OnChanges, OnInit, Type, EventEmitter, Output } from '@angular/core';
import { TableComparatorService } from '../../../services/table-comparator.service';
import { SortBy, SortOrder } from '../../../types/sort-properties';
import { Logger } from 'path-to-logger-service';

Check failure on line 4 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

`path-to-logger-service` import should occur before import of `../../../services/table-comparator.service`

Check failure on line 4 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

`path-to-logger-service` import should occur before import of `../../../services/table-comparator.service`

export class SortableTableComponent implements OnInit, OnChanges {

Check failure on line 6 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Multiple exports of name 'SortableTableComponent'

Check failure on line 6 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Multiple exports of name 'SortableTableComponent'

constructor(private tableComparatorService: TableComparatorService, private logger: Logger) { } // 添加logger服务

ngOnInit(): void {
this.logger.info('Initializing SortableTableComponent...');
this.tableRows = this.rows;
this.initialSort(); // Performs an initial sort on the table
this.setMainTableStyle = this.headerColorScheme === SortableTableHeaderColorScheme.BLUE;

Check failure on line 14 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

'SortableTableHeaderColorScheme' was used before it was defined

Check failure on line 14 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

'SortableTableHeaderColorScheme' was used before it was defined
}

ngOnChanges(): void {
this.logger.info('Changes detected in SortableTableComponent. Updating rows...');
this.tableRows = this.rows;
this.sortRows();
}

onClickHeader(columnHeader: string): void {
this.logger.info(`Header clicked: ${columnHeader}. Sorting rows...`);
this.sortOrder = this.columnToSortBy === columnHeader && this.sortOrder === SortOrder.ASC
? SortOrder.DESC : SortOrder.ASC;
this.columnToSortBy = columnHeader;
this.sortRows();
}

sortRows(): void {
this.logger.info(`Sorting rows by column: ${this.columnToSortBy}`);
}

initialSort(): void {
this.logger.info('Performing initial sort...');
}


Check failure on line 39 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

More than 1 blank line not allowed

Check failure on line 39 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

More than 1 blank line not allowed
}


Check failure on line 42 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

More than 1 blank line not allowed

Check failure on line 42 in src/web/app/components/sortable-table/sortable-table.component.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

More than 1 blank line not allowed

/**
* The color scheme of the header of the table
Expand Down

0 comments on commit 0c3cd6e

Please sign in to comment.