Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sunyihao
bkunyun
Commits
b0de1bf1
Commit
b0de1bf1
authored
Jun 15, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: token 换成 token_key
parent
f213250b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
98 deletions
+70
-98
raysyncApi.ts
src/api/fileserver/raysyncApi.ts
+57
-81
InformationDisplay.tsx
src/components/InformationDisplay/InformationDisplay.tsx
+1
-1
localStorageKey.ts
src/utils/localStorageKey.ts
+1
-1
util.ts
src/utils/util.ts
+11
-15
No files found.
src/api/fileserver/raysyncApi.ts
View file @
b0de1bf1
...
@@ -2,29 +2,6 @@
...
@@ -2,29 +2,6 @@
// const APIOPTION = "https://fileserver.cloudam.cn"
// const APIOPTION = "https://fileserver.cloudam.cn"
// const APIPORT = "39.105.230.38"
// const APIPORT = "39.105.230.38"
import
{
getLoaclStorageOfKey
}
from
"./utils"
;
import
{
getLoaclStorageOfKey
}
from
"./utils"
;
// const raysyncAddr = {
// bandwidth: null
// capacity: 10485760
// enableLargeFileTransfer: true
// fileServerEndPoint: "https://fileserver.cloudam.cn"
// fileSystemType: "standard"
// jobLogServerEndPoint: "https://fileserver.cloudam.cn:6677"
// privateIp: "10.8.2.67"
// protocolType: "NFS"
// publicMountDir: "/public"
// publicMountUrl: "132594ad6e-atf93.cn-beijing.nas.aliyuncs.com"
// ramUserId: "61261f8a2a2aa4d72f752c3c"
// smbMountUrl: null
// srcAddr: "fileserver.cloudam.cn"
// srcIp: "47.94.198.50"
// sshServerEndPoint: "https://fileserver.cloudam.cn:8888"
// storageType: "Capacity"
// token: null
// userMountDir: "/public/data/"
// userMountUrl: "132594ad6e-uop2.cn-beijing.nas.aliyuncs.com"
// vncServerEndPoint: "https://fileserver.cloudam.cn:9090"
// zoneId: "cn-beijing-h"
// }
const
API
=
function
()
{
const
API
=
function
()
{
const
raysyncAddr
=
getLoaclStorageOfKey
(
"raysyncAddr"
);
const
raysyncAddr
=
getLoaclStorageOfKey
(
"raysyncAddr"
);
...
@@ -50,38 +27,6 @@ const APIPORT = function () {
...
@@ -50,38 +27,6 @@ const APIPORT = function () {
return
raysyncAddr
.
srcIp
||
""
;
return
raysyncAddr
.
srcIp
||
""
;
};
};
// const currentRegion = {
// cloudProvider: "ALIYUN"
// description: "本计算区有丰富的CPU资源,并提供部分GPU资源,可以满足大部分计算作业需求。"
// enabled: true
// id: "CE-Z1"
// initialized: true
// location: "CLOUD"
// name: "通用计算区"
// primary: true
// storageConfig: {srcAddr: "fileserver.cloudam.cn", srcIp: "47.94.198.50", privateIp: "10.8.2.67",…}
// bandwidth: null
// capacity: 10485760
// enableLargeFileTransfer: true
// fileServerEndPoint: "https://fileserver.cloudam.cn"
// fileSystemType: "standard"
// jobLogServerEndPoint: "https://fileserver.cloudam.cn:6677"
// privateIp: "10.8.2.67"
// protocolType: "NFS"
// publicMountDir: "/public"
// publicMountUrl: "132594ad6e-atf93.cn-beijing.nas.aliyuncs.com"
// ramUserId: "61261f8a2a2aa4d72f752c3c"
// smbMountUrl: null
// srcAddr: "fileserver.cloudam.cn"
// srcIp: "47.94.198.50"
// sshServerEndPoint: "https://fileserver.cloudam.cn:8888"
// storageType: "Capacity"
// token: null
// userMountDir: "/public/data/"
// userMountUrl: "132594ad6e-uop2.cn-beijing.nas.aliyuncs.com"
// vncServerEndPoint: "https://fileserver.cloudam.cn:9090"
// zoneId: "cn-beijing-h"
// }
// 当前计算区
// 当前计算区
let
currentRegion
=
localStorage
.
getItem
(
"current-region"
);
let
currentRegion
=
localStorage
.
getItem
(
"current-region"
);
let
currentRegionJson
=
currentRegion
&&
JSON
.
parse
(
currentRegion
);
let
currentRegionJson
=
currentRegion
&&
JSON
.
parse
(
currentRegion
);
...
@@ -110,35 +55,10 @@ const ZONEID = (params: string) => {
...
@@ -110,35 +55,10 @@ const ZONEID = (params: string) => {
};
};
const
urlToken
=
(
filetoken
:
string
,
projectId
:
string
)
=>
{
const
urlToken
=
(
filetoken
:
string
,
projectId
:
string
)
=>
{
let
token
=
getLoaclStorageOfKey
(
"token"
).
access_token
;
let
token
=
getLoaclStorageOfKey
(
"token
_key
"
).
access_token
;
return
`?username=
${
projectId
}
&token=
${
token
}
&filetoken=
${
encodeURIComponent
(
return
`?username=
${
projectId
}
&token=
${
token
}
&filetoken=
${
encodeURIComponent
(
filetoken
filetoken
)}
&share=false&project=true`
;
)}
&share=false&project=true`
;
// let json = getLoaclStorageOfKey("current-region");
// const userInfo = getLoaclStorageOfKey("userinfo");
// if (json["location"] && json["location"] === "ON_PREMISE") {
// return `?username=${
// userInfo["name"]
// }&token=${token}&filetoken=${encodeURIComponent(filetoken)}&share=false`; // 之前的filetoken是: userInfo["shareFileAccessToken"]
// }
// if (root && root === "home") {
// return `?username=${
// userInfo["homeDirectoryMountPoint"]
// }&token=${token}&filetoken=${encodeURIComponent(filetoken)}&share=false`;
// }
// // 是否共有文件系统
// if (
// localStorage.getItem("isShareFileSystem") &&
// localStorage.getItem("isShareFileSystem") === "true"
// ) {
// return `?username=${
// userInfo["shareDirectoryMountPoint"]
// }&token=${token}&filetoken=${encodeURIComponent(filetoken)}&share=true`;
// } else {
// return `?username=${
// userInfo["homeDirectoryMountPoint"]
// }&token=${token}&filetoken=${encodeURIComponent(filetoken)}&share=false`;
// }
};
};
const
getUuid
=
()
=>
{
const
getUuid
=
()
=>
{
...
@@ -195,3 +115,59 @@ export {
...
@@ -195,3 +115,59 @@ export {
encryptTransfer
,
encryptTransfer
,
getType
,
getType
,
};
};
// const raysyncAddr = {
// bandwidth: null
// capacity: 10485760
// enableLargeFileTransfer: true
// fileServerEndPoint: "https://fileserver.cloudam.cn"
// fileSystemType: "standard"
// jobLogServerEndPoint: "https://fileserver.cloudam.cn:6677"
// privateIp: "10.8.2.67"
// protocolType: "NFS"
// publicMountDir: "/public"
// publicMountUrl: "132594ad6e-atf93.cn-beijing.nas.aliyuncs.com"
// ramUserId: "61261f8a2a2aa4d72f752c3c"
// smbMountUrl: null
// srcAddr: "fileserver.cloudam.cn"
// srcIp: "47.94.198.50"
// sshServerEndPoint: "https://fileserver.cloudam.cn:8888"
// storageType: "Capacity"
// token: null
// userMountDir: "/public/data/"
// userMountUrl: "132594ad6e-uop2.cn-beijing.nas.aliyuncs.com"
// vncServerEndPoint: "https://fileserver.cloudam.cn:9090"
// zoneId: "cn-beijing-h"
// }
// const currentRegion = {
// cloudProvider: "ALIYUN"
// description: "本计算区有丰富的CPU资源,并提供部分GPU资源,可以满足大部分计算作业需求。"
// enabled: true
// id: "CE-Z1"
// initialized: true
// location: "CLOUD"
// name: "通用计算区"
// primary: true
// storageConfig: {srcAddr: "fileserver.cloudam.cn", srcIp: "47.94.198.50", privateIp: "10.8.2.67",…}
// bandwidth: null
// capacity: 10485760
// enableLargeFileTransfer: true
// fileServerEndPoint: "https://fileserver.cloudam.cn"
// fileSystemType: "standard"
// jobLogServerEndPoint: "https://fileserver.cloudam.cn:6677"
// privateIp: "10.8.2.67"
// protocolType: "NFS"
// publicMountDir: "/public"
// publicMountUrl: "132594ad6e-atf93.cn-beijing.nas.aliyuncs.com"
// ramUserId: "61261f8a2a2aa4d72f752c3c"
// smbMountUrl: null
// srcAddr: "fileserver.cloudam.cn"
// srcIp: "47.94.198.50"
// sshServerEndPoint: "https://fileserver.cloudam.cn:8888"
// storageType: "Capacity"
// token: null
// userMountDir: "/public/data/"
// userMountUrl: "132594ad6e-uop2.cn-beijing.nas.aliyuncs.com"
// vncServerEndPoint: "https://fileserver.cloudam.cn:9090"
// zoneId: "cn-beijing-h"
// }
src/components/InformationDisplay/InformationDisplay.tsx
View file @
b0de1bf1
...
@@ -19,7 +19,7 @@ const InformationDisplay = (props: InformationDisplayProps) => {
...
@@ -19,7 +19,7 @@ const InformationDisplay = (props: InformationDisplayProps) => {
return
(
return
(
<
div
className=
{
style
.
infoListLi
}
key=
{
item
.
label
}
>
<
div
className=
{
style
.
infoListLi
}
key=
{
item
.
label
}
>
<
div
className=
{
style
.
infoListLiLabel
}
>
{
item
.
label
}
</
div
>
<
div
className=
{
style
.
infoListLiLabel
}
>
{
item
.
label
}
</
div
>
<
div
className=
{
style
.
infoListLiValue
}
>
{
item
.
value
}
</
div
>
<
div
className=
{
style
.
infoListLiValue
}
>
{
item
.
value
||
"-"
}
</
div
>
</
div
>
</
div
>
);
);
})
}
})
}
...
...
src/utils/localStorageKey.ts
View file @
b0de1bf1
const
localStorageKey
=
{
const
localStorageKey
=
{
TOKEN
:
"token"
,
TOKEN
:
"token
_key
"
,
USER_INFO
:
"userInfo"
,
USER_INFO
:
"userInfo"
,
USER_LOGIN
:
"userlogin"
,
USER_LOGIN
:
"userlogin"
,
};
};
...
...
src/utils/util.ts
View file @
b0de1bf1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
import
{
v4
as
uuidv4
}
from
'uuid'
;
import
{
v4
as
uuidv4
}
from
"uuid"
;
export
const
isProjectOwner
=
(
name
:
string
)
=>
{
export
const
isProjectOwner
=
(
name
:
string
)
=>
{
let
localName
=
""
;
let
localName
=
""
;
...
@@ -23,9 +23,9 @@ export const isProjectOwner = (name: string) => {
...
@@ -23,9 +23,9 @@ export const isProjectOwner = (name: string) => {
* 生成32位的随机id
* 生成32位的随机id
* @returns 返回32位的uuid
* @returns 返回32位的uuid
*/
*/
export
const
uuid
=
()
=>
{
export
const
uuid
=
()
=>
{
const
reg
=
/-/g
;
const
reg
=
/-/g
;
const
pwd
=
uuidv4
().
replace
(
reg
,
''
);
const
pwd
=
uuidv4
().
replace
(
reg
,
""
);
return
pwd
;
return
pwd
;
};
};
...
@@ -33,27 +33,23 @@ export const isProjectOwner = (name: string) => {
...
@@ -33,27 +33,23 @@ export const isProjectOwner = (name: string) => {
export
const
getUserInfo
=
()
=>
{
export
const
getUserInfo
=
()
=>
{
let
val
:
any
;
let
val
:
any
;
try
{
try
{
val
=
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)
||
"{}"
)
val
=
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)
||
"{}"
);
}
}
catch
{
catch
{
console
.
error
(
"获取用户信息 出错"
);
console
.
error
(
"获取用户信息 出错"
);
}
}
return
val
return
val
;
}
}
;
// 获取token信息
// 获取token信息
export
const
getTokenInfo
=
()
=>
{
export
const
getTokenInfo
=
()
=>
{
let
val
:
any
;
let
val
:
any
;
try
{
try
{
val
=
JSON
.
parse
(
localStorage
.
getItem
(
"token"
)
||
"{}"
)
val
=
JSON
.
parse
(
localStorage
.
getItem
(
"token_key"
)
||
"{}"
);
}
}
catch
{
catch
{
console
.
error
(
"获取token信息 出错"
);
console
.
error
(
"获取token信息 出错"
);
}
}
return
val
return
val
;
}
};
const
IsNumberLetterChineseReg
=
new
RegExp
(
"^[A-Za-z0-9
\
u4e00-
\
u9fa5]+$"
);
const
IsNumberLetterChineseReg
=
new
RegExp
(
"^[A-Za-z0-9
\
u4e00-
\
u9fa5]+$"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment