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

[Feat] Add @gauzy/plugin-integration-github-ui Package #8444

Merged
merged 7 commits into from
Oct 16, 2024
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: 2 additions & 0 deletions .deploy/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ COPY --chown=node:node packages/plugins/integration-hubstaff/package.json ./pack
COPY --chown=node:node packages/plugins/integration-upwork-ui/package.json ./packages/plugins/integration-upwork-ui/
COPY --chown=node:node packages/plugins/integration-upwork/package.json ./packages/plugins/integration-upwork/
COPY --chown=node:node packages/plugins/integration-github/package.json ./packages/plugins/integration-github/
COPY --chown=node:node packages/plugins/integration-github-ui/package.json ./packages/plugins/integration-github-ui/
COPY --chown=node:node packages/plugins/integration-jira/package.json ./packages/plugins/integration-jira/
COPY --chown=node:node packages/plugins/jitsu-analytics/package.json ./packages/plugins/jitsu-analytics/
COPY --chown=node:node packages/plugins/sentry-tracing/package.json ./packages/plugins/sentry-tracing/
Expand Down Expand Up @@ -228,6 +229,7 @@ COPY --chown=node:node packages/plugins/integration-hubstaff/package.json ./pack
COPY --chown=node:node packages/plugins/integration-upwork-ui/package.json ./packages/plugins/integration-upwork-ui/
COPY --chown=node:node packages/plugins/integration-upwork/package.json ./packages/plugins/integration-upwork/
COPY --chown=node:node packages/plugins/integration-github/package.json ./packages/plugins/integration-github/
COPY --chown=node:node packages/plugins/integration-github-ui/package.json ./packages/plugins/integration-github-ui/
COPY --chown=node:node packages/plugins/integration-jira/package.json ./packages/plugins/integration-jira/
COPY --chown=node:node packages/plugins/jitsu-analytics/package.json ./packages/plugins/jitsu-analytics/
COPY --chown=node:node packages/plugins/sentry-tracing/package.json ./packages/plugins/sentry-tracing/
Expand Down
1 change: 1 addition & 0 deletions .deploy/webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ COPY --chown=node:node packages/plugins/integration-hubstaff/package.json ./pack
COPY --chown=node:node packages/plugins/integration-upwork-ui/package.json ./packages/plugins/integration-upwork-ui/
COPY --chown=node:node packages/plugins/integration-upwork/package.json ./packages/plugins/integration-upwork/
COPY --chown=node:node packages/plugins/integration-github/package.json ./packages/plugins/integration-github/
COPY --chown=node:node packages/plugins/integration-github-ui/package.json ./packages/plugins/integration-github-ui/
COPY --chown=node:node packages/plugins/integration-jira/package.json ./packages/plugins/integration-jira/
COPY --chown=node:node packages/plugins/jitsu-analytics/package.json ./packages/plugins/jitsu-analytics/
COPY --chown=node:node packages/plugins/sentry-tracing/package.json ./packages/plugins/sentry-tracing/
Expand Down
35 changes: 35 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,41 @@
}
}
},
"plugin-integration-github-ui": {
"projectType": "library",
"root": "packages/plugins/integration-github-ui",
"sourceRoot": "packages/plugins/integration-github-ui",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "packages/plugins/integration-github-ui/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "packages/plugins/integration-github-ui/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "packages/plugins/integration-github-ui/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "packages/plugins/integration-github-ui/tsconfig.spec.json",
"polyfills": ["zone.js", "zone.js/testing"]
}
}
},
"schematics": {
"@nrwl/angular:component": {
"style": "scss"
}
}
},
"plugin-integration-upwork-ui": {
"projectType": "library",
"root": "packages/plugins/integration-upwork-ui",
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"../../../packages/plugins/integration-upwork-ui",
"../../../packages/plugins/integration-upwork",
"../../../packages/plugins/integration-github",
"../../../packages/plugins/integration-github-ui",
"../../../packages/plugins/integration-jira",
"../../../packages/plugins/knowledge-base",
"../../../packages/plugins/product-reviews",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class IntegrationsModule {
// Register the path 'github'
path: 'github',
// Register the loadChildren function to load the GithubModule lazy module
loadChildren: () => import('./github/github.module').then((m) => m.GithubModule)
loadChildren: () => import('@gauzy/plugin-integration-github-ui').then((m) => m.IntegrationGithubUiModule)
});

// Set hasRegisteredRoutes to true
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"../../../packages/plugins/integration-upwork-ui",
"../../../packages/plugins/integration-upwork",
"../../../packages/plugins/integration-github",
"../../../packages/plugins/integration-github-ui",
"../../../packages/plugins/integration-jira",
"../../../packages/plugins/product-reviews",
"../../../packages/plugins/knowledge-base",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
"build:package:plugin:integration-ai-ui:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/integration-ai-ui lib:build:prod",
"build:package:plugin:integration-hubstaff-ui": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/integration-hubstaff-ui lib:build",
"build:package:plugin:integration-hubstaff-ui:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/integration-hubstaff-ui lib:build:prod",
"build:package:plugin:integration-github-ui": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/integration-github-ui lib:build",
"build:package:plugin:integration-github-ui:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/integration-github-ui lib:build:prod",
"build:package:plugin:integration-upwork-ui": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/integration-upwork-ui lib:build",
"build:package:plugin:integration-upwork-ui:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/integration-upwork-ui lib:build:prod",
"build:package:plugin:job-employee-ui": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/plugins/job-employee-ui lib:build",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/shared/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './shared.module';
export * from './pipes';
export * from './handlers';
export * from './decorators';
export * from './guards';
export * from './dto';
export * from './guards';
export * from './handlers';
export * from './pipes';
rahul-rocket marked this conversation as resolved.
Show resolved Hide resolved
46 changes: 22 additions & 24 deletions packages/core/src/shared/pipes/column-numeric-transformer.pipe.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import { ValueTransformer } from "typeorm";
import { isNullOrUndefined } from "@gauzy/common";
import { ValueTransformer } from 'typeorm';
import { isNotNullOrUndefined } from '@gauzy/common';

/**
* Convert Non-integer numbers string to integer
*
* From https://github.com/typeorm/typeorm/issues/873#issuecomment-502294597
*/
export class ColumnNumericTransformerPipe implements ValueTransformer {
/**
* Transforms a number to the database value.
*
* @param data - The input number.
* @returns The transformed number or null.
*/
to(data?: number | null): number | null {
return isNullOrUndefined(data) ? null : data;
}
/**
* Converts a number for storage in the database.
* If the value is not defined, it returns null.
*
* @param value - The number to convert.
* @returns The number itself, or null if undefined.
*/
to(value: number): number | null {
return isNotNullOrUndefined(value) ? value : null; // Return the number for storage
}

/**
* Transforms a string to the entity property value.
*
* @param data - The input string.
* @returns The transformed number or null.
*/
from(data?: string | null): number | null {
if (!isNullOrUndefined(data)) {
const parsedValue = parseFloat(data);
return isNaN(parsedValue) ? null : parsedValue;
}
return null;
}
/**
* Transforms a string to the entity property value.
*
* @param value - The input string.
* @returns The transformed number or null if the input is invalid.
*/
from(value?: string | null): number | null {
return isNotNullOrUndefined(value) ? parseFloat(value) : null; // Convert string to number
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class AutomationTaskSyncHandler implements ICommandHandler<AutomationTask
return createdTask;
} catch (error) {
// Handle and log errors, and return a rejected promise or throw an exception.
console.log(chalk.red(`Error automation syncing a task with payload: %s`, error.message), entity);
console.log(chalk.red(`Error while creating task using Automation Task: %s`, error.message), entity);
}
}

Expand All @@ -146,7 +146,7 @@ export class AutomationTaskSyncHandler implements ICommandHandler<AutomationTask
* @param entity - The new data for the task.
* @returns A Promise that resolves to the updated task.
*/
async updateTask(id: ITaskUpdateInput['id'], entity: ITaskUpdateInput): Promise<ITask> {
async updateTask(id: ID, entity: ITaskUpdateInput): Promise<ITask> {
try {
// Find the existing task by its ID
const existingTask = await this._taskService.findOneByIdString(id);
Expand All @@ -162,7 +162,7 @@ export class AutomationTaskSyncHandler implements ICommandHandler<AutomationTask
return updatedTask;
} catch (error) {
// Handle and log errors, and return a rejected promise or throw an exception.
console.log(chalk.red(`Error automation syncing a task with payload: %s`, error), entity);
console.log(chalk.red(`Error while updating task using Automation Task: %s`), error.message);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { I18nService } from '@gauzy/ui-core/i18n';

@UntilDestroy({ checkProperties: true })
@Component({
selector: '</ngx-integration-ai-layout>',
selector: 'ngx-integration-ai-layout',
template: `<router-outlet></router-outlet>`
})
export class IntegrationAILayoutComponent implements OnInit, OnDestroy {
Expand Down
20 changes: 20 additions & 0 deletions packages/plugins/integration-github-ui/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
docker
tmp
README.md
.env

# git

.git
.gitignore
.gitmodules

# dependencies

node_modules

# misc

npm-debug.log
dist
build
33 changes: 33 additions & 0 deletions packages/plugins/integration-github-ui/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "gauzy",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "gauzy",
"style": "kebab-case"
}
]
},
"extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
}
rahul-rocket marked this conversation as resolved.
Show resolved Hide resolved
]
}
6 changes: 6 additions & 0 deletions packages/plugins/integration-github-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# dependencies
node_modules/

# misc
npm-debug.log
dist
4 changes: 4 additions & 0 deletions packages/plugins/integration-github-ui/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .npmignore

src/
node_modules/
7 changes: 7 additions & 0 deletions packages/plugins/integration-github-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# plugin-integration-github-ui

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test plugin-integration-github-ui` to execute the unit tests.
22 changes: 22 additions & 0 deletions packages/plugins/integration-github-ui/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'plugins-integration-github-ui',
preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../coverage/packages/plugins/integration-github-ui',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$'
}
]
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment'
]
};
10 changes: 10 additions & 0 deletions packages/plugins/integration-github-ui/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../../dist/packages/plugins/integration-github-ui",
rahul-rocket marked this conversation as resolved.
Show resolved Hide resolved
"lib": {
"entryFile": "src/index.ts",
"styleIncludePaths": ["../../../dist/packages/ui-core/static/styles"]
},
"allowedNonPeerDependencies": ["."],
rahul-rocket marked this conversation as resolved.
Show resolved Hide resolved
"assets": []
rahul-rocket marked this conversation as resolved.
Show resolved Hide resolved
}
Loading
Loading