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]
Operation Succeeded=操作成功
Connection Succeeded=连接成功
{{name}} is connected={{name}} 已连接
Error=错误
OK=确定
Confirm=确认

View file

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

View file

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

View file

@ -164,9 +164,12 @@
});
});
aria2TaskService.onFirstSuccess(function () {
ariaNgNotificationService.notifyInPage('', 'Connection Succeeded', {
type: 'success'
aria2TaskService.onFirstSuccess(function (event) {
ariaNgNotificationService.notifyInPage('', '{{name}} is connected', {
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) {
return;
}
for (var i = 0; i < callbacks.length; i++) {
var callback = callbacks[i];
callback();
callback(context);
}
};
@ -153,7 +153,10 @@
if (!isConnected) {
isConnected = true;
fireCustomEvent(onFirstSuccessCallbacks);
var firstSuccessContext = {
rpcName: ariaNgSettingService.getCurrentRpcDisplayName()
};
fireCustomEvent(onFirstSuccessCallbacks, firstSuccessContext);
}
};

View file

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

View file

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