Skip to content

Commit

Permalink
Merge pull request #7256 from ever-co/stage
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
evereq authored Dec 8, 2023
2 parents 4c04eef + 1d8edb1 commit 943df95
Show file tree
Hide file tree
Showing 225 changed files with 2,952 additions and 1,088 deletions.
5 changes: 4 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,10 @@
"SCALEWAY",
"VULTR",
"Codegen",
"icns"
"icns",
"pantone"
"openai",
"OPENAI"
],
"useGitignore": true,
"ignorePaths": [
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-render-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy to Render Demo
on:
workflow_run:
workflows: ['Build and Publish Docker Images Demo']
branches: [develop, temp]
branches: [render]
types:
- completed

Expand Down
10 changes: 7 additions & 3 deletions apps/desktop-timer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,13 @@ app.on('ready', async () => {
API_BASE_URL: getApiBaseUrl(configs || {}),
IS_INTEGRATED_DESKTOP: configs?.isLocalServer,
};
splashScreen = new SplashScreen(pathWindow.timeTrackerUi);
await splashScreen.loadURL();
splashScreen.show();
try {
splashScreen = new SplashScreen(pathWindow.timeTrackerUi);
await splashScreen.loadURL();
splashScreen.show();
} catch (error) {
console.error(error);
}
if (!settings) {
launchAtStartup(true, false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs/internal/Observable';
import { IIntegrationKeySecretPairInput, IIntegrationTenant } from '@gauzy/contracts';
import { IIntegrationAICreateInput, IIntegrationTenant } from '@gauzy/contracts';
import { API_PREFIX } from '../../constants';

@Injectable({
Expand All @@ -18,7 +18,7 @@ export class GauzyAIService {
* @param input
* @returns
*/
addIntegration(input: IIntegrationKeySecretPairInput): Observable<IIntegrationTenant> {
create(input: IIntegrationAICreateInput): Observable<IIntegrationTenant> {
return this._http.post<IIntegrationTenant>(`${API_PREFIX}/integration/gauzy-ai`, input);
}
}
15 changes: 8 additions & 7 deletions apps/gauzy/src/app/@core/services/integrations.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,17 @@ export class IntegrationsService {
}

/**
* Get an IntegrationTenant by ID with optional relations.
*
* @param integrationId
* @param relations
* @returns
* @param id - The ID of the IntegrationTenant.
* @param relations - Optional relations for the request.
* @returns {Observable<any>} An Observable of the HTTP response.
*/
fetchIntegrationTenant(
integrationId: IIntegrationTenant['id'],
getIntegrationTenant(
id: IIntegrationTenant['id'],
relations: IBaseRelationsEntityModel
) {
return this._http.get<any>(`${API_PREFIX}/integration-tenant/${integrationId}`, {
): Observable<IIntegrationTenant> {
return this._http.get<any>(`${API_PREFIX}/integration-tenant/${id}`, {
params: toParams({ ...relations })
});
}
Expand Down
2 changes: 2 additions & 0 deletions apps/gauzy/src/app/@shared/directives/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { UnderConstructionDirective } from './under-construction.directive';
import { ReadMoreDirective } from './read-more';
import { TimeTrackingAuthorizedDirective } from './time-tracking-authorized-directive';
import { NoSpaceEdgesDirective } from './no-space-edges.directive';
import { TextMaskDirective } from './text-mask.directive';

export const DIRECTIVES = [
AutocompleteOffDirective,
Expand All @@ -16,4 +17,5 @@ export const DIRECTIVES = [
OutsideDirective,
UnderConstructionDirective,
NoSpaceEdgesDirective,
TextMaskDirective
];
69 changes: 69 additions & 0 deletions apps/gauzy/src/app/@shared/directives/text-mask.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Directive, ElementRef, Renderer2, Input } from '@angular/core';

// Interface representing the configuration for text masking
interface IMaskConfig {
text: string;
showOriginal: boolean;
replacement: number;
}

@Directive({
selector: '[gaTextMask]'
})
export class TextMaskDirective {
// Default configuration for text masking
private readonly _config: IMaskConfig = {
text: '',
showOriginal: false,
replacement: 0.5
};

// Constructor to inject dependencies
constructor(
private readonly el: ElementRef,
private readonly renderer: Renderer2
) { }

// Apply the configured text mask to the element
private applyTextMask(): void {
// Get the text based on the showOriginal configuration
const text = this.config.showOriginal ? this.config.text : this.maskText(this.config.text);

// Set the masked or original text to the element's inner text
this.renderer.setProperty(this.el.nativeElement, 'innerText', text);
}

// Mask the given text based on the configured replacement percentage
private maskText(value: string): string {
// If text is not provided, return an empty string
if (!value) {
return '';
}

// Convert the text into an array of characters
const text = value.split('');

// Replace the specified percentage of characters with asterisks ('*')
for (let i = 0; i < Math.floor(this.config.replacement * text.length); i++) {
text[i] = '*';
}

// Join the array back into a string and return the masked text
return text.join('');
}

// Getter for the current configuration
public get config(): IMaskConfig {
return this._config;
}

// Setter for updating the configuration and applying the text mask
@Input()
public set config(partialConfig: Partial<IMaskConfig>) {
// Merge the provided partial configuration with the default configuration
Object.assign(this._config, partialConfig);

// Apply the text mask with the updated configuration
this.applyTextMask();
}
}
13 changes: 12 additions & 1 deletion apps/gauzy/src/app/@shared/gallery/gallery.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@
<div class="gallery-header d-flex p-2">
<span class="spacer"></span>
<div class="ml-auto">
<button
<button
*ngIf="item?.description"
status="info"
nbButton
[nbTooltip]="item?.description"
>
<nb-icon icon="info-outline"></nb-icon>
</button>
<button
class="ml-2"
status="success"
nbButton
(click)="downloadFile(item?.fullUrl)"
[nbTooltip]="'BUTTONS.DOWNLOAD' | translate"
Expand All @@ -11,6 +21,7 @@
</button>
<button
class="ml-2"
status="danger"
nbButton (click)="close()"
[nbTooltip]="'BUTTONS.CLOSE' | translate"
>
Expand Down
16 changes: 8 additions & 8 deletions apps/gauzy/src/app/@shared/gallery/gallery.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {
} from '@angular/core';
import { trigger, style, animate, transition } from '@angular/animations';
import { NbDialogRef } from '@nebular/theme';
import { GalleryItem } from './gallery.directive';
import { GalleryService } from './gallery.service';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { saveAs } from 'file-saver';
import { GalleryItem } from './gallery.directive';
import { GalleryService } from './gallery.service';

export const fadeInOutAnimation = trigger('fadeInOut', [
transition(':enter', [
Expand Down Expand Up @@ -124,12 +124,12 @@ export class GalleryComponent implements OnInit, OnDestroy {
ngOnDestroy() { }

downloadFile(url: string) {
if(url) {
if (url) {
this.galleryService
.downloadFile(url)
.subscribe(blob => {
saveAs(blob, url.replace(/^.*[\\\/]/, ''))
});
}
.downloadFile(url)
.subscribe(blob => {
saveAs(blob, url.replace(/^.*[\\\/]/, ''))
});
}
}
}
27 changes: 23 additions & 4 deletions apps/gauzy/src/app/@shared/gallery/gallery.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@angular/core';
import { NbDialogService } from '@nebular/theme';
import { sortBy } from 'underscore';
import { IScreenshot } from '@gauzy/contracts';
import { GalleryComponent } from './gallery.component';
import { GalleryService } from './gallery.service';

Expand All @@ -17,19 +18,22 @@ export interface GalleryItem {
fullUrl: string;
recordedAt?: Date;
employeeId?: string;
description?: IScreenshot['description'];
}

@Directive({
selector: '[ngxGallery]'
})
export class GalleryDirective implements OnDestroy, OnInit {
disableClick: boolean = false;
dialogRef: ComponentRef<GalleryComponent>;
public disableClick: boolean = false;
public dialogRef: ComponentRef<GalleryComponent>;

// Inputs
@Input() employeeId: string;
@Input() item: GalleryItem | GalleryItem[];
@Input() items: GalleryItem[] = [];

// Input with Setter
@Input() set disabled(value: any) {
this.disableClick = value || false;
if (this.disableClick) {
Expand All @@ -43,18 +47,28 @@ export class GalleryDirective implements OnDestroy, OnInit {
private readonly el: ElementRef,
private readonly nbDialogService: NbDialogService,
private readonly galleryService: GalleryService
) {}
) { }

/**
* Host listener for click events
*/
@HostListener('click', [])
onClick(): void {
// Check if clicking is disabled
if (this.disableClick) {
return;
}

// Deep copy the 'item' property
let items = JSON.parse(JSON.stringify(this.item));

// Sort the items array by 'createdAt' in descending order
items = sortBy(items, 'createdAt').reverse();

// Extract the first item from the sorted array
const item = items instanceof Array ? items[0] : items;

// Open a dialog (possibly a gallery) using NbDialogService
this.nbDialogService.open(GalleryComponent, {
context: {
items: this.items,
Expand All @@ -66,10 +80,15 @@ export class GalleryDirective implements OnDestroy, OnInit {
}

ngOnInit() {
// Check if 'item' is an array; if not, convert it to a single-element array
const item = this.item instanceof Array ? this.item : [this.item];

// Sort the 'item' array by 'createdAt'
this.item = sortBy(item, 'createdAt');

// Append the sorted 'item' array to the gallery service
this.galleryService.appendItems(this.item);
}

ngOnDestroy() {}
ngOnDestroy() { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
<ng-container *ngIf="timeSlot?.isAllowDelete">
<ng-container *ngIf="multiple">
<nb-checkbox
size="tiny"
[(ngModel)]="isSelected"
(click)="$event.stopPropagation()"
(ngModelChange)="toggleSelect(timeSlot)"
></nb-checkbox>
</ng-container>
<button
class="ml-auto select-hidden"
status="basic"
status="danger"
nbButton
size="tiny"
(click)="$event.stopPropagation()"
Expand All @@ -46,11 +47,20 @@
(confirm)="deleteSlot(timeSlot)"
>
<nb-icon
status="danger"
icon="trash-2-outline"
></nb-icon>
</button>
</ng-container>
<button
*ngIf="lastScreenshot?.description"
class="ml-2"
status="info"
nbButton
size="tiny"
[nbTooltip]="lastScreenshot?.description"
>
<nb-icon icon="info-outline" size="small"></nb-icon>
</button>
</div>
<div class="view-button select-hidden">
<ng-container *ngIf="timeSlot?.screenshots?.length > 0">
Expand Down
Loading

0 comments on commit 943df95

Please sign in to comment.