-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7275 from ever-co/develop
Release
- Loading branch information
Showing
67 changed files
with
1,635 additions
and
1,335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,7 +409,8 @@ | |
"VULTR", | ||
"Codegen", | ||
"icns", | ||
"pantone" | ||
"pantone", | ||
"msedge", | ||
"openai", | ||
"OPENAI" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,141 +1,20 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { environment } from '../environments/environment'; | ||
import { firstValueFrom } from 'rxjs'; | ||
import { UserOrganizationService } from '@gauzy/desktop-ui-lib'; | ||
import { IUserOrganization } from '@gauzy/contracts'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
providedIn: 'root' | ||
}) | ||
export class AppService { | ||
AW_HOST = environment.AWHost; | ||
buckets: any = {}; | ||
constructor( | ||
private http: HttpClient, | ||
private readonly _userOrganizationService: UserOrganizationService | ||
) {} | ||
constructor(private http: HttpClient, private readonly _userOrganizationService: UserOrganizationService) {} | ||
|
||
pingServer(values) { | ||
return firstValueFrom(this.http.get(values.host + '/api')); | ||
public pingServer({ host }) { | ||
return firstValueFrom(this.http.get(host + '/api')); | ||
} | ||
|
||
startTime(id): Promise<any> { | ||
const defaultValue: any = [ | ||
{ | ||
timestamp: new Date(), | ||
data: { | ||
running: true, | ||
label: '', | ||
}, | ||
}, | ||
]; | ||
|
||
if (id) defaultValue[0].id = id; | ||
return firstValueFrom( | ||
this.http.post( | ||
`${this.AW_HOST}/api/0/buckets/aw-stopwatch/events`, | ||
defaultValue | ||
) | ||
); | ||
} | ||
|
||
stopTime(historyTime): Promise<any> { | ||
const defaultStopParams = [ | ||
{ | ||
timestamp: new Date(), | ||
data: { | ||
running: false, | ||
label: '', | ||
}, | ||
id: historyTime.id, | ||
}, | ||
]; | ||
return firstValueFrom( | ||
this.http.post( | ||
`${this.AW_HOST}/api/0/buckets/aw-stopwatch/events`, | ||
defaultStopParams | ||
) | ||
); | ||
} | ||
|
||
getAwBuckets(tpURL): Promise<any> { | ||
return firstValueFrom(this.http.get(`${tpURL}/api/0/buckets`)); | ||
} | ||
|
||
parseBuckets(buckets) { | ||
Object.keys(buckets).forEach((key) => { | ||
const keyParse = key.split('_')[0]; | ||
switch (keyParse) { | ||
case 'aw-watcher-window': | ||
this.buckets.windowBucket = buckets[key]; | ||
break; | ||
case 'aw-watcher-afk': | ||
this.buckets.afkBucket = buckets[key]; | ||
break; | ||
case 'aw-watcher-web-chrome': | ||
this.buckets.chromeBucket = buckets[key]; | ||
break; | ||
case 'aw-watcher-web-firefox': | ||
this.buckets.firefoxBucket = buckets[key]; | ||
break; | ||
default: | ||
break; | ||
} | ||
}); | ||
} | ||
|
||
async collectEvents(tpURL, tp, start, end): Promise<any> { | ||
if (!this.buckets.windowBucket) { | ||
const allBuckets = await this.getAwBuckets(tpURL); | ||
this.parseBuckets(allBuckets); | ||
} | ||
return this.collectFromAW(tpURL, start, end); | ||
} | ||
|
||
collectAfk(tpURL, tp, start, end): Promise<any> { | ||
return this.collectAfkFromAW(tpURL, start, end); | ||
} | ||
|
||
collectChromeActivityFromAW(tpURL, start, end): Promise<any> { | ||
if (!this.buckets.chromeBucket) return Promise.resolve([]); | ||
return firstValueFrom( | ||
this.http.get( | ||
`${tpURL}/api/0/buckets/${this.buckets.chromeBucket.id}/events?start=${start}&end=${end}&limit=-1` | ||
) | ||
); | ||
} | ||
|
||
collectFirefoxActivityFromAw(tpURL, start, end): Promise<any> { | ||
if (!this.buckets.firefoxBucket) return Promise.resolve([]); | ||
return firstValueFrom( | ||
this.http.get( | ||
`${tpURL}/api/0/buckets/${this.buckets.firefoxBucket.id}/events?start=${start}&end=${end}&limit=-1` | ||
) | ||
); | ||
} | ||
|
||
pushActivityCollectionToGauzy() { | ||
return true; | ||
} | ||
collectFromAW(tpURL, start, end) { | ||
if (!this.buckets.windowBucket) return Promise.resolve([]); | ||
return firstValueFrom( | ||
this.http.get( | ||
`${tpURL}/api/0/buckets/${this.buckets.windowBucket.id}/events?start=${start}&end=${end}&limit=-1` | ||
) | ||
); | ||
} | ||
|
||
collectAfkFromAW(tpURL, start, end) { | ||
if (!this.buckets.afkBucket) return Promise.resolve([]); | ||
return firstValueFrom( | ||
this.http.get( | ||
`${tpURL}/api/0/buckets/${this.buckets.afkBucket.id}/events?limit=1` | ||
) | ||
); | ||
} | ||
|
||
async getUserDetail() { | ||
public async getUserDetail(): Promise<IUserOrganization> { | ||
return await this._userOrganizationService.detail(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,4 +165,4 @@ | |
"twing": "^5.0.2", | ||
"underscore": "^1.13.3" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.