From f14df67d62d13d04b27d74bb8d249c2676ae44a7 Mon Sep 17 00:00:00 2001 From: Sergii Ivanchenko Date: Mon, 30 Jan 2017 22:27:40 +0200 Subject: [PATCH] Add message about successfull send data to server --- frontEnd/src/pages/home/home.ts | 3 ++- frontEnd/src/providers/global.ts | 6 +++++- frontEnd/src/providers/local-data-save-service.ts | 2 +- frontEnd/src/providers/server-service.ts | 8 +++++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/frontEnd/src/pages/home/home.ts b/frontEnd/src/pages/home/home.ts index eb64fe5..e4376b7 100644 --- a/frontEnd/src/pages/home/home.ts +++ b/frontEnd/src/pages/home/home.ts @@ -353,7 +353,8 @@ export class HomePage { () => { // this.serverService.sendDataToServer(); this.localDataSaveService.saveCSVFile(); - this.global.clOnScreen = "Сессия успешно записана в csv-файл " + // this.global.clOnScreen = "Сессия успешно записана в csv-файл "; + // this.global.clOnScreen = this.global.msg9; }, 1000 ); diff --git a/frontEnd/src/providers/global.ts b/frontEnd/src/providers/global.ts index 1d70788..8c47f42 100644 --- a/frontEnd/src/providers/global.ts +++ b/frontEnd/src/providers/global.ts @@ -58,11 +58,15 @@ export class Global { public msg3 = "Err during data sending. See errorLog file"; public msg4 = "Technical error. Please contact application administrator (log file included)"; public msg5 = "Please turn on your Wi-Fi"; + public msg6 = "Невозможно отправить данные на сервер. Убедитесь что вы подключены к Wi-Fi и нажмите кнопку, а затем stop для повторной попытки"; + public msg7 = "Нет доступа к сети. Попробуйте позже"; + public msg8 = "Данные успешно отправлены на сервер"; + public msg9 = "Сессия успешно записана в csv-файл"; public generalSpinnerMsg = "Please wait..."; public spinnerSensorCheckMsg = "Checking sensors availability..."; constructor(public platform: Platform, public alertController: AlertController, public loadingController: LoadingController) { - console.log('Hello Global Provider'); + // console.log('Hello Global Provider'); this.propertyObj.sessionId = this.sessionID; this.propertyObj.status = this.stateStatus; } diff --git a/frontEnd/src/providers/local-data-save-service.ts b/frontEnd/src/providers/local-data-save-service.ts index d22c6b4..483ad3a 100644 --- a/frontEnd/src/providers/local-data-save-service.ts +++ b/frontEnd/src/providers/local-data-save-service.ts @@ -134,7 +134,7 @@ export class LocalDataSaveService { ) .then( (result) => { - + this.global.clOnScreen = this.global.msg9; return this.serverService.sendDataToServer(fileContent, "data"); } diff --git a/frontEnd/src/providers/server-service.ts b/frontEnd/src/providers/server-service.ts index d6d79a4..879f3a0 100644 --- a/frontEnd/src/providers/server-service.ts +++ b/frontEnd/src/providers/server-service.ts @@ -113,6 +113,8 @@ export class ServerService { HTTP.post(SERVER_URL, body, headers) .then(data => { + this.global.clOnScreen = this.global.msg8; + if (dataType == "log") { this.global.globalCleanLogFile(); } else if (dataType == "data") { @@ -126,7 +128,7 @@ export class ServerService { .catch(error => { // this.localDataSaveService.saveErrorLog(JSON.stringify(error)); - // this.global.clOnScreen = this.global.msg3; + this.global.clOnScreen = this.global.msg3; this.global.saveErrorLog("sendDataToServer()", "Err during data sending: " + JSON.stringify(error)); // console.log(error); // console.log(error.status); @@ -142,14 +144,14 @@ export class ServerService { } } else { - // this.clOnScreen4 = "Phone is offline. Try send data later"; + this.global.clOnScreen = this.global.msg7; // this.global.saveErrorLog("sendDataToServer()", "Phone is offline. Try send data later"); } } catch (err) { - // this.global.clOnScreen9 = "err in send data/log to server"; + this.global.clOnScreen = this.global.msg3; this.global.saveErrorLog("sendDataToServer()", "try-catch err: " + err); } }