From f4d626c91c8923d1a04a94cea172c27dce8d449c Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 16 Oct 2024 14:52:38 +0530 Subject: [PATCH 1/7] chore(plugin): add folder structure for integration GitHub UI package --- angular.json | 35 +++++++++++ package.json | 2 + .../integration-github-ui/.dockerignore | 20 +++++++ .../integration-github-ui/.eslintrc.json | 33 +++++++++++ .../plugins/integration-github-ui/.gitignore | 6 ++ .../plugins/integration-github-ui/.npmignore | 4 ++ .../plugins/integration-github-ui/README.md | 7 +++ .../integration-github-ui/jest.config.ts | 22 +++++++ .../integration-github-ui/ng-package.json | 10 ++++ .../integration-github-ui/package.json | 59 +++++++++++++++++++ .../integration-github-ui/project.json | 50 ++++++++++++++++ .../integration-github-ui/src/index.ts | 1 + .../src/lib/integration-github-ui.module.ts | 7 +++ .../integration-github-ui/src/test-setup.ts | 1 + .../integration-github-ui/tsconfig.json | 33 +++++++++++ .../integration-github-ui/tsconfig.lib.json | 12 ++++ .../tsconfig.lib.prod.json | 9 +++ .../integration-github-ui/tsconfig.spec.json | 11 ++++ tsconfig.json | 1 + 19 files changed, 323 insertions(+) create mode 100644 packages/plugins/integration-github-ui/.dockerignore create mode 100644 packages/plugins/integration-github-ui/.eslintrc.json create mode 100644 packages/plugins/integration-github-ui/.gitignore create mode 100644 packages/plugins/integration-github-ui/.npmignore create mode 100644 packages/plugins/integration-github-ui/README.md create mode 100644 packages/plugins/integration-github-ui/jest.config.ts create mode 100644 packages/plugins/integration-github-ui/ng-package.json create mode 100644 packages/plugins/integration-github-ui/package.json create mode 100644 packages/plugins/integration-github-ui/project.json create mode 100644 packages/plugins/integration-github-ui/src/index.ts create mode 100644 packages/plugins/integration-github-ui/src/lib/integration-github-ui.module.ts create mode 100644 packages/plugins/integration-github-ui/src/test-setup.ts create mode 100644 packages/plugins/integration-github-ui/tsconfig.json create mode 100644 packages/plugins/integration-github-ui/tsconfig.lib.json create mode 100644 packages/plugins/integration-github-ui/tsconfig.lib.prod.json create mode 100644 packages/plugins/integration-github-ui/tsconfig.spec.json diff --git a/angular.json b/angular.json index bd612afd587..e778b0af4d0 100644 --- a/angular.json +++ b/angular.json @@ -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", diff --git a/package.json b/package.json index d7d6609fe4c..523c69d0c94 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/plugins/integration-github-ui/.dockerignore b/packages/plugins/integration-github-ui/.dockerignore new file mode 100644 index 00000000000..6edd0523636 --- /dev/null +++ b/packages/plugins/integration-github-ui/.dockerignore @@ -0,0 +1,20 @@ +docker +tmp +README.md +.env + +# git + +.git +.gitignore +.gitmodules + +# dependencies + +node_modules + +# misc + +npm-debug.log +dist +build diff --git a/packages/plugins/integration-github-ui/.eslintrc.json b/packages/plugins/integration-github-ui/.eslintrc.json new file mode 100644 index 00000000000..32896661eef --- /dev/null +++ b/packages/plugins/integration-github-ui/.eslintrc.json @@ -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": {} + } + ] +} diff --git a/packages/plugins/integration-github-ui/.gitignore b/packages/plugins/integration-github-ui/.gitignore new file mode 100644 index 00000000000..a34877c2c0e --- /dev/null +++ b/packages/plugins/integration-github-ui/.gitignore @@ -0,0 +1,6 @@ +# dependencies +node_modules/ + +# misc +npm-debug.log +dist \ No newline at end of file diff --git a/packages/plugins/integration-github-ui/.npmignore b/packages/plugins/integration-github-ui/.npmignore new file mode 100644 index 00000000000..1eb4beb9572 --- /dev/null +++ b/packages/plugins/integration-github-ui/.npmignore @@ -0,0 +1,4 @@ +# .npmignore + +src/ +node_modules/ diff --git a/packages/plugins/integration-github-ui/README.md b/packages/plugins/integration-github-ui/README.md new file mode 100644 index 00000000000..7172115c585 --- /dev/null +++ b/packages/plugins/integration-github-ui/README.md @@ -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. diff --git a/packages/plugins/integration-github-ui/jest.config.ts b/packages/plugins/integration-github-ui/jest.config.ts new file mode 100644 index 00000000000..5bd36d4e71a --- /dev/null +++ b/packages/plugins/integration-github-ui/jest.config.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +export default { + displayName: 'plugins-integration-github-ui', + preset: '../../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../../coverage/packages/plugins/integration-github-ui', + transform: { + '^.+\\.(ts|mjs|js|html)$': [ + 'jest-preset-angular', + { + tsconfig: '/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' + ] +}; diff --git a/packages/plugins/integration-github-ui/ng-package.json b/packages/plugins/integration-github-ui/ng-package.json new file mode 100644 index 00000000000..48a1a1ab992 --- /dev/null +++ b/packages/plugins/integration-github-ui/ng-package.json @@ -0,0 +1,10 @@ +{ + "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../../dist/packages/plugins/integration-github-ui", + "lib": { + "entryFile": "src/index.ts", + "styleIncludePaths": ["../../../dist/packages/ui-core/static/styles"] + }, + "allowedNonPeerDependencies": ["."], + "assets": [] +} diff --git a/packages/plugins/integration-github-ui/package.json b/packages/plugins/integration-github-ui/package.json new file mode 100644 index 00000000000..ccf8cd74e67 --- /dev/null +++ b/packages/plugins/integration-github-ui/package.json @@ -0,0 +1,59 @@ +{ + "name": "@gauzy/plugin-integration-github-ui", + "version": "0.1.0", + "type": "commonjs", + "description": "A plugin for integrating GitHub with the Gauzy platform, enabling seamless interaction with GitHub's features and functionalities.", + "author": { + "name": "Ever Co. LTD", + "email": "ever@ever.co", + "url": "https://ever.co" + }, + "license": "AGPL-3.0", + "repository": { + "type": "git", + "url": "https://github.com/ever-co/ever-gauzy" + }, + "bugs": { + "url": "https://github.com/ever-co/ever-gauzy/issues" + }, + "homepage": "https://ever.co", + "keywords": [ + "gauzy", + "plugin", + "github", + "integration", + "ui", + "management", + "project", + "task" + ], + "private": true, + "scripts": { + "lib:build": "ng build plugin-integration-github-ui --configuration=development", + "lib:build:prod": "ng build plugin-integration-github-ui --configuration=production", + "lib:watch": "ng build plugin-integration-github-ui --watch --configuration=development" + }, + "peerDependencies": { + "@angular/common": "^16.2.12", + "@angular/core": "^16.2.12" + }, + "dependencies": { + "@angular/forms": "^16.2.12", + "@angular/router": "^16.2.12", + "@gauzy/contracts": "^0.1.0", + "@nebular/theme": "^12.0.0", + "ngx-permissions": "^13.0.1", + "rxjs": "^7.4.0", + "tslib": "^2.6.2" + }, + "devDependencies": { + "@types/jest": "^29.4.4", + "@types/node": "^20.14.9", + "jest-preset-angular": "^13.1.4" + }, + "engines": { + "node": ">=20.11.1", + "yarn": ">=1.22.19" + }, + "sideEffects": false +} diff --git a/packages/plugins/integration-github-ui/project.json b/packages/plugins/integration-github-ui/project.json new file mode 100644 index 00000000000..26a46e19a01 --- /dev/null +++ b/packages/plugins/integration-github-ui/project.json @@ -0,0 +1,50 @@ +{ + "name": "plugin-integration-github-ui", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/plugins/integration-github-ui/src", + "prefix": "gauzy", + "tags": [], + "projectType": "library", + "targets": { + "build": { + "executor": "@nrwl/angular:package", + "outputs": ["{workspaceRoot}/dist/{projectRoot}"], + "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": { + "executor": "@nrwl/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "packages/plugins/integration-github-ui/jest.config.ts", + "passWithNoTests": true + }, + "configurations": { + "ci": { + "ci": true, + "codeCoverage": true + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/plugins/integration-github-ui/**/*.ts", + "packages/plugins/integration-github-ui/**/*.html" + ] + } + } + } +} diff --git a/packages/plugins/integration-github-ui/src/index.ts b/packages/plugins/integration-github-ui/src/index.ts new file mode 100644 index 00000000000..b8a7b9c3204 --- /dev/null +++ b/packages/plugins/integration-github-ui/src/index.ts @@ -0,0 +1 @@ +export * from './lib/integration-github-ui.module'; diff --git a/packages/plugins/integration-github-ui/src/lib/integration-github-ui.module.ts b/packages/plugins/integration-github-ui/src/lib/integration-github-ui.module.ts new file mode 100644 index 00000000000..c6f4568ecac --- /dev/null +++ b/packages/plugins/integration-github-ui/src/lib/integration-github-ui.module.ts @@ -0,0 +1,7 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +@NgModule({ + imports: [CommonModule] +}) +export class IntegrationGithubUiModule {} diff --git a/packages/plugins/integration-github-ui/src/test-setup.ts b/packages/plugins/integration-github-ui/src/test-setup.ts new file mode 100644 index 00000000000..1100b3e8a6e --- /dev/null +++ b/packages/plugins/integration-github-ui/src/test-setup.ts @@ -0,0 +1 @@ +import 'jest-preset-angular/setup-jest'; diff --git a/packages/plugins/integration-github-ui/tsconfig.json b/packages/plugins/integration-github-ui/tsconfig.json new file mode 100644 index 00000000000..382cdf455f9 --- /dev/null +++ b/packages/plugins/integration-github-ui/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "target": "es2022", + "useDefineForClassFields": false, + "forceConsistentCasingInFileNames": true, + "strict": false, + "noImplicitOverride": false, + "noPropertyAccessFromIndexSignature": false, + "noImplicitReturns": false, + "noFallthroughCasesInSwitch": false, + "baseUrl": ".", + "paths": { + "@gauzy/ui-core/*": ["./../../../dist/packages/ui-core/*/index.d.ts"] + } + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/packages/plugins/integration-github-ui/tsconfig.lib.json b/packages/plugins/integration-github-ui/tsconfig.lib.json new file mode 100644 index 00000000000..5d1d67c0227 --- /dev/null +++ b/packages/plugins/integration-github-ui/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [] + }, + "exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"], + "include": ["src/**/*.ts"] +} diff --git a/packages/plugins/integration-github-ui/tsconfig.lib.prod.json b/packages/plugins/integration-github-ui/tsconfig.lib.prod.json new file mode 100644 index 00000000000..7b29b93f6f3 --- /dev/null +++ b/packages/plugins/integration-github-ui/tsconfig.lib.prod.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/packages/plugins/integration-github-ui/tsconfig.spec.json b/packages/plugins/integration-github-ui/tsconfig.spec.json new file mode 100644 index 00000000000..0b8b86994ff --- /dev/null +++ b/packages/plugins/integration-github-ui/tsconfig.spec.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/tsconfig.json b/tsconfig.json index 15323e9e86b..623b30ae5d1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,7 @@ "@gauzy/desktop-window": ["./packages/desktop-window/src/index.ts"], "@gauzy/plugin-integration-ai-ui": ["./packages/plugins/integration-ai-ui/src/index.ts"], "@gauzy/plugin-integration-hubstaff-ui": ["./packages/plugins/integration-hubstaff-ui/src/index.ts"], + "@gauzy/plugin-integration-github-ui": ["./packages/plugins/integration-github-ui/src/index.ts"], "@gauzy/plugin-integration-upwork-ui": ["./packages/plugins/integration-upwork-ui/src/index.ts"], "@gauzy/plugin-job-employee-ui": ["./packages/plugins/job-employee-ui/src/index.ts"], "@gauzy/plugin-job-matching-ui": ["./packages/plugins/job-matching-ui/src/index.ts"], From 6831f79bed81ddeae102072b10e3c981b6471c66 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 16 Oct 2024 14:52:51 +0530 Subject: [PATCH 2/7] fix: docker build command --- .deploy/api/Dockerfile | 2 ++ .deploy/webapp/Dockerfile | 1 + apps/desktop/src/package.json | 1 + apps/server/src/package.json | 1 + 4 files changed, 5 insertions(+) diff --git a/.deploy/api/Dockerfile b/.deploy/api/Dockerfile index 12eb747a359..64e3915923d 100644 --- a/.deploy/api/Dockerfile +++ b/.deploy/api/Dockerfile @@ -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/ @@ -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/ diff --git a/.deploy/webapp/Dockerfile b/.deploy/webapp/Dockerfile index b19678ccca5..e723c5057a5 100644 --- a/.deploy/webapp/Dockerfile +++ b/.deploy/webapp/Dockerfile @@ -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/ diff --git a/apps/desktop/src/package.json b/apps/desktop/src/package.json index 0c69abcf0ff..a3a27b9b0ea 100644 --- a/apps/desktop/src/package.json +++ b/apps/desktop/src/package.json @@ -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", diff --git a/apps/server/src/package.json b/apps/server/src/package.json index e8fe4403a5c..7dc66dc9fb6 100755 --- a/apps/server/src/package.json +++ b/apps/server/src/package.json @@ -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", From f15b07bc2c1f84c4b50f77ab8b566f7e9732a69c Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 16 Oct 2024 16:25:02 +0530 Subject: [PATCH 3/7] feat(plugin): add integration GitHub UI package --- .../github/github-routing.module.ts | 56 ----------------- .../integrations/github/github.module.ts | 57 ----------------- .../pages/integrations/integrations.module.ts | 2 +- .../integration-github-ui/package.json | 3 + .../integration-github-ui/src/index.ts | 5 ++ .../installation/installation.component.html | 0 .../installation/installation.component.ts | 1 + .../settings/settings.component.html | 0 .../settings/settings.component.scss | 0 .../settings/settings.component.spec.ts | 0 .../components/settings/settings.component.ts | 0 .../lib}/components/view/view.component.html | 6 +- .../lib}/components/view/view.component.scss | 0 .../components/view/view.component.spec.ts | 0 .../lib}/components/view/view.component.ts | 4 +- .../components/wizard/wizard.component.html | 0 .../components/wizard/wizard.component.scss | 0 .../wizard/wizard.component.spec.ts | 0 .../components/wizard/wizard.component.ts | 1 + .../src/lib}/github.config.ts | 0 .../src/lib/integration-github-ui.module.ts | 62 ++++++++++++++++++- .../integration-github.layout.component.ts | 18 +++--- .../src/lib/integration-github.routes.ts | 56 +++++++++++++++++ .../integration-github-ui/tsconfig.json | 4 +- 24 files changed, 143 insertions(+), 132 deletions(-) delete mode 100644 apps/gauzy/src/app/pages/integrations/github/github-routing.module.ts delete mode 100644 apps/gauzy/src/app/pages/integrations/github/github.module.ts rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/installation/installation.component.html (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/installation/installation.component.ts (99%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/settings/settings.component.html (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/settings/settings.component.scss (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/settings/settings.component.spec.ts (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/settings/settings.component.ts (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/view/view.component.html (97%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/view/view.component.scss (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/view/view.component.spec.ts (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/view/view.component.ts (99%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/wizard/wizard.component.html (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/wizard/wizard.component.scss (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/wizard/wizard.component.spec.ts (100%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/components/wizard/wizard.component.ts (99%) rename {apps/gauzy/src/app/pages/integrations/github => packages/plugins/integration-github-ui/src/lib}/github.config.ts (100%) rename apps/gauzy/src/app/pages/integrations/github/github.component.ts => packages/plugins/integration-github-ui/src/lib/integration-github.layout.component.ts (61%) create mode 100644 packages/plugins/integration-github-ui/src/lib/integration-github.routes.ts diff --git a/apps/gauzy/src/app/pages/integrations/github/github-routing.module.ts b/apps/gauzy/src/app/pages/integrations/github/github-routing.module.ts deleted file mode 100644 index 920869e166f..00000000000 --- a/apps/gauzy/src/app/pages/integrations/github/github-routing.module.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { IntegrationEnum, PermissionsEnum } from '@gauzy/contracts'; -import { IntegrationResolver, PermissionsGuard } from '@gauzy/ui-core/core'; -import { GithubWizardComponent } from './components/wizard/wizard.component'; -import { GithubInstallationComponent } from './components/installation/installation.component'; -import { GithubComponent } from './github.component'; -import { GithubViewComponent } from './components/view/view.component'; - -const routes: Routes = [ - { - path: '', - component: GithubComponent, - canActivate: [PermissionsGuard], - data: { - permissions: { - only: [PermissionsEnum.INTEGRATION_ADD], - redirectTo: '/pages/dashboard' - }, - integration: IntegrationEnum.GITHUB - }, - resolve: { - integration: IntegrationResolver - }, - runGuardsAndResolvers: 'always', - children: [ - { - path: ':integrationId', - component: GithubViewComponent, - data: { selectors: false } - }, - { - path: 'setup/wizard', - component: GithubWizardComponent - } - ] - }, - { - path: 'setup/wizard/reset', - component: GithubWizardComponent, - data: { - selectors: false, - redirectTo: '/pages/integrations/github/setup/wizard' - } - }, - { - path: 'setup/installation', - component: GithubInstallationComponent - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class GithubRoutingModule {} diff --git a/apps/gauzy/src/app/pages/integrations/github/github.module.ts b/apps/gauzy/src/app/pages/integrations/github/github.module.ts deleted file mode 100644 index 5c3611813f4..00000000000 --- a/apps/gauzy/src/app/pages/integrations/github/github.module.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { - NbButtonModule, - NbCardModule, - NbDialogModule, - NbIconModule, - NbPopoverModule, - NbSpinnerModule, - NbTabsetModule, - NbToggleModule -} from '@nebular/theme'; -import { NgSelectModule } from '@ng-select/ng-select'; -import { NgxPermissionsModule } from 'ngx-permissions'; -import { TranslateModule } from '@ngx-translate/core'; -import { - SmartDataViewLayoutModule, - ProjectSelectModule, - RepositorySelectorModule, - SharedModule -} from '@gauzy/ui-core/shared'; -import { GithubRoutingModule } from './github-routing.module'; -import { GithubComponent } from './github.component'; -import { GithubWizardComponent } from './components/wizard/wizard.component'; -import { GithubInstallationComponent } from './components/installation/installation.component'; -import { GithubViewComponent } from './components/view/view.component'; -import { GithubSettingsComponent } from './components/settings/settings.component'; - -@NgModule({ - declarations: [ - GithubComponent, - GithubWizardComponent, - GithubInstallationComponent, - GithubViewComponent, - GithubSettingsComponent - ], - imports: [ - CommonModule, - GithubRoutingModule, - NbButtonModule, - NbCardModule, - NbDialogModule, - NbIconModule, - NbPopoverModule, - NbSpinnerModule, - NbTabsetModule, - NbToggleModule, - NgSelectModule, - NgxPermissionsModule.forChild(), - TranslateModule.forChild(), - SharedModule, - SmartDataViewLayoutModule, - RepositorySelectorModule, - ProjectSelectModule - ] -}) -export class GithubModule {} diff --git a/apps/gauzy/src/app/pages/integrations/integrations.module.ts b/apps/gauzy/src/app/pages/integrations/integrations.module.ts index e52aafeaecd..c189665a1c0 100644 --- a/apps/gauzy/src/app/pages/integrations/integrations.module.ts +++ b/apps/gauzy/src/app/pages/integrations/integrations.module.ts @@ -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 diff --git a/packages/plugins/integration-github-ui/package.json b/packages/plugins/integration-github-ui/package.json index ccf8cd74e67..abd3c3c0ece 100644 --- a/packages/plugins/integration-github-ui/package.json +++ b/packages/plugins/integration-github-ui/package.json @@ -42,6 +42,9 @@ "@angular/router": "^16.2.12", "@gauzy/contracts": "^0.1.0", "@nebular/theme": "^12.0.0", + "@ngneat/until-destroy": "^9.2.0", + "@ngx-translate/core": "^15.0.0", + "angular2-smart-table": "^3.2.0", "ngx-permissions": "^13.0.1", "rxjs": "^7.4.0", "tslib": "^2.6.2" diff --git a/packages/plugins/integration-github-ui/src/index.ts b/packages/plugins/integration-github-ui/src/index.ts index b8a7b9c3204..e6aa4ba200b 100644 --- a/packages/plugins/integration-github-ui/src/index.ts +++ b/packages/plugins/integration-github-ui/src/index.ts @@ -1 +1,6 @@ export * from './lib/integration-github-ui.module'; +export * from './lib/github.config'; +export * from './lib/components/installation/installation.component'; +export * from './lib/components/settings/settings.component'; +export * from './lib/components/view/view.component'; +export * from './lib/components/wizard/wizard.component'; diff --git a/apps/gauzy/src/app/pages/integrations/github/components/installation/installation.component.html b/packages/plugins/integration-github-ui/src/lib/components/installation/installation.component.html similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/installation/installation.component.html rename to packages/plugins/integration-github-ui/src/lib/components/installation/installation.component.html diff --git a/apps/gauzy/src/app/pages/integrations/github/components/installation/installation.component.ts b/packages/plugins/integration-github-ui/src/lib/components/installation/installation.component.ts similarity index 99% rename from apps/gauzy/src/app/pages/integrations/github/components/installation/installation.component.ts rename to packages/plugins/integration-github-ui/src/lib/components/installation/installation.component.ts index 50a025edf8b..8562d89bf14 100644 --- a/apps/gauzy/src/app/pages/integrations/github/components/installation/installation.component.ts +++ b/packages/plugins/integration-github-ui/src/lib/components/installation/installation.component.ts @@ -7,6 +7,7 @@ import { GithubService, Store } from '@gauzy/ui-core/core'; @UntilDestroy({ checkProperties: true }) @Component({ + selector: 'ngx-integration-github-installation', templateUrl: './installation.component.html' }) export class GithubInstallationComponent implements AfterViewInit, OnInit { diff --git a/apps/gauzy/src/app/pages/integrations/github/components/settings/settings.component.html b/packages/plugins/integration-github-ui/src/lib/components/settings/settings.component.html similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/settings/settings.component.html rename to packages/plugins/integration-github-ui/src/lib/components/settings/settings.component.html diff --git a/apps/gauzy/src/app/pages/integrations/github/components/settings/settings.component.scss b/packages/plugins/integration-github-ui/src/lib/components/settings/settings.component.scss similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/settings/settings.component.scss rename to packages/plugins/integration-github-ui/src/lib/components/settings/settings.component.scss diff --git a/apps/gauzy/src/app/pages/integrations/github/components/settings/settings.component.spec.ts b/packages/plugins/integration-github-ui/src/lib/components/settings/settings.component.spec.ts similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/settings/settings.component.spec.ts rename to packages/plugins/integration-github-ui/src/lib/components/settings/settings.component.spec.ts diff --git a/apps/gauzy/src/app/pages/integrations/github/components/settings/settings.component.ts b/packages/plugins/integration-github-ui/src/lib/components/settings/settings.component.ts similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/settings/settings.component.ts rename to packages/plugins/integration-github-ui/src/lib/components/settings/settings.component.ts diff --git a/apps/gauzy/src/app/pages/integrations/github/components/view/view.component.html b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html similarity index 97% rename from apps/gauzy/src/app/pages/integrations/github/components/view/view.component.html rename to packages/plugins/integration-github-ui/src/lib/components/view/view.component.html index 7b3f71e6b3d..101e64c2c5c 100644 --- a/apps/gauzy/src/app/pages/integrations/github/components/view/view.component.html +++ b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html @@ -57,7 +57,7 @@
#issuesTable >
- + diff --git a/apps/gauzy/src/app/pages/integrations/github/components/view/view.component.scss b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.scss similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/view/view.component.scss rename to packages/plugins/integration-github-ui/src/lib/components/view/view.component.scss diff --git a/apps/gauzy/src/app/pages/integrations/github/components/view/view.component.spec.ts b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.spec.ts similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/view/view.component.spec.ts rename to packages/plugins/integration-github-ui/src/lib/components/view/view.component.spec.ts diff --git a/apps/gauzy/src/app/pages/integrations/github/components/view/view.component.ts b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.ts similarity index 99% rename from apps/gauzy/src/app/pages/integrations/github/components/view/view.component.ts rename to packages/plugins/integration-github-ui/src/lib/components/view/view.component.ts index e250325e6dd..f00ab6373b0 100644 --- a/apps/gauzy/src/app/pages/integrations/github/components/view/view.component.ts +++ b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.ts @@ -58,8 +58,8 @@ export class GithubViewComponent extends PaginationFilterBaseComponent implement public syncTabsEnum: typeof SyncTabsEnum = SyncTabsEnum; public nbTab$: Subject = new BehaviorSubject(SyncTabsEnum.AUTO_SYNC); public page$: Observable; // Observable for the organization project - public settingsSmartTableIssues: object; // Settings for the Smart Table used for issues - public settingsSmartTableProjects: object; // Settings for the Smart Table used for projects + public settingsSmartTableIssues: any; // Settings for the Smart Table used for issues + public settingsSmartTableProjects: any; // Settings for the Smart Table used for projects public syncing: boolean = false; // Flag to indicate if data synchronization is in progress public loading: boolean = false; // Flag to indicate if data loading is in progress public user: IUser = this._store.user; // User object obtained from a service (likely a store) diff --git a/apps/gauzy/src/app/pages/integrations/github/components/wizard/wizard.component.html b/packages/plugins/integration-github-ui/src/lib/components/wizard/wizard.component.html similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/wizard/wizard.component.html rename to packages/plugins/integration-github-ui/src/lib/components/wizard/wizard.component.html diff --git a/apps/gauzy/src/app/pages/integrations/github/components/wizard/wizard.component.scss b/packages/plugins/integration-github-ui/src/lib/components/wizard/wizard.component.scss similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/wizard/wizard.component.scss rename to packages/plugins/integration-github-ui/src/lib/components/wizard/wizard.component.scss diff --git a/apps/gauzy/src/app/pages/integrations/github/components/wizard/wizard.component.spec.ts b/packages/plugins/integration-github-ui/src/lib/components/wizard/wizard.component.spec.ts similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/components/wizard/wizard.component.spec.ts rename to packages/plugins/integration-github-ui/src/lib/components/wizard/wizard.component.spec.ts diff --git a/apps/gauzy/src/app/pages/integrations/github/components/wizard/wizard.component.ts b/packages/plugins/integration-github-ui/src/lib/components/wizard/wizard.component.ts similarity index 99% rename from apps/gauzy/src/app/pages/integrations/github/components/wizard/wizard.component.ts rename to packages/plugins/integration-github-ui/src/lib/components/wizard/wizard.component.ts index 47659f57a38..521a295a78d 100644 --- a/apps/gauzy/src/app/pages/integrations/github/components/wizard/wizard.component.ts +++ b/packages/plugins/integration-github-ui/src/lib/components/wizard/wizard.component.ts @@ -10,6 +10,7 @@ import { GITHUB_AUTHORIZATION_URL } from '../../github.config'; @UntilDestroy({ checkProperties: true }) @Component({ + selector: 'ngx-integration-github-wizard', templateUrl: './wizard.component.html' }) export class GithubWizardComponent implements AfterViewInit, OnInit, OnDestroy { diff --git a/apps/gauzy/src/app/pages/integrations/github/github.config.ts b/packages/plugins/integration-github-ui/src/lib/github.config.ts similarity index 100% rename from apps/gauzy/src/app/pages/integrations/github/github.config.ts rename to packages/plugins/integration-github-ui/src/lib/github.config.ts diff --git a/packages/plugins/integration-github-ui/src/lib/integration-github-ui.module.ts b/packages/plugins/integration-github-ui/src/lib/integration-github-ui.module.ts index c6f4568ecac..48cac63e4eb 100644 --- a/packages/plugins/integration-github-ui/src/lib/integration-github-ui.module.ts +++ b/packages/plugins/integration-github-ui/src/lib/integration-github-ui.module.ts @@ -1,7 +1,65 @@ import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; +import { HttpClient } from '@angular/common/http'; +import { + NbButtonModule, + NbCardModule, + NbDialogModule, + NbIconModule, + NbPopoverModule, + NbSpinnerModule, + NbTabsetModule, + NbToggleModule +} from '@nebular/theme'; +import { NgSelectModule } from '@ng-select/ng-select'; +import { NgxPermissionsModule } from 'ngx-permissions'; +import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { HttpLoaderFactory } from '@gauzy/ui-core/i18n'; +import { + SmartDataViewLayoutModule, + ProjectSelectModule, + RepositorySelectorModule, + SharedModule, + getBrowserLanguage +} from '@gauzy/ui-core/shared'; +import { IntegrationGithubRoutes } from './integration-github.routes'; +import { IntegrationGithubLayoutComponent } from './integration-github.layout.component'; +import { GithubWizardComponent } from './components/wizard/wizard.component'; +import { GithubInstallationComponent } from './components/installation/installation.component'; +import { GithubViewComponent } from './components/view/view.component'; +import { GithubSettingsComponent } from './components/settings/settings.component'; @NgModule({ - imports: [CommonModule] + declarations: [ + IntegrationGithubLayoutComponent, + GithubWizardComponent, + GithubInstallationComponent, + GithubViewComponent, + GithubSettingsComponent + ], + imports: [ + NbButtonModule, + NbCardModule, + NbDialogModule, + NbIconModule, + NbPopoverModule, + NbSpinnerModule, + NbTabsetModule, + NbToggleModule, + NgSelectModule, + NgxPermissionsModule.forRoot(), + TranslateModule.forRoot({ + defaultLanguage: getBrowserLanguage(), // Get the browser language and fall back to a default if needed + loader: { + provide: TranslateLoader, + useFactory: HttpLoaderFactory, + deps: [HttpClient] + } + }), + IntegrationGithubRoutes, + SharedModule, + SmartDataViewLayoutModule, + RepositorySelectorModule, + ProjectSelectModule + ] }) export class IntegrationGithubUiModule {} diff --git a/apps/gauzy/src/app/pages/integrations/github/github.component.ts b/packages/plugins/integration-github-ui/src/lib/integration-github.layout.component.ts similarity index 61% rename from apps/gauzy/src/app/pages/integrations/github/github.component.ts rename to packages/plugins/integration-github-ui/src/lib/integration-github.layout.component.ts index 8e576a97c3b..1d904e4e23d 100644 --- a/apps/gauzy/src/app/pages/integrations/github/github.component.ts +++ b/packages/plugins/integration-github-ui/src/lib/integration-github.layout.component.ts @@ -5,23 +5,21 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; @UntilDestroy({ checkProperties: true }) @Component({ - template: ` ` + selector: `ngx-integration-github-layout`, + template: `` }) -export class GithubComponent implements OnInit { +export class IntegrationGithubLayoutComponent implements OnInit { constructor(private readonly _router: Router, private readonly _activatedRoute: ActivatedRoute) {} - /** - * - */ ngOnInit() { this._activatedRoute.data .pipe( tap(({ integration }: Data) => { - if (integration) { - this._router.navigate(['/pages/integrations/github', integration.id]); - } else { - this._router.navigate(['/pages/integrations/github/setup/wizard']); - } + const path = integration + ? `/pages/integrations/github/${integration.id}` + : '/pages/integrations/github/setup/wizard'; + + this._router.navigate([path]); }), untilDestroyed(this) ) diff --git a/packages/plugins/integration-github-ui/src/lib/integration-github.routes.ts b/packages/plugins/integration-github-ui/src/lib/integration-github.routes.ts new file mode 100644 index 00000000000..89a45e3a8e1 --- /dev/null +++ b/packages/plugins/integration-github-ui/src/lib/integration-github.routes.ts @@ -0,0 +1,56 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { IntegrationEnum, PermissionsEnum } from '@gauzy/contracts'; +import { IntegrationResolver, PermissionsGuard } from '@gauzy/ui-core/core'; +import { GithubWizardComponent } from './components/wizard/wizard.component'; +import { GithubInstallationComponent } from './components/installation/installation.component'; +import { IntegrationGithubLayoutComponent } from './integration-github.layout.component'; +import { GithubViewComponent } from './components/view/view.component'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { + path: '', + component: IntegrationGithubLayoutComponent, + canActivate: [PermissionsGuard], + data: { + permissions: { + only: [PermissionsEnum.INTEGRATION_ADD], + redirectTo: '/pages/dashboard' + }, + integration: IntegrationEnum.GITHUB + }, + resolve: { + integration: IntegrationResolver + }, + runGuardsAndResolvers: 'always', + children: [ + { + path: ':integrationId', + component: GithubViewComponent, + data: { selectors: false } + }, + { + path: 'setup/wizard', + component: GithubWizardComponent + } + ] + }, + { + path: 'setup/wizard/reset', + component: GithubWizardComponent, + data: { + selectors: false, + redirectTo: '/pages/integrations/github/setup/wizard' + } + }, + { + path: 'setup/installation', + component: GithubInstallationComponent + } + ]) + ], + exports: [RouterModule] +}) +export class IntegrationGithubRoutes {} diff --git a/packages/plugins/integration-github-ui/tsconfig.json b/packages/plugins/integration-github-ui/tsconfig.json index 382cdf455f9..8a309f45a75 100644 --- a/packages/plugins/integration-github-ui/tsconfig.json +++ b/packages/plugins/integration-github-ui/tsconfig.json @@ -10,7 +10,9 @@ "noFallthroughCasesInSwitch": false, "baseUrl": ".", "paths": { - "@gauzy/ui-core/*": ["./../../../dist/packages/ui-core/*/index.d.ts"] + "@gauzy/ui-core/*": ["./../../../dist/packages/ui-core/*/index.d.ts"], + "@ngx-translate/*": ["./node_modules/@ngx-translate/*"], + "ngx-permissions": ["./node_modules/ngx-permissions"] } }, "files": [], From 7461ede02e7d423c2e94e67ef617c331cc0c0119 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 16 Oct 2024 18:03:38 +0530 Subject: [PATCH 4/7] fix(github): automatically selected repository based on project --- packages/core/src/shared/index.ts | 6 +- .../pipes/column-numeric-transformer.pipe.ts | 46 +++--- .../lib/components/view/view.component.html | 7 - .../src/lib/github/github-sync.service.ts | 4 +- .../repository/github-repository.entity.ts | 15 +- .../repository-selector.component.html | 16 ++- .../repository-selector.component.ts | 134 ++++++++++-------- 7 files changed, 123 insertions(+), 105 deletions(-) diff --git a/packages/core/src/shared/index.ts b/packages/core/src/shared/index.ts index c4d762575ab..21313c475b5 100644 --- a/packages/core/src/shared/index.ts +++ b/packages/core/src/shared/index.ts @@ -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'; diff --git a/packages/core/src/shared/pipes/column-numeric-transformer.pipe.ts b/packages/core/src/shared/pipes/column-numeric-transformer.pipe.ts index f13503b54d8..b398903efe8 100644 --- a/packages/core/src/shared/pipes/column-numeric-transformer.pipe.ts +++ b/packages/core/src/shared/pipes/column-numeric-transformer.pipe.ts @@ -1,32 +1,30 @@ -import { ValueTransformer } from "typeorm"; -import { isNullOrUndefined } from "@gauzy/common"; +import { ValueTransformer } from 'typeorm'; +import { isNotNullOrUndefined, isNullOrUndefined } 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 + } } diff --git a/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html index 101e64c2c5c..fa2f7e260df 100644 --- a/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html +++ b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html @@ -182,13 +182,6 @@
#issuesTable > - diff --git a/packages/plugins/integration-github/src/lib/github/github-sync.service.ts b/packages/plugins/integration-github/src/lib/github/github-sync.service.ts index 737221efa0c..9913e8dbba1 100644 --- a/packages/plugins/integration-github/src/lib/github/github-sync.service.ts +++ b/packages/plugins/integration-github/src/lib/github/github-sync.service.ts @@ -443,9 +443,7 @@ export class GithubSyncService { try { /** Extract necessary data from integration */ - const tenantId = integration['tenantId']; - const organizationId = integration['organizationId']; - const integrationId = integration['id']; + const { tenantId, organizationId, id: integrationId } = integration; /** Get a list of projects for the repository */ const projects = await this._organizationProjectService.getProjectsByGithubRepository(repository.id, { diff --git a/packages/plugins/integration-github/src/lib/github/repository/github-repository.entity.ts b/packages/plugins/integration-github/src/lib/github/repository/github-repository.entity.ts index 35aa94ff6b2..17c5c0c4305 100644 --- a/packages/plugins/integration-github/src/lib/github/repository/github-repository.entity.ts +++ b/packages/plugins/integration-github/src/lib/github/repository/github-repository.entity.ts @@ -8,7 +8,14 @@ import { IOrganizationGithubRepositoryIssue } from '@gauzy/contracts'; import { IntegrationTenant, TenantOrganizationBaseEntity } from '@gauzy/core'; -import { ColumnIndex, MultiORMColumn, MultiORMEntity, MultiORMManyToOne, MultiORMOneToMany } from '@gauzy/core'; +import { + ColumnIndex, + MultiORMColumn, + MultiORMEntity, + MultiORMManyToOne, + MultiORMOneToMany, + ColumnNumericTransformerPipe +} from '@gauzy/core'; import { MikroOrmOrganizationGithubRepositoryRepository } from './repository/mikro-orm-organization-github-repository.repository'; import { OrganizationGithubRepositoryIssue } from './issue/github-repository-issue.entity'; @@ -19,11 +26,15 @@ export class OrganizationGithubRepository extends TenantOrganizationBaseEntity implements IOrganizationGithubRepository { + /** + * The ID of the GitHub repository. + * Should be a bigint to accommodate larger IDs. + */ @ApiProperty({ type: () => Number }) @IsNotEmpty() @IsNumber() @ColumnIndex() - @MultiORMColumn({ type: 'bigint' }) + @MultiORMColumn({ type: 'bigint', transformer: new ColumnNumericTransformerPipe() }) repositoryId: number; @ApiProperty({ type: () => String }) diff --git a/packages/ui-core/shared/src/lib/integrations/github/repository-selector/repository-selector.component.html b/packages/ui-core/shared/src/lib/integrations/github/repository-selector/repository-selector.component.html index c569e23a858..27baef2e25d 100644 --- a/packages/ui-core/shared/src/lib/integrations/github/repository-selector/repository-selector.component.html +++ b/packages/ui-core/shared/src/lib/integrations/github/repository-selector/repository-selector.component.html @@ -9,13 +9,13 @@ [searchable]="false" [clearable]="true" [loading]="loading" - (change)="selectRepository($event)" [(ngModel)]="sourceId" - [placeholder]="placeholder || 'INTEGRATIONS.GITHUB_PAGE.SELECT_REPOSITORY' | translate" + [placeholder]="placeholder || ('INTEGRATIONS.GITHUB_PAGE.SELECT_REPOSITORY' | translate)" bindLabel="full_name" bindValue="id" appendTo="body" dropdownPosition="bottom" + (change)="selectRepository($event)" > - - {{ item.full_name }} + + + {{ item.full_name }} + - - {{ item.full_name }} + + + {{ item.full_name }} + diff --git a/packages/ui-core/shared/src/lib/integrations/github/repository-selector/repository-selector.component.ts b/packages/ui-core/shared/src/lib/integrations/github/repository-selector/repository-selector.component.ts index 40923350513..28c76a60914 100644 --- a/packages/ui-core/shared/src/lib/integrations/github/repository-selector/repository-selector.component.ts +++ b/packages/ui-core/shared/src/lib/integrations/github/repository-selector/repository-selector.component.ts @@ -5,8 +5,7 @@ import { catchError, finalize, map, tap } from 'rxjs/operators'; import { Observable } from 'rxjs/internal/Observable'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { IGithubRepository, IGithubRepositoryResponse, IIntegrationTenant, IOrganization } from '@gauzy/contracts'; -import { ErrorHandlingService, GithubService } from '@gauzy/ui-core/core'; -import { Store } from '@gauzy/ui-core/core'; +import { ErrorHandlingService, GithubService, Store } from '@gauzy/ui-core/core'; @UntilDestroy({ checkProperties: true }) @Component({ @@ -29,66 +28,72 @@ export class RepositorySelectorComponent implements OnInit, OnDestroy { public repositories: IGithubRepository[] = []; public repositories$: Observable; - /* - * Getter & Setter for dynamic placeholder + /** + * Placeholder text to guide the user. Defaults to null if not provided. */ - _placeholder: string; - get placeholder(): string { - return this._placeholder; - } - @Input() set placeholder(value: string) { - this._placeholder = value; - } + @Input() placeholder: string | null = null; - /** Getter & Setter */ - private _selected: boolean = false; - get selected(): boolean { - return this._selected; - } - @Input() set selected(value: boolean) { - this._selected = value; - } + /** + * Indicates whether the component is selected. Defaults to false. + */ + @Input() selected: boolean = false; - /** Getter & Setter */ + /** Getter & Setter for integration */ private _integration: IIntegrationTenant; - // Getter for the integration property as an Observable - get integration(): IIntegrationTenant { - return this._integration; - } - // Setter for the integration property + /** + * Setter for the integration property. + * Updates the integration and notifies observers with the new value. + */ @Input() set integration(value: IIntegrationTenant) { if (value) { this._integration = value; this.subject$.next(value); // Emit the updated value to observers } } - - // Implement your onChange and onTouched methods - onChange: (value: IGithubRepository['id']) => void = () => {}; - onTouched: (value: IGithubRepository['id']) => void = () => {}; + /** + * Getter for the integration property. + * Returns the current integration value. + */ + get integration(): IIntegrationTenant { + return this._integration; + } // Define the getter and setter for the repository - private _sourceId: IGithubRepository['id']; - get sourceId(): IGithubRepository['id'] { - return this._sourceId; - } - @Input() set sourceId(val: IGithubRepository['id']) { + private _sourceId: number; + /** + * Setter for the sourceId property. + * Updates the source ID and triggers relevant changes when a valid value is provided. + */ + @Input() set sourceId(val: number) { if (val) { + // Check if the conversion was successful this._sourceId = val; - this.onChange(val); - this.onTouched(val); - /** Pre Selected Repository */ + this.onChange(this._sourceId); // Trigger the onChange event with the converted number + this.onTouched(); // Mark the field as touched + + // Handle pre-selected repository if applicable if (this.selected) { - this._preSelectedRepository(this._sourceId); + this._preSelectedRepository(this._sourceId); // Pre-select the repository } } } + /** + * Getter for the sourceId property. + * Returns the current source ID value. + */ + get sourceId(): number { + return this._sourceId; + } /** */ @Output() onChanged = new EventEmitter(); @Output() afterLoad = new EventEmitter(); + // Implement your onChange and onTouched methods + onChange: (value: number) => void = () => {}; + onTouched: () => void = () => {}; + constructor( private readonly _store: Store, private readonly _githubService: GithubService, @@ -109,13 +114,11 @@ export class RepositorySelectorComponent implements OnInit, OnDestroy { * * @param sourceId - The ID of the source repository to pre-select. */ - private _preSelectedRepository(sourceId: IGithubRepository['id']) { - // Find the repository in the list of repositories using the source ID - const repository = this.repositories.find((repository: IGithubRepository) => repository.id === sourceId); + private _preSelectedRepository(sourceId: number): void { + const repository = this.repositories.find((repo: IGithubRepository) => repo.id === sourceId); - // If the repository is found, select it if (repository) { - this.selectRepository(repository); + this.selectRepository(repository); // Select the found repository } } @@ -123,17 +126,14 @@ export class RepositorySelectorComponent implements OnInit, OnDestroy { * Fetches repositories for a given integration and organization. */ private _getRepositories() { - // Ensure there is a valid organization - if (!this.organization) { - return; - } + if (!this.integration) return; // Ensure a valid integration is present this.loading = true; - // Extract organization properties - const { id: organizationId, tenantId } = this.organization; - const { id: integrationId } = this.integration; + // Destructure required properties from the integration object + const { id: integrationId, organizationId, tenantId } = this.integration; + // Fetch the repositories using the integration details const repositories$ = this._githubService.getRepositories(integrationId, { organizationId, tenantId @@ -151,6 +151,7 @@ export class RepositorySelectorComponent implements OnInit, OnDestroy { return of([]); }), finalize(() => { + // Set loading to false once finished this.loading = false; }), // Handle component lifecycle to avoid memory leaks @@ -159,27 +160,40 @@ export class RepositorySelectorComponent implements OnInit, OnDestroy { } /** - * Selects a GitHub repository and retrieves its associated issues. - * @param repository - The GitHub repository to select. + * Selects a GitHub repository and emits the selection event. + * + * @param repository - The selected GitHub repository. */ public selectRepository(repository: IGithubRepository) { if (repository) { - this.onChanged.emit(repository); + this.onChanged.emit(repository); // Emit the selected repository } } - // Define the writeValue method required for ControlValueAccessor - public writeValue(value: IGithubRepository['id']) { - this._sourceId = value; + /** + * Write the value (repository ID) into the component. + * + * @param value - The value to be written, representing the repository ID. + */ + public writeValue(value: number): void { + this._sourceId = value; // Assign the provided value to _sourceId } - // Define the registerOnChange method required for ControlValueAccessor - public registerOnChange(fn: (value: IGithubRepository['id']) => void) { + /** + * Register a function to call when the control's value changes. + * + * @param fn - The function that handles value changes. + */ + public registerOnChange(fn: (value: number) => void): void { this.onChange = fn; } - // Define the registerOnTouched method required for ControlValueAccessor - public registerOnTouched(fn: () => void) { + /** + * Register a function to call when the control is touched. + * + * @param fn - The function that handles touch events. + */ + public registerOnTouched(fn: () => void): void { this.onTouched = fn; } From 2b44771ac64fe0bf974d259bfe7f4ac802d871c2 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 16 Oct 2024 18:36:17 +0530 Subject: [PATCH 5/7] fix: manual repository issues pagination --- .../pipes/column-numeric-transformer.pipe.ts | 2 +- .../lib/components/view/view.component.html | 14 ++++ .../pagination/pagination.component.ts | 80 +++++++++++-------- 3 files changed, 63 insertions(+), 33 deletions(-) diff --git a/packages/core/src/shared/pipes/column-numeric-transformer.pipe.ts b/packages/core/src/shared/pipes/column-numeric-transformer.pipe.ts index b398903efe8..366afb302a6 100644 --- a/packages/core/src/shared/pipes/column-numeric-transformer.pipe.ts +++ b/packages/core/src/shared/pipes/column-numeric-transformer.pipe.ts @@ -1,5 +1,5 @@ import { ValueTransformer } from 'typeorm'; -import { isNotNullOrUndefined, isNullOrUndefined } from '@gauzy/common'; +import { isNotNullOrUndefined } from '@gauzy/common'; /** * Convert Non-integer numbers string to integer diff --git a/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html index fa2f7e260df..c0cd4fcf6e5 100644 --- a/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html +++ b/packages/plugins/integration-github-ui/src/lib/components/view/view.component.html @@ -182,6 +182,20 @@
#issuesTable > + +
+ + + +
+
diff --git a/packages/ui-core/shared/src/lib/smart-data-layout/pagination/pagination.component.ts b/packages/ui-core/shared/src/lib/smart-data-layout/pagination/pagination.component.ts index 220970220ee..cec1a740edf 100644 --- a/packages/ui-core/shared/src/lib/smart-data-layout/pagination/pagination.component.ts +++ b/packages/ui-core/shared/src/lib/smart-data-layout/pagination/pagination.component.ts @@ -59,8 +59,8 @@ export class PaginationComponent implements OnInit { subject$: Subject = new Subject(); - @Output() selectedPage = new EventEmitter(); - @Output() selectedOption = new EventEmitter(); + @Output() selectedPage = new EventEmitter(); + @Output() selectedOption = new EventEmitter(); ngOnInit() { this.subject$ @@ -78,75 +78,91 @@ export class PaginationComponent implements OnInit { } /** + * Generates an array of page numbers to be displayed in the pagination. + * The number of displayed pages is adjustable based on the current active page. * - * @returns + * @returns An array of page numbers. */ - getPages() { - const pagesCount = this.getPagesCount(); - let pages = []; - let showPagesCount = 5; - showPagesCount = pagesCount < showPagesCount ? pagesCount : showPagesCount; - let middleOne = Math.ceil(showPagesCount / 2); - middleOne = this.activePage >= middleOne ? this.activePage : middleOne; - let lastOne = middleOne + Math.floor(showPagesCount / 2); - lastOne = lastOne >= pagesCount ? pagesCount : lastOne; - const firstOne = lastOne - showPagesCount + 1; - for (let i = firstOne; i <= lastOne; i++) { - pages.push(i); - } - return pages; + getPages(): number[] { + const totalPages = this.getPagesCount(); // Total number of pages + const displayCount = 5; // Number of pages to display + const effectiveDisplayCount = Math.min(totalPages, displayCount); // Ensure we don't exceed total pages + const middlePage = Math.ceil(effectiveDisplayCount / 2); // Calculate middle page position + + // Determine the last page to display + let lastPage = + this.activePage >= middlePage + ? Math.min(this.activePage + Math.floor(effectiveDisplayCount / 2), totalPages) + : effectiveDisplayCount; + + // Determine the first page to display + const firstPage = Math.max(lastPage - effectiveDisplayCount + 1, 1); // Ensure first page is at least 1 + + // Generate the array of page numbers + return Array.from({ length: lastPage - firstPage + 1 }, (_, index) => firstPage + index); } /** + * Calculates the starting index of the items on the current page. * - * @returns + * @returns The starting index of the items for the active page. */ - getStartPagesCount() { + getStartPagesCount(): number { return (this.activePage - 1) * this.itemsPerPage + 1; } /** + * Calculates the ending index of the items on the current page. * - * @returns + * @returns The ending index of the items for the active page, capped at the total number of items. */ - getEndPagesCount() { + getEndPagesCount(): number { const entriesEndPage = (this.activePage - 1) * this.itemsPerPage + this.itemsPerPage; - if (entriesEndPage > this.totalItems) { - return this.totalItems; - } - return entriesEndPage; + // Ensure the ending index does not exceed the total number of items + return entriesEndPage > this.totalItems ? this.totalItems : entriesEndPage; } /** + * Calculates the total number of pages based on the total items and items per page. * + * @returns The total number of pages available. */ - getPagesCount() { + getPagesCount(): number { return Math.ceil(this.totalItems / this.itemsPerPage); } /** + * Updates the active page index when the user changes the page. * + * @param pageIdx - The index of the page to switch to. */ - onChangePage(pageIdx: number) { + onChangePage(pageIdx: number): void { this.activePage = pageIdx; } /** - * Next page click + * Handles the action of clicking the next page button. + * Increments the active page by 1, unless it is already the last page. */ - onNextPageClick() { + onNextPageClick(): void { + // Increment activePage or set it to the last page if already at the end this.activePage = this.activePage >= this.getPagesCount() ? this.getPagesCount() : this.activePage + 1; + // Emit the updated active page this.subject$.next(this.activePage); } /** - * Previous page click + * Handles the action of clicking the previous page button. + * Decrements the active page by 1, unless it is already the first page. */ - onPrevPageClick() { - if (this.activePage == 1) return; + onPrevPageClick(): void { + // Prevent decrementing if already on the first page + if (this.activePage === 1) return; + // Decrement activePage this.activePage--; + // Emit the updated active page this.subject$.next(this.activePage); } } From 68b9abac826e8d7ac1eb7a5bbaccc01a78bcfa3f Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Wed, 16 Oct 2024 19:04:20 +0530 Subject: [PATCH 6/7] fix: changed log messages for automation task sync handler --- .../tasks/commands/handlers/automation-task.sync.handler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/tasks/commands/handlers/automation-task.sync.handler.ts b/packages/core/src/tasks/commands/handlers/automation-task.sync.handler.ts index c3b465bd13e..0559acc301f 100644 --- a/packages/core/src/tasks/commands/handlers/automation-task.sync.handler.ts +++ b/packages/core/src/tasks/commands/handlers/automation-task.sync.handler.ts @@ -135,7 +135,7 @@ export class AutomationTaskSyncHandler implements ICommandHandler { + async updateTask(id: ID, entity: ITaskUpdateInput): Promise { try { // Find the existing task by its ID const existingTask = await this._taskService.findOneByIdString(id); @@ -162,7 +162,7 @@ export class AutomationTaskSyncHandler implements ICommandHandler Date: Wed, 16 Oct 2024 19:12:58 +0530 Subject: [PATCH 7/7] fix: integration layout selectors --- .../src/lib/integration-ai.layout.component.ts | 2 +- .../src/lib/integration-hubstaff.layout.component.ts | 2 +- .../src/lib/integration-upwork.layout.component.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/plugins/integration-ai-ui/src/lib/integration-ai.layout.component.ts b/packages/plugins/integration-ai-ui/src/lib/integration-ai.layout.component.ts index abae8c81ad2..6bf68bc2b31 100644 --- a/packages/plugins/integration-ai-ui/src/lib/integration-ai.layout.component.ts +++ b/packages/plugins/integration-ai-ui/src/lib/integration-ai.layout.component.ts @@ -10,7 +10,7 @@ import { I18nService } from '@gauzy/ui-core/i18n'; @UntilDestroy({ checkProperties: true }) @Component({ - selector: '', + selector: 'ngx-integration-ai-layout', template: `` }) export class IntegrationAILayoutComponent implements OnInit, OnDestroy { diff --git a/packages/plugins/integration-hubstaff-ui/src/lib/integration-hubstaff.layout.component.ts b/packages/plugins/integration-hubstaff-ui/src/lib/integration-hubstaff.layout.component.ts index 094d76b7f17..8f6e13e558d 100644 --- a/packages/plugins/integration-hubstaff-ui/src/lib/integration-hubstaff.layout.component.ts +++ b/packages/plugins/integration-hubstaff-ui/src/lib/integration-hubstaff.layout.component.ts @@ -10,7 +10,7 @@ import { I18nService } from '@gauzy/ui-core/i18n'; @UntilDestroy({ checkProperties: true }) @Component({ - selector: '', + selector: 'ngx-integration-hubstaff-layout', template: `` }) export class IntegrationHubstaffLayoutComponent implements OnInit, OnDestroy { diff --git a/packages/plugins/integration-upwork-ui/src/lib/integration-upwork.layout.component.ts b/packages/plugins/integration-upwork-ui/src/lib/integration-upwork.layout.component.ts index 9ceecb83da6..67d007687e5 100644 --- a/packages/plugins/integration-upwork-ui/src/lib/integration-upwork.layout.component.ts +++ b/packages/plugins/integration-upwork-ui/src/lib/integration-upwork.layout.component.ts @@ -9,7 +9,7 @@ import { I18nService } from '@gauzy/ui-core/i18n'; @UntilDestroy({ checkProperties: true }) @Component({ - selector: '', + selector: 'ngx-integration-upwork-layout', template: `` }) export class IntegrationUpworkLayoutComponent implements OnInit, OnDestroy {