Skip to content

Commit

Permalink
Merge branch 'develop' into fix/#8505-user-removal-from-org
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmbabhazi committed Nov 4, 2024
2 parents 49ff8f1 + cf41b76 commit a2c93b9
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 22 deletions.
6 changes: 3 additions & 3 deletions apps/server-api/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@
"node_modules/linebreak/src/classes.trie"
],
"targets": [
"node16-linux-x64",
"node16-mac-x64",
"node16-win-x64"
"node20-linux-x64",
"node20-mac-x64",
"node20-win-x64"
]
}
}
6 changes: 3 additions & 3 deletions apps/server/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@
"node_modules/linebreak/src/classes.trie"
],
"targets": [
"node16-linux-x64",
"node16-mac-x64",
"node16-win-x64"
"node20-linux-x64",
"node20-mac-x64",
"node20-win-x64"
]
}
}
1 change: 1 addition & 0 deletions packages/desktop-ui-lib/src/lib/constants/app.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { environment } from '@gauzy/ui-config';
export const API_PREFIX = '/api';
export const BACKGROUND_SYNC_INTERVAL = 25000; // milliseconds
export const BACKGROUND_SYNC_OFFLINE_INTERVAL = 5000; // milliseconds
export const BLOCK_DELAY = 10000; // milliseconds

export const GAUZY_ENV = new InjectionToken<any>('gauzyEnvironment');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class TimeTrackerStatusService {
duration: status.duration
});
this._icon$.next(TimerIconFactory.create(remoteTimer.source));
if (!remoteTimer.running || !remoteTimer.isExternalSource) this._icon$.next(null);
if (!remoteTimer.running) this._icon$.next(null);
this._external$.next(remoteTimer);
}),
repeat({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,43 @@
</div>
</div>
</div>
<gauzy-time-tracker-status class="status"></gauzy-time-tracker-status>
<gauzy-time-tracker-status *ngIf="isRemoteTimer" class="status"></gauzy-time-tracker-status>
</div>
<div class="col-3 d-flex flex-column align-items-center">
<div>
<button (click)="toggleStart(true)" *ngIf="!(start$ | async)"
[disabled]="loading || !isTrackingEnabled" class="button-ghost" nbButton
status="success">
<nb-icon [nbTooltipDisabled]="isTrackingEnabled" [nbTooltipIcon]="{
<button
(click)="toggleStart(true)"
*ngIf="!(start$ | async)"
[ngClass]="{ 'pulse-border start-button': isProcessingEnabled }"
[disabled]="loading || !isTrackingEnabled"
class="button-ghost"
nbButton
status="success"
>
<nb-icon
[nbTooltipDisabled]="isTrackingEnabled"
[nbTooltipIcon]="{
icon: 'alert-triangle-outline',
pack: 'eva'
}" [nbTooltip]="'TIMER_TRACKER.TIME_TRACKER_DISABLED' | translate" class="start-button" icon="play"
nbTooltipPlacement="bottom" nbTooltipStatus="warning" pack="font-awesome">
}"
[nbTooltip]="'TIMER_TRACKER.TIME_TRACKER_DISABLED' | translate"
class="start-button"
icon="play"
nbTooltipPlacement="bottom"
nbTooltipStatus="warning"
pack="font-awesome"
>
</nb-icon>
</button>
<button (click)="toggleStart(false)" *ngIf="start$ | async" [disabled]="loading"
class="button-ghost" nbButton status="danger">
<button
(click)="toggleStart(false)"
*ngIf="start$ | async"
[disabled]="loading"
[ngClass]="{ 'pulse-border stop-button': isProcessingEnabled }"
class="button-ghost"
nbButton
status="danger"
>
<nb-icon class="start-button" icon="pause" pack="font-awesome"> </nb-icon>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,3 +741,35 @@ img {
}
}
}

//animation
@keyframes pulseBorder {
0% {
box-shadow: 0 0 0 0 var(--pulse-color-rgba);
}
70% {
box-shadow: 0 0 1rem 1rem rgba(var(--pulse-color-rgb), 0);
}
100% {
box-shadow: 0 0 0 0 rgba(var(--pulse-color-rgb), 0);
}
}

.pulse-border {
--pulse-duration: 1.5s;
--pulse-color-rgb: 0, 255, 0; /* Default green color in RGB format */
--pulse-color-rgba: rgba(var(--pulse-color-rgb), 0.4);
--border-color: rgb(var(--pulse-color-rgb));

animation: pulseBorder var(--pulse-duration) infinite;
}

.start-button {
--pulse-color-rgb: 0, 255, 0; /* Green */
--pulse-duration: 1s;
}

.stop-button {
--pulse-color-rgb: 255, 0, 0; /* Red */
--pulse-duration: 1s;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ import {
Observable,
of,
Subject,
tap
Subscription,
tap,
timer
} from 'rxjs';
import { AlwaysOnService, AlwaysOnStateEnum } from '../always-on/always-on.service';
import { AuthStrategy } from '../auth';
import { GAUZY_ENV } from '../constants';
import { BLOCK_DELAY, GAUZY_ENV } from '../constants';
import { ElectronService, LoggerService } from '../electron/services';
import { ImageViewerService } from '../image-viewer/image-viewer.service';
import { ActivityWatchViewService } from '../integrations';
Expand Down Expand Up @@ -115,6 +117,7 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit {
private _isReady = false;
private _session: moment.Moment = null;
private hasActiveTaskPermissions = false;
private timerSubscription: Subscription | null = null;
@ViewChild('dialogOpenBtn') btnDialogOpen: ElementRef<HTMLElement>;
public start$: BehaviorSubject<boolean> = new BehaviorSubject(false);
userData: any;
Expand Down Expand Up @@ -519,8 +522,6 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit {
}
}

this.isProcessingEnabled = false;

asapScheduler.schedule(async () => {
try {
await this.electronService.ipcRenderer.invoke('UPDATE_SYNCED_TIMER', {
Expand Down Expand Up @@ -1391,11 +1392,25 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit {
: 'Please wait for timer to start and make initial screenshot';
this._toastrNotifier.warn(message);
this._loggerService.debug(message);
return;
} else {
this.isProcessingEnabled = true;
}
this.loading = true;

if (this.timerSubscription) {
this.timerSubscription.unsubscribe();
}

this.timerSubscription = timer(BLOCK_DELAY)
.pipe(untilDestroyed(this))
.subscribe(() => {
this.loading = false;
this.isProcessingEnabled = false;
this._loggerService.info('Processing Unlocked');
this.timerSubscription = null;
});

if (!val) {
console.log('Stop tracking');

Expand Down Expand Up @@ -1515,6 +1530,7 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit {
this._loggerService.info('Capturing Screen and Sending Activities Start...', activities);
await this.takeCaptureAndSendActivities(activities);
this._loggerService.info('Capturing Screen and Sending Activities Done ✔️');
this.isProcessingEnabled = false;
}, 1000);
}

Expand All @@ -1536,7 +1552,9 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit {
this._errorHandlerService.handleError(error);
} finally {
this.loading = false;
this.isProcessingEnabled = false;
if (this.isRemoteTimer) {
this.isProcessingEnabled = false;
}
}
}

Expand Down Expand Up @@ -1590,6 +1608,7 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit {
await this.uploadScreenshots(activities, timeSlotId, screenshots);
this._loggerService.info('Capturing Screen and Sending Activities Done ✔️');
}
this.isProcessingEnabled = false;
}, 1000);
}
} else {
Expand Down Expand Up @@ -1628,7 +1647,9 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit {
} finally {
this._session = null;
this.loading = false;
this.isProcessingEnabled = false;
if (this.isRemoteTimer) {
this.isProcessingEnabled = false;
}
this.timeTrackerStore.ignition({ state: IgnitionState.STOPPED, mode: this._startMode });
}
}
Expand Down

0 comments on commit a2c93b9

Please sign in to comment.