chore: format with Prettier

This commit is contained in:
Julien Fontanet 2018-08-19 16:46:34 +02:00
parent ec869ffdd3
commit 2236bd71c4
64 changed files with 313 additions and 242 deletions

View File

@ -44,7 +44,9 @@ class Schedule {
this._createDate =
zone.toLowerCase() === 'utc'
? moment.utc
: zone === 'local' ? moment : () => moment.tz(zone)
: zone === 'local'
? moment
: () => moment.tz(zone)
}
createJob (fn) {

View File

@ -85,8 +85,8 @@ export const validChecksumOfReadStream = (
callback(
checksum !== expectedChecksum
? new Error(
`Bad checksum (${checksum}), expected: ${expectedChecksum}`
)
`Bad checksum (${checksum}), expected: ${expectedChecksum}`
)
: null
)
}

View File

@ -14,7 +14,8 @@ export default async function main (args) {
onProgress ({ done, total }) {
if (bar === undefined) {
bar = new Bar({
format: 'merging [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}',
format:
'merging [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}',
})
bar.start(total, done)
} else {

View File

@ -58,7 +58,7 @@ export default asyncIteratorToStream(async function * (
const maxTableEntries = Math.ceil(diskSize / VHD_BLOCK_SIZE_BYTES) + 1
const tablePhysicalSizeBytes =
Math.ceil(maxTableEntries * 4 / SECTOR_SIZE) * SECTOR_SIZE
Math.ceil((maxTableEntries * 4) / SECTOR_SIZE) * SECTOR_SIZE
const batPosition = FOOTER_SIZE + HEADER_SIZE
const firstBlockPosition = batPosition + tablePhysicalSizeBytes
@ -115,7 +115,7 @@ export default asyncIteratorToStream(async function * (
}
next.data.copy(
currentBlockWithBitmap,
bitmapSize + next.offsetBytes % VHD_BLOCK_SIZE_BYTES
bitmapSize + (next.offsetBytes % VHD_BLOCK_SIZE_BYTES)
)
}
yield * yieldAndTrack(currentBlockWithBitmap)

View File

@ -51,7 +51,10 @@ export default concurrency(2)(async function merge (
// finds first allocated block for the 2 following loops
let firstBlock = 0
while (firstBlock < maxTableEntries && !childVhd.containsBlock(firstBlock)) {
while (
firstBlock < maxTableEntries &&
!childVhd.containsBlock(firstBlock)
) {
++firstBlock
}

View File

@ -30,14 +30,14 @@ exports.resolveRef = (xapi, type, refOrUuidOrNameLabel) =>
isOpaqueRef(refOrUuidOrNameLabel)
? refOrUuidOrNameLabel
: xapi.call(`${type}.get_by_uuid`, refOrUuidOrNameLabel).catch(() =>
xapi
.call(`${type}.get_by_name_label`, refOrUuidOrNameLabel)
.then(refs => {
if (refs.length === 1) {
return refs[0]
}
throw new Error(
`no single match for ${type} with name label ${refOrUuidOrNameLabel}`
)
})
)
xapi
.call(`${type}.get_by_name_label`, refOrUuidOrNameLabel)
.then(refs => {
if (refs.length === 1) {
return refs[0]
}
throw new Error(
`no single match for ${type} with name label ${refOrUuidOrNameLabel}`
)
})
)

View File

@ -308,8 +308,8 @@ async function listObjects (args) {
const properties = getKeys(extractFlags(args))
const filterProperties = properties.length
? function (object) {
return pick(object, properties)
}
return pick(object, properties)
}
: identity
const filter = args.length ? parseParameters(args) : undefined

View File

@ -8,7 +8,10 @@ import isObject from './is-object'
// ===================================================================
const { create: createObject, prototype: { hasOwnProperty } } = Object
const {
create: createObject,
prototype: { hasOwnProperty },
} = Object
export const ACTION_ADD = 'add'
export const ACTION_UPDATE = 'update'

View File

@ -10,8 +10,7 @@ const xo = new Xo({
url: 'localhost:9000',
})
xo
.open()
xo.open()
.then(function () {
return xo
.call('acl.get', {})

View File

@ -8,13 +8,10 @@ import { debug } from './utils'
export default class DensityPlan extends Plan {
_checkRessourcesThresholds (objects, averages) {
const { low } = this._thresholds.memoryFree
return filter(
objects,
object => {
const { memory, memoryFree = memory } = averages[object.id]
return memoryFree > low
}
)
return filter(objects, object => {
const { memory, memoryFree = memory } = averages[object.id]
return memoryFree > low
})
}
async execute () {

View File

@ -124,7 +124,7 @@ const SR_FUNCTIONS = {
comparator: '>',
createGetter: threshold => sr => {
const getDisplayableValue = () =>
sr.physical_utilisation * 100 / sr.physical_size
(sr.physical_utilisation * 100) / sr.physical_size
return {
getDisplayableValue,
shouldAlarm: () => getDisplayableValue() > threshold,

View File

@ -120,9 +120,13 @@ class XoServerNagios {
const client = new net.Socket()
client.connect(this._conf.port, this._conf.server, () => {
console.log('Successful connection')
})
client.connect(
this._conf.port,
this._conf.server,
() => {
console.log('Successful connection')
}
)
client.on('data', data => {
const timestamp = data.readInt32BE(128)

View File

@ -201,7 +201,7 @@ function computePercentage (curr, prev, options) {
opt =>
prev[opt] === 0 || prev[opt] === null
? 'NONE'
: `${(curr[opt] - prev[opt]) * 100 / prev[opt]}`
: `${((curr[opt] - prev[opt]) * 100) / prev[opt]}`
)
)
}

View File

@ -83,14 +83,14 @@ export default class Redis extends Collection {
values == null
? redis.srem(idsIndex, id) // entry no longer exists
: asyncMap(indexes, index => {
const value = values[index]
if (value !== undefined) {
return redis.sadd(
`${prefix}_${index}:${String(value).toLowerCase()}`,
id
)
}
})
const value = values[index]
if (value !== undefined) {
return redis.sadd(
`${prefix}_${index}:${String(value).toLowerCase()}`,
id
)
}
})
)
)
)

View File

@ -58,16 +58,15 @@ export default function proxyConsole (ws, vmConsole, sessionId) {
ws.close()
})
ws
.on('error', error => {
closed = true
debug(
'error from the XO client: %s',
error.stack || error.message || error
)
ws.on('error', error => {
closed = true
debug(
'error from the XO client: %s',
error.stack || error.message || error
)
socket.end()
})
socket.end()
})
.on('message', data => {
if (!closed) {
socket.write(data)

View File

@ -100,7 +100,7 @@ describe('formatXml()', function () {
describe('generateToken()', () => {
it('generates a string', async () => {
expect(typeof await generateToken()).toBe('string')
expect(typeof (await generateToken())).toBe('string')
})
})

View File

@ -165,7 +165,7 @@ export default class {
}
async deleteAuthenticationToken (id) {
if (!await this._tokens.remove(id)) {
if (!(await this._tokens.remove(id))) {
throw noSuchAuthenticationToken(id)
}
}

View File

@ -175,8 +175,8 @@ export default class IpPools {
Promise.all(mapToArray(updatedIpPools, ipPool => this._save(ipPool)))
return resourseSetId
? this._xo
.allocateLimitsInResourceSet(limits, resourseSetId)
.then(saveIpPools)
.allocateLimitsInResourceSet(limits, resourseSetId)
.then(saveIpPools)
: saveIpPools()
}
})()

View File

@ -61,15 +61,15 @@ const normalize = set => ({
ipPools: set.ipPools || [],
limits: set.limits
? map(
set.limits,
limit =>
isObject(limit)
? limit
: {
available: limit,
total: limit,
}
)
set.limits,
limit =>
isObject(limit)
? limit
: {
available: limit,
total: limit,
}
)
: {},
name: set.name || '',
objects: set.objects || [],

View File

@ -64,7 +64,7 @@ export default class {
)
)
if (!await usersDb.exists()) {
if (!(await usersDb.exists())) {
const email = 'admin@admin.net'
const password = 'admin'
@ -229,7 +229,7 @@ export default class {
}
async changeUserPassword (userId, oldPassword, newPassword) {
if (!await this.checkUserPassword(userId, oldPassword, false)) {
if (!(await this.checkUserPassword(userId, oldPassword, false))) {
throw invalidCredentials()
}

View File

@ -81,7 +81,7 @@ export default class {
async unregisterXenServer (id) {
;this.disconnectXenServer(id)::ignoreErrors()
if (!await this._servers.remove(id)) {
if (!(await this._servers.remove(id))) {
throw noSuchObject(id, 'xenServer')
}
}
@ -406,9 +406,10 @@ export default class {
async mergeXenPools (sourceId, targetId, force = false) {
const sourceXapi = this.getXapi(sourceId)
const { _auth: { user, password }, _url: { hostname } } = this.getXapi(
targetId
)
const {
_auth: { user, password },
_url: { hostname },
} = this.getXapi(targetId)
// We don't want the events of the source XAPI to interfere with
// the events of the new XAPI.

View File

@ -58,7 +58,10 @@ export default class Xo extends EventEmitter {
// Returns an object from its key or UUID.
getObject (key, type) {
const { all, indexes: { byRef } } = this._objects
const {
all,
indexes: { byRef },
} = this._objects
const obj = all[key] || byRef[key]
if (!obj) {

View File

@ -94,32 +94,32 @@ const src = lazyFn(function () {
return PRODUCTION
? function src (pattern, opts) {
const base = resolve(opts && opts.base)
const base = resolve(opts && opts.base)
return gulp.src(pattern, {
base: base,
cwd: base,
passthrough: opts && opts.passthrough,
sourcemaps: opts && opts.sourcemaps,
})
}
: function src (pattern, opts) {
const base = resolve(opts && opts.base)
return pipe(
gulp.src(pattern, {
return gulp.src(pattern, {
base: base,
cwd: base,
passthrough: opts && opts.passthrough,
sourcemaps: opts && opts.sourcemaps,
}),
require('gulp-watch')(pattern, {
base: base,
cwd: base,
}),
require('gulp-plumber')()
)
}
})
}
: function src (pattern, opts) {
const base = resolve(opts && opts.base)
return pipe(
gulp.src(pattern, {
base: base,
cwd: base,
passthrough: opts && opts.passthrough,
sourcemaps: opts && opts.sourcemaps,
}),
require('gulp-watch')(pattern, {
base: base,
cwd: base,
}),
require('gulp-plumber')()
)
}
})
// Similar to `gulp.dest()` but the output directory is relative to
@ -136,13 +136,13 @@ const dest = lazyFn(function () {
return PRODUCTION
? function dest (path) {
return gulp.dest(resolve(path), opts)
}
return gulp.dest(resolve(path), opts)
}
: function dest (path) {
const stream = gulp.dest(resolve(path), opts)
stream.pipe(livereload())
return stream
}
const stream = gulp.dest(resolve(path), opts)
stream.pipe(livereload())
return stream
}
})
// ===================================================================

View File

@ -43,7 +43,9 @@ export default class EnumInput extends Component {
required={required}
value={this._getSelectedIndex()}
>
{_('noSelectedValue', message => <option value=''>{message}</option>)}
{_('noSelectedValue', message => (
<option value=''>{message}</option>
))}
{map(enumNames, (name, index) => (
<option value={index} key={index}>
{name}

View File

@ -233,24 +233,24 @@ const CONFIRM_BUTTONS = [{ btnStyle: 'primary', label: _('confirmOk') }]
export const confirm = ({ body, icon = 'alarm', title, strongConfirm }) =>
strongConfirm
? new Promise((resolve, reject) => {
modal(
<StrongConfirm
body={body}
icon={icon}
reject={reject}
resolve={resolve}
strongConfirm={strongConfirm}
title={title}
/>,
reject
)
})
modal(
<StrongConfirm
body={body}
icon={icon}
reject={reject}
resolve={resolve}
strongConfirm={strongConfirm}
title={title}
/>,
reject
)
})
: chooseAction({
body,
buttons: CONFIRM_BUTTONS,
icon,
title,
})
body,
buttons: CONFIRM_BUTTONS,
icon,
title,
})
// -----------------------------------------------------------------------------

View File

@ -109,7 +109,12 @@ export default class NoVnc extends Component {
// if not available from the URL, use the default ones
const port = url.port || (isSecure ? 443 : 80)
rfb.connect(url.hostname, port, null, clippedPath)
rfb.connect(
url.hostname,
port,
null,
clippedPath
)
disableShortcuts()
}

View File

@ -45,7 +45,9 @@ export default class ResourceSetQuotas extends Component {
)
render () {
const { intl: { formatMessage } } = this.props
const {
intl: { formatMessage },
} = this.props
const labels = [
formatMessage(messages.availableResourceLabel),
formatMessage(messages.usedResourceLabel),

View File

@ -5,17 +5,17 @@ const createAction = (() => {
defineProperty(
payloadCreator
? (...args) => ({
type,
payload: payloadCreator(...args),
})
type,
payload: payloadCreator(...args),
})
: (action =>
function () {
if (arguments.length) {
throw new Error('this action expects no payload!')
}
function () {
if (arguments.length) {
throw new Error('this action expects no payload!')
}
return action
})({ type }),
return action
})({ type }),
'toString',
{ value: () => type }
)

View File

@ -38,7 +38,7 @@ const Element = ({ highlight, href, others, tooltip, total, value }) => (
highlight && 'usage-element-highlight',
others && 'usage-element-others'
)}
style={{ width: value / total * 100 + '%' }}
style={{ width: (value / total) * 100 + '%' }}
/>
</Tooltip>
)
@ -58,14 +58,14 @@ export const Limits = ({ used, toBeUsed, limit }) => {
<span className='limits'>
<span
className='limits-used'
style={{ width: (used || 0) / limit * 100 + '%' }}
style={{ width: ((used || 0) / limit) * 100 + '%' }}
/>
<span
className={
toBeUsed > available ? 'limits-over-used' : 'limits-to-be-used'
}
style={{
width: Math.min(toBeUsed || 0, available) / limit * 100 + '%',
width: (Math.min(toBeUsed || 0, available) / limit) * 100 + '%',
}}
/>
</span>

View File

@ -23,7 +23,7 @@ const TOOLTIP_PADDING = 10
const DEFAULT_STROKE_WIDTH_FACTOR = 500
const HIGHLIGHT_STROKE_WIDTH_FACTOR = 200
const BRUSH_SELECTION_WIDTH = 2 * CHART_WIDTH / 100
const BRUSH_SELECTION_WIDTH = (2 * CHART_WIDTH) / 100
// ===================================================================

View File

@ -376,7 +376,10 @@ export default class XoWeekCharts extends Component {
}
render () {
const { props, state: { chartsWidth, maxValue, tooltipX } } = this
const {
props,
state: { chartsWidth, maxValue, tooltipX },
} = this
return (
<div>

View File

@ -166,9 +166,9 @@ export default class XoWeekHeatmap extends Component {
content={
hour
? _('weekHeatmapData', {
date: hour.date,
value: this.props.cellRenderer(hour.value),
})
date: hour.date,
value: this.props.cellRenderer(hour.value),
})
: _('weekHeatmapNoData')
}
key={key}

View File

@ -64,7 +64,7 @@ export default class AddHostModal extends BaseComponent {
host,
nMissingPatches: host
? differenceBy(this.props.poolMasterPatches, host.patches, 'name')
.length
.length
: undefined,
})
}

View File

@ -32,12 +32,12 @@ class CopyVmsModalBody extends BaseComponent {
const names = namePattern
? map(
vms,
buildTemplate(namePattern, {
'{name}': vm => vm.name_label,
'{id}': vm => vm.id,
})
)
vms,
buildTemplate(namePattern, {
'{name}': vm => vm.name_label,
'{id}': vm => vm.id,
})
)
: map(vms, vm => vm.name_label)
return {
compress: state.compress,

View File

@ -31,7 +31,8 @@ const Upgrade = propTypes({
>
<Icon icon='plan-upgrade' /> {_('upgradeNow')}
</a>{' '}
{_('or')}&nbsp;
{_('or')}
&nbsp;
<Link className='btn btn-success btn-lg' to='/xoa/update'>
<Icon icon='plan-trial' /> {_('tryIt')}
</Link>

View File

@ -16,7 +16,8 @@ import { scanDisk, scanFiles } from 'xo'
const backupOptionRenderer = backup => (
<span>
{backup.tag} - {backup.remoteName} (<FormattedDate
{backup.tag} - {backup.remoteName} (
<FormattedDate
value={backup.datetime * 1e3}
month='long'
day='numeric'
@ -24,7 +25,8 @@ const backupOptionRenderer = backup => (
hour='2-digit'
minute='2-digit'
second='2-digit'
/>)
/>
)
</span>
)

View File

@ -50,7 +50,8 @@ const backupOptionRenderer = backup => (
<span className='tag tag-info'>{_('delta')}</span>{' '}
</span>
)}
{backup.tag} - {backup.remoteName} (<FormattedDate
{backup.tag} - {backup.remoteName} (
<FormattedDate
value={new Date(backup.date)}
month='long'
day='numeric'
@ -58,7 +59,8 @@ const backupOptionRenderer = backup => (
hour='2-digit'
minute='2-digit'
second='2-digit'
/>)
/>
)
</span>
)

View File

@ -467,7 +467,7 @@ class DefaultCard extends Component {
labels: map(topSrs, 'name_label'),
series: map(
topSrs,
sr => sr.physical_usage / sr.size * 100
sr => (sr.physical_usage / sr.size) * 100
),
}}
options={{

View File

@ -191,7 +191,7 @@ class SelectMetric extends Component {
objects,
predicate: objects.length
? object =>
runningObjectsPredicate(object) && object.type === objects[0].type
runningObjectsPredicate(object) && object.type === objects[0].type
: runningObjectsPredicate,
})
}

View File

@ -180,7 +180,7 @@ export default class HostItem extends Component {
<Tooltip
content={_('memoryLeftTooltip', {
used: Math.round(
host.memory.usage / host.memory.size * 100
(host.memory.usage / host.memory.size) * 100
),
free: formatSizeShort(host.memory.size - host.memory.usage),
})}
@ -188,7 +188,7 @@ export default class HostItem extends Component {
<progress
style={{ margin: 0 }}
className='progress'
value={host.memory.usage / host.memory.size * 100}
value={(host.memory.usage / host.memory.size) * 100}
max='100'
/>
</Tooltip>
@ -213,7 +213,8 @@ export default class HostItem extends Component {
className={styles.itemExpandButton}
onClick={this._toggleExpanded}
>
<Icon icon='nav' fixedWidth />&nbsp;&nbsp;&nbsp;
<Icon icon='nav' fixedWidth />
&nbsp;&nbsp;&nbsp;
</a>
</Col>
</SingleLineRow>

View File

@ -200,7 +200,7 @@ export default class PoolItem extends Component {
<Tooltip
content={_('memoryLeftTooltip', {
used: Math.round(
hostMetrics.memoryUsage / hostMetrics.memoryTotal * 100
(hostMetrics.memoryUsage / hostMetrics.memoryTotal) * 100
),
free: formatSizeShort(
hostMetrics.memoryTotal - hostMetrics.memoryUsage
@ -211,7 +211,7 @@ export default class PoolItem extends Component {
style={{ margin: 0 }}
className='progress'
value={
hostMetrics.memoryUsage / hostMetrics.memoryTotal * 100
(hostMetrics.memoryUsage / hostMetrics.memoryTotal) * 100
}
max='100'
/>
@ -223,7 +223,8 @@ export default class PoolItem extends Component {
className={styles.itemExpandButton}
onClick={this._toggleExpanded}
>
<Icon icon='nav' fixedWidth />&nbsp;&nbsp;&nbsp;
<Icon icon='nav' fixedWidth />
&nbsp;&nbsp;&nbsp;
</a>
</Col>
</SingleLineRow>
@ -233,8 +234,8 @@ export default class PoolItem extends Component {
<Col mediumSize={3} className={styles.itemExpanded}>
<span>
{hostMetrics.count}x <Icon icon='host' /> {nVms}x{' '}
<Icon icon='vm' /> {nSrs}x <Icon icon='sr' /> {hostMetrics.cpus}x{' '}
<Icon icon='cpu' /> {formatSizeShort(hostMetrics.memoryTotal)}
<Icon icon='vm' /> {nSrs}x <Icon icon='sr' /> {hostMetrics.cpus}
x <Icon icon='cpu' /> {formatSizeShort(hostMetrics.memoryTotal)}
</span>
</Col>
<Col mediumSize={4} className={styles.itemExpanded}>

View File

@ -164,14 +164,16 @@ export default class SrItem extends Component {
{sr.size > 0 && (
<Tooltip
content={_('spaceLeftTooltip', {
used: String(Math.round(sr.physical_usage / sr.size * 100)),
used: String(
Math.round((sr.physical_usage / sr.size) * 100)
),
free: formatSizeShort(sr.size - sr.physical_usage),
})}
>
<progress
style={{ margin: 0 }}
className='progress'
value={sr.physical_usage / sr.size * 100}
value={(sr.physical_usage / sr.size) * 100}
max='100'
/>
</Tooltip>
@ -189,7 +191,8 @@ export default class SrItem extends Component {
className={styles.itemExpandButton}
onClick={this._toggleExpanded}
>
<Icon icon='nav' fixedWidth />&nbsp;&nbsp;&nbsp;
<Icon icon='nav' fixedWidth />
&nbsp;&nbsp;&nbsp;
</a>
</Col>
</SingleLineRow>

View File

@ -88,7 +88,8 @@ export default class TemplateItem extends Component {
className={styles.itemExpandButton}
onClick={this.toggleState('expanded')}
>
<Icon icon='nav' fixedWidth />&nbsp;&nbsp;&nbsp;
<Icon icon='nav' fixedWidth />
&nbsp;&nbsp;&nbsp;
</a>
</Col>
</SingleLineRow>

View File

@ -197,7 +197,8 @@ export default class VmItem extends Component {
className={styles.itemExpandButton}
onClick={this._toggleExpanded}
>
<Icon icon='nav' fixedWidth />&nbsp;&nbsp;&nbsp;
<Icon icon='nav' fixedWidth />
&nbsp;&nbsp;&nbsp;
</a>
</Col>
</SingleLineRow>

View File

@ -172,9 +172,8 @@ export default class extends Component {
<tr>
<th>{_('hostXenServerVersion')}</th>
<Copiable tagName='td' data={host.version}>
{host.license_params.sku_marketing_name} {host.version} ({
host.license_params.sku_type
})
{host.license_params.sku_marketing_name} {host.version} (
{host.license_params.sku_type})
</Copiable>
</tr>
<tr>
@ -219,17 +218,15 @@ export default class extends Component {
<tr>
<th>{_('hostManufacturerinfo')}</th>
<Copiable tagName='td'>
{host.bios_strings['system-manufacturer']} ({
host.bios_strings['system-product-name']
})
{host.bios_strings['system-manufacturer']} (
{host.bios_strings['system-product-name']})
</Copiable>
</tr>
<tr>
<th>{_('hostBiosinfo')}</th>
<td>
{host.bios_strings['bios-vendor']} ({
host.bios_strings['bios-version']
})
{host.bios_strings['bios-vendor']} (
{host.bios_strings['bios-version']})
</td>
</tr>
</tbody>

View File

@ -85,9 +85,11 @@ export default ({
</Col>
<Col mediumSize={3}>
<p>
{host.productBrand} {host.version} ({host.productBrand !== 'XCP-ng'
{host.productBrand} {host.version} (
{host.productBrand !== 'XCP-ng'
? host.license_params.sku_type
: 'GPLv2'})
: 'GPLv2'}
)
</p>
</Col>
<Col mediumSize={3}>

View File

@ -120,7 +120,7 @@ export default connectStore(() => {
pbdId: pbd.id,
shared: isSrShared(sr),
size: size > 0 ? size : 0,
usagePercentage: size > 0 && Math.round(100 * usage / size),
usagePercentage: size > 0 && Math.round((100 * usage) / size),
}
})
)

View File

@ -166,10 +166,9 @@ export default [
let globalIsFull
return (
<li key={taskLog.data.id} className='list-group-item'>
<VmItem id={taskLog.data.id} link /> ({taskLog.data.id.slice(
4,
8
)}) <TaskStateInfos status={taskLog.status} />{' '}
<VmItem id={taskLog.data.id} link /> (
{taskLog.data.id.slice(4, 8)}){' '}
<TaskStateInfos status={taskLog.status} />{' '}
{scheduleId !== undefined &&
taskLog.status !== 'success' &&
taskLog.status !== 'pending' && (
@ -202,17 +201,13 @@ export default [
</span>
) : subTaskLog.data.type === 'remote' ? (
<span>
<RemoteItem id={subTaskLog.data.id} link /> ({subTaskLog.data.id.slice(
4,
8
)})
<RemoteItem id={subTaskLog.data.id} link /> (
{subTaskLog.data.id.slice(4, 8)})
</span>
) : (
<span>
<SrItem id={subTaskLog.data.id} link /> ({subTaskLog.data.id.slice(
4,
8
)})
<SrItem id={subTaskLog.data.id} link /> (
{subTaskLog.data.id.slice(4, 8)})
</span>
)}{' '}
<TaskStateInfos status={subTaskLog.status} />

View File

@ -506,7 +506,8 @@ const MenuLinkItem = props => {
/>
<span className={styles.hiddenCollapsed}>
{' '}
{typeof label === 'string' ? _(label) : label}&nbsp;
{typeof label === 'string' ? _(label) : label}
&nbsp;
</span>
{pill > 0 && <span className='tag tag-pill tag-primary'>{pill}</span>}
{extra}

View File

@ -117,7 +117,12 @@ const LineItem = ({ children }) => (
const Item = ({ label, children, className }) => (
<span className={styles.item}>
{label && <span>{label}&nbsp;</span>}
{label && (
<span>
{label}
&nbsp;
</span>
)}
<span className={classNames(styles.input, className)}>{children}</span>
</span>
)
@ -221,10 +226,13 @@ class Vif extends BaseComponent {
pool: createGetObject((_, props) => props.location.query.pool),
pools: createGetObjectsOfType('pool'),
templates: createGetObjectsOfType('VM-template').sort(),
userSshKeys: createSelector((_, props) => {
const user = props.user
return user && user.preferences && user.preferences.sshKeys
}, keys => keys),
userSshKeys: createSelector(
(_, props) => {
const user = props.user
return user && user.preferences && user.preferences.sshKeys
},
keys => keys
),
srs: createGetObjectsOfType('SR'),
}))
@injectIntl

View File

@ -726,7 +726,8 @@ export default class New extends Component {
onChange={event => {
this._handleAuthChoice()
}}
/>)
/>
)
</label>
<div className='form-inline'>
<input

View File

@ -248,7 +248,9 @@ class PifsItem extends BaseComponent {
</tr>
</thead>
<tbody>
{map(network.PIFs, pifId => <PifItem key={pifId} id={pifId} />)}
{map(network.PIFs, pifId => (
<PifItem key={pifId} id={pifId} />
))}
</tbody>
</table>
)}

View File

@ -43,7 +43,11 @@ class UserDisplay extends Component {
return (
<span>
{(id && users && users[id] && users[id].email) || (
<em>&lt;{_('unknownUser')}&gt;</em>
<em>
&lt;
{_('unknownUser')}
&gt;
</em>
)}{' '}
<ActionButton
className='pull-right'

View File

@ -189,7 +189,13 @@ export default class Servers extends Component {
}
render () {
const { props: { intl: { formatMessage }, servers }, state } = this
const {
props: {
intl: { formatMessage },
servers,
},
state,
} = this
return (
<Container>

View File

@ -61,10 +61,8 @@ export default class TabGeneral extends Component {
<Row>
<Col className='text-xs-center'>
<h5>
{formatSize(sr.physical_usage)} {_('srUsed')} ({formatSize(
sr.size - sr.physical_usage
)}{' '}
{_('srFree')})
{formatSize(sr.physical_usage)} {_('srUsed')} (
{formatSize(sr.size - sr.physical_usage)} {_('srFree')})
</h5>
</Col>
</Row>

View File

@ -110,7 +110,9 @@ class Node extends Component {
() => this.props.node.statusDetail,
statusDetail => ({
used: String(
Math.round(100 - +statusDetail.sizeFree / +statusDetail.sizeTotal * 100)
Math.round(
100 - (+statusDetail.sizeFree / +statusDetail.sizeTotal) * 100
)
),
free: formatSize(+statusDetail.sizeFree),
})
@ -121,7 +123,7 @@ class Node extends Component {
statusDetail => ({
used: String(
Math.round(
100 - +statusDetail.inodesFree / +statusDetail.inodesTotal * 100
100 - (+statusDetail.inodesFree / +statusDetail.inodesTotal) * 100
)
),
free: formatSize(+statusDetail.inodesFree),
@ -215,7 +217,7 @@ class Node extends Component {
max='100'
value={
100 -
+statusDetail.sizeFree / +statusDetail.sizeTotal * 100
(+statusDetail.sizeFree / +statusDetail.sizeTotal) * 100
}
/>
</Tooltip>
@ -272,8 +274,8 @@ class Node extends Component {
max='100'
value={
100 -
+statusDetail.inodesFree /
+statusDetail.inodesTotal *
(+statusDetail.inodesFree /
+statusDetail.inodesTotal) *
100
}
/>
@ -689,7 +691,9 @@ export default class TabXosan extends Component {
size='lg'
color={
status_
? status_.commandStatus ? 'text-success' : status_.error
? status_.commandStatus
? 'text-success'
: status_.error
: 'text-info'
}
/>
@ -702,7 +706,9 @@ export default class TabXosan extends Component {
size='lg'
color={
heal_
? heal_.commandStatus ? 'text-success' : heal_.error
? heal_.commandStatus
? 'text-success'
: heal_.error
: 'text-info'
}
/>
@ -730,7 +736,9 @@ export default class TabXosan extends Component {
size='lg'
color={
info_
? info_.commandStatus ? 'text-success' : info_.error
? info_.commandStatus
? 'text-success'
: info_.error
: 'text-info'
}
/>

View File

@ -553,7 +553,8 @@ export default class TabAdvanced extends Component {
<th>{_('vmMemoryLimitsLabel')}</th>
<td>
<p>
Static: {formatSize(vm.memory.static[0])}/<Size
Static: {formatSize(vm.memory.static[0])}/
<Size
value={defined(vm.memory.static[1], null)}
onChange={memoryStaticMax =>
editVm(vm, { memoryStaticMax })
@ -565,7 +566,9 @@ export default class TabAdvanced extends Component {
<Size
value={defined(vm.memory.dynamic[0], null)}
onChange={memoryMin => editVm(vm, { memoryMin })}
/>/<Size
/>
/
<Size
value={defined(vm.memory.dynamic[1], null)}
onChange={memoryMax => editVm(vm, { memoryMax })}
/>
@ -596,7 +599,9 @@ export default class TabAdvanced extends Component {
<Icon
className='text-info'
icon={osFamily(vm.os_version.distro)}
/>&nbsp;{vm.os_version.name}
/>
&nbsp;
{vm.os_version.name}
</span>
)}
</td>

View File

@ -61,7 +61,8 @@ export default connectStore(() => {
<Number
value={vm.CPUs.number}
onChange={vcpus => editVm(vm, { CPUs: vcpus })}
/>x <Icon icon='cpu' size='lg' />
/>
x <Icon icon='cpu' size='lg' />
</h2>
<BlockLink to={`/vms/${vm.id}/stats`}>
{statsOverview && <CpuSparkLines data={statsOverview} />}
@ -73,7 +74,8 @@ export default connectStore(() => {
value={defined(vm.memory.dynamic[1], null)}
onChange={memory => editVm(vm, { memory })}
/>
&nbsp;<span>
&nbsp;
<span>
<Icon icon='memory' size='lg' />
</span>
</h2>

View File

@ -242,7 +242,8 @@ export default class XoaUpdates extends Component {
<div>
{map(log, (log, key) => (
<p key={key}>
<span className={textClasses[log.level]}>{log.date}</span>:{' '}
<span className={textClasses[log.level]}>{log.date}</span>
:{' '}
<span
dangerouslySetInnerHTML={{
__html: ansiUp.ansi_to_html(log.message),

View File

@ -47,9 +47,9 @@ const fork = (n, x, y, w, h, nDisksLoss) => [
stroke(w / (2 * n), 0, w - w / (2 * n), 0, x, y),
// vertical lines (and disks icons)
map(new Array(n), (_, i) => [
stroke(i * w / n + w / (2 * n), 0, i * w / n + w / (2 * n), h, x, y),
stroke((i * w) / n + w / (2 * n), 0, (i * w) / n + w / (2 * n), h, x, y),
nDisksLoss !== undefined &&
disk(x + i * w / n + w / (2 * n), y + h, i >= n - nDisksLoss),
disk(x + (i * w) / n + w / (2 * n), y + h, i >= n - nDisksLoss),
]),
]
@ -63,18 +63,18 @@ const graph = (nGroups, nPerGroup, w, h, disksLoss) => {
{nGroups === 1
? fork(nPerGroup, 0, 2 * hUnit, w, hUnit, disksLoss)
: [
fork(nGroups, 0, 2 * hUnit, w, hUnit),
map(new Array(nGroups), (_, i) =>
fork(
nPerGroup,
i * w / nGroups,
3 * hUnit,
w / nGroups,
hUnit,
disksLoss
)
),
]}
fork(nGroups, 0, 2 * hUnit, w, hUnit),
map(new Array(nGroups), (_, i) =>
fork(
nPerGroup,
(i * w) / nGroups,
3 * hUnit,
w / nGroups,
hUnit,
disksLoss
)
),
]}
</svg>
)
}
@ -109,11 +109,11 @@ export default class Graph extends Component {
{layout === 'disperse'
? disperseGraph(nSrs, redundancy, width, height)
: replicationGraph(
nSrs,
redundancy - (layout === 'replica_arbiter' ? 1 : 0),
width,
height
)}
nSrs,
redundancy - (layout === 'replica_arbiter' ? 1 : 0),
width,
height
)}
</div>
</div>
<div>

View File

@ -62,7 +62,9 @@ const XOSAN_COLUMNS = [
: _('xosanBadStatus', {
badStatuses: (
<ul>
{map(status, (_, status) => <li key={status}>{status}</li>)}
{map(status, (_, status) => (
<li key={status}>{status}</li>
))}
</ul>
),
})
@ -117,18 +119,18 @@ const XOSAN_COLUMNS = [
sr.size > 0 ? (
<Tooltip
content={_('spaceLeftTooltip', {
used: String(Math.round(sr.physical_usage * 100 / sr.size)),
used: String(Math.round((sr.physical_usage * 100) / sr.size)),
free: formatSize(sr.size - sr.physical_usage),
})}
>
<progress
className='progress'
max='100'
value={sr.physical_usage * 100 / sr.size}
value={(sr.physical_usage * 100) / sr.size}
/>
</Tooltip>
) : null,
sortCriteria: sr => sr.physical_usage * 100 / sr.size,
sortCriteria: sr => (sr.physical_usage * 100) / sr.size,
},
{
name: _('xosanLicense'),

View File

@ -416,7 +416,7 @@ export default class NewXosan extends Component {
content={_('spaceLeftTooltip', {
used: String(
Math.round(
sr.physical_usage / sr.size * 100
(sr.physical_usage / sr.size) * 100
)
),
free: formatSize(
@ -427,7 +427,7 @@ export default class NewXosan extends Component {
<progress
className='progress'
max='100'
value={sr.physical_usage / sr.size * 100}
value={(sr.physical_usage / sr.size) * 100}
/>
</Tooltip>
)}

View File

@ -10,7 +10,11 @@ const formatFiles = files => {
const testFiles = files =>
run(
'./node_modules/.bin/jest',
['--testRegex=^(?!.*.integ.spec.js$).*.spec.js$', '--findRelatedTests', '--passWithNoTests'].concat(files)
[
'--testRegex=^(?!.*.integ.spec.js$).*.spec.js$',
'--findRelatedTests',
'--passWithNoTests',
].concat(files)
)
// -----------------------------------------------------------------------------

View File

@ -17,7 +17,6 @@ const deleteProperties = (object, property, properties) => {
}
}
require('exec-promise')(() =>
getPackages(true).map(({ dir, name, package: pkg, relativeDir }) => {
pkg.name = name