Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.28.0 #926

Merged
merged 10 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/api",
"version": "0.27.5",
"version": "0.28.0",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface ISaveResults {
interface IDataItem {
index: number;
errors?: Record<string, string>;
wanings?: Record<string, string>;
isValid: boolean;
record: Record<string, any>;
updated: Record<string, boolean>;
Expand Down Expand Up @@ -268,6 +269,7 @@ export class DoReReview extends BaseReview {
update: {
$set: {
errors: record.errors,
warnings: record.warnings,
isValid: record.isValid,
updated: {},
},
Expand Down
23 changes: 22 additions & 1 deletion apps/api/src/app/shared/services/sandbox/contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,38 @@ 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(
rowIndexToUpdate > -1 &&
(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
}
Expand Down
2 changes: 1 addition & 1 deletion apps/queue-manager/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/queue-manager",
"version": "0.27.5",
"version": "0.28.0",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/web",
"version": "0.27.5",
"version": "0.28.0",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion apps/widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/widget",
"version": "0.27.5",
"version": "0.28.0",
"author": "implerhq",
"license": "MIT",
"private": true,
Expand Down
11 changes: 11 additions & 0 deletions apps/widget/src/components/Common/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -248,6 +257,7 @@ export const Table = forwardRef<HotTableClass, TableProps>(
if (!selectEnabled && i < 0) {
TH.innerHTML = '#';
} else if (selectEnabled && i === 0 && selectEnabled) {
TH.classList.add('check-all-cell');
TH.innerHTML = `
<div class="checkbox">
<input type="checkbox" ${allChecked ? 'checked' : ''} class="checkbox__control">
Expand All @@ -269,6 +279,7 @@ export const Table = forwardRef<HotTableClass, TableProps>(
'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'
Expand Down
10 changes: 5 additions & 5 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}
Expand All @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"npmClient": "pnpm",
"useNx": true,
"packages": ["apps/*", "libs/*", "packages/*"],
"version": "0.27.5"
"version": "0.28.0"
}
2 changes: 1 addition & 1 deletion libs/dal/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/dal",
"version": "0.27.5",
"version": "0.28.0",
"author": "implerhq",
"license": "MIT",
"main": "dist/index.js",
Expand Down
4 changes: 2 additions & 2 deletions libs/dal/src/dal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions libs/dal/src/repositories/record/record.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export class RecordEntity {

errors: Record<string, string>;

warnings: Record<string, string>;

record: Record<string, any>;

updated: Record<string, boolean>;
Expand Down
1 change: 1 addition & 0 deletions libs/dal/src/repositories/record/record.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
2 changes: 1 addition & 1 deletion libs/embed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@impler/embed",
"version": "0.27.5",
"version": "0.28.0",
"private": true,
"license": "MIT",
"author": "implerhq",
Expand Down
2 changes: 1 addition & 1 deletion libs/services/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion libs/shared/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions libs/shared/src/entities/Record/Record.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export interface IRecord {
isValid: boolean;
record: Record<string, any>;
errors?: Record<string, string>;
warnings?: Record<string, any>;
updated: Record<string, boolean>;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "impler.io",
"version": "0.27.5",
"version": "0.28.0",
"description": "Open source infrastructure to import data easily",
"packageManager": "[email protected]",
"private": true,
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -52,6 +52,6 @@
"typescript": "^4.4.4"
},
"dependencies": {
"@impler/client": "^0.27.5"
"@impler/client": "^0.28.0"
}
}
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -53,6 +53,6 @@
"typescript": "^4.4.4"
},
"dependencies": {
"@impler/client": "^0.27.5"
"@impler/client": "^0.28.0"
}
}
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading