mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-10 01:17:40 +03:00
Signed-off-by: Jorge Lobo <jlobo@opennebula.io>
This commit is contained in:
parent
92e97426bd
commit
35232a764d
@ -2,7 +2,8 @@
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true,
|
||||
"node": true
|
||||
"node": true,
|
||||
"cypress/globals": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:react/recommended",
|
||||
@ -15,8 +16,12 @@
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["react"],
|
||||
"plugins": ["react", "cypress"],
|
||||
"rules": {
|
||||
"cypress/no-assigning-return-values": "error",
|
||||
"cypress/no-unnecessary-waiting": "error",
|
||||
"cypress/assertion-before-screenshot": "warn",
|
||||
"cypress/no-async-tests": "error",
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
|
@ -27,7 +27,7 @@
|
||||
"opennebula"
|
||||
],
|
||||
"devDependencies": {
|
||||
"cypress": "^5.3.0",
|
||||
"cypress": "^6.2.1",
|
||||
"eslint": "^7.11.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-config-standard": "^14.1.1",
|
||||
|
@ -25,7 +25,7 @@ const SidebarLink = ({ label, path, icon: Icon, devMode, isSubItem }) => {
|
||||
history.push(path)
|
||||
!isUpLg && fixMenu(false)
|
||||
}
|
||||
|
||||
const labelProps = {'data-cy':"main-menu-item-text"}
|
||||
return (
|
||||
<ListItem
|
||||
button
|
||||
@ -34,6 +34,7 @@ const SidebarLink = ({ label, path, icon: Icon, devMode, isSubItem }) => {
|
||||
selected={pathname === path}
|
||||
className={clsx({ [classes.subItem]: isSubItem })}
|
||||
classes={{ selected: classes.itemSelected }}
|
||||
data-cy="main-menu-item"
|
||||
>
|
||||
{Icon && (
|
||||
<ListItemIcon className={classes.itemIcon}>
|
||||
@ -41,7 +42,9 @@ const SidebarLink = ({ label, path, icon: Icon, devMode, isSubItem }) => {
|
||||
</ListItemIcon>
|
||||
)}
|
||||
<ListItemText
|
||||
primary={devMode ? <DevTypography label={label} /> : label}
|
||||
disableTypography = {devMode}
|
||||
primaryTypographyProps={labelProps}
|
||||
primary={devMode ? <DevTypography label={label} labelProps={labelProps}/> : label}
|
||||
/>
|
||||
</ListItem>
|
||||
)
|
||||
|
@ -83,7 +83,7 @@ const Sidebar = memo(({ endpoints }) => {
|
||||
</Box>
|
||||
<Divider />
|
||||
<Box className={classes.menu}>
|
||||
<List className={classes.list} disablePadding>
|
||||
<List className={classes.list} disablePadding data-cy="main-menu">
|
||||
{SidebarEndpoints}
|
||||
</List>
|
||||
</Box>
|
||||
|
@ -23,6 +23,7 @@ export const BY = {
|
||||
url: 'https://opennebula.io/'
|
||||
}
|
||||
|
||||
export const TIME_HIDE_LOGO = 1500
|
||||
export const _APPS = defaultApps
|
||||
export const APPS = Object.keys(defaultApps)
|
||||
export const APP_URL = defaultAppName ? `/${defaultAppName}` : ''
|
||||
|
@ -68,7 +68,7 @@ function Login () {
|
||||
{isLoading && <LinearProgress color='secondary' className={classes.loading} />}
|
||||
<Paper variant="outlined" className={classes.paper}>
|
||||
{useMemo(() => (
|
||||
<Logo width="100%" height={100} withText viewBox="140 140 380 360" />
|
||||
<Logo width="100%" height={100} withText viewBox="140 140 380 360" data-cy="opennebula-logo" />
|
||||
), [])}
|
||||
<Box className={classes.wrapperForm}>
|
||||
{step === STEPS.USER_FORM && <Form
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useCallback, useEffect } from 'react'
|
||||
import { useSelector, useDispatch, shallowEqual } from 'react-redux'
|
||||
|
||||
import { JWT_NAME, FILTER_POOL, ONEADMIN_ID } from 'client/constants'
|
||||
import { JWT_NAME, FILTER_POOL, ONEADMIN_ID, TIME_HIDE_LOGO } from 'client/constants'
|
||||
import { storage, findStorageData, removeStoreData, fakeDelay } from 'client/utils'
|
||||
|
||||
import * as serviceAuth from 'client/services/auth'
|
||||
@ -32,7 +32,7 @@ export default function useAuth () {
|
||||
const tokenStorage = findStorageData(JWT_NAME)
|
||||
|
||||
if ((tokenStorage && jwt && tokenStorage !== jwt) || firstRender) {
|
||||
fakeDelay(1500).then(() => dispatch(successAuth({ jwt: tokenStorage })))
|
||||
fakeDelay(TIME_HIDE_LOGO).then(() => dispatch(successAuth({ jwt: tokenStorage })))
|
||||
}
|
||||
}, [jwt, firstRender])
|
||||
|
||||
|
@ -251,7 +251,7 @@ const deleteProvision = (res = {}, next = () => undefined, params = {}, userData
|
||||
message.toString().split(/\r|\n/).map(line => {
|
||||
if (line) {
|
||||
lastLine = line
|
||||
publish(defaultCommandProvision, { id: params.id, message: lastLine, command: command, commandId: uuid })
|
||||
publish(defaultCommandProvision, { id: params.id, data: lastLine, command: command, commandId: uuid })
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -364,7 +364,7 @@ const createProvision = (res = {}, next = () => undefined, params = {}, userData
|
||||
const resource = parsePostData(params.resource)
|
||||
const content = createYMLContent(resource)
|
||||
if (content) {
|
||||
const command = 'create';
|
||||
const command = 'create'
|
||||
const files = createFolderWithFiles(`${global.CPI}/provision/${id}/tmp`, [{ name: logFile.name, ext: logFile.ext }, { name: configFile.name, ext: configFile.ext, content }])
|
||||
if (files && files.name && files.files) {
|
||||
const find = (val = '', ext = '', arr = files.files) => arr.find(e => e && e.path && e.ext && e.name && e.name === val && e.ext === ext)
|
||||
@ -373,7 +373,6 @@ const createProvision = (res = {}, next = () => undefined, params = {}, userData
|
||||
if (config && log) {
|
||||
const create = (filedata = '') => {
|
||||
const paramsCommand = [command, config.path, '--batch', '--debug', '--json', ...optionalCommand, ...authCommand, ...endpoint]
|
||||
console.log("-->", paramsCommand)
|
||||
let lastLine = ''
|
||||
var stream = createWriteStream(log.path, { flags: 'a' })
|
||||
const uuid = v4()
|
||||
@ -392,8 +391,9 @@ const createProvision = (res = {}, next = () => undefined, params = {}, userData
|
||||
}
|
||||
}
|
||||
lastLine = line
|
||||
stream.write(`${line}\n`)
|
||||
publish(defaultCommandProvision, { id: files.name, message: line, command: command,commandId: uuid })
|
||||
const renderLine = { id: files.name, data: line, command: command, commandId: uuid }
|
||||
stream.write(`${JSON.stringify(renderLine)}\n`)
|
||||
publish(defaultCommandProvision)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -474,12 +474,12 @@ const configureProvision = (res = {}, next = () => undefined, params = {}, userD
|
||||
const authCommand = ['--user', user, '--password', password]
|
||||
const paramsCommand = [command, params.id, '--debug', '--json', '--fail_cleanup', '--batch', ...authCommand, ...endpoint]
|
||||
let lastLine = ''
|
||||
const uuid = v4();
|
||||
const uuid = v4()
|
||||
const emit = message => {
|
||||
message.toString().split(/\r|\n/).map(line => {
|
||||
if (line) {
|
||||
lastLine = line
|
||||
publish(defaultCommandProvision, { id: params.id, message: lastLine, command: command, commandId: uuid })
|
||||
publish(defaultCommandProvision, { id: params.id, data: lastLine, command: command, commandId: uuid })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ const { internalServerError } = require('./constants/http-codes')
|
||||
const { messageTerminal } = require('server/utils/general')
|
||||
const { validateAuth } = require('server/utils/jwt')
|
||||
const {
|
||||
appName,
|
||||
defaultAppName,
|
||||
defaultConfigFile,
|
||||
defaultLogFilename,
|
||||
defaultLogPath,
|
||||
@ -181,10 +181,11 @@ const genPathResources = () => {
|
||||
global.FIREEDGE_KEY_PATH = `${VAR_LOCATION}/.one/${defaultKeyFilename}`
|
||||
}
|
||||
if (!global.CPI) {
|
||||
global.CPI = `${VAR_LOCATION}/${appName}`
|
||||
console.log('-->', defaultAppName)
|
||||
global.CPI = `${VAR_LOCATION}/${defaultAppName}`
|
||||
}
|
||||
if (!global.ETC_CPI) {
|
||||
global.ETC_CPI = `${ETC_LOCATION}/${appName}`
|
||||
global.ETC_CPI = `${ETC_LOCATION}/${defaultAppName}`
|
||||
}
|
||||
if (!global.SHARE_CPI) {
|
||||
global.SHARE_CPI = `${SHARE_LOCATION}/oneprovision`
|
||||
|
Loading…
Reference in New Issue
Block a user