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

Fix/desktop setup error handling #8727

Merged
merged 5 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export class OrganizationTeamEmployeeService extends TenantAwareCrudService<Orga
// Admins and Super Admins can update the activeTaskId of any employee
if (RequestContext.hasPermission(PermissionsEnum.CHANGE_SELECTED_EMPLOYEE)) {
const member = await this.typeOrmRepository.findOneOrFail({
where: { id: memberId, ...whereClause }
where: { employeeId: memberId, ...whereClause }
});

// Update the active task ID
Expand All @@ -260,7 +260,6 @@ export class OrganizationTeamEmployeeService extends TenantAwareCrudService<Orga

// Find the organization team employee
const member = await this.typeOrmRepository.findOneByOrFail(whereClause);

// Update the active task ID
return await this.typeOrmRepository.update(
{ id: member.id, organizationId, organizationTeamId, tenantId },
Expand Down
62 changes: 28 additions & 34 deletions packages/desktop-ui-lib/src/lib/setup/setup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { GAUZY_ENV } from '../constants';
import { ElectronService, LoggerService } from '../electron/services';
import { LanguageElectronService } from '../language/language-electron.service';
import { LanguageSelectorComponent } from '../language/language-selector.component';
import { ErrorHandlerService, Store } from '../services';
import { ErrorHandlerService, Store, ToastrNotificationService } from '../services';
import { SetupService } from './setup.service';

@Component({
Expand Down Expand Up @@ -44,9 +44,10 @@ export class SetupComponent implements OnInit {
@Inject(GAUZY_ENV)
private readonly _environment: any,
private readonly _domSanitizer: DomSanitizer,
private languageElectronService: LanguageElectronService
private languageElectronService: LanguageElectronService,
private readonly _notifier: ToastrNotificationService
) {
electronService.ipcRenderer.on('setup-data', (event, arg) => {
electronService.ipcRenderer.on('setup-data', (_, arg) => {
this.desktopFeatures.gauzyPlatform = arg.gauzyWindow;
this.desktopFeatures.timeTracking = arg.timeTrackerWindow;
this.connectivity.integrated = arg.isLocalServer;
Expand All @@ -71,7 +72,7 @@ export class SetupComponent implements OnInit {
}
});

electronService.ipcRenderer.on('log_state', (event, arg) => {
electronService.ipcRenderer.on('log_state', (_, arg) => {
const validMessage = this.defaultMessage.findIndex((item) => arg.msg.indexOf(item) > -1);
if (validMessage > -1) {
if (validMessage === 0 && arg.msg.indexOf('Found 0 users in DB') < 0) {
Expand Down Expand Up @@ -253,6 +254,15 @@ export class SetupComponent implements OnInit {
};
}

sanitizeServerPort(host: string, port: string) {
const url = new URL(host);
if (port) {
url.port = port;
}

return url.origin;
}
rahul-rocket marked this conversation as resolved.
Show resolved Hide resolved

getServerConfig() {
if (this.connectivity.integrated) {
return {
Expand All @@ -263,9 +273,10 @@ export class SetupComponent implements OnInit {

if (this.connectivity.custom) {
const protocol = this.serverConfig.custom.apiHost.indexOf('http') === 0 ? '' : 'https://';
const port = this.serverConfig.custom.port ? ':' + this.serverConfig.custom.port : '';
const port = this.serverConfig.custom.port;
const apiHost = `${protocol}${this.serverConfig.custom.apiHost}`;
return {
serverUrl: protocol + this.serverConfig.custom.apiHost + port,
serverUrl: this.sanitizeServerPort(apiHost, port),
isLocalServer: false
};
}
Expand Down Expand Up @@ -419,14 +430,15 @@ export class SetupComponent implements OnInit {
const resp = await this.setupService.pingServer({
host: url.origin
})
this.serverConfig.custom.apiHost = url.origin;
this.serverConfig.custom.apiHost = `${url.protocol}//${url.hostname}`;
this.serverConfig.custom.port = url.port;
return resp;
} catch (error) {
if (!retry) {
url.protocol = url.protocol === 'http:' ? 'https' : 'http';
return this.serverProtocolCheck(url.origin, true);
}
throw error;
throw new Error(this._translateService.instant('TIMER_TRACKER.SETUP.UNABLE_TO_CONNECT'));
}
}

Expand All @@ -437,28 +449,18 @@ export class SetupComponent implements OnInit {
if (this.runApp) {
await this.saveAndRun();
} else {
this.dialogData = {
title: 'TOASTR.TITLE.SUCCESS',
message: this._translateService.instant('TIMER_TRACKER.SETTINGS.MESSAGES.CONNECTION_SUCCEEDS', {
url: serverHostOptions.serverUrl
}),
status: 'success'
};
const elBtn: HTMLElement = this.btnDialogOpen.nativeElement;
elBtn.click();
this._notifier.success(this._translateService.instant('TIMER_TRACKER.SETTINGS.MESSAGES.CONNECTION_SUCCEEDS', {
url: serverHostOptions.serverUrl
}))
this.isCheckConnection = false;
this._cdr.detectChanges();
}
})
.catch((e) => {
this.dialogData = {
title: 'TOASTR.TITLE.ERROR',
message: e.message,
status: 'danger'
};
const elBtn: HTMLElement = this.btnDialogOpen.nativeElement;
elBtn.click();
this._notifier.error(e.message);
this.isSaving = false;
this.isCheckConnection = false;
this._cdr.detectChanges();
});
}

Expand Down Expand Up @@ -492,17 +494,9 @@ export class SetupComponent implements OnInit {
this.electronService.ipcRenderer.on('database_status', (event, arg) => {
// this.open(true);
if (arg.status) {
this.dialogData = {
title: 'TOASTR.TITLE.SUCCESS',
message: arg.message,
status: 'success'
};
this._notifier.success(arg.message);
} else {
this.dialogData = {
title: 'TOASTR.TITLE.WARNING',
message: arg.message,
status: 'danger'
};
this._notifier.warn(arg.message)
}

if (arg.status && this.runApp) {
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3877,7 +3877,8 @@
"PASSWORD": "كلمة المرور",
"UI_HOSTNAME": "اسم المضيف أو عنوان IP واجهة المستخدم (UI)",
"TITLE_SERVER_API": "معالج تثبيت خادم API الخاص بـ Ever Gauzy",
"LABEL_SERVER_API": "يوفر تطبيق سطح المكتب Ever Gauzy API Server الوظائف الكاملة لمنصة Gauzy المتوفرة مباشرة على جهاز الكمبيوتر المكتبي أو الكمبيوتر المحمول. بالإضافة إلى ذلك، فهو يسمح بتتبع وقت العمل وتسجيل النشاط والقدرة على تلقي تذكيرات/إشعارات التتبع"
"LABEL_SERVER_API": "يوفر تطبيق سطح المكتب Ever Gauzy API Server الوظائف الكاملة لمنصة Gauzy المتوفرة مباشرة على جهاز الكمبيوتر المكتبي أو الكمبيوتر المحمول. بالإضافة إلى ذلك، فهو يسمح بتتبع وقت العمل وتسجيل النشاط والقدرة على تلقي تذكيرات/إشعارات التتبع",
"UNABLE_TO_CONNECT": "غير قادر على الاتصال بالخادم. يرجى التحقق من مضيف API أو اتصال الإنترنت الخاص بك."
},
"SETTINGS": {
"SCREEN_CAPTURE": "التقاط الشاشة",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -3927,7 +3927,8 @@
"PASSWORD": "Парола",
"UI_HOSTNAME": "Име на хост на потребителския интерфейс / IP адрес",
"TITLE_SERVER_API": "Съветник за инсталиране на Ever Gauzy API сървър",
"LABEL_SERVER_API": "Приложението Ever Gauzy API Server Desktop предоставя пълната функционалност на платформата Gauzy, достъпна директно на вашия настолен компютър или лаптоп. Освен това позволява проследяване на работното време, записване на дейността и възможност за получаване на напомняния/известия за проследяване"
"LABEL_SERVER_API": "Приложението Ever Gauzy API Server Desktop предоставя пълната функционалност на платформата Gauzy, достъпна директно на вашия настолен компютър или лаптоп. Освен това позволява проследяване на работното време, записване на дейността и възможност за получаване на напомняния/известия за проследяване",
"UNABLE_TO_CONNECT": "Не може да се осъществи връзка със сървъра. Моля, проверете вашия API хост или интернет връзка."
},
"SETTINGS": {
"SCREEN_CAPTURE": "Захващане на екран",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3875,7 +3875,8 @@
"PASSWORD": "Passwort",
"UI_HOSTNAME": "UI Hostname / IP-Adresse",
"TITLE_SERVER_API": "Ever Gauzy API Server Installation Wizard",
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App giver den fulde funktionalitet af Gauzy Platform tilgængelig direkte på din stationære computer eller en bærbar computer. Derudover tillader det sporing af arbejdstid, aktivitetsregistrering og mulighed for at modtage sporingspåmindelser/notifikationer."
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App giver den fulde funktionalitet af Gauzy Platform tilgængelig direkte på din stationære computer eller en bærbar computer. Derudover tillader det sporing af arbejdstid, aktivitetsregistrering og mulighed for at modtage sporingspåmindelser/notifikationer.",
"UNABLE_TO_CONNECT": "Verbindung zum Server nicht möglich. Bitte überprüfen Sie Ihren API-Host oder Ihre Internetverbindung."
},
"SETTINGS": {
"SCREEN_CAPTURE": "Bildschirmaufnahme",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4008,7 +4008,8 @@
"PASSWORD": "Password",
"UI_HOSTNAME": "UI Hostname / IP Address",
"TITLE_SERVER_API": "Ever Gauzy API Server Installation Wizard",
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App provides the full functionality of the Gauzy Platform available directly on your desktop computer or a laptop. In addition, it allows tracking work time, activity recording, and the ability to receive tracking reminders/notifications."
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App provides the full functionality of the Gauzy Platform available directly on your desktop computer or a laptop. In addition, it allows tracking work time, activity recording, and the ability to receive tracking reminders/notifications.",
"UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection."
},
"SETTINGS": {
"SCREEN_CAPTURE": "Screen Capture",
Expand Down
4 changes: 3 additions & 1 deletion packages/ui-core/i18n/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3881,7 +3881,9 @@
"PASSWORD": "Contraseña",
"UI_HOSTNAME": "Nombre de host de IU / Dirección IP",
"TITLE_SERVER_API": "Asistente de instalación del servidor API de Ever Gauzy",
"LABEL_SERVER_API": "La aplicación de escritorio Ever Gauzy API Server proporciona la funcionalidad completa de la plataforma Gauzy disponible directamente en su computadora de escritorio o portátil. Además, permite realizar un seguimiento del tiempo de trabajo, registrar actividades y recibir recordatorios/notificaciones de seguimiento."
"LABEL_SERVER_API": "La aplicación de escritorio Ever Gauzy API Server proporciona la funcionalidad completa de la plataforma Gauzy disponible directamente en su computadora de escritorio o portátil. Además, permite realizar un seguimiento del tiempo de trabajo, registrar actividades y recibir recordatorios/notificaciones de seguimiento.",
"UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection."

},
"SETTINGS": {
"SCREEN_CAPTURE": "Captura de pantalla",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,8 @@
"PASSWORD": "Mot de passe",
"UI_HOSTNAME": "Nom d'hôte de l'interface utilisateur / Adresse IP",
"TITLE_SERVER_API": "Assistant d'installation du serveur API Ever Gauzy",
"LABEL_SERVER_API": "L'application de bureau Ever Gauzy API Server fournit toutes les fonctionnalités de la plateforme Gauzy disponibles directement sur votre ordinateur de bureau ou votre ordinateur portable. De plus, elle permet de suivre le temps de travail, d'enregistrer les activités et de recevoir des rappels/notifications de suivi."
"LABEL_SERVER_API": "L'application de bureau Ever Gauzy API Server fournit toutes les fonctionnalités de la plateforme Gauzy disponibles directement sur votre ordinateur de bureau ou votre ordinateur portable. De plus, elle permet de suivre le temps de travail, d'enregistrer les activités et de recevoir des rappels/notifications de suivi.",
"UNABLE_TO_CONNECT": "Impossible de se connecter au serveur. Veuillez vérifier votre hôte API ou votre connexion Internet."
},
"SETTINGS": {
"SCREEN_CAPTURE": "Capture d'écran",
Expand Down
4 changes: 3 additions & 1 deletion packages/ui-core/i18n/assets/i18n/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -3891,7 +3891,9 @@
"PASSWORD": "סיסמה",
"UI_HOSTNAME": "שם מארח יישום ממשק משתמש / כתובת IP",
"TITLE_SERVER_API": "אשף התקנת שרת API של Ever Gauzy",
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App מספקת את הפונקציונליות המלאה של פלטפורמת Gauzy הזמינה ישירות במחשב השולחני או במחשב הנייד שלך. בנוסף, הוא מאפשר מעקב אחר זמן עבודה, רישום פעילות ויכולת לקבל תזכורות/הודעות מעקב."
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App מספקת את הפונקציונליות המלאה של פלטפורמת Gauzy הזמינה ישירות במחשב השולחני או במחשב הנייד שלך. בנוסף, הוא מאפשר מעקב אחר זמן עבודה, רישום פעילות ויכולת לקבל תזכורות/הודעות מעקב.",
"UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection."

},
"SETTINGS": {
"SCREEN_CAPTURE": "לכידת מסך",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,8 @@
"PASSWORD": "Password",
"UI_HOSTNAME": "Nome host dell'interfaccia utente / indirizzo IP",
"TITLE_SERVER_API": "Procedura guidata di installazione del server API Ever Gauzy",
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App fornisce la piena funzionalità della piattaforma Gauzy disponibile direttamente sul tuo computer desktop o laptop. Inoltre, consente di tracciare il tempo di lavoro, registrare le attività e ricevere promemoria/notifiche di tracciamento."
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App fornisce la piena funzionalità della piattaforma Gauzy disponibile direttamente sul tuo computer desktop o laptop. Inoltre, consente di tracciare il tempo di lavoro, registrare le attività e ricevere promemoria/notifiche di tracciamento.",
"UNABLE_TO_CONNECT": "Impossibile connettersi al server. Controlla il tuo host API o la connessione internet."
},
"SETTINGS": {
"SCREEN_CAPTURE": "Cattura dello schermo",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,8 @@
"PASSWORD": "Wachtwoord",
"UI_HOSTNAME": "UI Hostnaam / IP-adres",
"TITLE_SERVER_API": "Ever Gauzy API Server-installatiewizard",
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App biedt de volledige functionaliteit van het Gauzy Platform direct beschikbaar op uw desktopcomputer of laptop. Daarnaast kunt u hiermee werktijd bijhouden, activiteiten registreren en trackingherinneringen/meldingen ontvangen."
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App biedt de volledige functionaliteit van het Gauzy Platform direct beschikbaar op uw desktopcomputer of laptop. Daarnaast kunt u hiermee werktijd bijhouden, activiteiten registreren en trackingherinneringen/meldingen ontvangen.",
"UNABLE_TO_CONNECT": "Kan geen verbinding maken met de server. Controleer uw API-host of internetverbinding."
},
"SETTINGS": {
"SCREEN_CAPTURE": "Schermopname",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,8 @@
"PASSWORD": "Hasło",
"UI_HOSTNAME": "Nazwa hosta interfejsu użytkownika / Adres IP",
"TITLE_SERVER_API": "Kreator instalacji serwera API Ever Gauzy",
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App zapewnia pełną funkcjonalność platformy Gauzy dostępną bezpośrednio na komputerze stacjonarnym lub laptopie. Ponadto umożliwia śledzenie czasu pracy, rejestrowanie aktywności i możliwość otrzymywania przypomnień/powiadomień o śledzeniu."
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App zapewnia pełną funkcjonalność platformy Gauzy dostępną bezpośrednio na komputerze stacjonarnym lub laptopie. Ponadto umożliwia śledzenie czasu pracy, rejestrowanie aktywności i możliwość otrzymywania przypomnień/powiadomień o śledzeniu.",
"UNABLE_TO_CONNECT": "Impossibile connettersi al server. Controlla il tuo host API o la connessione internet."
},
"SETTINGS": {
"SCREEN_CAPTURE": "Zrzut ekranu",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,8 @@
"PASSWORD": "Senha",
"UI_HOSTNAME": "Nome do Host da Interface do Usuário / Endereço IP",
"TITLE_SERVER_API": "Ever Gauzy API Server Instalation Wizard",
"LABEL_SERVER_API": "A aplicação Gauzy API Server Desktop fornece a funcionalidade completa da plataforma Gauzy disponível diretamente no seu computador de secretária ou portátil. Além disso, permite o tempo de trabalho de rastreio, o registo de atividades e a capacidade de receber lembretes/notificações de rastreio."
"LABEL_SERVER_API": "A aplicação Gauzy API Server Desktop fornece a funcionalidade completa da plataforma Gauzy disponível diretamente no seu computador de secretária ou portátil. Além disso, permite o tempo de trabalho de rastreio, o registo de atividades e a capacidade de receber lembretes/notificações de rastreio.",
"UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection."
},
"SETTINGS": {
"SCREEN_CAPTURE": "Captura de tela",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -3897,7 +3897,8 @@
"PASSWORD": "Пароль",
"UI_HOSTNAME": "Имя хоста интерфейса пользователя / IP-адрес",
"TITLE_SERVER_API": "Мастер установки сервера API Ever Gauzy",
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App предоставляет полный функционал Gauzy Platform, доступный непосредственно на вашем настольном компьютере или ноутбуке. Кроме того, он позволяет отслеживать рабочее время, записывать активность и получать напоминания/уведомления об отслеживании."
"LABEL_SERVER_API": "Ever Gauzy API Server Desktop App предоставляет полный функционал Gauzy Platform, доступный непосредственно на вашем настольном компьютере или ноутбуке. Кроме того, он позволяет отслеживать рабочее время, записывать активность и получать напоминания/уведомления об отслеживании.",
"UNABLE_TO_CONNECT": "Не удается подключиться к серверу. Пожалуйста, проверьте ваш API хост или подключение к интернету."
},
"SETTINGS": {
"SCREEN_CAPTURE": "Захват экрана",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui-core/i18n/assets/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,8 @@
"PASSWORD": "密码",
"UI_HOSTNAME": "界面主机名/ IP地址",
"TITLE_SERVER_API": "Ever Gauzy API 服务器安装向导",
"LABEL_SERVER_API": "Ever Gauzy API Server 桌面应用程序提供 Gauzy 平台的全部功能,可直接在您的台式计算机或笔记本电脑上使用。此外,它还允许跟踪工作时间、活动记录以及接收跟踪提醒/通知的功能。"
"LABEL_SERVER_API": "Ever Gauzy API Server 桌面应用程序提供 Gauzy 平台的全部功能,可直接在您的台式计算机或笔记本电脑上使用。此外,它还允许跟踪工作时间、活动记录以及接收跟踪提醒/通知的功能。",
"UNABLE_TO_CONNECT": "Unable to connect to the server. Please check your API host or internet connection."
},
"SETTINGS": {
"SCREEN_CAPTURE": "屏幕捕获",
Expand Down
Loading