Commit 49a5c155 authored by ajlarrosa's avatar ajlarrosa

Saco menus no desarrollados

parent e87fddb0
This diff is collapsed.
...@@ -8,7 +8,6 @@ import { ...@@ -8,7 +8,6 @@ import {
Popover, Popover,
Position, Position,
Avatar, Avatar,
Portal,
Button, Button,
toaster, toaster,
CornerDialog, CornerDialog,
...@@ -16,12 +15,6 @@ import { ...@@ -16,12 +15,6 @@ import {
import { import {
FullCircleIcon, FullCircleIcon,
UngroupObjectsIcon, UngroupObjectsIcon,
RefreshIcon,
SwapVerticalIcon,
FullscreenIcon,
MinimizeIcon,
LogOutIcon,
CogIcon,
ErrorIcon, ErrorIcon,
DisableIcon, DisableIcon,
} from 'evergreen-ui'; } from 'evergreen-ui';
...@@ -132,7 +125,6 @@ const Console = (props: RouteComponentProps) => { ...@@ -132,7 +125,6 @@ const Console = (props: RouteComponentProps) => {
const _t = sessionStorage.getItem(Config.jwt.tokenName); const _t = sessionStorage.getItem(Config.jwt.tokenName);
if (_t === null) { if (_t === null) {
toaster.danger(t('console:web_socket_expire')); toaster.danger(t('console:web_socket_expire'));
// setConnecting(ConnStatus.ConnectionLost)
props.history.push('/signin'); props.history.push('/signin');
return; return;
} }
...@@ -153,11 +145,26 @@ const Console = (props: RouteComponentProps) => { ...@@ -153,11 +145,26 @@ const Console = (props: RouteComponentProps) => {
setConnecting(ConnStatus.ConnectionAlive); setConnecting(ConnStatus.ConnectionAlive);
}; };
ws.onclose = () => { ws.onclose = (ev) => {
term.setOption('cursorBlink', false); term.setOption('cursorBlink', false);
sessionStorage.removeItem(Config.jwt.tokenName); sessionStorage.removeItem(Config.jwt.tokenName);
setConnecting(ConnStatus.ConnectionLost); setConnecting(ConnStatus.ConnectionLost);
setShowCornerDialog(true); 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); sshWebSocket.bindTerminal(term, ws!, true, -1);
...@@ -219,16 +226,6 @@ const Console = (props: RouteComponentProps) => { ...@@ -219,16 +226,6 @@ const Console = (props: RouteComponentProps) => {
</Menu.Item> </Menu.Item>
</Menu.Group> </Menu.Group>
<Menu.Divider /> <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> </Menu>
}> }>
<Avatar <Avatar
...@@ -266,14 +263,6 @@ const Console = (props: RouteComponentProps) => { ...@@ -266,14 +263,6 @@ const Console = (props: RouteComponentProps) => {
<Button intent="success" onClick={() => setSideSheetShwon(true)}> <Button intent="success" onClick={() => setSideSheetShwon(true)}>
SFTP SFTP
</Button> </Button>
<Button
intent="none"
marginLeft="0.05rem"
onClick={() => {
toaster.notify('under develop!', { id: 'dev' });
}}>
Paste
</Button>
<Pane flex="1"></Pane> <Pane flex="1"></Pane>
<Text marginRight="0.4rem">active time: 0:00:00</Text> <Text marginRight="0.4rem">active time: 0:00:00</Text>
</Pane> </Pane>
...@@ -295,55 +284,6 @@ const Console = (props: RouteComponentProps) => { ...@@ -295,55 +284,6 @@ const Console = (props: RouteComponentProps) => {
onCloseComplete={() => setShowCornerDialog(false)}> onCloseComplete={() => setShowCornerDialog(false)}>
{t('console:ssh_disconn_dialog_text')} {t('console:ssh_disconn_dialog_text')}
</CornerDialog> </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> </Pane>
); );
}; };
......
...@@ -3,7 +3,6 @@ import { NavLink, Route, Switch } from 'react-router-dom'; ...@@ -3,7 +3,6 @@ import { NavLink, Route, Switch } from 'react-router-dom';
import { Button, Pane, Heading } from 'evergreen-ui'; import { Button, Pane, Heading } from 'evergreen-ui';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import Footer from './layout/Footer';
import Header from './layout/Header'; import Header from './layout/Header';
import Signin from './Signin'; import Signin from './Signin';
...@@ -52,10 +51,6 @@ const Home = () => { ...@@ -52,10 +51,6 @@ const Home = () => {
<Route path={`/signin`} component={Signin} /> <Route path={`/signin`} component={Signin} />
</Switch> </Switch>
</main> </main>
{/*<footer className="home-content-footer">
<Footer />
</footer>
*/}
</div> </div>
); );
}; };
......
import React, { useState } from 'react'; import React from 'react';
import { RouteComponentProps } from 'react-router-dom'; import { RouteComponentProps } from 'react-router-dom';
import { import { Pane, Heading, toaster } from 'evergreen-ui';
//Button,
Pane,
Heading,
//TextInputField,
//GeolocationIcon,
//FormField,
toaster,
} from 'evergreen-ui';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import Config from '../config/config'; import Config from '../config/config';
import Utils from '../libs/utils'; import Utils from '../libs/utils';
import apiRouters from '../config/api_routers'; 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) => { const Signin = (props: RouteComponentProps) => {
React.useEffect(() => { React.useEffect(() => {
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
if (event.origin !== process.env.REACT_APP_CLUSTER_URL) return; if (event.origin !== process.env.REACT_APP_CLUSTER_URL) return;
doSignin(event.data); doSignin(event.data);
}); });
}, []); }, []);
...@@ -55,7 +20,6 @@ const Signin = (props: RouteComponentProps) => { ...@@ -55,7 +20,6 @@ const Signin = (props: RouteComponentProps) => {
const doSignin = (data: Record<string, string>) => { const doSignin = (data: Record<string, string>) => {
Utils.axiosInstance Utils.axiosInstance
.post(Utils.loadUrl(apiRouters.router.sign_in, null), { .post(Utils.loadUrl(apiRouters.router.sign_in, null), {
// _xsrf: Utils.base64Decode(xsrf.split("|")[0]), // todo
host: data.host, host: data.host,
port: data.port, port: data.port,
username: data.username, username: data.username,
...@@ -64,7 +28,6 @@ const Signin = (props: RouteComponentProps) => { ...@@ -64,7 +28,6 @@ const Signin = (props: RouteComponentProps) => {
.then((response) => { .then((response) => {
try { try {
if (!response.data || response.data.has_error) { if (!response.data || response.data.has_error) {
// self.$Loading.error();
switch (response.data.message) { switch (response.data.message) {
case 0: case 0:
toaster.danger(t('signin:form_has_error')); toaster.danger(t('signin:form_has_error'));
...@@ -78,10 +41,8 @@ const Signin = (props: RouteComponentProps) => { ...@@ -78,10 +41,8 @@ const Signin = (props: RouteComponentProps) => {
} }
} else { } else {
if (!response.data.addition) { if (!response.data.addition) {
// self.$Loading.error();
toaster.danger(t('signin:form_error_remote_server')); toaster.danger(t('signin:form_error_remote_server'));
} else { } else {
// self.$Loading.finish();
toaster.success(t('signin:signin_success')); toaster.success(t('signin:signin_success'));
localStorage.setItem('user.host', data.host); localStorage.setItem('user.host', data.host);
localStorage.setItem('user.username', data.username); localStorage.setItem('user.username', data.username);
...@@ -94,12 +55,10 @@ const Signin = (props: RouteComponentProps) => { ...@@ -94,12 +55,10 @@ const Signin = (props: RouteComponentProps) => {
} }
} }
} catch (e) { } catch (e) {
// self.$Loading.error();
toaster.danger(t('signin:form_error_ssh_login')); toaster.danger(t('signin:form_error_ssh_login'));
} }
}) })
.catch((e: Error) => { .catch((e: Error) => {
// self.$Loading.error();
toaster.danger(t('signin:form_error_ssh_login') + ': ' + e.message); toaster.danger(t('signin:form_error_ssh_login') + ': ' + e.message);
}); });
}; };
...@@ -115,65 +74,7 @@ const Signin = (props: RouteComponentProps) => { ...@@ -115,65 +74,7 @@ const Signin = (props: RouteComponentProps) => {
<Heading marginBottom="0.6rem" marginTop="0.6rem" size={700}> <Heading marginBottom="0.6rem" marginTop="0.6rem" size={700}>
{t('signin:form_title')} {t('signin:form_title')}
</Heading> </Heading>
{/* <span>Waiting for loging</span>
<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>
*/}
</div> </div>
</Pane> </Pane>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment