Skip to content

Commit

Permalink
Merge pull request #7082 from ever-co/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
evereq authored Nov 3, 2023
2 parents cd9fbe9 + 9f55795 commit 3209d61
Show file tree
Hide file tree
Showing 39 changed files with 833 additions and 202 deletions.
23 changes: 20 additions & 3 deletions apps/gauzy/src/app/@core/services/github/github.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import {
IBasePerTenantAndOrganizationEntityModel,
IGithubAppInstallInput,
IGithubIssue,
IGithubIssueFindInput,
IGithubRepository,
IGithubRepositoryResponse,
IIntegrationMapSyncRepository,
IIntegrationTenant,
IOrganization,
IOrganizationGithubRepository,
IOrganizationGithubRepositoryUpdateInput,
IOrganizationProject
} from '@gauzy/contracts';
import { toParams } from '@gauzy/common-angular';
Expand Down Expand Up @@ -65,7 +67,7 @@ export class GithubService {
integrationId: IIntegrationTenant['id'],
owner: string,
repo: string,
query: IBasePerTenantAndOrganizationEntityModel
query: IGithubIssueFindInput
): Observable<IGithubIssue[]> {
const url = `${API_PREFIX}/integration/github/${integrationId}/${owner}/${repo}/issues`;
const params = toParams(query);
Expand All @@ -83,6 +85,21 @@ export class GithubService {
return this._http.post<IOrganizationGithubRepository>(url, input);
}

/**
* Update a GitHub repository's information.
*
* @param id - A string representing the unique identifier of the GitHub repository to be updated.
* @param input - An object containing the data to update the GitHub repository.
* @returns An Observable that emits the updated GitHub repository data.
*/
updateGithubRepository(id: string, input: IOrganizationGithubRepositoryUpdateInput): Observable<IOrganizationGithubRepository> {
// Construct the URL for the API endpoint.
const url = `${API_PREFIX}/integration/github/repository/${id}`;

// Send an HTTP PUT request to update the GitHub repository using the provided input.
return this._http.put<IOrganizationGithubRepository>(url, input);
}

/**
* Auto-synchronize GitHub issues for a specific repository.
*
Expand Down Expand Up @@ -126,7 +143,7 @@ export class GithubService {
projectId?: IOrganizationProject['id'];
},
): Observable<any> {
return this._http.post(`${API_PREFIX}/integration/github/${integrationId}/sync/issues`, {
return this._http.post(`${API_PREFIX}/integration/github/${integrationId}/manual-sync/issues`, {
integrationId,
repository: this._mapRepositoryPayload(repository),
issues: this._mapIssuePayload(options.issues),
Expand Down Expand Up @@ -165,7 +182,7 @@ export class GithubService {
*/
private _mapIssuePayload(data: IGithubIssue[]): any[] {
return data.map(({ id, number, title, state, body }) => ({
sourceId: id,
id,
number,
title,
state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@
[placeholder]="'INTEGRATIONS.GITHUB_PAGE.SEARCH_REPOSITORY' | translate"
>
</ng-template>
<ng-template ng-label-tmp let-item="item">
<img src="assets/images/integrations/github.svg"/>
<span class="ml-1">{{ item.full_name }}</span>
</ng-template>
<ng-template ng-option-tmp let-item="item">
<span>{{ item.full_name }}</span>
</ng-template>
<img src="assets/images/integrations/github.svg"/>
<span class="ml-1">{{ item.full_name }}</span>
</ng-template>
</ng-select>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@
nb-select {
max-width: none;
}
img {
width: 28px;
height: 28px;
border-radius: nb-theme(border-radius);
box-shadow: var(--gauzy-shadow);
object-fit: cover;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,28 @@ export interface IPaginationBase {
@Component({
template: ''
})
export class PaginationFilterBaseComponent extends TranslationBaseComponent
implements AfterViewInit {
export class PaginationFilterBaseComponent extends TranslationBaseComponent implements AfterViewInit {

public activePage: number = 1;
public totalItems: number = 0;
public itemsPerPage: number = 10;
/**
* Getter for minimum items per page
* Can't be modified outside the class
*/
private _minItemPerPage: number = 10;

public get minItemPerPage() {
return this._minItemPerPage;
}

private _pagination: IPaginationBase = {
totalItems: 0,
activePage: 1,
itemsPerPage: 10
totalItems: this.totalItems,
activePage: this.activePage,
itemsPerPage: this.itemsPerPage
};

public get pagination(): IPaginationBase {
return this._pagination;
}

protected set pagination(value: IPaginationBase) {
this._pagination = value;
}
Expand Down Expand Up @@ -75,7 +74,7 @@ export class PaginationFilterBaseComponent extends TranslationBaseComponent
protected refreshPagination() {
this.setPagination({
...this.getPagination(),
activePage: 1,
activePage: this.activePage,
itemsPerPage: this.minItemPerPage
});
}
Expand Down
10 changes: 5 additions & 5 deletions apps/gauzy/src/app/@shared/pagination/pagination.module.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NbIconModule, NbSelectModule } from '@nebular/theme';
import { TranslateModule } from '../translate/translate.module';
import { PaginationComponent } from './pagination.component';
import { NbIconModule, NbSelectModule } from '@nebular/theme';

@NgModule({
declarations: [PaginationComponent],
imports: [
CommonModule,
TranslateModule,
NbIconModule,
NbSelectModule
NbIconModule,
NbSelectModule
],
declarations: [PaginationComponent],
exports: [PaginationComponent]

})
export class PaginationModule {}
export class PaginationModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ import { TruncatePipe } from '../../pipes';
}
]
})
export class ProjectSelectorComponent
implements OnInit, OnDestroy, AfterViewInit {
export class ProjectSelectorComponent implements OnInit, OnDestroy, AfterViewInit {

projects: IOrganizationProject[] = [];
selectedProject: IOrganizationProject;
hasAddProject$: Observable<boolean>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
[checked]="autoSync$ | async"
(checkedChange)="onCheckedChange($event)"
>
{{ ((autoSync$ | async) ? 'BUTTONS.DISABLE' : 'BUTTONS.ENABLE') | translate }}
{{ ((autoSync$ | async) ? 'BUTTONS.ENABLED' : 'BUTTONS.DISABLED') | translate }}
</nb-toggle >
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="issue-details">
<div class="issue-header">
<div class="issue-labels">
<ng-template [ngIf]="rowData?.labels">
<ga-only-tags
[value]="rowData?.labels"
[rowData]="rowData"
></ga-only-tags>
</ng-template>
</div>
<div class="issue-title">
<a href="javascript:void(0)" (click)="openIssue()">
<nb-icon icon="eye-outline" pack="eva" [nbTooltip]="rowData?.title"></nb-icon>
{{ rowData?.title }}
</a>
</div>
</div>
<div class="issue-body">
<div class="issue-description">
<ngx-security-trust-html
[value]="rowData?.body"
></ngx-security-trust-html>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
:host {
.issue-details {
letter-spacing: 0em;
text-align: left;
.issue-header {
.issue-labels {
font-size: 14px;
display: block;
margin-top: 15px;
}
.issue-title {
font-size: 16px;
font-weight: 600;
text-decoration: none;
padding-top: 10px;
a {
color: var(--text-basic-color);
&:hover {
text-decoration: none;
}
}
}
}
.issue-body {
margin-top: 20px;
.issue-description {
font-size: 14px;
margin-top: 10px;
line-height: 17px
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Component, Input } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ViewCell } from 'ng2-smart-table';
import { TranslationBaseComponent } from './../../../../@shared/language-base';

@Component({
selector: 'issue-title-description',
templateUrl: './issue-title-description.component.html',
styleUrls: ['./issue-title-description.component.scss']
})
export class GithubIssueTitleDescriptionComponent extends TranslationBaseComponent implements ViewCell {

@Input() rowData: any;
@Input() value: string | number;

constructor(
public readonly translateService: TranslateService
) {
super(translateService);
}

/**
*
* @returns
*/
public openIssue() {
if (!this.rowData) {
return;
}
if (this.rowData?.html_url) {
window.open(this.rowData.html_url, '_blank');
}
}
}
1 change: 1 addition & 0 deletions apps/gauzy/src/app/@shared/table-components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ export * from './clickable-link/clickable-link.component';
export * from './trust-html/trust-html.component';
export * from './github/repository/repository.component';
export * from './github/auto-sync-switch/auto-sync-switch.component';
export * from './github/issue-title-description/issue-title-description.component';
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,20 @@ import { ClickableLinkComponent } from './clickable-link/clickable-link.componen
import { TrustHtmlLinkComponent } from './trust-html/trust-html.component';
import { GithubAutoSyncSwitchComponent } from './github/auto-sync-switch/auto-sync-switch.component';
import { GithubRepositoryComponent } from './github/repository/repository.component';
import { GithubIssueTitleDescriptionComponent } from './github/issue-title-description/issue-title-description.component';
import { StatusBadgeModule } from '../status-badge';

@NgModule({
imports: [
CommonModule,
FormsModule,
NbBadgeModule,
NbIconModule,
NbToggleModule,
NbTooltipModule,
NbBadgeModule,
TranslateModule,
SharedModule,
NbToggleModule
StatusBadgeModule,
],
declarations: [
DateViewComponent,
Expand Down Expand Up @@ -96,7 +99,8 @@ import { GithubRepositoryComponent } from './github/repository/repository.compon
ClickableLinkComponent,
TrustHtmlLinkComponent,
GithubRepositoryComponent,
GithubAutoSyncSwitchComponent
GithubAutoSyncSwitchComponent,
GithubIssueTitleDescriptionComponent
],
exports: [
NotesWithTagsComponent,
Expand All @@ -120,7 +124,8 @@ import { GithubRepositoryComponent } from './github/repository/repository.compon
ClickableLinkComponent,
TrustHtmlLinkComponent,
GithubRepositoryComponent,
GithubAutoSyncSwitchComponent
GithubAutoSyncSwitchComponent,
GithubIssueTitleDescriptionComponent
],
providers: []
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<div class="container">
<p [innerHTML]="value | nl2br"></p>
</div>
<p [innerHTML]="value | nl2br"></p>
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<nb-card class="card-scroll">
<nb-card
class="card-scroll"
[nbSpinner]="loading"
nbSpinnerStatus="primary"
nbSpinnerSize="large"
>
<nb-card-header class="card-header-title">
<div class="card-header-title">
<h5>
Expand Down Expand Up @@ -34,8 +39,8 @@ <h5>
</div>
</div>
</nb-card-header>
<nb-card-body>
<nb-tabset>
<nb-card-body class="p-0">
<nb-tabset class="mt-4">
<nb-tab [tabTitle]="'INTEGRATIONS.GITHUB_PAGE.TAB.AUTO_SYNC' | translate">
<ng-template [ngIf]="integration$ | async">
<nb-card>
Expand All @@ -60,6 +65,7 @@ <h5>
[defaultSelected]="false"
[showAllOption]="false"
[skipGlobalChange]="true"
[shortened]="true"
(onChanged)="selectedProject$.next($event)"
></ga-project-selector>
</div>
Expand Down Expand Up @@ -139,17 +145,29 @@ <h5>
</div>
</nb-card-header>
<nb-card-body>
<div class="issues-container">
<div class="table-scroll-container">
<ng2-smart-table
[settings]="settingsSmartTableIssues"
[source]="issues$ | async"
(userRowSelect)="selectIssues($event)"
style="cursor: pointer;"
#issuesTable
></ng2-smart-table>
</div>
<div class="table-scroll-container">
<ng2-smart-table
[settings]="settingsSmartTableIssues"
[source]="issues"
(userRowSelect)="selectIssues($event)"
style="cursor: pointer;"
#issuesTable
></ng2-smart-table>
</div>
<ng-container *ngIf="(page$ | async)">
<div class="pagination-container">
<ng-container *ngIf="pagination.totalItems > minItemPerPage">
<ga-pagination
(selectedOption)="onUpdateOption($event)"
(selectedPage)="onPageChange($event)"
[doEmit]="false"
[totalItems]="pagination?.totalItems"
[itemsPerPage]="pagination?.itemsPerPage"
[activePage]="pagination?.activePage"
></ga-pagination>
</ng-container>
</div>
</ng-container>
</nb-card-body>
</nb-card>
</ng-template>
Expand Down
Loading

0 comments on commit 3209d61

Please sign in to comment.