Skip to content

Commit

Permalink
fix: minor code smells and issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Jan 31, 2024
1 parent a9f1442 commit 39864b8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ COPY dist/onecx-help-ui/ $DIR_HTML
ENV BFF_URL http://onecx-help-bff:8080/
ENV APP_BASE_HREF /

RUN chmod 775 -R $DIR_HTML/assets
RUN chmod 775 -R "$DIR_HTML"/assets
USER 1001
1 change: 0 additions & 1 deletion src/app/help/help-detail/help-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export class HelpDetailComponent implements OnChanges {
createHelp: this.helpFormComponent.formGroup.value as CreateHelp
})
.subscribe({
/* eslint-disable @typescript-eslint/no-unused-vars */ /* TODO: fix help processing */
next: () => {
this.searchEmitter.emit()
this.msgService.success({ summaryKey: 'HELPITEM_CREATION.CREATION_SUCCESS' })
Expand Down
28 changes: 19 additions & 9 deletions src/app/help/help-search/help-search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ocx-page-content styleClass="px-3">
<p-table
#table
id="help_search_table"
responsiveLayout="scroll"
[value]="loadingResults ? [] : results"
[columns]="filteredColumns"
Expand Down Expand Up @@ -38,16 +39,21 @@

<ng-template pTemplate="emptymessage">
<tr>
<td colspan="16">{{ 'GENERAL.SEARCH.NO_DATA' | translate }}</td>
<td id="help_search_table_no_data" colspan="16">{{ 'GENERAL.SEARCH.NO_DATA' | translate }}</td>
</tr>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th class="text-center white-space-nowrap" title="{{ 'GENERAL.SEARCH.ACTION' | translate }}">
<tr id="help_search_table_header">
<th
id="help_search_table_header_action"
class="text-center white-space-nowrap"
title="{{ 'GENERAL.SEARCH.ACTION' | translate }}"
>
{{ 'GENERAL.SEARCH.ACTION' | translate }}
</th>
<th
*ngFor="let col of columns"
[id]="'help_search_table_header_' + col.field"
[class]="col.css"
[pSortableColumn]="col.field"
title=" {{ 'HELP_ITEM.TOOLTIPS.' + col.header | translate }}"
Expand All @@ -59,14 +65,14 @@
</tr>
</ng-template>
<ng-template pTemplate="body" let-row="rowIndex" let-rowData let-columns="columns">
<tr>
<tr [id]="'help_search_table_row_' + row">
<td class="text-center white-space-nowrap">
<ng-container *ocxIfNotPermission="'HELP#EDIT'">
<button
pbutton
type="button"
*ocxIfPermission="'HELP#VIEW'"
[id]="'ahm_help_search_table_row_' + row + '_view_action'"
[id]="'help_search_table_row_' + row + '_view_action'"
(click)="onDetail($event, rowData, 'VIEW')"
[title]="'GENERAL.VIEW' | translate"
class="my-0 mr-1 p-1 p-button-rounded font-medium p-button-text p-button p-component p-button-icon-only"
Expand All @@ -78,7 +84,7 @@
pbutton
type="button"
*ocxIfPermission="'HELP#EDIT'"
[id]="'ahm_help_search_table_row_' + row + '_edit_action'"
[id]="'help_search_table_row_' + row + '_edit_action'"
(click)="onDetail($event, rowData, 'EDIT')"
[title]="'ACTIONS.EDIT.HELP_ITEM.TOOLTIP' | translate"
class="my-0 mr-1 p-1 p-button-rounded font-medium p-button-text p-button p-component p-button-icon-only"
Expand All @@ -89,7 +95,7 @@
pbutton
type="button"
*ocxIfPermission="'HELP#EDIT'"
[id]="'ahm_help_search_table_row_' + row + '_copy_action'"
[id]="'help_search_table_row_' + row + '_copy_action'"
(click)="onCopy($event, rowData)"
[title]="'ACTIONS.COPY.HELP_ITEM.TOOLTIP' | translate"
class="mr-1 my-0 p-1 p-button-rounded font-medium p-button-text p-button p-component p-button-icon-only"
Expand All @@ -100,15 +106,17 @@
pbutton
type="button"
*ocxIfPermission="'HELP#DELETE'"
[id]="'ahm_help_search_table_row_' + row + '_delete_action'"
[id]="'help_search_table_row_' + row + '_delete_action'"
(click)="onDelete($event, rowData)"
[title]="'ACTIONS.DELETE.HELP_ITEM.TOOLTIP' | translate"
class="my-0 p-1 p-button-rounded font-medium p-button-text p-button p-component p-button-icon-only"
>
<span class="danger-action-text font-medium p-button-icon pi pi-trash" aria-hidden="true"></span>
</button>
</td>
<td *ngFor="let col of columns" [class]="col.css">{{ rowData[col.field] }}</td>
<td [id]="'help_search_table_row_' + row + '_' + col.field" *ngFor="let col of columns" [class]="col.css">
{{ rowData[col.field] }}
</td>
</tr>
</ng-template>
</p-table>
Expand Down Expand Up @@ -139,6 +147,7 @@
class="m-0"
icon="pi pi-times"
iconPos="left"
[id]="'help_delete_button_no'"
[label]="'ACTIONS.CONFIRMATION.NO' | translate"
[title]="'ACTIONS.CONFIRMATION.NO.TOOLTIP' | translate"
(click)="displayDeleteDialog = false"
Expand All @@ -149,6 +158,7 @@
class="m-0"
icon="pi pi-check"
iconPos="left"
[id]="'help_delete_button_yes'"
[label]="'ACTIONS.CONFIRMATION.YES' | translate"
[title]="'ACTIONS.CONFIRMATION.YES.TOOLTIP' | translate"
(click)="onDeleteConfirmation()"
Expand Down
10 changes: 3 additions & 7 deletions src/app/help/help-search/help-search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class HelpSearchComponent implements OnInit {
* - re-searching (with current criteria) after changes in detail dialog
*/
public search(criteria: HelpSearchCriteria, reuseCriteria: boolean = false): void {
var criteriaSearchParams: SearchHelpsRequestParams = {
let criteriaSearchParams: SearchHelpsRequestParams = {
helpSearchCriteria: criteria
}
if (!reuseCriteria) {
Expand Down Expand Up @@ -124,12 +124,8 @@ export class HelpSearchComponent implements OnInit {
// default sorting: 1. appId, 2.itemId
private sortHelpItemByDefault(a: Help, b: Help): number {
return (
(a.appId ? (a.appId as string).toUpperCase() : '').localeCompare(
b.appId ? (b.appId as string).toUpperCase() : ''
) ||
(a.itemId ? (a.itemId as string).toUpperCase() : '').localeCompare(
b.itemId ? (b.itemId as string).toUpperCase() : ''
)
(a.appId ? a.appId.toUpperCase() : '').localeCompare(b.appId ? b.appId.toUpperCase() : '') ||
(a.itemId ? a.itemId.toUpperCase() : '').localeCompare(b.itemId ? b.itemId.toUpperCase() : '')
)
}

Expand Down
9 changes: 0 additions & 9 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,3 @@ export const environment = {
skipRemoteConfigLoad: true,
apiPrefix: 'bff'
}

/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.

0 comments on commit 39864b8

Please sign in to comment.