Skip to content

Commit

Permalink
Merge branch 'master' into charts-replace
Browse files Browse the repository at this point in the history
  • Loading branch information
sjd78 authored Jul 28, 2019
2 parents c4ae4fd + af2cd0c commit 7ec0e2f
Show file tree
Hide file tree
Showing 23 changed files with 150 additions and 113 deletions.
9 changes: 9 additions & 0 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ to accomplish this. To start the server:
When asked, provide a valid user name (in the form of `user@domain`) and password so
the application can start in the context of a logged in user.

When the dev server is started, it will attempt to open a new browser window/tab on
your system default browser to the app's running URL. This behavior can be modified
by specifying the `BROWSER` environment variable. Possible values are:
BROWSER=none # disable the feature
BROWSER=google-chrome # open a new tab in chrome on Linux
BROWSER='google chrome' # open a new tab in chrome on MacOS
BROWSER=chrome # open a new tab in chrome on Windows
BROWSER=firefox # open a new tab in firefox on Linux


### Build
You can build the static assets from source by:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"bootstrap": "3.4.1",
"bootstrap-select": "1.13.1",
"bootstrap-switch": "3.3.4",
"classnames": "2.2.6",
"connected-react-router": "4.3.0",
"history": "4.7.2",
"immutable": "3.8.2",
Expand Down
8 changes: 5 additions & 3 deletions scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ function openBrowser(port, protocol) {
if (process.env.BROWSER) {
options.app = process.env.BROWSER
}
opn(protocol + '://localhost:' + port + '/', options).catch(err => {
// ignore errors - can happen when starting the server in docker container
})
if (options.app !== 'none') {
opn(protocol + '://localhost:' + port + '/', options).catch(err => {
// ignore errors - can happen when starting the server in docker container
})
}
}

// We need to provide a custom onError function for httpProxyMiddleware.
Expand Down
5 changes: 1 addition & 4 deletions src/actions/clusters.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@ export function setClusters (clusters) {
}

export function getAllClusters () {
return {
type: GET_ALL_CLUSTERS,
payload: {},
}
return { type: GET_ALL_CLUSTERS }
}
5 changes: 1 addition & 4 deletions src/actions/hosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@ export function setHosts (hosts) {
}

export function getAllHosts () {
return {
type: GET_ALL_HOSTS,
payload: {},
}
return { type: GET_ALL_HOSTS }
}
35 changes: 7 additions & 28 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ export * from './userMessages'
export * from './disks'

export function appConfigured () {
return {
type: APP_CONFIGURED,
payload: {},
}
return { type: APP_CONFIGURED }
}

export function startSchedulerFixedDelay (delayInSeconds = AppConfiguration.schedulerFixedDelayInSeconds) {
Expand All @@ -55,17 +52,11 @@ export function startSchedulerFixedDelay (delayInSeconds = AppConfiguration.sche
}

export function stopSchedulerFixedDelay () {
return {
type: STOP_SCHEDULER_FIXED_DELAY,
payload: {},
}
return { type: STOP_SCHEDULER_FIXED_DELAY }
}

export function persistState () {
return {
type: PERSIST_STATE,
payload: {},
}
return { type: PERSIST_STATE }
}

/**
Expand Down Expand Up @@ -138,17 +129,11 @@ export function changePage ({ type, id }) {
}

export function checkTokenExpired () {
return {
type: CHECK_TOKEN_EXPIRED,
payload: {},
}
return { type: CHECK_TOKEN_EXPIRED }
}

export function showTokenExpiredMessage () {
return {
type: SHOW_TOKEN_EXPIRED_MSG,
payload: {},
}
return { type: SHOW_TOKEN_EXPIRED_MSG }
}

export function getByPage ({ page, shallowFetch = true }) {
Expand All @@ -171,10 +156,7 @@ export function setUSBFilter ({ usbFilter }) {
}

export function getUSBFilter () {
return {
type: GET_USB_FILTER,
payload: {},
}
return { type: GET_USB_FILTER }
}

/**
Expand Down Expand Up @@ -203,10 +185,7 @@ export function setUserGroups ({ groups }) {
}

export function getUserGroups () {
return {
type: GET_USER_GROUPS,
payload: {},
}
return { type: GET_USER_GROUPS }
}

export function setCpuTopologyOptions ({
Expand Down
5 changes: 1 addition & 4 deletions src/actions/operatingSystems.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ export function setOperatingSystems (operatingSystems) {
}

export function getAllOperatingSystems () {
return {
type: GET_ALL_OS,
payload: {},
}
return { type: GET_ALL_OS }
}
10 changes: 2 additions & 8 deletions src/actions/pendingTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ export function addSnapshotRestorePendingTask () {
}

export function removeSnapshotRestorePendingTask () {
return {
type: REMOVE_SNAPSHOT_RESTORE_PENDING_TASK,
payload: {},
}
return { type: REMOVE_SNAPSHOT_RESTORE_PENDING_TASK }
}

export function addSnapshotAddPendingTask () {
Expand All @@ -78,8 +75,5 @@ export function addSnapshotAddPendingTask () {
}

export function removeSnapshotAddPendingTask () {
return {
type: REMOVE_SNAPSHOT_ADD_PENDING_TASK,
payload: {},
}
return { type: REMOVE_SNAPSHOT_ADD_PENDING_TASK }
}
6 changes: 1 addition & 5 deletions src/actions/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ export function getSinglePool ({ poolId }) {
}

export function updateVmsPoolsCount () {
return {
type: UPDATE_VMPOOLS_COUNT,
payload: {
},
}
return { type: UPDATE_VMPOOLS_COUNT }
}

export function poolActionInProgress ({ poolId, name, started }) {
Expand Down
8 changes: 2 additions & 6 deletions src/actions/storageDomains.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ import {
} from '_/constants'

export function getAllStorageDomains (): Object {
return {
type: GET_ALL_STORAGE_DOMAINS,
}
return { type: GET_ALL_STORAGE_DOMAINS }
}

export function getIsoFiles (): Object {
return {
type: GET_ISO_FILES,
}
return { type: GET_ISO_FILES }
}

export function setStorageDomains (storageDomains: Array<Object>): Object {
Expand Down
5 changes: 1 addition & 4 deletions src/actions/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ export function setTemplates (templates) {
}

export function getAllTemplates () {
return {
type: GET_ALL_TEMPLATES,
payload: {},
}
return { type: GET_ALL_TEMPLATES }
}
5 changes: 1 addition & 4 deletions src/actions/userMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ export function addUserMessage ({ message, shortMessage, type = '' }) {
}

export function clearUserMessages () {
return {
type: CLEAR_USER_MSGS,
payload: {},
}
return { type: CLEAR_USER_MSGS }
}

export function setNotificationNotified ({ time }) {
Expand Down
5 changes: 1 addition & 4 deletions src/actions/vnicProfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ export function setVnicProfiles ({ vnicProfiles }) {
}

export function getAllVnicProfiles () {
return {
type: GET_ALL_VNIC_PROFILES,
payload: {},
}
return { type: GET_ALL_VNIC_PROFILES }
}

export function addNetworksToVnicProfiles ({ networks }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react'
import PropTypes from 'prop-types'
import { xor } from '_/propTypeExtras'
import style from './style.css'
import classnames from 'classnames'

class FieldValue extends React.Component {
class EllipsisValue extends React.Component {
constructor (props) {
super(props)
this.ref = React.createRef()
Expand All @@ -12,11 +14,25 @@ class FieldValue extends React.Component {

this.updateOverflow = this.updateOverflow.bind(this)
}

componentDidUpdate () {
this.updateOverflow()
}

componentDidMount () {
window.addEventListener('resize', this.updateOverflow)
this.updateOverflow()
}

componentWillUnmount () {
window.removeEventListener('resize', this.updateOverflow)
}

updateOverflow () {
if (!this.props.children) {
return
}

const state = { isOverflow: false }
if (this.ref.current.offsetWidth < this.ref.current.scrollWidth) {
state.isOverflow = true
Expand All @@ -26,25 +42,28 @@ class FieldValue extends React.Component {
}
}

componentDidMount () {
window.addEventListener('resize', this.updateOverflow)
this.updateOverflow()
}

componentWillUnmount () {
window.removeEventListener('resize', this.updateOverflow)
}
render () {
const { children, tooltip } = this.props
return <span className={style['field-value']} title={this.state.isOverflow ? tooltip : ''} ref={this.ref}>
{children}
</span>
const { className, id, children, tooltip } = this.props

if (children) {
return <span
className={classnames(style['field-value'], className)}
id={id}
title={this.state.isOverflow ? tooltip : ''}
ref={this.ref}
>
{children}
</span>
}
return null
}
}

FieldValue.propTypes = {
children: PropTypes.oneOfType([ PropTypes.string, PropTypes.node ]).isRequired,
tooltip: PropTypes.string.isRequired,
EllipsisValue.propTypes = {
className: PropTypes.string,
id: PropTypes.string,
children: xor(PropTypes.oneOfType([ PropTypes.string, PropTypes.node ]), 'tooltip'),
tooltip: xor(PropTypes.string, 'children'),
}

export default FieldValue
export default EllipsisValue
5 changes: 5 additions & 0 deletions src/components/EllipsisValue/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.field-value {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
5 changes: 1 addition & 4 deletions src/components/OptionsDialog/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@ export function getSSHKey ({ userId }) {
}

export function setUnloaded () {
return {
type: SET_UNLOADED,
payload: {},
}
return { type: SET_UNLOADED }
}
15 changes: 7 additions & 8 deletions src/components/VmDetails/cards/DetailsCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ import SelectBox from '../../../SelectBox'
import BaseCard from '../../BaseCard'

import { Grid, Row, Col } from '_/components/Grid'
import CloudInit from './CloudInit'
import EllipsisValue from '_/components/EllipsisValue'
import ExpandCollapseSection from '_/components/ExpandCollapseSection'

import style from './style.css'

import CloudInit from './CloudInit'
import HotPlugChangeConfirmationModal from './HotPlugConfirmationModal'
import NextRunChangeConfirmationModal from './NextRunChangeConfirmationModal'

import ExpandCollapseSection from '../../../ExpandCollapseSection'
import FieldValue from './FieldValue'
import FieldRow from './FieldRow'

/*
Expand Down Expand Up @@ -723,7 +722,7 @@ class DetailsCard extends React.Component {
<Col className={style['fields-column']}>
<Grid>
<FieldRow label={msg.host()} id={`${idPrefix}-host`}>
{ <FieldValue tooltip={hostName}>{hostName}</FieldValue> || <NotAvailable tooltip={msg.notAvailableUntilRunning()} id={`${idPrefix}-host-not-available`} /> }
{ <EllipsisValue tooltip={hostName}>{hostName}</EllipsisValue> || <NotAvailable tooltip={msg.notAvailableUntilRunning()} id={`${idPrefix}-host-not-available`} /> }
</FieldRow>
<FieldRow label={msg.ipAddress()} id={`${idPrefix}-ip`}>
<React.Fragment>
Expand All @@ -739,7 +738,7 @@ class DetailsCard extends React.Component {
</React.Fragment>
</FieldRow>
<FieldRow label={msg.fqdn()} id={`${idPrefix}-fqdn`}>
{ <FieldValue tooltip={fqdn}>{fqdn}</FieldValue> || <NotAvailable tooltip={msg.notAvailableUntilRunningAndGuestAgent()} id={`${idPrefix}-fqdn-not-available`} /> }
{ <EllipsisValue tooltip={fqdn}>{fqdn}</EllipsisValue> || <NotAvailable tooltip={msg.notAvailableUntilRunningAndGuestAgent()} id={`${idPrefix}-fqdn-not-available`} /> }
</FieldRow>
<FieldRow label={msg.cluster()} id={`${idPrefix}-cluster`}>
{ !isFullEdit && clusterName }
Expand Down Expand Up @@ -775,10 +774,10 @@ class DetailsCard extends React.Component {
{ templateName }
</FieldRow>
<FieldRow label={isEditing ? msg.changeCd() : msg.cd()} id={`${idPrefix}-cdrom`}>
{ !isEditing && <FieldValue tooltip={cdImageName}>{cdImageName}</FieldValue> }
{ !isEditing && <EllipsisValue tooltip={cdImageName}>{cdImageName}</EllipsisValue> }
{ isEditing && !canChangeCd &&
<div>
<FieldValue tooltip={cdImageName}>{cdImageName}</FieldValue>
<EllipsisValue tooltip={cdImageName}>{cdImageName}</EllipsisValue>
<FieldLevelHelp disabled={false} content={msg.cdCanOnlyChangeWhenVmRunning()} inline />
</div>
}
Expand Down
6 changes: 0 additions & 6 deletions src/components/VmDetails/cards/DetailsCard/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@
display: inline-block;
}

.field-value {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

button.field-level-help:global(.popover-pf-info) {
flex-grow: 0;
}
Loading

0 comments on commit 7ec0e2f

Please sign in to comment.