diff --git a/apps/api/package.json b/apps/api/package.json index 410ef7d30..66f9ddc5e 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -1,6 +1,6 @@ { "name": "@impler/api", - "version": "0.27.5", + "version": "0.28.0", "author": "implerhq", "license": "MIT", "private": true, diff --git a/apps/api/src/app/review/usecases/do-review/re-review-data.usecase.ts b/apps/api/src/app/review/usecases/do-review/re-review-data.usecase.ts index 18d05dbcc..e97105783 100644 --- a/apps/api/src/app/review/usecases/do-review/re-review-data.usecase.ts +++ b/apps/api/src/app/review/usecases/do-review/re-review-data.usecase.ts @@ -28,6 +28,7 @@ interface ISaveResults { interface IDataItem { index: number; errors?: Record; + wanings?: Record; isValid: boolean; record: Record; updated: Record; @@ -268,6 +269,7 @@ export class DoReReview extends BaseReview { update: { $set: { errors: record.errors, + warnings: record.warnings, isValid: record.isValid, updated: {}, }, diff --git a/apps/api/src/app/shared/services/sandbox/contents.ts b/apps/api/src/app/shared/services/sandbox/contents.ts index e873aca1c..71f525c59 100644 --- a/apps/api/src/app/shared/services/sandbox/contents.ts +++ b/apps/api/src/app/shared/services/sandbox/contents.ts @@ -42,7 +42,26 @@ function processErrors(batchData, errors) { if(!Array.isArray(errors) || (Array.isArray(errors) && errors.length === 0)) { return batchData; } - let rowIndexToUpdate, combinedErrors, isErrorsEmpty; + + errors.forEach(error => { + if (error.warnings && typeof error.warnings === 'object') { + const rowIndexToUpdate = batchData.data.findIndex(data => data.index === error.index); + + if (rowIndexToUpdate > -1) { + // Initialize warnings object if it doesn't exist + if (!batchData.data[rowIndexToUpdate].warnings) { + batchData.data[rowIndexToUpdate].warnings = {}; + } + + batchData.data[rowIndexToUpdate].warnings = { + ...batchData.data[rowIndexToUpdate].warnings, + ...error.warnings + }; + } + } + }); + + let rowIndexToUpdate, combinedErrors, isErrorsEmpty, combinedWarnings; errors.forEach(error => { rowIndexToUpdate = batchData.data.findIndex(data => data.index === error.index); if( @@ -50,9 +69,11 @@ function processErrors(batchData, errors) { (typeof error.errors === 'object' && !Array.isArray(error.errors) && error.errors !== null) ) { combinedErrors = Object.assign(batchData.data[rowIndexToUpdate]?.errors || {}, error.errors); + combinedWarnings = batchData.data[rowIndexToUpdate]?.warnings || {}; isErrorsEmpty = isObjectEmpty(combinedErrors); batchData.data[rowIndexToUpdate] = { ...batchData.data[rowIndexToUpdate], + warnings: combinedWarnings, errors: combinedErrors, isValid: isErrorsEmpty } diff --git a/apps/queue-manager/package.json b/apps/queue-manager/package.json index 8ad1395c7..d9313ffc7 100644 --- a/apps/queue-manager/package.json +++ b/apps/queue-manager/package.json @@ -1,6 +1,6 @@ { "name": "@impler/queue-manager", - "version": "0.27.5", + "version": "0.28.0", "author": "implerhq", "license": "MIT", "private": true, diff --git a/apps/web/package.json b/apps/web/package.json index 5a8e748ab..071e4e34b 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,6 +1,6 @@ { "name": "@impler/web", - "version": "0.27.5", + "version": "0.28.0", "author": "implerhq", "license": "MIT", "private": true, diff --git a/apps/widget/package.json b/apps/widget/package.json index 1a8553497..291dac1db 100644 --- a/apps/widget/package.json +++ b/apps/widget/package.json @@ -1,6 +1,6 @@ { "name": "@impler/widget", - "version": "0.27.5", + "version": "0.28.0", "author": "implerhq", "license": "MIT", "private": true, diff --git a/apps/widget/src/components/Common/Table/Table.tsx b/apps/widget/src/components/Common/Table/Table.tsx index 92c645e64..bf51a115f 100644 --- a/apps/widget/src/components/Common/Table/Table.tsx +++ b/apps/widget/src/components/Common/Table/Table.tsx @@ -64,6 +64,7 @@ const createErrorSvg = memoize(() => { const memoizedStyles = { errorUpdated: 'vertical-align: middle;float: right;cursor: pointer;color:#795e00;', errorOnly: 'vertical-align: middle;float: right;cursor: pointer;color:#ff1111;', + warningOnly: 'vertical-align: middle;float: right;cursor: pointer;#795e00;', }; Handsontable.renderers.registerRenderer( @@ -72,6 +73,7 @@ Handsontable.renderers.registerRenderer( const name = String(prop).replace('record.', ''); const sourceData = instance.getSourceDataAtRow(row) as IRecord; const hasError = sourceData.errors?.[name]; + const hasWarnings = sourceData.warnings?.[name]; const isUpdated = sourceData.updated?.[name]; TD.className = 'custom-cell'; @@ -109,6 +111,13 @@ Handsontable.renderers.registerRenderer( errorSvg.setAttribute('style', memoizedStyles.errorOnly); TD.appendChild(errorSvg); TD.style.backgroundColor = '#fdebeb'; + } else if (hasWarnings) { + TD.ariaLabel = hasWarnings; + TD.dataset.cooltipzDir = row < 5 ? 'bottom' : 'top'; + TD.dataset.cooltipzSize = 'fit'; + errorSvg.setAttribute('style', hasWarnings ? memoizedStyles.warningOnly : memoizedStyles.errorUpdated); + TD.appendChild(errorSvg); + TD.style.backgroundColor = '#ffda5b'; } return TD; @@ -248,6 +257,7 @@ export const Table = forwardRef( if (!selectEnabled && i < 0) { TH.innerHTML = '#'; } else if (selectEnabled && i === 0 && selectEnabled) { + TH.classList.add('check-all-cell'); TH.innerHTML = `
@@ -269,6 +279,7 @@ export const Table = forwardRef( 'vertical-align: middle;float: right;cursor: pointer;color:#fffff; margin-right:4px;' ); const infoIconPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); + infoIconPath.setAttribute( 'd', 'M10 20C4.477 20 0 15.523 0 10S4.477 0 10 0s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-10a1 1 0 0 1 1 1v5a1 1 0 0 1-2 0V9a1 1 0 0 1 1-1zm0-1a1 1 0 1 1 0-2 1 1 0 0 1 0 2z' diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 979172913..0358247b3 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -19,7 +19,7 @@ services: api: privileged: true - image: "ghcr.io/implerhq/impler/api:0.27.5" + image: "ghcr.io/implerhq/impler/api:0.28.0" depends_on: - mongodb - rabbitmq @@ -53,7 +53,7 @@ services: - impler queue-manager: - image: "ghcr.io/implerhq/impler/queue-manager:0.27.5" + image: "ghcr.io/implerhq/impler/queue-manager:0.28.0" depends_on: - api - rabbitmq @@ -78,7 +78,7 @@ services: - impler widget: - image: "ghcr.io/implerhq/impler/widget:0.27.5" + image: "ghcr.io/implerhq/impler/widget:0.28.0" depends_on: - api container_name: widget @@ -95,7 +95,7 @@ services: embed: depends_on: - widget - image: "ghcr.io/implerhq/impler/embed:0.27.5" + image: "ghcr.io/implerhq/impler/embed:0.28.0" container_name: embed environment: WIDGET_URL: ${WIDGET_BASE_URL} @@ -107,7 +107,7 @@ services: web: depends_on: - api - image: "ghcr.io/implerhq/impler/web:0.27.5" + image: "ghcr.io/implerhq/impler/web:0.28.0" container_name: web environment: NEXT_PUBLIC_API_BASE_URL: ${API_ROOT_URL} diff --git a/lerna.json b/lerna.json index 31828e601..17692c93b 100644 --- a/lerna.json +++ b/lerna.json @@ -3,5 +3,5 @@ "npmClient": "pnpm", "useNx": true, "packages": ["apps/*", "libs/*", "packages/*"], - "version": "0.27.5" + "version": "0.28.0" } diff --git a/libs/dal/package.json b/libs/dal/package.json index 23f8de7c8..d205b4f8c 100644 --- a/libs/dal/package.json +++ b/libs/dal/package.json @@ -1,6 +1,6 @@ { "name": "@impler/dal", - "version": "0.27.5", + "version": "0.28.0", "author": "implerhq", "license": "MIT", "main": "dist/index.js", diff --git a/libs/dal/src/dal.service.ts b/libs/dal/src/dal.service.ts index c5ad0eacb..811716282 100644 --- a/libs/dal/src/dal.service.ts +++ b/libs/dal/src/dal.service.ts @@ -57,7 +57,7 @@ export class DalService { const conditions = type === 'all' ? {} : { isValid: type === 'valid' }; return model - .find(conditions, 'index isValid errors record updated') + .find(conditions, 'index isValid errors warnings record updated') .skip(Math.max(0, (page - 1) * limit)) // when page is 0, it was skiping 0*n records .limit(limit) .exec(); @@ -132,7 +132,7 @@ export class DalService { const model = this.getRecordCollection(_uploadId); if (!model) return; - return model.find({}, 'index isValid errors record'); + return model.find({}, 'index isValid errors warnings record'); } getFieldData(_uploadId: string, fields: string[]) { const model = this.getRecordCollection(_uploadId); diff --git a/libs/dal/src/repositories/record/record.entity.ts b/libs/dal/src/repositories/record/record.entity.ts index bbe206cf9..dffc3578a 100644 --- a/libs/dal/src/repositories/record/record.entity.ts +++ b/libs/dal/src/repositories/record/record.entity.ts @@ -7,6 +7,8 @@ export class RecordEntity { errors: Record; + warnings: Record; + record: Record; updated: Record; diff --git a/libs/dal/src/repositories/record/record.schema.ts b/libs/dal/src/repositories/record/record.schema.ts index 531bff111..58a50944f 100644 --- a/libs/dal/src/repositories/record/record.schema.ts +++ b/libs/dal/src/repositories/record/record.schema.ts @@ -7,6 +7,7 @@ const RecordSchema = new Schema({ }, isValid: Boolean, errors: Schema.Types.Mixed, + warnings: Schema.Types.Mixed, record: Schema.Types.Mixed, updated: Schema.Types.Mixed, }); diff --git a/libs/embed/package.json b/libs/embed/package.json index 869b22745..82ac5bd27 100644 --- a/libs/embed/package.json +++ b/libs/embed/package.json @@ -1,6 +1,6 @@ { "name": "@impler/embed", - "version": "0.27.5", + "version": "0.28.0", "private": true, "license": "MIT", "author": "implerhq", diff --git a/libs/services/package.json b/libs/services/package.json index fb70796f5..69d5e7966 100644 --- a/libs/services/package.json +++ b/libs/services/package.json @@ -1,6 +1,6 @@ { "name": "@impler/services", - "version": "0.27.5", + "version": "0.28.0", "description": "Reusable services to shared between backend api and queue-manager", "license": "MIT", "author": "implerhq", diff --git a/libs/shared/package.json b/libs/shared/package.json index f69e367e6..2f6b36cfe 100644 --- a/libs/shared/package.json +++ b/libs/shared/package.json @@ -1,6 +1,6 @@ { "name": "@impler/shared", - "version": "0.27.5", + "version": "0.28.0", "description": "Reusable types and classes to shared between apps and libraries", "license": "MIT", "author": "implerhq", diff --git a/libs/shared/src/entities/Record/Record.interface.ts b/libs/shared/src/entities/Record/Record.interface.ts index 129be485b..f80f81eb5 100644 --- a/libs/shared/src/entities/Record/Record.interface.ts +++ b/libs/shared/src/entities/Record/Record.interface.ts @@ -4,5 +4,6 @@ export interface IRecord { isValid: boolean; record: Record; errors?: Record; + warnings?: Record; updated: Record; } diff --git a/package.json b/package.json index c222660c0..d7c2532c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "impler.io", - "version": "0.27.5", + "version": "0.28.0", "description": "Open source infrastructure to import data easily", "packageManager": "pnpm@8.9.0", "private": true, diff --git a/packages/angular/package.json b/packages/angular/package.json index b16e50df4..7b0c65567 100644 --- a/packages/angular/package.json +++ b/packages/angular/package.json @@ -1,6 +1,6 @@ { "name": "@impler/angular", - "version": "0.27.5", + "version": "0.28.0", "description": "Angular library to show CSV Excel Importer in angular applications", "license": "MIT", "author": "implerhq", @@ -52,6 +52,6 @@ "typescript": "^4.4.4" }, "dependencies": { - "@impler/client": "^0.27.5" + "@impler/client": "^0.28.0" } } diff --git a/packages/client/package.json b/packages/client/package.json index f577ef9a7..579e2646b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@impler/client", - "version": "0.27.5", + "version": "0.28.0", "description": "API client to be used in end user environments", "license": "MIT", "author": "implerhq", diff --git a/packages/react/package.json b/packages/react/package.json index b280de534..86d90e085 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@impler/react", - "version": "0.27.5", + "version": "0.28.0", "description": "React library to show CSV Excel Importer in react applications", "license": "MIT", "author": "implerhq", @@ -53,6 +53,6 @@ "typescript": "^4.4.4" }, "dependencies": { - "@impler/client": "^0.27.5" + "@impler/client": "^0.28.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 13b97b057..e715f83fb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -796,7 +796,7 @@ importers: specifier: '>=12.0.0' version: 12.2.17(rxjs@7.8.1)(zone.js@0.11.8) '@impler/client': - specifier: ^0.27.5 + specifier: ^0.28.0 version: link:../client devDependencies: '@angular/compiler': @@ -863,7 +863,7 @@ importers: packages/react: dependencies: '@impler/client': - specifier: ^0.27.5 + specifier: ^0.28.0 version: link:../client react: specifier: '>=16.8.0'