Skip to content

Commit

Permalink
fix: code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Feb 2, 2024
1 parent cbbad9a commit e684240
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
16 changes: 9 additions & 7 deletions src/app/product-store/app-detail/app-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class AppDetailComponent implements OnChanges {
this.app = data
this.viewForm(this.app)
if (this.changeMode === 'COPY') {
if (this.app && this.app.id) {
if (this.app?.id) {
this.app.id = undefined
this.app.creationDate = undefined
this.app.modificationDate = undefined
Expand Down Expand Up @@ -179,16 +179,18 @@ export class AppDetailComponent implements OnChanges {
}

private displaySaveError(err: any): void {
let key = err?.error?.detail.indexOf('microfrontend_app_id') > 0 ? 'VALIDATION.APP.UNIQUE_CONSTRAINT.APP_ID' : ''
key =
err?.error?.detail.indexOf('microfrontend_remote_module') > 0
? 'VALIDATION.APP.UNIQUE_CONSTRAINT.REMOTE_MODULE'
: key

this.msgService.error({
summaryKey: 'ACTIONS.' + this.changeMode + '.APP.NOK',
detailKey:
err?.error?.errorCode && err?.error?.errorCode === 'PERSIST_ENTITY_FAILED'
? err?.error?.detail.indexOf('microfrontend_app_id') > 0
? 'VALIDATION.APP.UNIQUE_CONSTRAINT.APP_ID'
: err?.error?.detail.indexOf('microfrontend_remote_module') > 0
? 'VALIDATION.APP.UNIQUE_CONSTRAINT.REMOTE_MODULE'
: 'VALIDATION.ERRORS.INTERNAL_ERROR'
: ''
? key
: 'VALIDATION.ERRORS.INTERNAL_ERROR'
})
console.error('err', err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@
</ocx-data-view-controls
></ng-template>
<ng-template let-app pTemplate="gridItem">
<!--
<div
class="col-12 grid grid-nogutter align-items-center row-gap-1 listview-row p-1 hover:bg-gray-200 cursor-pointer"
>
<div class="col-12 md:col-5 lg:col-5 xl:col-6">
<div class="flex flex-column justify-content-center gap-1 text-center md:text-left">
<div>{{ limitText(app.appName, 50) }}</div>
</div>
</div>
</div-->
<div class="col-12 sm:col-6 md:col-4 lg:col-4 xl:col-3 p-3" (click)="onDetail($event, app)">
<div class="card relative p-1 flex flex-column justify-content-center hover:bg-gray-200 cursor-pointer">
<span
Expand Down

0 comments on commit e684240

Please sign in to comment.