Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-console
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
Javier Larrosa
web-console
Commits
49a5c155
Commit
49a5c155
authored
Sep 09, 2021
by
ajlarrosa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Saco menus no desarrollados
parent
e87fddb0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
184 deletions
+20
-184
.eslintcache
web/.eslintcache
+1
-1
Console.tsx
web/src/components/Console.tsx
+16
-76
Home.tsx
web/src/components/Home.tsx
+0
-5
Signin.tsx
web/src/components/Signin.tsx
+3
-102
No files found.
web/.eslintcache
View file @
49a5c155
This diff is collapsed.
Click to expand it.
web/src/components/Console.tsx
View file @
49a5c155
...
...
@@ -8,7 +8,6 @@ import {
Popover
,
Position
,
Avatar
,
Portal
,
Button
,
toaster
,
CornerDialog
,
...
...
@@ -16,12 +15,6 @@ import {
import
{
FullCircleIcon
,
UngroupObjectsIcon
,
RefreshIcon
,
SwapVerticalIcon
,
FullscreenIcon
,
MinimizeIcon
,
LogOutIcon
,
CogIcon
,
ErrorIcon
,
DisableIcon
,
}
from
'evergreen-ui'
;
...
...
@@ -132,7 +125,6 @@ const Console = (props: RouteComponentProps) => {
const
_t
=
sessionStorage
.
getItem
(
Config
.
jwt
.
tokenName
);
if
(
_t
===
null
)
{
toaster
.
danger
(
t
(
'console:web_socket_expire'
));
// setConnecting(ConnStatus.ConnectionLost)
props
.
history
.
push
(
'/signin'
);
return
;
}
...
...
@@ -153,11 +145,26 @@ const Console = (props: RouteComponentProps) => {
setConnecting
(
ConnStatus
.
ConnectionAlive
);
};
ws
.
onclose
=
()
=>
{
ws
.
onclose
=
(
ev
)
=>
{
term
.
setOption
(
'cursorBlink'
,
false
);
sessionStorage
.
removeItem
(
Config
.
jwt
.
tokenName
);
setConnecting
(
ConnStatus
.
ConnectionLost
);
setShowCornerDialog
(
true
);
send
(
ev
);
};
const
send
=
(
e
:
CloseEvent
)
=>
{
e
.
preventDefault
();
if
(
window
&&
window
.
parent
)
{
window
.
parent
.
postMessage
(
{
message
:
'close'
,
},
'*'
,
);
}
};
sshWebSocket
.
bindTerminal
(
term
,
ws
!
,
true
,
-
1
);
...
...
@@ -219,16 +226,6 @@ const Console = (props: RouteComponentProps) => {
</
Menu
.
Item
>
</
Menu
.
Group
>
<
Menu
.
Divider
/>
<
Menu
.
Group
>
<
Menu
.
Item
icon=
{
LogOutIcon
}
intent=
"danger"
onSelect=
{
()
=>
{
toaster
.
notify
(
'under develop!'
,
{
id
:
'dev'
});
}
}
>
{
t
(
'console:nav_user_exit'
)
}
</
Menu
.
Item
>
</
Menu
.
Group
>
</
Menu
>
}
>
<
Avatar
...
...
@@ -266,14 +263,6 @@ const Console = (props: RouteComponentProps) => {
<
Button
intent=
"success"
onClick=
{
()
=>
setSideSheetShwon
(
true
)
}
>
SFTP
</
Button
>
<
Button
intent=
"none"
marginLeft=
"0.05rem"
onClick=
{
()
=>
{
toaster
.
notify
(
'under develop!'
,
{
id
:
'dev'
});
}
}
>
Paste
</
Button
>
<
Pane
flex=
"1"
></
Pane
>
<
Text
marginRight=
"0.4rem"
>
active time: 0:00:00
</
Text
>
</
Pane
>
...
...
@@ -295,55 +284,6 @@ const Console = (props: RouteComponentProps) => {
onCloseComplete=
{
()
=>
setShowCornerDialog
(
false
)
}
>
{
t
(
'console:ssh_disconn_dialog_text'
)
}
</
CornerDialog
>
<
Portal
>
<
Pane
className=
"toolbar"
zIndex=
{
10
}
borderRadius=
{
4
}
display=
"flex"
flexDirection=
"column"
background=
"#2d8cf0"
padding=
{
0
}
position=
"fixed"
top=
{
120
}
right=
{
64
}
>
<
Button
appearance=
"minimal"
marginY=
{
8
}
className=
"toolbar-item"
onClick=
{
()
=>
{
toaster
.
notify
(
'under develop!'
,
{
id
:
'dev'
});
}
}
>
<
RefreshIcon
color=
"white"
size=
{
10
}
/>
</
Button
>
<
Button
appearance=
"minimal"
marginY=
{
8
}
className=
"toolbar-item"
onClick=
{
()
=>
setSideSheetShwon
(
true
)
}
>
<
SwapVerticalIcon
color=
"white"
size=
{
10
}
/>
</
Button
>
<
Button
appearance=
"minimal"
marginY=
{
8
}
className=
"toolbar-item"
onClick=
{
()
=>
{
setFullscreen
(
!
fullscreen
);
}
}
>
{
!
fullscreen
&&
<
FullscreenIcon
color=
"white"
size=
{
10
}
/>
}
{
fullscreen
&&
<
MinimizeIcon
color=
"white"
size=
{
10
}
/>
}
</
Button
>
<
Button
appearance=
"minimal"
marginY=
{
8
}
className=
"toolbar-item"
onClick=
{
()
=>
{
toaster
.
notify
(
'under develop!'
,
{
id
:
'dev'
});
}
}
>
<
CogIcon
color=
"white"
size=
{
10
}
/>
</
Button
>
</
Pane
>
</
Portal
>
</
Pane
>
);
};
...
...
web/src/components/Home.tsx
View file @
49a5c155
...
...
@@ -3,7 +3,6 @@ import { NavLink, Route, Switch } from 'react-router-dom';
import
{
Button
,
Pane
,
Heading
}
from
'evergreen-ui'
;
import
{
useTranslation
}
from
'react-i18next'
;
import
Footer
from
'./layout/Footer'
;
import
Header
from
'./layout/Header'
;
import
Signin
from
'./Signin'
;
...
...
@@ -52,10 +51,6 @@ const Home = () => {
<
Route
path=
{
`/signin`
}
component=
{
Signin
}
/>
</
Switch
>
</
main
>
{
/*<footer className="home-content-footer">
<Footer />
</footer>
*/
}
</
div
>
);
};
...
...
web/src/components/Signin.tsx
View file @
49a5c155
import
React
,
{
useState
}
from
'react'
;
import
React
from
'react'
;
import
{
RouteComponentProps
}
from
'react-router-dom'
;
import
{
//Button,
Pane
,
Heading
,
//TextInputField,
//GeolocationIcon,
//FormField,
toaster
,
}
from
'evergreen-ui'
;
import
{
Pane
,
Heading
,
toaster
}
from
'evergreen-ui'
;
import
{
useTranslation
}
from
'react-i18next'
;
import
Config
from
'../config/config'
;
import
Utils
from
'../libs/utils'
;
import
apiRouters
from
'../config/api_routers'
;
{
/*interface FieldState {
isInvalid: boolean;
validationMessage: string | undefined;
value: string;
}
const checkHostFormat = (host: string) => {
if (!host || host === '') {
return [false, '', 22];
}
const hostList = host.split(':');
if (hostList.length === 1) {
return [true, host, 22];
}
const ok =
hostList.length === 2 &&
hostList[1].length !== 0 &&
!isNaN(Number(hostList[1]));
if (ok) {
return [true, hostList[0], parseInt(hostList[1])];
} else {
return [false, host, 22];
}
};*/
}
const
Signin
=
(
props
:
RouteComponentProps
)
=>
{
React
.
useEffect
(()
=>
{
window
.
addEventListener
(
'message'
,
(
event
)
=>
{
if
(
event
.
origin
!==
process
.
env
.
REACT_APP_CLUSTER_URL
)
return
;
doSignin
(
event
.
data
);
});
},
[]);
...
...
@@ -55,7 +20,6 @@ const Signin = (props: RouteComponentProps) => {
const
doSignin
=
(
data
:
Record
<
string
,
string
>
)
=>
{
Utils
.
axiosInstance
.
post
(
Utils
.
loadUrl
(
apiRouters
.
router
.
sign_in
,
null
),
{
// _xsrf: Utils.base64Decode(xsrf.split("|")[0]), // todo
host
:
data
.
host
,
port
:
data
.
port
,
username
:
data
.
username
,
...
...
@@ -64,7 +28,6 @@ const Signin = (props: RouteComponentProps) => {
.
then
((
response
)
=>
{
try
{
if
(
!
response
.
data
||
response
.
data
.
has_error
)
{
// self.$Loading.error();
switch
(
response
.
data
.
message
)
{
case
0
:
toaster
.
danger
(
t
(
'signin:form_has_error'
));
...
...
@@ -78,10 +41,8 @@ const Signin = (props: RouteComponentProps) => {
}
}
else
{
if
(
!
response
.
data
.
addition
)
{
// self.$Loading.error();
toaster
.
danger
(
t
(
'signin:form_error_remote_server'
));
}
else
{
// self.$Loading.finish();
toaster
.
success
(
t
(
'signin:signin_success'
));
localStorage
.
setItem
(
'user.host'
,
data
.
host
);
localStorage
.
setItem
(
'user.username'
,
data
.
username
);
...
...
@@ -94,12 +55,10 @@ const Signin = (props: RouteComponentProps) => {
}
}
}
catch
(
e
)
{
// self.$Loading.error();
toaster
.
danger
(
t
(
'signin:form_error_ssh_login'
));
}
})
.
catch
((
e
:
Error
)
=>
{
// self.$Loading.error();
toaster
.
danger
(
t
(
'signin:form_error_ssh_login'
)
+
': '
+
e
.
message
);
});
};
...
...
@@ -115,65 +74,7 @@ const Signin = (props: RouteComponentProps) => {
<
Heading
marginBottom=
"0.6rem"
marginTop=
"0.6rem"
size=
{
700
}
>
{
t
(
'signin:form_title'
)
}
</
Heading
>
{
/*
<form
onSubmit={(event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
doSignin();
return false;
}}>
<Pane textAlign="left">
<TextInputField
value={hostField.value}
isInvalid={hostField.isInvalid}
validationMessage={hostField.validationMessage}
label={t('signin:form_fullhost_label')}
onChange={onHostChanged}
onBlur={onHostChanged}
placeholder={t('signin:form_fullhost_ph')}
marginBottom="8px"
/>
<TextInputField
value={unameField.value}
isInvalid={unameField.isInvalid}
label={t('signin:form_username_label')}
onChange={onUsernameChanged}
onBlur={onUsernameChanged}
placeholder={t('signin:form_username_ph')}
validationMessage={unameField.validationMessage}
marginBottom="8px"
/>
<TextInputField
label={t('signin:form_passwd_label')}
type="password"
placeholder={t('signin:form_passwd_ph')}
marginBottom="24px"
onChange={onPasswdChanged}
onBlur={onPasswdChanged}
onKeyDown={(event: React.KeyboardEvent<HTMLDivElement>): void => {
// 'keypress' event misbehaves on mobile so we track 'Enter' key via 'keydown' event
if (event.key === 'Enter') {
event.preventDefault();
event.stopPropagation();
doSignin();
}
}}
/>
</Pane>
<FormField>
<Button
isLoading={submitLoading}
type="submit"
width="100%"
appearance="primary"
justifyContent="center"
intent="success"
iconBefore={GeolocationIcon}>
{t('signin:form_submit_btn')}
</Button>
</FormField>
</form>
*/
}
<
span
>
Waiting for loging
</
span
>
</
div
>
</
Pane
>
);
...
...
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