Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
55 changes: 33 additions & 22 deletions app/main/files/modals/grant-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ angular.module('web').controller('grantModalCtrl', [
privTypes: ['readOnly', 'all'],
privType: 'readOnly'
},
// eslint-disable-next-line no-useless-escape
policyNameReg: /^[a-z0-9A-Z\-]{1,128}$/,
mailSmtp: settingsSvs.mailSmtp.get(),
showEmailSettings: function() {
Expand Down Expand Up @@ -219,31 +220,41 @@ angular.module('web').controller('grantModalCtrl', [
var title = T('simplePolicy.title'); // 简化policy授权
var successMsg = T('simplePolicy.success'); // '应用policy成功'

let retry = 0; // policyName创建后需要等几秒才生效,故需要重试3次,使用setTimeout避免attachPolicyToUser提示policyName不存在
const retryFunc = ()=>{
if (retry < 3) {
retry++;
setTimeout(()=>{
ramSvs
.attachPolicyToUser(policyName, $scope.grant.userName) // 为指定用户添加权限
.then(function() {
// 发邮件
if (sendInfo) {
Mailer.send(sendInfo).then(
function(result) {
console.log(result);
Toast.success(T('mail.test.success'));
},
function(err) {
console.error(err);
Toast.error(err);
}
);
}

Toast.success(successMsg);
cancel();
}).catch(()=>{
retryFunc(); // 递归重试
});
}, 1000);
}
};
checkCreatePolicy(policyName, $scope.grant.policy, title).then(
function() {
switch ($scope.grant.toType) {
case 'user':
ramSvs
.attachPolicyToUser(policyName, $scope.grant.userName)
.then(function() {
// 发邮件
if (sendInfo) {
Mailer.send(sendInfo).then(
function(result) {
console.log(result);
Toast.success(T('mail.test.success'));
},
function(err) {
console.error(err);
Toast.error(err);
}
);
}

Toast.success(successMsg);
cancel();
});

retryFunc();
break;
case 'group':
ramSvs
Expand Down Expand Up @@ -294,7 +305,7 @@ angular.module('web').controller('grantModalCtrl', [
}
);

return df.promise;
// return df.promise;
}

function checkCreateUser(fn) {
Expand Down
4 changes: 2 additions & 2 deletions app/main/files/transfer/downloads.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// 下载弹窗
angular.module('web').controller('transferDownloadsCtrl', [
'$scope',
'$timeout',
Expand Down Expand Up @@ -34,7 +34,7 @@ angular.module('web').controller('transferDownloadsCtrl', [
checkStartJob: checkStartJob,
openLocaleFolder: function(item) {
var suffix = item.status == 'finished' ? '' : '.download';

// eslint-disable-next-line no-undef
openLocaleFolder(item.to.path + suffix);
},

Expand Down
2 changes: 1 addition & 1 deletion node/ossstore/lib/download-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ DownloadJob.prototype._changeStatus = function (status, retryTimes) {
if (status == "failed" || status == "stopped" || status == "finished") {
self.endTime = new Date().getTime();
//util.closeFD(self.keepFd);

util.closeFD(self.fd); // #50555373 不关闭会导致windows下删除job后,缓冲文件不会删除
console.log("clear speed tid, status:", self.status);
clearInterval(self.speedTid);
self.speed = 0;
Expand Down
2 changes: 1 addition & 1 deletion node/ossstore/lib/upload-job-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function prepareChunks(filePath, checkPoints, fn) {

fs.stat(filePath, function (err, state) {
if (err) {
// callback(err);
console.error(err);
return;
}

Expand Down
Loading