modify the tip of the first successful connection

This commit is contained in:
MaysWind 2018-08-11 11:13:55 +08:00
parent f049393813
commit 24dc426541
7 changed files with 26 additions and 11 deletions

View file

@ -1,6 +1,6 @@
[global] [global]
Operation Succeeded=操作成功 Operation Succeeded=操作成功
Connection Succeeded=连接成功 {{name}} is connected={{name}} 已连接
Error=错误 Error=错误
OK=确定 OK=确定
Confirm=确认 Confirm=确认

View file

@ -1,6 +1,6 @@
[global] [global]
Operation Succeeded=操作成功 Operation Succeeded=操作成功
Connection Succeeded=連線成功 {{name}} is connected={{name}} 已連線
Error=錯誤 Error=錯誤
OK=確定 OK=確定
Confirm=確認 Confirm=確認

View file

@ -4,7 +4,7 @@
angular.module('ariaNg').config(['$translateProvider', 'ariaNgConstants', function ($translateProvider, ariaNgConstants) { angular.module('ariaNg').config(['$translateProvider', 'ariaNgConstants', function ($translateProvider, ariaNgConstants) {
var defaultLanguageResource = { var defaultLanguageResource = {
'Operation Succeeded': 'Operation Succeeded', 'Operation Succeeded': 'Operation Succeeded',
'Connection Succeeded': 'Connection Succeeded', '{{name}} is connected': '{{name}} is connected',
'Error': 'Error', 'Error': 'Error',
'OK': 'OK', 'OK': 'OK',
'Confirm': 'Confirm', 'Confirm': 'Confirm',

View file

@ -164,9 +164,12 @@
}); });
}); });
aria2TaskService.onFirstSuccess(function () { aria2TaskService.onFirstSuccess(function (event) {
ariaNgNotificationService.notifyInPage('', 'Connection Succeeded', { ariaNgNotificationService.notifyInPage('', '{{name}} is connected', {
type: 'success' type: 'success',
contentParams: {
name: event.rpcName
}
}); });
}); });

View file

@ -67,14 +67,14 @@
}); });
}; };
var fireCustomEvent = function (callbacks) { var fireCustomEvent = function (callbacks, context) {
if (!angular.isArray(callbacks) || callbacks.length < 1) { if (!angular.isArray(callbacks) || callbacks.length < 1) {
return; return;
} }
for (var i = 0; i < callbacks.length; i++) { for (var i = 0; i < callbacks.length; i++) {
var callback = callbacks[i]; var callback = callbacks[i];
callback(); callback(context);
} }
}; };
@ -153,7 +153,10 @@
if (!isConnected) { if (!isConnected) {
isConnected = true; isConnected = true;
fireCustomEvent(onFirstSuccessCallbacks); var firstSuccessContext = {
rpcName: ariaNgSettingService.getCurrentRpcDisplayName()
};
fireCustomEvent(onFirstSuccessCallbacks, firstSuccessContext);
} }
}; };

View file

@ -50,11 +50,11 @@
} }
if (title) { if (title) {
title = $translate.instant(title); title = $translate.instant(title, options.titleParams);
} }
if (content) { if (content) {
content = $translate.instant(content); content = $translate.instant(content, options.contentParams);
} }
if (!content) { if (!content) {

View file

@ -277,6 +277,15 @@
setBrowserNotification: function (value) { setBrowserNotification: function (value) {
setOption('browserNotification', value); setOption('browserNotification', value);
}, },
getCurrentRpcDisplayName: function () {
var options = getOptions();
if (options.rpcAlias) {
return options.rpcAlias;
}
return options.rpcHost + ':' + options.rpcPort;
},
getCurrentRpcUrl: function () { getCurrentRpcUrl: function () {
var options = getOptions(); var options = getOptions();
var protocol = options.protocol; var protocol = options.protocol;