Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: to #48424264 添加上传错误时展示ec code 和 request id #451

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

Merged
PeterRao merged 9 commits into aliyun:develop from shungang:csg/feat/develop/48424264
May 24, 2023
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
36 changes: 35 additions & 1 deletion .eslintrc.json
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,41 @@
}
},
"rules": {
"semi": 2
"semi": 2,
"quotes": 0,
"strict": 0,
"padding-line-between-statements": 0,
"spaced-comment": 0,
"no-console": 0,
"comma-dangle": 0,
"no-unneeded-ternary": 0,
"space-before-function-paren": 0,
"indent": 0,
"curly": 0,
"no-unused-vars": 0,
"guard-for-in": 0,
"radix": 0,
"no-param-reassign": 0,
"no-else-return": 0,
"eqeqeq": 0,
"dot-notation": 0,
"object-curly-newline": 0,
"operator-assignment": 0,
"no-shadow": 0,
"require-atomic-updates": 0,
"nonblock-statement-body-position": 0,
"no-empty": 0,
"no-lonely-if": 0,
"one-var": 0,
"block-scoped-var": 0,
"no-redeclare": 0,
"no-useless-return": 0,
"no-loop-func": 0,
"default-case": 0,
"no-fallthrough": 0,
"prefer-promise-reject-errors": 0,
"no-throw-literal": 0,
"brace-style": 0
},
"extends": ["@alicloud/eslint-config/es5"],
"ignorePatterns": ["static/", "vendor/", "dist/", "node_modules/", "test/"],
Expand Down
1 change: 0 additions & 1 deletion app/components/filters/formater.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

angular
.module('web')
.filter('trustAsResourceUrl', [
Expand Down
1 change: 0 additions & 1 deletion app/components/filters/list-filter.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

angular.module('web').filter('listFilter', function() {
return function(arr, keyFn, value) {
if (!value) { return arr; }
Expand Down
2 changes: 1 addition & 1 deletion app/components/services/cipher.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ angular.module('web').factory('Cipher', function() {
};

function cipher(buf, key, algorithm) {
if (!buf instanceof Buffer) {
if (!(buf instanceof Buffer)) {
buf = new Buffer(buf);
}

Expand Down
1 change: 0 additions & 1 deletion app/components/services/diff-modal.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

angular
.module('web')
.factory('DiffModal', [
Expand Down
1 change: 1 addition & 0 deletions app/components/services/oss-download-manager.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ angular.module('web').factory('ossDownloadManager', [
// 文件
if (process.platform == 'win32') {
// 修复window下,文件名含非法字符需要转义
// eslint-disable-next-line no-useless-escape
if (/[\/\\\:\<\>\?\*\"\|]/.test(fileName)) {
fileName = encodeURIComponent(fileName);
filePath = path.join(
Expand Down
4 changes: 2 additions & 2 deletions app/components/services/oss-upload-manager.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,13 @@ angular.module('web').factory('ossUploadManager', [
from: n.from,
status: n.status,
message: n.message,
ecCode: n.ecCode,
requestId: n.requestId,
prog: n.prog
});
});

// console.log('request save upload:', t);

// console.log('-save')
fs.writeFileSync(getUpProgFilePath(), JSON.stringify(t));
$scope.calcTotalProg();
},
Expand Down
60 changes: 10 additions & 50 deletions app/components/services/oss2.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-unexpected-multiline */
angular.module('web').factory('ossSvs2', [
'$q',
'$rootScope',
Expand Down Expand Up @@ -245,6 +246,7 @@ angular.module('web').factory('ossSvs2', [
if (i.status === 'fulfilled') {
fulfilled.push(i.value);
} else {
// eslint-disable-next-line no-unused-expressions
i.status === 'rejected';

if (Array.isArray(i.reason)) {
Expand Down Expand Up @@ -1200,14 +1202,15 @@ angular.module('web').factory('ossSvs2', [

if (taggingResult && taggingResult.tag) {
tagging = Object.keys(taggingResult.tag).map(function(k) {
// eslint-disable-next-line no-undef
return encodeURIComponent(k) + '=' + encodeURIComponent(data[k]);
}).join('&');
}

let encoding = headResult.ContentEncoding;
// code-modal保存时,如果encoding=gzip,就不变更gzip,避免内容未做gzip压缩,导致sdk中的urllib响应内容解析失败
if(isCodeSave && encoding === 'gzip'){
encoding=undefined;
if(isCodeSave && encoding === 'gzip'){
encoding = undefined;
}

client3.put(key, new Buffer(content), {
Expand Down Expand Up @@ -1611,7 +1614,9 @@ angular.module('web').factory('ossSvs2', [
});
}

function _listFilesOrigion(region, bucket, key, marker = '', length = 1000) {
function _listFilesOrigion(region, bucket, key, marker = '', length) {
if (!length) length = localStorage.getItem("listObjectNum") || 500;
console.log('list-object-max-length', length);
const client = getClient3({
region,
bucket
Expand Down Expand Up @@ -1689,51 +1694,6 @@ angular.module('web').factory('ossSvs2', [

list(marker);
});

return client.listV2(Object.assign({}, options, { 'continuation-token': marker }))
.then((resp) => {
const dirs = (resp.prefixes || [])
.filter((n) => n !== key)
.map((n) => {
const arr = n.split('/').filter((k) => !!k);
const name = arr[arr.length - 1];

return {
isFolder: true,
itemType: 'folder',
path: n,
name: name === '/' ? name : name.replace(/\/$/, '')
};
});
const objects = (resp.objects || [])
.filter((n) => n.name !== key)
.map((n) => {
const arr = n.name.split('/').filter((k) => !!k);
const name = arr[arr.length - 1];

return Object.assign(n, {
isFile: true,
itemType: 'file',
path: n.name,
name: name
});
});

return {
data: {
dirs,
objects
},
marker: resp.nextContinuationToken,
truncated: resp.isTruncated,
maxKeys: +resp.keyCount
};
})
['catch']((e) => {
handleError(e);

return Promise.reject(e);
});
}

function listAllFiles(region, bucket, key, folderOnly) {
Expand Down Expand Up @@ -1997,7 +1957,7 @@ angular.module('web').factory('ossSvs2', [
}

return (
protocol + '//' + bucket + '.' + region + '.aliyuncs.com' + '/' + key
protocol + '//' + bucket + '.' + region + '.aliyuncs.com/' + key
);
}

Expand All @@ -2018,7 +1978,7 @@ angular.module('web').factory('ossSvs2', [
}

return (
protocol + '//' + bucket + '.' + region + '.aliyuncs.com' + '/' + key
protocol + '//' + bucket + '.' + region + '.aliyuncs.com/' + key
);
}

Expand Down
10 changes: 10 additions & 0 deletions app/components/services/settings.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ angular.module('web').factory('settingsSvs', [
return localStorage.setItem('downloadConcurrecyPartSize', v);
}
},
listObjectNum: {
get: function() {
return parseInt(
localStorage.getItem('listObjectNum') || 500
);
},
set: function(v) {
return localStorage.setItem('listObjectNum', v);
}
},
uploadAndDownloadRetryTimes: {
get: function() {
return parseInt(
Expand Down
4 changes: 2 additions & 2 deletions app/main/files/files.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ angular
function(result) {
const arr = result.data;

// eslint-disable-next-line no-unused-expressions
settingsSvs.showImageSnapshot.get() == 1
? signPicURL(info, arr)
: null;
Expand Down Expand Up @@ -726,8 +727,7 @@ angular
`)
);
safeApply($scope);
})
['finally'](() => {
}).finally(() => {
$timeout(() => {
isLoadingObjectSymlinkMeta = false;
}, 500);
Expand Down
15 changes: 12 additions & 3 deletions app/main/files/transfer/uploads.html
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@
{{item.status|status:1}}
<i
ng-if="item.message"
uib-tooltip="{{item.message}}"
uib-tooltip-template="'error-mess-tooltip-tpl.html'"
tooltip-placement="left"
tooltip-append-to-body="true"
class="fa fa-info-circle"
style="cursor: pointer;"
ng-click="copyMessage(item)"
></i>
</small>
<small ng-show="item.status=='running'">
Expand Down Expand Up @@ -185,7 +187,14 @@

<script type="text/ng-template" id="upload-path-tooltip-tpl.html">
<div class="break text-left">
<div><label class="text-primary">From:</label>{{item.from.path}}</div>
<div><label class="text-success">To:</label>oss://{{item.to.bucket}}/{{item.to.key}}</div>
<div><label class="text-primary">From:&nbsp;</label>{{item.from.path}}</div>
<div><label class="text-success">To:&nbsp;</label>oss://{{item.to.bucket}}/{{item.to.key}}</div>
</div>
</script>
<script type="text/ng-template" id="error-mess-tooltip-tpl.html">
<div class="break text-left">
<div><label class="text-primary">Message:&nbsp;</label>{{item.message}}</div>
<div ng-if="item.ecCode"><label class="text-success">EC Code:&nbsp;</label>{{item.ecCode}}</div>
<div ng-if="item.requestId"><label class="text-success">Request Id:&nbsp;</label>{{item.requestId}}</div>
</div>
</script>
12 changes: 10 additions & 2 deletions app/main/files/transfer/uploads.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

angular.module('web').controller('transferUploadsCtrl', [
'$scope',
'$timeout',
Expand Down Expand Up @@ -43,7 +42,8 @@ angular.module('web').controller('transferUploadsCtrl', [
);
},
limitToNum: 100,
loadMoreUploadItems: loadMoreItems
loadMoreUploadItems: loadMoreItems,
copyMessage: copyMessage
});

function loadMoreItems() {
Expand Down Expand Up @@ -206,5 +206,13 @@ angular.module('web').controller('transferUploadsCtrl', [
);
}
}

/** 复制到剪贴板 */
function copyMessage(item) {
const { clipboard } = require('electron');
const { message, ecCode, requestId } = item;
clipboard.writeText(`Message: ${message}${ecCode ? '\nEC Code: ' + ecCode : ''}${requestId ? '\nRequest Id: ' + requestId : '' }`);
Toast.success(T('copy.successfully'));
}
}
]);
24 changes: 24 additions & 0 deletions app/main/modals/settings.html
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,30 @@ <h5 class="text-primary">{{'settings.log'|translate}}</h5>
</div>
</div>
</fieldset>
<fieldset>
<legend>
<h5 class="text-primary">{{'settings.other'|translate}}</h5>
</legend>
<div class="form-group">
<label class="col-sm-4 control-label">
<!-- 单次列举Object最大数量 -->
{{'settings.other.list.object.max.number'|translate}}:
</label>
<div class="col-sm-7">
<input
type="number"
name="listObjectNum"
ng-model="set.listObjectNum"
ng-change="setChange(form1,'listObjectNum')"
max="1000"
min="20"
required
class="form-control"
placeholder="20-1000"
/>
</div>
</div>
</fieldset>
</div>
<div class="modal-footer">
<!-- <button type="submit" class="btn btn-success btn-sm">
Expand Down
2 changes: 1 addition & 1 deletion app/main/modals/settings.js
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

angular.module('web').controller('settingsCtrl', [
'$scope',
'$state',
Expand Down Expand Up @@ -40,6 +39,7 @@ angular.module('web').controller('settingsCtrl', [
connectTimeout: settingsSvs.connectTimeout.get(),
uploadPartSize: settingsSvs.uploadPartSize.get(),
downloadConcurrecyPartSize: settingsSvs.downloadConcurrecyPartSize.get(),
listObjectNum: settingsSvs.listObjectNum.get(),
uploadAndDownloadRetryTimes: settingsSvs.uploadAndDownloadRetryTimes.get()
},
reg: {
Expand Down
12 changes: 7 additions & 5 deletions node/i18n/en-US.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ module.exports = {
"settings.uploadPartSize": "uploadpart size(M)",
"settings.downloadConcurrecyPartSize": "download concurrency part number",
"settings.uploadAndDownloadRetryTimes": "retry times",
"settings.other": "Other Settings",
"settings.other.list.object.max.number": "Maximum number of objects listed in a single instance",

//address bar
//address bar
backward: "Backward",
forward: "Forward",
goUp: "Go up",
Expand All @@ -145,7 +147,7 @@ module.exports = {
"bookmark.add.error1": "Add Bookmark failed: Exceeds the maximum limit",
"bookmark.add.success": "Add Bookmark success",

//bucket
//bucket
"bucket.add": "Create Bucket",
"bucket.multipart": "MultiPart",
acl: "ACL",
Expand Down Expand Up @@ -218,7 +220,7 @@ module.exports = {
"simplePolicy.noauth.message3": "You are not authorized to get role list",
"simplePolicy.success": "Apply policy successfully",

//settings
//settings
"settings.maxUploadNum": "Upload tasks concurrent number",
"settings.maxDownloadNum": "Download tasks concurrent number",
"settings.WhetherShowThumbnail": "Whether to show the image thumbnail",
Expand All @@ -228,7 +230,7 @@ module.exports = {
"settings.autoUpgrade": "Auto update",
"settings.autoUpgrade.msg": "Download update package automatically",

//bookmark
//bookmark
"bookmarks.title": "Bookmarks",
time: "Time",
"bookmarks.delete.success": "Deleted bookmark successfully",
Expand All @@ -238,7 +240,7 @@ module.exports = {
clickToDownload: "Click to download",
currentIsLastest: "This is the lastest version!",

//files
//files
upload: "Upload",
"folder.create": "Directory",
"folder.create.success": "Directory created successfully",
Expand Down
2 changes: 2 additions & 0 deletions node/i18n/ja-JP.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ module.exports = {
"settings.uploadPartSize": "スライスサイズ(M)",
"settings.downloadConcurrecyPartSize": "ダウンロード数",
"settings.uploadAndDownloadRetryTimes": "再試行回数",
"settings.other": "その他の設定",
"settings.other.list.object.max.number": "Objectの最大数を列挙",

//bookmark
"bookmarks.title": "ブックマーク",
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /