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

Stage #7074

Merged
merged 27 commits into from
Nov 2, 2023
Merged

Stage #7074

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e758f1d
Soft Delete Column moved to base Entity
Gramosx Oct 4, 2023
02afe4c
Fixes for SoftDelete
Gramosx Oct 5, 2023
c33c32b
Merge branch 'develop' into feat/6909-softDelete-implimentation
rahul-rocket Oct 30, 2023
552e0a9
Merge branch 'develop' into feat/6909-softDelete-implimentation
rahul-rocket Oct 30, 2023
6d68856
feat(migration): #6909 soft delete feature [tables migration]
rahul-rocket Oct 30, 2023
41b9823
fix: #6909 soft delete feature for seeders
rahul-rocket Oct 30, 2023
f430a64
fix: #6909 eager loading relationship with image asset
rahul-rocket Oct 30, 2023
6235433
fix: #6909 removed unnecessary logs
rahul-rocket Oct 30, 2023
f85fe38
fix: #6909 eager loading false
rahul-rocket Oct 30, 2023
1be46bc
fix: #6909 missing image for employee/organization selectors
rahul-rocket Oct 30, 2023
8d318b6
fix: #6909 reverted some eager loading
rahul-rocket Oct 31, 2023
409c664
fix: #6909 reverted some eager loading
rahul-rocket Oct 31, 2023
813177d
fix: #6909 eager loading query set find option issue
rahul-rocket Oct 31, 2023
593176f
fix: #6909 reverted some eager loading
rahul-rocket Oct 31, 2023
0f7a88b
fix: #6909 eager loading query set find option issue
rahul-rocket Oct 31, 2023
eabfac1
fix: #6909 removed deletedAt column filter manually
rahul-rocket Oct 31, 2023
a4045a3
fix: #6909 missing join for candidate entities
rahul-rocket Oct 31, 2023
db0975f
fix: #6909 reverted left join (deprecated)
rahul-rocket Oct 31, 2023
e0d5880
fix: #6909 reverted left join (deprecated)
rahul-rocket Oct 31, 2023
93df737
fix: cspell spelling
rahul-rocket Oct 31, 2023
da5c1c4
fix: gauzy AI integration page improvement
rahul-rocket Nov 1, 2023
c804f72
Merge pull request #7066 from ever-co/fix/integration-task-sync-dupli…
rahul-rocket Nov 1, 2023
611f4f9
Merge branch 'develop' into feat/6909-softDelete-implimentation
rahul-rocket Nov 1, 2023
b42ce23
Merge pull request #6931 from ever-co/feat/6909-softDelete-implimenta…
rahul-rocket Nov 1, 2023
4c2691d
fix: sending empty activities
adkif Nov 1, 2023
8ad0e4a
Merge pull request #7070 from ever-co/bug/send-empty-activities
rahul-rocket Nov 1, 2023
1e130c8
Merge pull request #7072 from ever-co/develop
evereq Nov 1, 2023
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/gauzy/src/app/@core/services/app-init-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class AppInitService {
private readonly router: Router,
private readonly store: Store,
private readonly ngxPermissionsService: NgxPermissionsService
) {}
) { }

async init() {
try {
Expand Down
3 changes: 3 additions & 0 deletions apps/gauzy/src/app/@shared/workspaces/workspaces.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export class WorkspacesComponent extends TranslationBaseComponent
}

getWorkspaces() {
if (!this.user.tenantId) {
return;
}
const { tenant } = this.user;
const workspace = {
id: tenant.id,
Expand Down
2 changes: 1 addition & 1 deletion apps/gauzy/src/app/@theme/layouts/public/public.layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class PublicLayoutComponent implements OnInit, AfterViewInit {
private readonly store: Store,
private readonly usersService: UsersService,
private readonly themeService: NbThemeService
) {}
) { }
@ViewChild(NbLayoutComponent) layout: NbLayoutComponent;

user: any;
Expand Down
17 changes: 6 additions & 11 deletions apps/gauzy/src/app/pages/candidates/candidates.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,9 @@ export class CandidatesComponent extends PaginationFilterBaseComponent
if (!this.selectedCandidate) {
return;
}
this.router.navigate([
'/pages/employees/candidates/edit/' +
this.selectedCandidate.id +
'/profile'
]);

const candidateId = this.selectedCandidate.id;
this.router.navigate(['/pages/employees/candidates/edit/', candidateId, '/profile']);
}

async archive(selectedItem?: ICandidateViewModel) {
Expand Down Expand Up @@ -427,11 +425,8 @@ export class CandidatesComponent extends PaginationFilterBaseComponent
type: 'custom',
component: InputFilterComponent
},
filterFunction: (value) => {
this.setFilter({
field: 'user.firstName',
search: value
});
filterFunction: (value: string) => {
this.setFilter({ field: 'user.name', search: value });
}
},
email: {
Expand Down Expand Up @@ -606,5 +601,5 @@ export class CandidatesComponent extends PaginationFilterBaseComponent
}
}

ngOnDestroy() {}
ngOnDestroy() { }
}
6 changes: 3 additions & 3 deletions apps/gauzy/src/app/pages/contacts/contacts.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ export class ContactsComponent extends PaginationFilterBaseComponent implements
contactType: this.contactType,
...(this.selectedEmployeeId
? {
members: [this.selectedEmployeeId]
}
members: [this.selectedEmployeeId]
}
: {}),
...(this.filters.where ? this.filters.where : {})
},
Expand Down Expand Up @@ -612,5 +612,5 @@ export class ContactsComponent extends PaginationFilterBaseComponent implements
return find ? find.country : row.country;
}

ngOnDestroy(): void {}
ngOnDestroy(): void { }
}
20 changes: 10 additions & 10 deletions apps/gauzy/src/app/pages/departments/departments.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ import {
})
export class DepartmentsComponent
extends PaginationFilterBaseComponent
implements AfterViewInit, OnInit, OnDestroy
{
implements AfterViewInit, OnInit, OnDestroy {
@ViewChild('addEditTemplate')
addEditTemplate: TemplateRef<any>;
addEditDialogRef: NbDialogRef<any>;
Expand Down Expand Up @@ -158,15 +157,15 @@ export class DepartmentsComponent
.subscribe();
}

ngOnDestroy() {}
ngOnDestroy() { }

ngAfterViewInit() {}
ngAfterViewInit() { }

selectDepartment(department: any) {
if (department.data) department = department.data;
const res =
this.selected.department &&
department.id === this.selected.department.id
department.id === this.selected.department.id
? { state: !this.selected.state }
: { state: true };
this.disableButton = !res.state;
Expand Down Expand Up @@ -294,9 +293,9 @@ export class DepartmentsComponent
if (input.name) {
this.selectedDepartment
? await this.organizationDepartmentsService.update(
this.selectedDepartment.id,
input
)
this.selectedDepartment.id,
input
)
: await this.organizationDepartmentsService.create(input);

this.toastrService.success(
Expand Down Expand Up @@ -340,8 +339,9 @@ export class DepartmentsComponent
...(this.filters.join ? this.filters.join : {})
},
where: {
...{ organizationId, tenantId },
...this.filters.where
tenantId,
organizationId,
...(this.filters.where ? this.filters.where : {})
},
resultMap: (department: IOrganizationDepartment) => {
return department;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ import { ExpenseCategoryMutationComponent } from './expense-category-mutation/ex
})
export class ExpenseCategoriesComponent
extends PaginationFilterBaseComponent
implements OnInit, OnDestroy
{
implements OnInit, OnDestroy {
loading: boolean = false;
disableButton: boolean = true;
smartTableSource: ServerDataSource;
Expand Down Expand Up @@ -306,7 +305,7 @@ export class ExpenseCategoriesComponent

const res =
this.selected.expenseCategory &&
expenseCategory === this.selected.expenseCategory
expenseCategory === this.selected.expenseCategory
? { state: !this.selected.state }
: { state: true };
this.selected.state = res.state;
Expand Down Expand Up @@ -353,5 +352,5 @@ export class ExpenseCategoriesComponent
.subscribe();
}

ngOnDestroy(): void {}
ngOnDestroy(): void { }
}
25 changes: 11 additions & 14 deletions apps/gauzy/src/app/pages/expenses/expenses.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class ExpensesComponent extends PaginationFilterBaseComponent

organization: IOrganization;
expenses$: Subject<any> = this.subject$;
private _refresh$ : Subject<any> = new Subject();
private _refresh$: Subject<any> = new Subject();

expensesTable: Ng2SmartTableComponent;
@ViewChild('expensesTable') set content(content: Ng2SmartTableComponent) {
Expand Down Expand Up @@ -146,11 +146,11 @@ export class ExpensesComponent extends PaginationFilterBaseComponent
)
.subscribe();
this._refresh$.pipe(
filter(() => this.dataLayoutStyle === ComponentLayoutStyleEnum.CARDS_GRID),
tap(() => this.refreshPagination()),
tap(() => this.expenses = []),
untilDestroyed(this)
).subscribe();
filter(() => this.dataLayoutStyle === ComponentLayoutStyleEnum.CARDS_GRID),
tap(() => this.refreshPagination()),
tap(() => this.expenses = []),
untilDestroyed(this)
).subscribe();

}

Expand Down Expand Up @@ -199,8 +199,8 @@ export class ExpensesComponent extends PaginationFilterBaseComponent
? [ExpenseStatusesEnum.PAID].includes(value)
? 'success'
: [ExpenseStatusesEnum.INVOICED].includes(value)
? 'warning'
: 'danger'
? 'warning'
: 'danger'
: null;
return {
text: this.replacePipe.transform(value, '_', ' '),
Expand Down Expand Up @@ -283,7 +283,7 @@ export class ExpensesComponent extends PaginationFilterBaseComponent
}
},
purpose: {
title: this.getTranslation('POP_UPS.PURPOSE'),
title: this.getTranslation('POP_UPS.PURPOSE'),
type: 'string',
class: 'align-row',
filter: {
Expand Down Expand Up @@ -491,9 +491,6 @@ export class ExpensesComponent extends PaginationFilterBaseComponent
'project',
'organizationContact'
],
join: {
...(this.filters.join) ? this.filters.join : {}
},
where: {
organizationId,
tenantId,
Expand All @@ -519,7 +516,7 @@ export class ExpensesComponent extends PaginationFilterBaseComponent
categoryName: expense.category ? expense.category.name : null,
projectName: expense.project ? expense.project.name : null,
statuses: this.statusMapper(expense.status),
employee: { ... employeeMapper(expense) }
employee: { ...employeeMapper(expense) }
});
},
finalize: () => {
Expand Down Expand Up @@ -598,5 +595,5 @@ export class ExpensesComponent extends PaginationFilterBaseComponent
) ? (employee.fullName).trim() : ALL_EMPLOYEES_SELECTED.firstName;
}

ngOnDestroy() {}
ngOnDestroy() { }
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<nb-card class="card-scroll">
<nb-card-header class="d-flex">
<ngx-back-navigation
(click)="navigateToIntegrations()"
[haveLink]="true"
class="float-left"
></ngx-back-navigation>
<h5>{{ 'MENU.GAUZY_AI' | translate }}</h5>
<nb-card-header class="card-header-title">
<div class="card-header-title">
<h5>
<ngx-back-navigation
class="float-left"
[haveLink]="true"
(click)="navigateToIntegrations()"
></ngx-back-navigation>
{{ 'MENU.GAUZY_AI' | translate }}
</h5>
</div>
</nb-card-header>
<nb-card-body>
<div class="col-xl-6 col-12">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { GauzyAIAuthorizationComponent } from './authorization.component';

describe('GauzyAIAuthorizationComponent', () => {
let component: GauzyAIAuthorizationComponent;
let fixture: ComponentFixture<GauzyAIAuthorizationComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [GauzyAIAuthorizationComponent],
teardown: { destroyAfterEach: false }
}).compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(GauzyAIAuthorizationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { ActivatedRoute, Data, Router } from '@angular/router';
import { FormGroup, FormBuilder, Validators, FormGroupDirective } from '@angular/forms';
import { filter, tap } from 'rxjs/operators';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { IIntegrationTenant, IOrganization } from '@gauzy/contracts';
import { GauzyAIService, Store } from './../../../../../@core/services';

@UntilDestroy({ checkProperties: true })
@Component({
selector: 'ngx-gauzy-ai-authorization',
templateUrl: './authorization.component.html',
styleUrls: ['./authorization.component.scss'],
})
export class GauzyAIAuthorizationComponent implements OnInit, OnDestroy {

public organization: IOrganization;

readonly form: FormGroup = GauzyAIAuthorizationComponent.buildForm(this._formBuilder);
static buildForm(fb: FormBuilder): FormGroup {
return fb.group({
client_id: [null, Validators.required],
client_secret: [null, Validators.required],
});
}

@ViewChild('formDirective') formDirective: FormGroupDirective;

constructor(
private readonly _formBuilder: FormBuilder,
private readonly _router: Router,
private readonly _activatedRoute: ActivatedRoute,
private readonly _store: Store,
private readonly _gauzyAIService: GauzyAIService
) { }

ngOnInit(): void {
this._activatedRoute.data
.pipe(
tap(({ integration }: Data) => {
if (integration) {
this._redirectToGauzyAIIntegration(integration.id);
}
}),
untilDestroyed(this) // Ensure that subscriptions are automatically unsubscribed on component destruction.
)
.subscribe();
this._store.selectedOrganization$
.pipe(
filter((organization: IOrganization) => !!organization),
tap((organization: IOrganization) => (this.organization = organization)),
untilDestroyed(this)
)
.subscribe();
}

ngOnDestroy(): void { }

/**
* Gauzy AI integration remember state API call
*/
private _redirectToGauzyAIIntegration(integrationId: string) {
this._router.navigate(['pages/integrations/gauzy-ai', integrationId]);
}

/**
*
* @returns
*/
async onSubmit() {
if (!this.organization || this.form.invalid) {
return;
}
try {
const { client_id, client_secret } = this.form.value;
const { id: organizationId, tenantId } = this.organization;

this._gauzyAIService.addIntegration({
client_id,
client_secret,
organizationId,
tenantId
}).pipe(
tap((integration: IIntegrationTenant) => {
this._redirectToGauzyAIIntegration(integration.id);
}),
untilDestroyed(this)
).subscribe();
} catch (error) {
console.log('Error while creating new integration for Gauzy AI', error);
}
}

/**
* Navigate to the "Integrations" page.
*/
navigateToIntegrations(): void {
this._router.navigate(['/pages/integrations']);
}
}
Loading