Compare commits

...

424 Commits

Author SHA1 Message Date
Julien Fontanet
0d11817e3f 5.7.9 2017-04-24 15:50:35 +02:00
Julien Fontanet
a8cb209717 chore(backup/new): clarify timeout meaning 2017-04-24 15:49:43 +02:00
Olivier Lambert
cf45ffddf1 feat(sr/disks): provide filters for snapshots (#2103)
Fixes #2102
2017-04-24 15:26:29 +02:00
Pierre Donias
2e0ea51c30 fix(dashboard): replace unused labelId by tooltip (#2100)
Fixes #2090
2017-04-21 17:41:51 +02:00
Julien Fontanet
0f7f8c7330 chore(Combobox): use uncontrollableInput 2017-04-20 12:08:16 +02:00
Julien Fontanet
808f72409f fix(home): replace history when setting initial filter 2017-04-19 17:19:14 +02:00
Julien Fontanet
f8e2d29372 chore(Button): own implementation instead of react-bootstrap (#2089) 2017-04-18 10:12:02 +02:00
Julien Fontanet
22dec27c65 chore(package): update standard to v10 (#2067) 2017-04-13 17:34:49 +02:00
Julien Fontanet
89b3806a7a fix(vm/action-bar): pending status for copy 2017-04-13 17:34:20 +02:00
Julien Fontanet
b6bedf9253 chore(ButtonGroup): own implementation instead of react-bootstrap 2017-04-13 14:43:32 +02:00
Julien Fontanet
0d4983043b feat(vm/tab-snapshots): add pending status on new snasphot 2017-04-13 14:16:07 +02:00
Julien Fontanet
f9ff3fe168 fix(vm/tab-disks): fix StateButton prop 2017-04-13 14:16:07 +02:00
Julien Fontanet
4a25c5323f feat(servers): add pending status 2017-04-13 14:16:07 +02:00
Julien Fontanet
9b4e2d3bb8 feat(vm/action-bar): add pending status 2017-04-13 14:16:07 +02:00
Julien Fontanet
3915efcf92 feat(ActionButton): add pending prop 2017-04-13 14:16:07 +02:00
Julien Fontanet
4591ff8522 chore(ActionButton): do not reassign redirectOnSuccess 2017-04-13 14:16:07 +02:00
Julien Fontanet
e3491797f3 chore(ActionButton): do not use React.PropTypes directly 2017-04-13 14:16:07 +02:00
Julien Fontanet
6eee167675 chore(ActionButton): props documentation 2017-04-13 14:16:07 +02:00
Julien Fontanet
16b965b28a chore(ActionButton): use relative import for Icon 2017-04-13 14:16:07 +02:00
Julien Fontanet
5125410efd chore(ActionButton): do not use react-bootstrap 2017-04-13 14:16:07 +02:00
karolsok
1a4da2a8de feat(intl): improve pl translation (#2088) 2017-04-13 09:50:29 +02:00
Julien Fontanet
991fbaec86 5.7.8 2017-04-12 17:32:37 +02:00
Pierre Donias
fb399278b3 fix(new-vm): add network predicate in VIF item (#2087)
Fixes #2086
2017-04-12 17:32:00 +02:00
Julien Fontanet
b868092365 fix(vms/new): only display Shared checkbox in resource set
Fixes #2061
2017-04-12 17:07:00 +02:00
Pierre Donias
80fdc6849f fix(XOSAN): use new pack format to check if XOSAN pack is installed (#2085) 2017-04-12 16:53:08 +02:00
karolsok
25ffcb952b fix(user/lang selector): fix Polski spelling (#2083) 2017-04-12 12:33:28 +02:00
Julien Fontanet
083ac1e2d6 5.7.7 2017-04-11 17:02:51 +02:00
Julien Fontanet
5a4b553a60 fix(form/Toggle): onChange now emits the raw value
Fixes #2080
2017-04-11 16:54:13 +02:00
Julien Fontanet
b1135ef566 fix(backup/new): do not send timeout=null on creation 2017-04-11 16:38:17 +02:00
Julien Fontanet
1928d1e00f chore(backup/new): remove now unnecessary code 2017-04-11 16:33:30 +02:00
Julien Fontanet
a369f7f387 fix(backup/new): wrap tags in array
Fixes #176
2017-04-11 16:12:08 +02:00
Olivier Lambert
33d9801dfe feat(i18n): add Polish language, fixes #2079 2017-04-11 08:51:44 +02:00
Julien Fontanet
8c7a031cca chore: coding style 2017-04-10 17:32:38 +02:00
Julien Fontanet
9484d87e76 chore(backup/new): clearer timeout label 2017-04-10 17:24:53 +02:00
Julien Fontanet
4b6822d6e5 fix(backup/new): default owner is current user 2017-04-10 17:23:10 +02:00
Julien Fontanet
7241a0529b fix(utils/addSubscription): only use setState() when mounted 2017-04-10 17:05:50 +02:00
Julien Fontanet
66083b4e50 fix(backup/new): timeout should be in seconds
Fixes #2076
2017-04-10 16:47:04 +02:00
karolsok
f631b3cc64 feat(intl): pl translation (#2068) 2017-04-10 16:07:01 +02:00
Julien Fontanet
bb58d9b4d6 5.7.6 2017-04-07 16:16:06 +02:00
Julien Fontanet
93ebff1055 fix(backup/new): default to non smart backup 2017-04-07 16:12:51 +02:00
Julien Fontanet
08aec1c09a fix(backup/new): job creation was broken 2017-04-07 16:10:56 +02:00
Julien Fontanet
8ca98a56fe 5.7.5 2017-04-07 15:52:13 +02:00
Julien Fontanet
705f53e3e5 fix(scheduling): timezone selection 2017-04-07 15:51:49 +02:00
Julien Fontanet
adaf069d20 5.7.4 2017-04-07 15:27:46 +02:00
Julien Fontanet
d7be7d8660 fix(select-objects): do not treat empty string as a value (2) 2017-04-07 15:25:41 +02:00
Julien Fontanet
faddee86b6 fix(select-objects): do not treat empty string as a value 2017-04-07 15:23:27 +02:00
Julien Fontanet
c4fcc65d16 fix(backup/new): coding style 2017-04-07 15:17:51 +02:00
Julien Fontanet
890631d33b fix(select-objects): correctly handle incorrect values with non-multi 2017-04-07 15:17:32 +02:00
Julien Fontanet
8e8145bb48 chore(backup/new): controlled inputs (#2072) 2017-04-07 15:02:53 +02:00
Julien Fontanet
d73d6719a5 5.7.3 2017-04-06 19:30:33 +02:00
Pierre Donias
3419bee198 feat(pack,patch): support 7.1 packs/patches format (#2069)
Fixes #2058
2017-04-06 19:05:51 +02:00
Julien Fontanet
4368fad393 fix(react-novnc): do not error if canvas is not mounted 2017-04-06 17:28:29 +02:00
badrAZ
ab93fdbf10 feat: Display a warning when the CD drive is not completely installed (#2066)
Fixes #2064
2017-04-06 15:22:42 +02:00
Julien Fontanet
8fd7697a45 fix(vm/disks): attach/create disk for non-PV VM 2017-04-06 12:15:22 +02:00
badrAZ
1121a60912 feat(host/network): use StateButton (#2063)
Fixes #2060
2017-04-06 09:58:41 +02:00
Julien Fontanet
e7b4bd2fe4 5.7.2 2017-04-05 15:07:39 +02:00
Julien Fontanet
fcd8bdd1b3 chore(backup/new): simplify smart-backup condition 2017-04-05 14:52:52 +02:00
badrAZ
e6f140f575 fix(select-objects): display missing objects (#2059)
Fixes #2052
2017-04-05 14:52:21 +02:00
Julien Fontanet
bfe4c45fcf fix(xo/configurePlugin): do not swallow error 2017-04-03 10:31:21 +02:00
Julien Fontanet
f95370124b 5.7.1 2017-03-31 18:05:29 +02:00
Julien Fontanet
2564343816 fix(xo-json-schema-input/vm): controlled mode 2017-03-31 18:03:35 +02:00
Julien Fontanet
03734eb761 fix(logs): do not fail on non-string params 2017-03-31 18:03:35 +02:00
Julien Fontanet
29d63a9fdd 5.7.0 2017-03-31 16:36:40 +02:00
Julien Fontanet
ca94b236a8 feat(settings/plugins): easier edition 2017-03-31 16:35:14 +02:00
Julien Fontanet
fa1ec30ba5 chore(json-schema-input): controlled inputs (#2001) 2017-03-31 16:21:54 +02:00
Olivier Lambert
2b1423aebe fix(changelog): it seems we are in 2017. 2017-03-31 14:55:56 +02:00
Pierre Donias
373332141f fix(pool/packs): starter plan required to install packs (#2055) 2017-03-31 11:01:17 +02:00
Olivier Lambert
ecf2cf15b5 fix(changelog): typo in 5.7 release 2017-03-31 10:32:50 +02:00
Olivier Lambert
4ee0831d93 feat(changelog): updates for 5.7 2017-03-31 10:31:11 +02:00
Pierre Donias
7df2a88c13 feat(xosan/pack): check XS version requirement (#2054) 2017-03-31 10:18:43 +02:00
Olivier Lambert
3d52556c67 feat(changelog): updates for 5.6 2017-03-31 10:11:38 +02:00
badrAZ
437b160a3f feat(servers): add label property (#2051)
Fixes #1965
2017-03-29 16:23:51 +02:00
Pierre Donias
5c87b82e0c feat(new-vm,vm): select an affinity host (#2039)
See #1983
2017-03-29 14:07:55 +02:00
badrAZ
7f2bc79d5f feat(ActionButton): improve error reporting (#2050)
Fixes #2048
2017-03-29 12:03:19 +02:00
Pierre Donias
837a61acf3 fix(home): not visible items should never be selected (#2042)
Fixes #2027
Fixes #2035
2017-03-29 10:53:31 +02:00
badrAZ
5971eed72a feat(jobs): configure job timeout (#2043)
Fixes #1956
2017-03-29 10:39:29 +02:00
Pierre Donias
1b8224030b fix(ipPools): prevent creating 2 IP pools with the same name (#2041)
Fixes #1731
2017-03-24 12:26:52 +01:00
Pierre Donias
ed3ec3fa8b fix(vm/disks): do not show bootable flags for non PV VMs (#2040)
Fixes #1996
2017-03-24 11:49:46 +01:00
Pierre Donias
aa98ca49e5 feat(locales): Hungarian (hu) (#2038)
Fixes #2019
2017-03-24 10:36:03 +01:00
badrAZ
44d35c2351 feat: more uses of StateButton (#2034) 2017-03-23 17:46:26 +01:00
badrAZ
df8eb7a000 feat({backup,job}/overview): clearer state (#2023)
Fixes #1958
2017-03-23 09:42:23 +01:00
Julien Fontanet
ac061c8750 chore(backup/new): improve description of report 2017-03-22 12:13:35 +01:00
Julien Fontanet
656d3e55ac feat(backup/new): report on failure by default 2017-03-22 12:09:13 +01:00
Julien Fontanet
50641287f8 fix(XoApp): wait for signin before show pages 2017-03-17 14:48:33 +01:00
Julien Fontanet
0bc072aa65 feat(Home): add a None filter 2017-03-17 14:26:21 +01:00
Julien Fontanet
9d7d665520 chore(Home#_getDefaultFilter): cleaner code 2017-03-17 14:26:21 +01:00
Julien Fontanet
819ea94e7b fix(xo): keep user in store up to date 2017-03-17 14:26:21 +01:00
badrAZ
40753568df fix(settings/remotes): no duplicate names (#2021)
Fixes #1879
2017-03-17 14:11:15 +01:00
badrAZ
8793aed561 feat(home): improve inter-types linkage (#2015)
Fixes #2012
2017-03-16 10:11:52 +01:00
Julien Fontanet
377a50bc09 fix: minor warnings 2017-03-15 17:02:03 +01:00
Julien Fontanet
fe5a43fbdf chore: update yarn.lock 2017-03-15 16:09:17 +01:00
badrAZ
7f44220220 feat(new VM): share a VM (#2013) 2017-03-15 14:38:28 +01:00
greenkeeper[bot]
0df1610ca9 chore(package): update gulp-csso to version 3.0.0 (#2009)
https://greenkeeper.io/
2017-03-14 14:51:53 +01:00
Julien Fontanet
24c8b9e02d chore(auto-controlled-component): remove base-component dep 2017-03-14 11:43:47 +01:00
Pierre Donias
01b311f2ba fix(new-vm): remove bootable option (#2008)
Fixes #2007
2017-03-14 11:27:49 +01:00
Pierre Donias
a2bb3182f4 feat(backup/logs): show job tag in table (#2005)
Fixes #1982
2017-03-14 10:54:39 +01:00
Pierre Donias
c86e15a310 feat(xo/utils/getDefaultNetworkForVif): match network with same VLAN (#1997)
Fixes #1990
2017-03-13 18:03:14 +01:00
Julien Fontanet
862e5a95e7 fix(package): update babel-plugin-lodash 2017-03-09 17:51:47 +01:00
Julien Fontanet
73e2c7e849 chore(package): use babel-plugin-dev 2017-03-09 17:50:08 +01:00
Julien Fontanet
0b0937e233 chore(base-component): remove shallow-equal dep 2017-03-09 15:22:52 +01:00
Julien Fontanet
6bf114859f chore(base-component): remove invoke dep 2017-03-09 15:20:14 +01:00
Julien Fontanet
db6d67eeb7 feat(JsonSchemaInput/EnumInput): handle enumNames 2017-03-08 18:08:59 +01:00
Julien Fontanet
a345d89aac fix(home): changing type reset paging
Fixes #1993
2017-03-06 15:47:42 +01:00
Pierre Donias
e8f8ebb112 feat(XOSAN): select suggestion, SVG graph (#1991) 2017-03-06 12:01:38 +01:00
Julien Fontanet
1dad5b5c3a 5.6.3 2017-03-02 19:07:29 +01:00
Pierre Donias
5cc5ee4e87 fix(XOSAN): XS v7.0 required to install XOSAN (#1981) 2017-03-02 17:38:55 +01:00
Julien Fontanet
e8d2b32a14 5.6.2 2017-03-01 17:09:19 +01:00
Julien Fontanet
f492909e42 fix(linting): ignored files go into /.gitignore 2017-03-01 15:19:39 +01:00
Pierre Donias
7ea17750a1 fix(pool/patches): disable patching for free plan (#1972) 2017-03-01 10:13:09 +01:00
Julien Fontanet
663e1f1a4b fix(menu): XOSAN only displayed to admins
Fixes #1968
2017-02-28 17:54:21 +01:00
Julien Fontanet
079310c67e fix(store/reducer/object): missing part of previous fix 2017-02-28 17:01:36 +01:00
Julien Fontanet
5cf7f1f886 fix(store/reducer/object): handle type change
Fixes #1967
2017-02-28 16:14:07 +01:00
Julien Fontanet
9f64af859e chore(package): update react-select to v1.0.0-rc.3 2017-02-28 10:44:04 +01:00
Julien Fontanet
007aa776cb chore(package): update index-modules to v0.3.0 2017-02-28 10:33:12 +01:00
Julien Fontanet
66bc092edd chore(package): update husky to v0.13.1 2017-02-28 10:30:44 +01:00
Julien Fontanet
140a88ee12 chore(package): update jest to v19.0.2 2017-02-28 10:29:44 +01:00
Julien Fontanet
f42758938d fix(package): migrate ghooks→husky config 2017-02-27 11:41:31 +01:00
Julien Fontanet
e19fd81536 chore: update yarn.lock 2017-02-27 11:40:28 +01:00
Julien Fontanet
73835ded96 chore(store/actions/createAction): minor optimizations 2017-02-27 11:37:56 +01:00
Julien Fontanet
1ec1a8bd94 chore(package): update superagent to version 3.5.0 (#1962)
Closes #1947

https://greenkeeper.io/
2017-02-27 11:34:57 +01:00
greenkeeper[bot]
f0b6d57ba8 chore(package): update modular-css to version 4.1.1 (#1952)
https://greenkeeper.io/
2017-02-27 11:33:12 +01:00
Julien Fontanet
f9a3ad14d1 5.6.1 2017-02-23 18:39:04 +01:00
Pierre Donias
1b86f533f7 feat(XOSAN) (#1955) 2017-02-23 18:34:20 +01:00
greenkeeper[bot]
46416fb026 chore(package): update notifyjs to version 3.0.0 (#1940)
https://greenkeeper.io/
2017-02-15 12:41:38 +01:00
Julien Fontanet
54ed37c95d chore: update yarn.lock 2017-02-14 15:21:44 +01:00
Julien Fontanet
fd79b47d9e fix(tasks): do not break on unknown host 2017-02-14 15:13:37 +01:00
greenkeeper[bot]
be8333824b chore(package): update browserify to version 14.1.0 (#1938)
https://greenkeeper.io/
2017-02-14 09:05:21 +01:00
Julien Fontanet
55daffc791 fix(pool): predicate for host to add is now dynamic (#1923) 2017-02-07 11:17:33 +01:00
Pierre Donias
375baf7fe5 feat(home): link to VM's resource set (#1920)
Fixes #1905
2017-02-01 17:01:40 +01:00
Pierre Donias
815e74c93c feat(vm): allow snapshot with ACLs (#1916)
Fixes #1865
2017-02-01 15:35:54 +01:00
Pierre Donias
547d6fbc93 feat(pool/advanced): install supplemental pack on all pool's hosts (#1910)
See #1896
2017-02-01 13:08:16 +01:00
greenkeeper[bot]
b45a4b9e6c chore(package): update chartist-plugin-legend to version 0.6.1 (#1915)
https://greenkeeper.io/
2017-02-01 09:21:28 +01:00
greenkeeper[bot]
3436d0256a chore(package): update modular-css to version 3.0.0 (#1914)
https://greenkeeper.io/
2017-01-31 08:35:26 +01:00
greenkeeper[bot]
2627cfd426 chore(package): update react-chartist to version 0.12.0 (#1912)
https://greenkeeper.io/
2017-01-30 10:53:38 +01:00
Olivier Lambert
34b18c00a1 fix(lang): button verbiage. Fixes #1911 2017-01-30 10:07:00 +01:00
Julien Fontanet
e13af7f5f0 5.6.0 2017-01-27 16:41:29 +01:00
Nicolas Raynaud
ca08613292 fix(VM import): behave if network is not an object (#1908) 2017-01-27 13:03:30 +01:00
Pierre Donias
4ab63591a0 feat(host/advanced): install a supplemental pack (#1895)
Fixes #1460
2017-01-25 16:08:45 +01:00
Pierre Donias
5b4f98b03b fix(scheduling): improve TimePicker UI (#1898)
Fixes #1893
2017-01-25 15:59:03 +01:00
Pierre Donias
f396d61633 feat(settings/logs): easy bug reporting from errors (#1907)
See #1602
2017-01-25 15:06:18 +01:00
Julien Fontanet
9f8c0c8cdf fix(scheduling): month range is 0-11 not 1-12 (#1894)
* fix(scheduling): month range is 0-11 not 1-12

* fix(scheduling): remove unused import
2017-01-19 17:46:37 +01:00
Julien Fontanet
198777ffab fix(xo): improve plugin errors 2017-01-19 16:42:38 +01:00
Pierre Donias
29c5ca1132 feat(host/advanced): display installed supplemental packs (#1890)
Fixes #1506
2017-01-16 18:03:57 +01:00
Pierre Donias
05d6f3d1ed feat(iso-device): show DVDs in ISO selector (#1889)
Fixes #1880
2017-01-16 17:06:56 +01:00
Olivier Lambert
536e82de3d feat(readme): add live chat link and icon 2017-01-16 14:54:57 +01:00
Pierre Donias
c59be7c315 fix(backup/new): smart backup pool filter (#1888)
Leaving the pool filter empty now means no filtering on pools, it should be clearer.

See #1885
2017-01-16 14:49:50 +01:00
Pierre Donias
b327bb5bd0 feat(backup/file-restore): restore multiple files (#1886)
Fixes #1877
2017-01-16 09:33:30 +01:00
Julien Fontanet
a3103587f5 chore(package): use husky instead of ghooks 2017-01-11 10:07:16 +01:00
Julien Fontanet
1bb11b574f chore: update yarn.lock 2017-01-11 10:05:18 +01:00
greenkeeper[bot]
405efe6a31 chore(package): update react-redux to version 5.0.0 (#1825)
https://greenkeeper.io/
2017-01-11 09:22:07 +01:00
Pierre Donias
73663c3703 fix(locales/fr): multiple fixes (#1876) 2017-01-10 17:42:41 +01:00
Julien Fontanet
421ee7125b chore: update yarn.lock 2017-01-09 10:12:31 +01:00
Julien Fontanet
1a6166b63c chore: update yarn.lock 2017-01-09 10:04:37 +01:00
Julien Fontanet
3828e75b7d fix(package): use bootstrap 4.0.0-alpha5 exactly
Bootstrap 4.0.0-alpha6 is not compatible, we'll migrate with beta1.

See #1871
2017-01-09 10:02:43 +01:00
greenkeeper[bot]
154da142c7 chore(package): update gulp-sourcemaps to version 2.2.3 (#1874)
https://greenkeeper.io/
2017-01-09 09:58:50 +01:00
Pierre Donias
312cd60dd1 feat(settings/servers): error handling (#1868)
Fixes #1833
2017-01-06 16:38:24 +01:00
greenkeeper[bot]
6bf522f72f chore(package): update promise-toolbox to version 0.8.0 (#1870)
https://greenkeeper.io/
2017-01-06 11:39:58 +01:00
Pierre Donias
a844f8d459 fix(backup/new): prevent negative depth values (#1869)
Fixes #1851
2017-01-06 11:12:56 +01:00
Julien Fontanet
8ee206174b fix(vm/advanced): PV args edition for all PV VMs
Currently only available if there are already PV args.
2017-01-05 16:51:56 +01:00
Olivier Lambert
1a08e24a5c feat(pool): harmonize links to hosts and storages (#1867)
Fixes #1864
2017-01-05 14:29:06 +01:00
greenkeeper[bot]
086cd0e038 chore(package): update modular-css to version 2.0.0 (#1862)
https://greenkeeper.io/
2017-01-04 09:43:32 +01:00
Julien Fontanet
42d123318c chore(pakcage): upgrade react/react-dom to v15.4.1 2017-01-03 15:28:53 +01:00
Julien Fontanet
89f160317c 5.5.3 2017-01-03 15:19:09 +01:00
Julien Fontanet
9ccd1a0362 chore: update yarn.lock 2017-01-03 15:18:27 +01:00
Pierre Donias
d116d014bc fix(host/network): PIF deletion (#1861)
Fixes #1853
2017-01-03 15:13:44 +01:00
Pierre Donias
7956cabcf4 feat(pool): combined stats tab (#1848)
Fixes #1324
2017-01-03 14:58:22 +01:00
Pierre Donias
36c61ad357 feat(vm/snapshots): icon to indicate if a snapshot is quiesce (#1860)
Fixes #1858
2017-01-03 10:54:58 +01:00
greenkeeper[bot]
25d60360d5 chore(package): update modular-css to version 1.0.0 (#1859)
https://greenkeeper.io/
2017-01-03 09:38:00 +01:00
Olivier Lambert
1e5579e3ad feat(icons): use microchip for the CPU icon 2017-01-02 17:14:05 +01:00
Julien Fontanet
77d43b2280 fix(settings/logs): correctly refresh users 2017-01-02 16:36:09 +01:00
Julien Fontanet
33e8929e8b fix(settings/groups): avoid error when adding a user 2017-01-02 16:36:02 +01:00
Julien Fontanet
b79fa9cb9f feat(backup/overview): sort by start if not end
Avoid unfinished (broken) jobs to stay at the top.
2017-01-02 16:34:36 +01:00
Olivier Lambert
a2812a85bd feat(vm): redirect to home after converting VM to template (#1857)
Fixes #1855
2017-01-02 14:12:33 +01:00
Olivier Lambert
e8ff46a8ba fix(health): add link from SR to hosts and not only for pools. Fixes #1850 (#1856) 2017-01-02 11:29:32 +01:00
Julien Fontanet
351c01d642 fix(intl/messages): typo
Fix #1849
2016-12-24 09:15:54 +01:00
Julien Fontanet
e333b1d083 chore(package): use new shorter paths for Jest serializer 2016-12-22 16:58:26 +01:00
Julien Fontanet
5ad49de642 5.5.2 2016-12-22 12:27:03 +01:00
Fabrice Marsaud
b45bb5c144 fix(xoa-updater): use the new source info (#1846) 2016-12-22 12:26:02 +01:00
Julien Fontanet
9402596f69 5.5.1 2016-12-22 11:18:32 +01:00
Fabrice Marsaud
096687ae2c fix(xoa-updates): also refresh on plan change (#1843) 2016-12-22 11:16:45 +01:00
Julien Fontanet
210b5de992 fix(backup/file-restore-modal): fetched timestamps are in seconds
Follow up to for #1840.
2016-12-20 17:10:55 +01:00
Julien Fontanet
f742fdbf1b fix(backup/file-restore): fetched timestamps are in seconds
Fixes #1840
2016-12-20 16:49:37 +01:00
Pierre Donias
e7026c522d fix(editable/XoSelect): update value before saving (#1835) 2016-12-20 13:54:22 +01:00
Julien Fontanet
c21fc4beda 5.5.0 2016-12-20 13:39:05 +01:00
Julien Fontanet
edf6fe782e chore: update yarn.lock 2016-12-20 13:36:39 +01:00
Pierre Donias
3cbb6c4a98 feat(backup): implement file restore (#1838)
Fixes #1590
2016-12-20 13:34:59 +01:00
Olivier Lambert
568a50acc5 feat(changelog): update changelog 2016-12-19 17:59:14 +01:00
Pierre Donias
fbcb756cef fix(backup/new): remove "Only metadata" option (#1837)
Fixes #1818
2016-12-19 17:53:04 +01:00
Pierre Donias
81eb4ba4f9 fix(form/Select): make text wrap when too long (#1836)
Fixes #1832
2016-12-19 17:15:03 +01:00
Olivier Lambert
0cc14d2ab8 fix(intl): fix the place holder for NFS path, removing the initial slash 2016-12-19 13:48:49 +01:00
greenkeeper[bot]
6aedadc982 chore(package): update jest to version 18.0.0 (#1831)
https://greenkeeper.io/
2016-12-15 12:34:05 +01:00
Olivier Lambert
a8d10dab3c feat(changelog): changelog for 5.5 release 2016-12-15 12:19:35 +01:00
Pierre Donias
1ff6ff1d7a fix(getDefaultNetworkForVif): allow PIFs with no IP (#1830)
Fixes #1788
2016-12-15 10:31:03 +01:00
Pierre Donias
8afe4a85dc fix(form/select-plain-object): make it controlled (#1829) 2016-12-14 17:18:31 +01:00
greenkeeper[bot]
c57fbdce63 chore(package): update index-modules to version 0.2.1 (#1822) 2016-12-12 16:49:29 +01:00
greenkeeper[bot]
bdc0278fd1 chore(package): update gulp-sass to version 3.0.0 (#1820)
https://greenkeeper.io/
2016-12-10 15:07:20 +01:00
Fabrice Marsaud
c3ac8d0587 fix(xoa-updater): propose refresh when xo-web is not up to date (#1815)
Fixes #1801.
2016-12-08 16:24:47 +01:00
Julien Fontanet
f3a5e1e97c feat: yarn integration (#1813) 2016-12-07 14:36:51 +01:00
Julien Fontanet
919aa5fc43 feat(tests): basic tests for grid components 2016-12-07 14:06:20 +01:00
Julien Fontanet
416c98ffd2 chore(tests): use jest instead of ava 2016-12-07 14:06:20 +01:00
Pierre Donias
8094447183 fix(self-service): make it controlled and multiple fixes (#1812)
Fixes:
- VIF IP edition was not possible if the current IP's IP-pool did not exist anymore
- VM creation: removing the pool/resource set in the selector was broken
- Prevent selecting a negative number as an IP pool quantity
- Prevent deleting a resource set that hasn't been created yet
- Remove console.log
2016-12-06 16:43:07 +01:00
Julien Fontanet
575375d3e0 5.4.1 2016-12-05 14:08:56 +01:00
Julien Fontanet
4296ae02dc fix(vm/network): fix IP addresses concatenation 2016-12-05 14:04:43 +01:00
Julien Fontanet
0e40af0515 feat(patch-react): name the patched render function 2016-12-05 14:03:39 +01:00
Julien Fontanet
5d3a0e7a41 fix(patch-react): assign arguments object directly 2016-12-05 10:43:09 +01:00
Julien Fontanet
8ae2aae37a fix(package): update xo-acl-resolver to v0.2.3
It ships a workaround for an issue when a VDI snapshot $snapshot_of is itself.
2016-12-02 16:18:31 +01:00
Pierre Donias
83b3cf406a fix(lang): auto-refresh XO app when changing language (#1809)
Fixes #1800
2016-12-02 13:09:35 +01:00
Julien Fontanet
1643ced4e0 feat: do not break if a component throws 2016-12-01 16:49:36 +01:00
Pierre Donias
b2a1840da7 fix(vm-import): SR selector disable condition (#1808)
Fixes #1804
2016-12-01 15:54:58 +01:00
Pierre Donias
b9f20d1e80 fix(select-objects): allow integer IDs (#1807)
Fixes #1805
2016-12-01 15:39:47 +01:00
Pierre Donias
0c77781be8 feat(backup/smart): tags/pools select all and negation (#1802)
Fixes #1503
2016-12-01 14:56:18 +01:00
Julien Fontanet
83245af1e2 feat: improve debugging in production (#1806)
* feat(build): enable sourcemaps in production

* feat(index): let browsers handle unhandled rejections

They do a much better job to display the error and its trace with sourcemaps.
2016-12-01 14:22:07 +01:00
Julien Fontanet
7db806a461 fix(xo/subcriptions): handle unsubscription during notification 2016-12-01 12:15:12 +01:00
Olivier Lambert
92b15fb1e2 feat(consoles): update tip about console issue to point to XS ticket 2016-11-29 11:00:30 +01:00
Pierre Donias
7b5182111c fix(dashboard/health): message parsing and link to object view (#1796)
Related to #1776
2016-11-29 09:53:19 +01:00
Nicolas Raynaud
82b1b81999 fix(dashboard/overview): graphs on Safari (#1771)
There seems to be a bug in Safari with flex layout, hard coding the height of the graph seems to do the trick.

Fixes #1755
2016-11-29 09:21:04 +01:00
Pierre Donias
f0a430f350 feat(acls): filter object selector (#1791)
Fixes #1515
2016-11-28 12:05:56 +01:00
Olivier Lambert
90f95b7270 feat(i18n): added selector for simplified Chinese 2016-11-28 10:53:41 +01:00
Olivier Lambert
15e6a93fac feat(i18n): added simplified Chinese translation 2016-11-28 10:45:33 +01:00
Julien Fontanet
01541a2577 feat(@autoControlledInput): make controlled inputs able to handle uncontrolled mode
See #1628.
2016-11-24 11:34:21 +01:00
Olivier Lambert
8c70bc0a17 feat(i18n): fix wrong translate key 2016-11-24 10:16:44 +01:00
Nicolas Raynaud
9d96074604 chore(package): update react-shortcuts to v1.3.1 (#1792)
Fix #1691
2016-11-24 09:58:56 +01:00
Julien Fontanet
114a4028f4 fix: coding style fixes 2016-11-24 09:57:02 +01:00
Julien Fontanet
b342a4ba17 5.4.0 2016-11-23 11:09:24 +01:00
Olivier Lambert
fcbf037619 feat(changelog): prepare for the 5.4 release 2016-11-22 18:23:23 +01:00
Pierre Donias
a8e4ab433d feat(backup/new): warning when using delta or continuous rep with XS<6.5 (#1782) 2016-11-22 17:10:26 +01:00
Pierre Donias
6613ba02ab feat(dashboard/health): better formating of alert messages (#1781)
Fixes #1776
2016-11-22 16:41:07 +01:00
Pierre Donias
2af7fde83f fix(dashboard/health): delete orphaned VDIs (#1778)
Fixes #1622
2016-11-21 15:49:23 +01:00
Pierre Donias
19a0d4bc98 feat(timezone-picker): make server timezone less central (#1774)
Fixes #1706
2016-11-21 15:48:01 +01:00
Pierre Donias
9ed49b1f27 fix(menu): non admin users should not see backups and SRs in menu (#1777)
Fixes #1773
2016-11-21 15:45:34 +01:00
Pierre Donias
d56df30a22 feat(host): link to VMs list (#1772)
Fixes #1432
2016-11-18 12:50:43 +01:00
Julien Fontanet
64908068d9 fix: remove Intl polyfill
Safari 10 fixes this issue.

Fixes #1629
2016-11-18 12:40:24 +01:00
Pierre Donias
fe69d59aeb feat(tags): link to home page with tag filter (#1770)
Fixes #1763
2016-11-18 11:31:12 +01:00
Julien Fontanet
b65e737f84 feat(complex-matcher): support matching boolean props
Fixes #1768
2016-11-17 15:28:52 +01:00
Pierre Donias
bd274fdc3c feat(home): can display SRs (#1767)
Fixes #1764
2016-11-17 15:03:46 +01:00
greenkeeper[bot]
ac19249c63 chore(package): update xo-common to version 0.1.0 (#1765)
https://greenkeeper.io/
2016-11-17 05:28:32 +01:00
badrAZ
2abff1fec8 fix(settings/plugins): fix test when no test schema (#1766) 2016-11-16 15:38:48 +01:00
badrAZ
f1a6cfae0d feat(settings/plugins): display plugin test failures (#1754) 2016-11-16 10:53:57 +01:00
greenkeeper[bot]
e43e90ed3c chore(package): update react-chartist to version 0.11.0 (#1761)
https://greenkeeper.io/
2016-11-15 12:58:44 +01:00
greenkeeper[bot]
0ee88fe0dc Update dependencies to enable Greenkeeper 🌴 (#1757)
https://greenkeeper.io/
2016-11-15 11:02:45 +01:00
Pierre Donias
07e7f2e14d fix(menu): jobs should not be available to non-admin users (#1760)
Fixes #1759
2016-11-15 09:46:37 +01:00
Julien Fontanet
366ab95a2f feat(backup,job): ability to set the job owner (#1758)
Fixes #1733
2016-11-14 17:43:02 +01:00
Pierre Donias
ca723068a1 Fix clearable condition. 2016-11-14 17:29:29 +01:00
Pierre Donias
e424a105b3 Minor fixes. 2016-11-14 17:23:05 +01:00
Pierre Donias
32d2f92413 Multiple fixes. 2016-11-14 16:48:33 +01:00
Pierre Donias
898e2ff010 feat(job,backup): handle unexisting job creator
See #1733
2016-11-14 15:32:52 +01:00
Pierre Donias
dfa5e76870 feat(sr/disks): also display VDI snapshots (#1750)
Fixes #1723
2016-11-09 16:38:52 +01:00
Julien Fontanet
c93dd12fae feat(settings/plugins): testing
See #1749
2016-11-09 16:34:29 +01:00
Julien Fontanet
dbb1b1e582 fix(settings/plugins): unloading 2016-11-09 16:19:07 +01:00
Julien Fontanet
76388ee160 feat(utils/Debug): correctly display undefined 2016-11-09 16:18:32 +01:00
Pierre Donias
5ec2eee69a fix(settings/plugins): no plugins message condition (#1746) 2016-11-09 10:08:18 +01:00
Pierre Donias
31875a36fe fix(backup/restore): do not display duplicate tags (#1745)
Fixes #1734
2016-11-08 17:43:01 +01:00
Olivier Lambert
c50598b78e fix(jobs): last slicing fixed for job IDs 2016-11-08 15:37:44 +01:00
Pierre Donias
2f0c81d9ad feat(settings/plugins): message when no plugins (#1744)
Fixes #1670
2016-11-08 15:30:36 +01:00
Olivier Lambert
c22f89c6bb fix(jobs): better slicing of job IDs 2016-11-08 15:29:46 +01:00
Pierre Donias
568a23cd35 feat(pool/networks): change columns layout. Fixes #1696 2016-11-08 15:20:13 +01:00
Pierre Donias
eb7c4c131d fix(xo): add xo-common package (#1742) 2016-11-07 18:18:07 +01:00
Pierre Donias
f0664cd2c7 feat(xo/restartHost-s): trigger error modal if host could not be restarted (#1740)
Fixes #1717
2016-11-07 17:10:02 +01:00
Julien Fontanet
570eb7bc89 chore(package): update jsonrpc-websocket-client to v0.1.1 2016-11-07 16:48:10 +01:00
Pierre Donias
1ee91b4925 feat(backup/overview): display jobs in a SortedTable (#1741)
Fixes #1726
2016-11-07 14:43:16 +01:00
Julien Fontanet
69fee37f00 5.3.2 2016-11-04 11:43:49 +01:00
Julien Fontanet
49be66ae69 fix(xo/deleteSchedule): resolveIds() → resolveId()
Fixes #1737
2016-11-04 10:53:52 +01:00
Julien Fontanet
a0efe6895c fix(jobs/schedules/<id>/edit): correctly pass id prop
Fixes #1736
2016-11-04 10:31:32 +01:00
Julien Fontanet
8ef07e917d fix(jobs/<id>/edit): correctly set the id prop
Fixes #1728
2016-11-04 10:00:55 +01:00
Olivier Lambert
d3995b7bab feat(job): slicing some job ids 2016-11-03 18:00:49 +01:00
Olivier Lambert
c353e71ce7 feat(jobs): slice ids to be more human readable (#1735) 2016-11-03 16:48:48 +01:00
Olivier Lambert
a3570a1c9f feat(pif): use carrier to detect physical link (#1732)
Fixes #1702
2016-11-02 16:59:43 +01:00
Pierre Donias
c593c98e6d fix(settings/acls): display only valid ACLs (#1730) 2016-11-02 14:32:22 +01:00
Olivier Lambert
a4b5b532f2 feat(health): add links to some objects (#1729)
Fixes #1700
2016-11-02 12:29:50 +01:00
Julien Fontanet
6357f23aeb fix(package): use bootstrap 4.0.0-alpha5 2016-10-31 11:26:33 +01:00
Olivier Lambert
01d9b3bd0e feat(home/pools): add links to VMs or hosts and add VM number (#1720)
Fixes #1226
2016-10-28 14:35:32 +02:00
Pierre Donias
6b428f7587 fix(IP pools): behave with missing VIFs (#1716) 2016-10-28 11:57:29 +02:00
Pierre Donias
f829aa76d7 fix(dashboard/stats): requires at least Enterprise plan (#1718) 2016-10-28 11:43:36 +02:00
Fabrice Marsaud
a72051e96f fix(xoa-updater): fix double connection (#1714)
* fix double connection
* fix minified class name display
2016-10-28 10:16:56 +02:00
Pierre Donias
797622ba66 fix(settings/config): export/import should be available to Starter plan (#1715) 2016-10-28 09:52:41 +02:00
Julien Fontanet
39342cd662 5.3.1 2016-10-27 18:24:31 +02:00
Olivier Lambert
051a3ac122 feat(changelog): modify changelog for 5.3.1 2016-10-27 18:21:25 +02:00
Julien Fontanet
f842a321ba fix(xo): properly sign out on auth failure (#1712)
Fixes #1711
2016-10-27 18:17:20 +02:00
Julien Fontanet
3cd2dd65d3 chore(xo/importConfig): no need to promisify 2016-10-27 17:52:13 +02:00
Pierre Donias
5ce7e0b108 feat(settings/config): import/export XO configuration (#1703)
See #786
2016-10-27 15:08:45 +02:00
Julien Fontanet
71c2058cc8 fix(package): do not test on Node 7 (#1705)
* fix(package): do not test on Node 7
* fix(package): directly depend on chartist 0.9
* fix(package): directly depend on react-overlays 0.6
2016-10-27 11:57:06 +02:00
Greenkeeper
f200d39d23 chore(package): update modular-css to version 0.28.0 (#1707)
https://greenkeeper.io/
2016-10-26 23:34:32 +02:00
Pierre Donias
7932845ac5 fix(xo/exportVm): window.location instead of window.open() (#1704) 2016-10-26 16:52:26 +02:00
Julien Fontanet
94bda6ac9e chore(intl): update all locales (#1698) 2016-10-25 14:48:53 +02:00
fufroma
7a65f80406 feat(intl/messages): more translations (#1684) 2016-10-25 14:12:11 +02:00
Pierre Donias
36ab58dad9 feat(backup/restore): VM-centered UI (#1697)
Fixes #1609
2016-10-25 12:59:01 +02:00
Julien Fontanet
e9be9e3761 chore(package): update react-router to version 3.0.0 2016-10-25 11:21:46 +02:00
Julien Fontanet
b54645c86c chore(package): update d3 to version 4.2.8 2016-10-25 11:21:11 +02:00
Greenkeeper
ab77d8430c chore(package): update promise-toolbox to version 0.7.0 (#1690)
https://greenkeeper.io/
2016-10-24 15:02:02 +02:00
Pierre Donias
c6f683b532 feat(host,pool): edit PIFs VLAN (#1685)
See #1092
2016-10-24 09:52:47 +02:00
Pierre Donias
a2604f5156 fix(xo-app): ensure there is always a page title (#1687) 2016-10-21 18:10:53 +02:00
Pierre Donias
5ae7f683d6 fix(new-vm): fix getting disks in self service (#1688) 2016-10-21 18:00:38 +02:00
fufroma
f953c89979 fix(new/sr): fix username handling (#1683)
Regression was introduced in e79096626a
2016-10-21 11:56:36 +02:00
Julien Fontanet
bb8aab02ea fix(form/Password): generator in controlled mode
Fixes #1678
2016-10-20 17:58:49 +02:00
Julien Fontanet
af0c03ff6a 5.3.0 2016-10-20 16:09:25 +02:00
Olivier Lambert
8859900537 feat(changelog): update for release 2016-10-20 16:07:25 +02:00
Julien Fontanet
130852ab85 fix(xo): pass the refresh function to tap() 2016-10-20 15:13:55 +02:00
fufroma
65fa8f96b4 feat(intl): minor improvements (#1668) 2016-10-20 14:54:06 +02:00
Pierre Donias
0a84e9e363 feat(host/network): configure IP mode (#1671)
Fixes #1651
2016-10-20 13:32:43 +02:00
Pierre Donias
163c69454b fix(modal): disable shortcuts when a modal is open (#1673)
Fixes #1589
2016-10-20 13:30:29 +02:00
Julien Fontanet
49d3fde0f3 fix(JsonSchemaInput/Array): fix items handling
#1663
2016-10-20 13:22:11 +02:00
Pierre Donias
bb67e2254e fix(package): use new syntax of Boostrap classes (#1667) 2016-10-19 16:05:59 +02:00
Pierre Donias
6d2abc4e74 feat(IP pools): can be used in resource sets (#1662)
Fixes #1565
2016-10-19 11:17:44 +02:00
Julien Fontanet
4875450053 fix(home): correctly set default filter when user is loaded
Fixes #1665
2016-10-18 11:57:55 +02:00
Julien Fontanet
19184ca8a0 chore(base-component): disable verbose logs 2016-10-18 11:18:00 +02:00
Julien Fontanet
654c3d324b chore(package): jade → pug 2016-10-18 11:17:35 +02:00
fufroma
c5b4811f16 feat(intl): various new translations (#1659)
Also: favicon.
2016-10-17 14:43:50 +02:00
Julien Fontanet
7a9dc4fd59 fix(package): minor style issues 2016-10-14 14:13:20 +02:00
fufroma
e79096626a feat(intl): more translatable messages (#1641) 2016-10-14 10:46:46 +02:00
fufroma
332d074d32 fix(intl/locales/fr): various fixes (#1638) 2016-10-13 14:14:42 +02:00
Pierre Donias
e511ecd76e fix(vm/copy): inital value of compress should be false (#1652)
Fixes #1645
2016-10-12 09:06:28 +02:00
Greenkeeper
bcfbd5eba9 chore(package): update promise-toolbox to version 0.6.0 (#1650)
https://greenkeeper.io/
2016-10-11 17:32:23 +02:00
Pierre Donias
9fa3db395b fix(self): SizeInput's empty value should be null (#1649) 2016-10-11 15:01:43 +02:00
Julien Fontanet
52a41ceb04 chore(package): update standard to version 8.4.0 2016-10-11 11:39:27 +02:00
Julien Fontanet
e65d67266d style: indent fixes 2016-10-11 10:21:57 +02:00
Julien Fontanet
0d1045821c chore(intl/locales/zh): update skeleton 2016-10-10 16:02:44 +02:00
Pierre Donias
45d526dda2 fix(select-objects): dynamic option height (#1644)
Fixes #1411
2016-10-10 15:47:46 +02:00
Julien Fontanet
e52f998e78 fix(tools/update-locales): remove incorrect import 2016-10-10 10:15:58 +02:00
Julien Fontanet
42ed3b9355 feat(tools/update-locales): create or update locales (#1632)
Replace the existing `tools/create-locale`.
2016-10-10 09:57:08 +02:00
Julien Fontanet
563b4cb1ec 5.2.5 2016-10-07 15:45:28 +02:00
Olivier Lambert
45bad231cf feat(changelog): add 5.2.4 and 5.2.5 release 2016-10-07 15:44:47 +02:00
Pierre Donias
d76bd2484b fix(console): disable shortcuts when console is focused (#1637)
Fixes #1614
2016-10-07 15:26:20 +02:00
Pierre Donias
445b60bb63 fix(vm/console): initial scale value should be 1 (#1639) 2016-10-07 14:06:16 +02:00
Julien Fontanet
3214e0e41e fix: style & minor issues 2016-10-06 18:28:23 +02:00
Julien Fontanet
c61230e145 fix(intl/locales/fr): remove incorrect entry 2016-10-06 16:13:54 +02:00
fufroma
fac6a29226 feat(intl): new translatable messages (#1627) 2016-10-06 16:05:47 +02:00
Olivier Lambert
7a8f414748 feat(home/host): sparklines in expanded zone (#1619)
Fixes #1634
2016-10-06 15:14:35 +02:00
Julien Fontanet
9f450d282e chore(package): use index-modules 2016-10-06 14:41:46 +02:00
Pierre Donias
31787067e3 feat(new-vm): set dynamic and static memory bounds (#1618)
Fixes #1603
2016-10-05 17:27:59 +02:00
fufroma
1a769b23e2 feat(i18n): update French translation (#1600) 2016-10-05 10:38:12 +02:00
Olivier Lambert
ae002abafc feat(home/pool): bar for pool RAM usage (#1626)
Fixes #1625
2016-10-05 10:26:47 +02:00
Julien Fontanet
31a25d9c16 5.2.4 2016-10-04 15:35:11 +02:00
Julien Fontanet
356295c361 fix(package): add missing make-error 2016-10-04 15:33:24 +02:00
Julien Fontanet
d10681b6d1 fix(package): add missing even-to-promise 2016-10-04 15:33:24 +02:00
Julien Fontanet
0602410aa8 fix(package): update xo-acl-resolver to 0.2.2
Fixes vatesfr/xo-web#1621
2016-10-04 15:33:23 +02:00
Olivier Lambert
1112768adc feat(home/host): add memory bar (#1617)
Fixes #1616
2016-10-03 18:06:36 +02:00
Julien Fontanet
86b599df89 5.2.3 2016-10-03 09:39:59 +02:00
Olivier Lambert
88f7661172 feat(changelog): add info for 5.2.3 release 2016-10-03 09:21:45 +02:00
Julien Fontanet
29c96c0119 chore(gitignore): pnpm compat 2016-10-03 09:15:18 +02:00
Julien Fontanet
d8c6e54c68 fix(user): add VM template label 2016-10-03 09:13:42 +02:00
Julien Fontanet
df053eb016 fix(user): do not crash on missing type label 2016-10-03 09:13:26 +02:00
Julien Fontanet
d1715f7711 chore(intl): homeTypeTemplate → homeTypeVmTemplate 2016-10-03 09:09:40 +02:00
Julien Fontanet
240282c72d chore(intl): remove unused message 2016-10-03 09:09:03 +02:00
Olivier Lambert
9e8dd6ea21 fix(README): broken link to doc 2016-10-02 23:23:19 +02:00
Julien Fontanet
32806a20c9 fix(sr): goes to homepage if object disappear
Fixes #1611
2016-10-02 23:02:14 +02:00
Pierre Donias
34dcfbbf49 fix(home/item): prevent item from being displayed on 2 rows (#1608)
Fixes #1580
2016-09-30 13:33:05 +02:00
Pierre Donias
91fec43866 feat(pool/network): create a bonded network (#1605)
See #876
2016-09-30 11:23:44 +02:00
Greenkeeper
aa2d196a79 chore(package): update vinyl to version 2.0.0 (#1607)
https://greenkeeper.io/
2016-09-29 23:06:53 +02:00
Pierre Donias
180ca458ad feat(vm/network): allow VIF edition (#1596)
See #1446
2016-09-28 14:29:15 +02:00
Greenkeeper
aa881c60e7 chore(package): update babel-eslint to version 7.0.0 (#1597)
https://greenkeeper.io/
2016-09-27 23:39:03 +02:00
Greenkeeper
5b6966042d standard@8.2.0 breaks build 🚨 (#1595)
https://greenkeeper.io/
2016-09-27 01:11:46 +02:00
Julien Fontanet
dc859da0cd chore(build): remove embedded dev server 2016-09-26 16:45:02 +02:00
Pierre Donias
151eb6cbd6 feat(updates,users,servers): disable credentials autocomplete (#1592)
Fixes #1304
2016-09-26 16:00:04 +02:00
Olivier Lambert
16db591bbf feat(vm): add red icon if VM doesn't have tools. Fixes #1575 2016-09-26 12:24:58 +02:00
Pierre Donias
05a55e5eb2 fix(xoa-upgrade): more suitable message for non-admin users (#1591)
Fixes #1564
2016-09-26 10:31:23 +02:00
Pierre Donias
dcd84b2b8f feat(shortcuts): help modal and new home shortcuts (#1588)
Fixes #1578
2016-09-23 18:43:10 +02:00
Greenkeeper
4a89119f0a Update react-virtualized to version 8.0.8 🚀 (#1587)
https://greenkeeper.io/
2016-09-23 17:11:55 +02:00
Julien Fontanet
bc1c30a7bf chore(package): add __self prop, better React warnings 2016-09-23 16:02:19 +02:00
Julien Fontanet
33cffbf28b fix(Copiable): do not pass tagName prop to wrapper 2016-09-23 15:50:40 +02:00
Julien Fontanet
a18b68116c chore(package): improve React stack traces in dev build 2016-09-23 15:45:03 +02:00
Pierre Donias
d5acf15bca feat(vm/network): indicate when an IP is already used (#1584)
Fixes #1566
2016-09-23 12:13:48 +02:00
Pierre Donias
84f970af68 fix(shortcuts): prevent Shortcuts from stopping events propagation (#1583)
`Editable`s were broken (could not use *enter* to save).
2016-09-23 11:35:56 +02:00
Julien Fontanet
969f636bb7 fix(host/storage): name sorting 2016-09-23 10:54:36 +02:00
Pierre Donias
6939aee20a feat(home): keyboard shortcuts (#1400)
Fixes #1279
2016-09-22 19:01:05 +02:00
Pierre Donias
ab2a02a555 fix(vm/tab-network): lock icon conditions (#1576)
Fixes #1573
2016-09-22 16:52:37 +02:00
Pierre Donias
70038e0764 fix(new-vm): lodash/sum instead of lodash/sumBy (#1577) 2016-09-22 16:19:34 +02:00
Olivier Lambert
e730ef5e11 feat(host/sr): Sr link and better storage tab. (#1572)
Fixes #1567
2016-09-22 16:04:45 +02:00
Olivier Lambert
835ad5aaf1 feat(vm/host/pools/sr): add tooltips. Fixes #1568 2016-09-22 11:02:05 +02:00
Pierre Donias
ac645c8617 fix(home): types dropdown button title (#1570) 2016-09-22 10:47:48 +02:00
Julien Fontanet
b801fdbab2 5.2.2 2016-09-21 18:01:03 +02:00
Pierre Donias
bf495953e2 feat(new-vm): show resource set limits (#1563)
Fixes #1541
2016-09-21 11:58:07 -04:00
Pierre Donias
45b165deec fix(home): VM bulk restart (#1562)
Fixes #1561
2016-09-21 14:48:16 +02:00
Olivier Lambert
09169578e8 feat(changelog): add issue #1562 2016-09-21 14:47:52 +02:00
Olivier Lambert
43b2366927 feat(changelog): update changelog for 5.2.2 2016-09-21 12:22:37 +02:00
Julien Fontanet
f015a69eec feat(host/patches): display if needs to be restarted (#1559)
Fixes #1352
2016-09-21 10:10:44 +02:00
Olivier Lambert
99568508dd fix(charts): change color order to avoid confusions. Fixes #1265 2016-09-20 18:41:44 +02:00
Olivier Lambert
e8515344dd feat(home): display a message if a filter is empty. (#1560)
feat(home): display a message if a filter is empty. Fixes #1517
2016-09-20 12:34:07 -04:00
Julien Fontanet
edc873a570 fix(pool/storage): fix sort by usage 2016-09-20 15:53:45 +02:00
Julien Fontanet
1a03e96ab2 fix(pool/storage): fix passing pool to SortedTable 2016-09-20 15:53:25 +02:00
Olivier Lambert
89e0bb4f0a feat(home/templates): template management (#1533)
Fixes #1091
2016-09-20 13:46:58 +02:00
Olivier Lambert
7d0fd60908 feat(pool/storage): display default SR and add button to set it (#1557)
Fixes #1554
2016-09-20 13:19:47 +02:00
Pierre Donias
6b20523df4 fix(vm/tab-network): check for undefined network (#1556)
Fixes #1518
2016-09-20 11:52:17 +02:00
Julien Fontanet
e9a612647e fix(home): do not overwrite current filter (#1555)
Fixes #1513
2016-09-20 05:38:33 -04:00
Julien Fontanet
28404ef149 feat(SortedTable): default column can be set by a simple prop 2016-09-20 09:43:57 +02:00
Olivier Lambert
a5f8230def feat(self): hide some buttons and tabs for self service VMs (#1550) 2016-09-19 15:17:45 +02:00
Pierre Donias
39171de5de fix(job/new): forbid "_" character in job names (#1548)
Fixes #1414
2016-09-19 11:58:46 +02:00
Pierre Donias
5aa5a0acbc fix(home): set items per page in createPager (#1549) 2016-09-19 11:39:56 +02:00
Olivier Lambert
a4518e630a fix(log): sort logs by end date 2016-09-19 11:04:15 +02:00
Julien Fontanet
94975f5ea6 feat(settings/logs): group action buttons
Fixes #1547
2016-09-19 10:59:19 +02:00
Julien Fontanet
7e98838d96 feat(ActionButton): can have a tooltip 2016-09-19 10:59:19 +02:00
Pierre Donias
e8c9c196ff feat(vm/snapshot): "Snapshot before" checkbox in revert modal (#1543)
Fixes #1445
2016-09-17 00:11:51 +02:00
Julien Fontanet
db314a238f fix(xo/subcriptions): mark as non-running on error 2016-09-16 17:13:56 +02:00
Julien Fontanet
2c85a6d4ab fix(self/admin): do not fail on empty limits
Fixes #1537
2016-09-16 17:13:56 +02:00
Pierre Donias
b683e14e80 feat(self): merge dashboard and administration (#1542)
Fixes #1429
2016-09-16 16:47:20 +02:00
Olivier Lambert
ba45095fa8 fix(editable): limit input size for long text to 50ex. Fixes #1528 2016-09-15 16:45:19 +02:00
Olivier Lambert
b8e5ffa9f7 feat(backup): improved view. Fixes #1534 2016-09-15 16:26:42 +02:00
Pierre Donias
b4bff9e032 feat(vm/disks): "Long click to migrate" tooltip on SR (#1529)
* feat(vm/disks): "Long click to migrate" tooltip on SR

Fixes #1512

* feat(vm/disks): migrate VDI button, force cursor on editable

* fix bulk VDI migration

* Return Promise.all

* Ternary operator
2016-09-15 16:08:50 +02:00
Olivier Lambert
0c461bc4e2 feat(backuplogs): shorten the start/end date format. Fixes #1535 2016-09-15 15:55:01 +02:00
Olivier Lambert
a33b2a5294 fix(home/menu): adapt message depending of user perm (#1532)
Fixes #1519
2016-09-15 13:56:33 +02:00
Olivier Lambert
298e1c4471 fix(host console): removing useless ISO selector for host. Fixes #1527 2016-09-15 13:07:33 +02:00
Julien Fontanet
1c70cdc10b fix(render-xo-item): remove unused import 2016-09-15 13:07:04 +02:00
Julien Fontanet
160e4bb530 fix(SelectVmTemplates): use correct placeholder
Fixes #1530
2016-09-15 12:00:32 +02:00
fufroma
e69ba8dd96 Fix typo on Changelog (#1526) 2016-09-15 04:44:42 -04:00
Julien Fontanet
e55f4c3eb2 feat(settings/logs): show complete error object 2016-09-14 17:42:32 +02:00
Pierre Donias
1a3272b980 feat(new-vm): auto poweron setting (#1514)
Fixes #1444
2016-09-14 15:25:54 +02:00
Julien Fontanet
7bed5e025a fix(home): fix empty default filter (#1504)
Fixes #1354
2016-09-14 14:38:24 +02:00
Pierre Donias
29d22c0598 feat(backup/new): confirm modal when local remote is selected (#1507)
Fixes #1441
2016-09-14 13:20:51 +02:00
Greenkeeper
a38c7c34ac chore(package): update react-key-handler to version 0.3.0 (#1505)
https://greenkeeper.io/
2016-09-14 01:42:16 +02:00
Julien Fontanet
8d690ce4ff 5.2.1 2016-09-13 16:54:42 +02:00
Olivier Lambert
2569568a03 feat(changelog): patch version 5.2.1 changelog 2016-09-13 16:52:47 +02:00
Olivier Lambert
2c6ff6b5b8 feat(stopHost modal): explain consequences if halting a pool master. Fixes #1458 2016-09-13 15:28:30 +02:00
Pierre Donias
1257f01027 feat(new-vm): create tags during VM creation (#1501)
See #1431
2016-09-13 14:17:04 +02:00
Pierre Donias
fad6830863 fix(settings/remotes): SMB domain is required (#1502)
Fixes #1499
2016-09-13 11:28:07 +02:00
Olivier Lambert
66262bb20b fix(vm console): re-fix issue #1485 2016-09-13 11:01:18 +02:00
Julien Fontanet
4abb0754c7 fix(remotes): edition of URL parts (#1500)
Fixes #1498
2016-09-13 10:20:48 +02:00
Pierre Donias
78c53bf3ad fix(xo): better message for snapshot deletion (#1497)
Fixes #1433
2016-09-13 09:42:18 +02:00
Pierre Donias
810d666d84 feat(home): tooltips on bulk action buttons (#1496)
Fixes #1456
2016-09-12 17:04:02 +02:00
Pierre Donias
67699f0bb6 feat(pool/network): SortedTable and collapsable PIFs table (#1494)
Fixes #1461
2016-09-12 16:44:43 +02:00
Pierre Donias
46274948c0 fix(settings/logs): properly handle unknown user (#1495) 2016-09-12 16:42:52 +02:00
Olivier Lambert
28e3a842ef feat(vm): new containers tab (#1492)
Fixes #1442
2016-09-12 13:50:14 +02:00
Pierre Donias
6d90f1d45d fix(user): prevent SSH key overflow (#1491)
Fixes #1475
2016-09-12 12:57:11 +02:00
Pierre Donias
09642c347d feat(new-vm): Advanced section (#1486)
Fixes #1444
2016-09-12 12:27:11 +02:00
Pierre Donias
2d0e06f785 fix(backup/new): better month and week days layout (#1490)
Fixes #1488
2016-09-12 11:58:24 +02:00
Pierre Donias
a5bc8497cf fix(vm/tab-network): set default network and MTU for VIF creation (#1487)
Fixes #1472
2016-09-12 11:26:32 +02:00
208 changed files with 33928 additions and 7787 deletions

10
.gitignore vendored
View File

@@ -1,9 +1,9 @@
/.nyc_output/
/bower_components/
/dist/
/node_modules/
/src/common/intl/locales/index.js
/src/common/themes/index.js
npm-debug.log
npm-debug.log.*
!node_modules/*
node_modules/*/
pnpm-debug.log
pnpm-debug.log.*

View File

@@ -1,11 +1,10 @@
language: node_js
node_js:
- 'stable'
#- '4' # Disabled for now because npm 2 cannot properly handled broken peer dependencies.
- '6'
#- '4' # npm 3's flat tree is needed because some packages do not
# declare their deps correctly (e.g. chartist-plugin-tooltip)
cache:
directories:
- node_modules
cache: yarn
# Use containers.
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/

View File

@@ -1,5 +1,249 @@
# ChangeLog
## **5.7.0** (2017-03-31)
### Enhancements
- Improve ActionButton error reporting [\#2048](https://github.com/vatesfr/xo-web/issues/2048)
- Home view master checkbox UI issue [\#2027](https://github.com/vatesfr/xo-web/issues/2027)
- HU Translation [\#2019](https://github.com/vatesfr/xo-web/issues/2019)
- [Usage report] Add name for all objects [\#2017](https://github.com/vatesfr/xo-web/issues/2017)
- [Home] Improve inter-types linkage [\#2012](https://github.com/vatesfr/xo-web/issues/2012)
- Remove bootable checkboxes in VM creation [\#2007](https://github.com/vatesfr/xo-web/issues/2007)
- Do not display bootable toggles for disks of non-PV VMs [\#1996](https://github.com/vatesfr/xo-web/issues/1996)
- Try to match network VLAN for VM migration modal [\#1990](https://github.com/vatesfr/xo-web/issues/1990)
- [Usage reports] Add VM names in addition to UUIDs [\#1984](https://github.com/vatesfr/xo-web/issues/1984)
- Host affinity in "advanced" VM creation [\#1983](https://github.com/vatesfr/xo-web/issues/1983)
- Add job tag in backup logs [\#1982](https://github.com/vatesfr/xo-web/issues/1982)
- Possibility to add a label/description to servers [\#1965](https://github.com/vatesfr/xo-web/issues/1965)
- Possibility to create shared VM in a resource set [\#1964](https://github.com/vatesfr/xo-web/issues/1964)
- Clearer display of disabled (backup) jobs [\#1958](https://github.com/vatesfr/xo-web/issues/1958)
- Job should have a configurable timeout [\#1956](https://github.com/vatesfr/xo-web/issues/1956)
- Sort failed VMs in backup report [\#1950](https://github.com/vatesfr/xo-web/issues/1950)
- Support for UNIX socket path [\#1944](https://github.com/vatesfr/xo-web/issues/1944)
- Interface - Host Patching - Button Verbiage [\#1911](https://github.com/vatesfr/xo-web/issues/1911)
- Display if a VM is in Self Service (and which group) [\#1905](https://github.com/vatesfr/xo-web/issues/1905)
- Install supplemental pack on a whole pool [\#1896](https://github.com/vatesfr/xo-web/issues/1896)
- Allow VM snapshots with ACLs [\#1865](https://github.com/vatesfr/xo-web/issues/1886)
- Icon to indicate if a snapshot is quiesce [\#1858](https://github.com/vatesfr/xo-web/issues/1858)
- Pool Ips input too permissive [\#1731](https://github.com/vatesfr/xo-web/issues/1731)
- Select is going on top after each choice [\#1359](https://github.com/vatesfr/xo-web/issues/1359)
### Bug fixes
- Missing objects should be displayed in backup edition [\#2052](https://github.com/vatesfr/xo-web/issues/2052)
- Search bar content changes while typing [\#2035](https://github.com/vatesfr/xo-web/issues/2035)
- VM.$guest_metrics.PV_drivers_up_to_date is deprecated in XS 7.1 [\#2024](https://github.com/vatesfr/xo-web/issues/2024)
- Bootable flag selection checkbox for extra disk not fetched [\#1994](https://github.com/vatesfr/xo-web/issues/1994)
- Home view Changing type must reset paging [\#1993](https://github.com/vatesfr/xo-web/issues/1993)
- XOSAN menu item should only be displayed to admins [\#1968](https://github.com/vatesfr/xo-web/issues/1968)
- Object type change are not correctly handled in UI [\#1967](https://github.com/vatesfr/xo-web/issues/1967)
- VM creation is stuck when using ISO/DVD as install method [\#1966](https://github.com/vatesfr/xo-web/issues/1966)
- Install pack on whole pool fails [\#1957](https://github.com/vatesfr/xo-web/issues/1957)
- Consoles are broken in next-release [\#1954](https://github.com/vatesfr/xo-web/issues/1954)
- [VHD merge] Increase BAT when necessary [\#1939](https://github.com/vatesfr/xo-web/issues/1939)
- Issue on VM restore time [\#1936](https://github.com/vatesfr/xo-web/issues/1936)
- Two remotes should not be able to have the same name [\#1879](https://github.com/vatesfr/xo-web/issues/1879)
- Selfservice limits not honored after VM creation [\#1695](https://github.com/vatesfr/xo-web/issues/1695)
## **5.6.0** (2017-01-27)
Reporting, LVM File level restore.
### Enhancements
- Do not stop patches install if already applied [\#1904](https://github.com/vatesfr/xo-web/issues/1904)
- Improve scheduling UI [\#1893](https://github.com/vatesfr/xo-web/issues/1893)
- Smart backup and tag [\#1885](https://github.com/vatesfr/xo-web/issues/1885)
- Missing embeded API documention [\#1882](https://github.com/vatesfr/xo-web/issues/1882)
- Add local DVD in CD selector [\#1880](https://github.com/vatesfr/xo-web/issues/1880)
- File level restore for LVM [\#1878](https://github.com/vatesfr/xo-web/issues/1878)
- Restore multiple files from file level restore [\#1877](https://github.com/vatesfr/xo-web/issues/1877)
- Add a VM tab for host & pool views [\#1864](https://github.com/vatesfr/xo-web/issues/1864)
- Icon to indicate if a snapshot is quiesce [\#1858](https://github.com/vatesfr/xo-web/issues/1858)
- UI for disconnect hosts comp [\#1833](https://github.com/vatesfr/xo-web/issues/1833)
- Eject all xs-guest.iso in a pool [\#1798](https://github.com/vatesfr/xo-web/issues/1798)
- Display installed supplemental pack on host [\#1506](https://github.com/vatesfr/xo-web/issues/1506)
- Install supplemental pack on host comp [\#1460](https://github.com/vatesfr/xo-web/issues/1460)
- Pool-wide combined stats [\#1324](https://github.com/vatesfr/xo-web/issues/1324)
### Bug fixes
- IP-address not released when VM removed [\#1906](https://github.com/vatesfr/xo-web/issues/1906)
- Interface broken due to new Bootstrap Alpha [\#1871](https://github.com/vatesfr/xo-web/issues/1871)
- Self service recompute all limits broken [\#1866](https://github.com/vatesfr/xo-web/issues/1866)
- Patch not found error for XS 6.5 [\#1863](https://github.com/vatesfr/xo-web/issues/1863)
- Convert To Template issues [\#1855](https://github.com/vatesfr/xo-web/issues/1855)
- Removing PIF seems to fail [\#1853](https://github.com/vatesfr/xo-web/issues/1853)
- Depth should be >= 1 in backup creation [\#1851](https://github.com/vatesfr/xo-web/issues/1851)
- Wrong link in Dashboard > Health [\#1850](https://github.com/vatesfr/xo-web/issues/1850)
- Incorrect file dates shown in new File Restore feature [\#1840](https://github.com/vatesfr/xo-web/issues/1840)
- IP allocation problem [\#1747](https://github.com/vatesfr/xo-web/issues/1747)
- Selfservice limits not honored after VM creation [\#1695](https://github.com/vatesfr/xo-web/issues/1695)
## **5.5.0** (2016-12-20)
File level restore.
### Enhancements
- Better auto select network when migrate VM [\#1788](https://github.com/vatesfr/xo-web/issues/1788)
- Plugin for passive backup job reporting in Nagios [\#1664](https://github.com/vatesfr/xo-web/issues/1664)
- File level restore for delta backup [\#1590](https://github.com/vatesfr/xo-web/issues/1590)
- Better select filters for ACLs [\#1515](https://github.com/vatesfr/xo-web/issues/1515)
- All pools and "negative" filters [\#1503](https://github.com/vatesfr/xo-web/issues/1503)
- VM copy with disk selection [\#826](https://github.com/vatesfr/xo-web/issues/826)
- Disable metadata exports [\#1818](https://github.com/vatesfr/xo-web/issues/1818)
### Bug fixes
- Tool small selector [\#1832](https://github.com/vatesfr/xo-web/issues/1832)
- Replication does not work from a VM created by a CR or delta backup [\#1811](https://github.com/vatesfr/xo-web/issues/1811)
- Can't add a SSH key in VM creation [\#1805](https://github.com/vatesfr/xo-web/issues/1805)
- Issue when no default SR in a pool [\#1804](https://github.com/vatesfr/xo-web/issues/1804)
- XOA doesn't refresh after an update anymore [\#1801](https://github.com/vatesfr/xo-web/issues/1801)
- Shortcuts not inhibited on inputs on Safari [\#1691](https://github.com/vatesfr/xo-web/issues/1691)
## **5.4.0** (2016-11-23)
### Enhancements
- XML display in alerts [\#1776](https://github.com/vatesfr/xo-web/issues/1776)
- Remove some view for non admin users [\#1773](https://github.com/vatesfr/xo-web/issues/1773)
- Complex matcher should support matching boolean values [\#1768](https://github.com/vatesfr/xo-web/issues/1768)
- Home SR view [\#1764](https://github.com/vatesfr/xo-web/issues/1764)
- Filter on tag click [\#1763](https://github.com/vatesfr/xo-web/issues/1763)
- Testable plugins [\#1749](https://github.com/vatesfr/xo-web/issues/1749)
- Backup/Restore Design fix. [\#1734](https://github.com/vatesfr/xo-web/issues/1734)
- Display the owner of a \(backup\) job [\#1733](https://github.com/vatesfr/xo-web/issues/1733)
- Use paginated table for backup jobs [\#1726](https://github.com/vatesfr/xo-web/issues/1726)
- SR view / Disks: should display snapshot VDIs [\#1723](https://github.com/vatesfr/xo-web/issues/1723)
- Restored VM should have an identifiable name [\#1719](https://github.com/vatesfr/xo-web/issues/1719)
- If host reboot action returns NO\_HOSTS\_AVAILABLE, ask to force [\#1717](https://github.com/vatesfr/xo-web/issues/1717)
- Hide xo-server timezone in backups [\#1706](https://github.com/vatesfr/xo-web/issues/1706)
- Enable hyperlink for Hostname for Issues [\#1700](https://github.com/vatesfr/xo-web/issues/1700)
- Pool/network - Modify column [\#1696](https://github.com/vatesfr/xo-web/issues/1696)
- UI - Plugins - Display a message if no plugins [\#1670](https://github.com/vatesfr/xo-web/issues/1670)
- Display warning/error for delta backup on XS older than 6.5 [\#1647](https://github.com/vatesfr/xo-web/issues/1647)
- XO without internet access doesn't work [\#1629](https://github.com/vatesfr/xo-web/issues/1629)
- Improve backup restore view [\#1609](https://github.com/vatesfr/xo-web/issues/1609)
- UI Enhancement - Acronym for dummy [\#1604](https://github.com/vatesfr/xo-web/issues/1604)
- Slack XO plugin for backup report [\#1593](https://github.com/vatesfr/xo-web/issues/1593)
- Expose XAPI exceptions in the UI [\#1481](https://github.com/vatesfr/xo-web/issues/1481)
- Running VMs in the host overview, all VMs in the pool overview [\#1432](https://github.com/vatesfr/xo-web/issues/1432)
- Move location of NFS mount point [\#1405](https://github.com/vatesfr/xo-web/issues/1405)
- Home: Pool list - additionnal informations for pool [\#1226](https://github.com/vatesfr/xo-web/issues/1226)
- Modify VLAN of an existing network [\#1092](https://github.com/vatesfr/xo-web/issues/1092)
- Wrong instructions for CLI upgrade [\#787](https://github.com/vatesfr/xo-web/issues/787)
- Ability to export/import XO config [\#786](https://github.com/vatesfr/xo-web/issues/786)
- Test button for transport-email plugin [\#697](https://github.com/vatesfr/xo-web/issues/697)
- Merge `scheduler` API into `schedule` [\#664](https://github.com/vatesfr/xo-web/issues/664)
### Bug fixes
- Should jobs be accessible to non admins? [\#1759](https://github.com/vatesfr/xo-web/issues/1759)
- Schedules deletion is not working [\#1737](https://github.com/vatesfr/xo-web/issues/1737)
- Editing a job from the jobs overview page does not work [\#1736](https://github.com/vatesfr/xo-web/issues/1736)
- Editing a schedule from jobs overview does not work [\#1728](https://github.com/vatesfr/xo-web/issues/1728)
- ACLs not correctly imported [\#1722](https://github.com/vatesfr/xo-web/issues/1722)
- Some Bootstrap style broken [\#1721](https://github.com/vatesfr/xo-web/issues/1721)
- Not properly sign out on auth token expiration [\#1711](https://github.com/vatesfr/xo-web/issues/1711)
- Hosts/<UUID>/network status is incorrect [\#1702](https://github.com/vatesfr/xo-web/issues/1702)
- Patches application fails "Found : Moved Temporarily" [\#1701](https://github.com/vatesfr/xo-web/issues/1701)
- Password generation for user creation is not working [\#1678](https://github.com/vatesfr/xo-web/issues/1678)
- \#/dashboard/health Remove All Orphaned VDIs [\#1622](https://github.com/vatesfr/xo-web/issues/1622)
- Create a new SR - CIFS/SAMBA Broken [\#1615](https://github.com/vatesfr/xo-web/issues/1615)
- xo-cli --list-objects: truncated output ? 64k buffer limitation ? [\#1356](https://github.com/vatesfr/xo-web/issues/1356)
## **5.3.0** (2016-10-20)
### Enhancements
- Missing favicon [\#1660](https://github.com/vatesfr/xo-web/issues/1660)
- ipPools quota [\#1565](https://github.com/vatesfr/xo-web/issues/1565)
- Dashboard - orphaned VDI [\#1654](https://github.com/vatesfr/xo-web/issues/1654)
- Stats in home/host view when expanded [\#1634](https://github.com/vatesfr/xo-web/issues/1634)
- Bar for used and total RAM on home pool view [\#1625](https://github.com/vatesfr/xo-web/issues/1625)
- Can't translate some text [\#1624](https://github.com/vatesfr/xo-web/issues/1624)
- Dynamic RAM allocation at creation time [\#1603](https://github.com/vatesfr/xo-web/issues/1603)
- Display memory bar in home/host view [\#1616](https://github.com/vatesfr/xo-web/issues/1616)
- Improve keyboard navigation [\#1578](https://github.com/vatesfr/xo-web/issues/1578)
- Strongly suggest to install the guest tools [\#1575](https://github.com/vatesfr/xo-web/issues/1575)
- Missing tooltip [\#1568](https://github.com/vatesfr/xo-web/issues/1568)
- Emphasize already used ips in ipPools [\#1566](https://github.com/vatesfr/xo-web/issues/1566)
- Change "missing feature message" for non-admins [\#1564](https://github.com/vatesfr/xo-web/issues/1564)
- Allow VIF edition [\#1446](https://github.com/vatesfr/xo-web/issues/1446)
- Disable browser autocomplete on credentials on the Update page [\#1304](https://github.com/vatesfr/xo-web/issues/1304)
- keyboard shortcuts [\#1279](https://github.com/vatesfr/xo-web/issues/1279)
- Add network bond creation [\#876](https://github.com/vatesfr/xo-web/issues/876)
- `pool.setDefaultSr\(\)` should not require `pool` param [\#1558](https://github.com/vatesfr/xo-web/issues/1558)
- Select default SR [\#1554](https://github.com/vatesfr/xo-web/issues/1554)
- No error message when I exceed my resource set quota [\#1541](https://github.com/vatesfr/xo-web/issues/1541)
- Hide some buttons for self service VMs [\#1539](https://github.com/vatesfr/xo-web/issues/1539)
- Add Job ID to backup schedules [\#1534](https://github.com/vatesfr/xo-web/issues/1534)
- Correct name for VM selector with templates [\#1530](https://github.com/vatesfr/xo-web/issues/1530)
- Help text when no matches for a filter [\#1517](https://github.com/vatesfr/xo-web/issues/1517)
- Icon or tooltip to allow VDI migration in VM disk view [\#1512](https://github.com/vatesfr/xo-web/issues/1512)
- Create a snapshot before restoring one [\#1445](https://github.com/vatesfr/xo-web/issues/1445)
- Auto power on setting at creation time [\#1444](https://github.com/vatesfr/xo-web/issues/1444)
- local remotes should be avoided if possible [\#1441](https://github.com/vatesfr/xo-web/issues/1441)
- Self service edition unclear [\#1429](https://github.com/vatesfr/xo-web/issues/1429)
- Avoid "\_" char in job tag name [\#1414](https://github.com/vatesfr/xo-web/issues/1414)
- Display message if host reboot needed to apply patches [\#1352](https://github.com/vatesfr/xo-web/issues/1352)
- Color code on host PIF stats can be misleading [\#1265](https://github.com/vatesfr/xo-web/issues/1265)
- Sign in page is not rendered correctly [\#1161](https://github.com/vatesfr/xo-web/issues/1161)
- Template management [\#1091](https://github.com/vatesfr/xo-web/issues/1091)
- On pool view: collapse network list [\#1461](https://github.com/vatesfr/xo-web/issues/1461)
- Alert when trying to reboot/halt the pool master XS [\#1458](https://github.com/vatesfr/xo-web/issues/1458)
- Adding tooltip on Home page [\#1456](https://github.com/vatesfr/xo-web/issues/1456)
- Docker container management functionality missing from v5 [\#1442](https://github.com/vatesfr/xo-web/issues/1442)
- bad error message - delete snapshot [\#1433](https://github.com/vatesfr/xo-web/issues/1433)
- Create tag during VM creation [\#1431](https://github.com/vatesfr/xo-web/issues/1431)
### Bug fixes
- Display issues on plugin array edition [\#1663](https://github.com/vatesfr/xo-web/issues/1663)
- Import of delta backups fails [\#1656](https://github.com/vatesfr/xo-web/issues/1656)
- Host - Missing IP config for PIF [\#1651](https://github.com/vatesfr/xo-web/issues/1651)
- Remote copy is always activating compression [\#1645](https://github.com/vatesfr/xo-web/issues/1645)
- LB plugin UI problems [\#1630](https://github.com/vatesfr/xo-web/issues/1630)
- Keyboard shortcuts should not work when a modal is open [\#1589](https://github.com/vatesfr/xo-web/issues/1589)
- UI small bug in drop-down lists [\#1411](https://github.com/vatesfr/xo-web/issues/1411)
- md5 delta backup error [\#1672](https://github.com/vatesfr/xo-web/issues/1672)
- Can't edit VIF network [\#1640](https://github.com/vatesfr/xo-web/issues/1640)
- Do not expose shortcuts while console is focused [\#1614](https://github.com/vatesfr/xo-web/issues/1614)
- All users can see VM templates [\#1621](https://github.com/vatesfr/xo-web/issues/1621)
- Profile page is broken [\#1612](https://github.com/vatesfr/xo-web/issues/1612)
- SR delete should redirect to home [\#1611](https://github.com/vatesfr/xo-web/issues/1611)
- Delta VHD backup checksum is invalidated by chaining [\#1606](https://github.com/vatesfr/xo-web/issues/1606)
- VM with long description break on 2 lines [\#1580](https://github.com/vatesfr/xo-web/issues/1580)
- Network status on VM edition [\#1573](https://github.com/vatesfr/xo-web/issues/1573)
- VM template deletion fails [\#1571](https://github.com/vatesfr/xo-web/issues/1571)
- Template edition - "no such object" [\#1569](https://github.com/vatesfr/xo-web/issues/1569)
- missing links / element not displayed as links [\#1567](https://github.com/vatesfr/xo-web/issues/1567)
- Backup restore stalled on some SMB shares [\#1412](https://github.com/vatesfr/xo-web/issues/1412)
- Wrong bond display [\#1156](https://github.com/vatesfr/xo-web/issues/1156)
- Multiple reboot selection doesn't work [\#1562](https://github.com/vatesfr/xo-web/issues/1562)
- Server logs should be displayed in reverse chonological order [\#1547](https://github.com/vatesfr/xo-web/issues/1547)
- Cannot create resource sets without limits [\#1537](https://github.com/vatesfr/xo-web/issues/1537)
- UI - Weird display when editing long VM desc [\#1528](https://github.com/vatesfr/xo-web/issues/1528)
- Useless iso selector in host console [\#1527](https://github.com/vatesfr/xo-web/issues/1527)
- Pool and Host dummy welcome message [\#1519](https://github.com/vatesfr/xo-web/issues/1519)
- Bug on Network VM tab [\#1518](https://github.com/vatesfr/xo-web/issues/1518)
- Link to home with filter in query does not work [\#1513](https://github.com/vatesfr/xo-web/issues/1513)
- VHD merge fails with "RangeError: index out of range" on SMB remote [\#1511](https://github.com/vatesfr/xo-web/issues/1511)
- DR: previous VDIs are not removed [\#1510](https://github.com/vatesfr/xo-web/issues/1510)
- DR: previous copies not removed when same number as depth [\#1509](https://github.com/vatesfr/xo-web/issues/1509)
- Empty Saved Search doesn't load when set to default filter [\#1354](https://github.com/vatesfr/xo-web/issues/1354)
- Removing a user/group should delete its ACLs [\#899](https://github.com/vatesfr/xo-web/issues/899)
- OVA Import - XO stuck during import [\#1551](https://github.com/vatesfr/xo-web/issues/1551)
- SMB remote empty domain fails [\#1499](https://github.com/vatesfr/xo-web/issues/1499)
- Can't edit a remote password [\#1498](https://github.com/vatesfr/xo-web/issues/1498)
- Issue in VM create with CoreOS [\#1493](https://github.com/vatesfr/xo-web/issues/1493)
- Overlapping months in backup view [\#1488](https://github.com/vatesfr/xo-web/issues/1488)
- No line break for SSH key in user view [\#1475](https://github.com/vatesfr/xo-web/issues/1475)
- Create VIF UI issues [\#1472](https://github.com/vatesfr/xo-web/issues/1472)
## **5.2.0** (2016-09-09)
### Enhancements
@@ -51,7 +295,7 @@
- Giving resource set to end-user ends with error [\#1448](https://github.com/vatesfr/xo-web/issues/1448)
- Error thrown when cancelling out of Delete User confirmation dialog [\#1439](https://github.com/vatesfr/xo-web/issues/1439)
- Wrong month label shown in Backup and Job scheduler [\#1438](https://github.com/vatesfr/xo-web/issues/1438)
- Bug on Self service creation/edition [\#1438](https://github.com/vatesfr/xo-web/issues/1428)
- Bug on Self service creation/edition [\#1428](https://github.com/vatesfr/xo-web/issues/1428)
- ISO selection during VM create is not mounted after [\#1415](https://github.com/vatesfr/xo-web/issues/1415)
- Hosts general view: bad link for storage [\#1408](https://github.com/vatesfr/xo-web/issues/1408)
- Backup Schedule - "Month" and "Day of Week" display error [\#1404](https://github.com/vatesfr/xo-web/issues/1404)

View File

@@ -1,4 +1,4 @@
# Xen Orchestra Web [![Build Status](https://travis-ci.org/vatesfr/xo-web.png?branch=master)](https://travis-ci.org/vatesfr/xo-web)
# Xen Orchestra Web [![Chat with us](https://storage.crisp.im/plugins/images/936925df-f37b-4ba8-bab0-70cd2edcb0be/badge.svg)](https://go.crisp.im/chat/embed/?website_id=-JzqzzwddSV7bKGtEyAQ) [![Build Status](https://travis-ci.org/vatesfr/xo-web.png?branch=master)](https://travis-ci.org/vatesfr/xo-web)
![](http://i.imgur.com/tRffA5y.png)
@@ -10,7 +10,7 @@ ___
## Installation
XOA or manual install procedure is [available here](https://github.com/vatesfr/xo/blob/master/doc/installation/README.md)
XOA or manual install procedure is [available here](https://xen-orchestra.com/docs/installation.html)
## Compilation

View File

@@ -11,17 +11,6 @@ var DIST_DIR = __dirname + '/dist' // eslint-disable-line no-path-concat
// http://www.random.org/integers/?num=1&min=1024&max=65535&col=1&base=10&format=plain&rnd=new
var LIVERELOAD_PORT = 26242
// Port to use for the embedded web server.
//
// Set to 0 to choose a random port at each run.
var SERVER_PORT = LIVERELOAD_PORT + 1
// Address the server should bind to.
//
// - `'localhost'` to make it accessible from this host only
// - `null` to make it accessible for the whole network
var SERVER_ADDR = 'localhost'
var PRODUCTION = process.env.NODE_ENV === 'production'
var DEVELOPMENT = !PRODUCTION
@@ -173,7 +162,7 @@ function browserify (path, opts) {
var bundler = require('browserify')(path, {
basedir: SRC_DIR,
debug: DEVELOPMENT, // TODO: enable also in production but need to make it work with gulp-uglify.
debug: true,
extensions: opts.extensions,
fullPaths: false,
paths: SRC_DIR + '/common',
@@ -249,8 +238,8 @@ function browserify (path, opts) {
gulp.task(function buildPages () {
return pipe(
src('index.jade', { sourcemaps: true }),
require('gulp-jade')(),
src('index.pug', { sourcemaps: true }),
require('gulp-pug')(),
DEVELOPMENT && require('gulp-embedlr')({
port: LIVERELOAD_PORT
}),
@@ -268,6 +257,7 @@ gulp.task(function buildScripts () {
}]
]
}),
require('gulp-sourcemaps').init({ loadMaps: true }),
PRODUCTION && require('gulp-uglify')(),
dest()
)
@@ -313,27 +303,3 @@ gulp.task('build', gulp.parallel(
gulp.task(function clean (done) {
require('rimraf')(DIST_DIR, done)
})
// -------------------------------------------------------------------
gulp.task(function server (done) {
require('connect')()
.use(require('serve-static')(DIST_DIR))
.listen(SERVER_PORT, SERVER_ADDR, function onListen () {
var address = this.address()
var port = address.port
address = address.address
// Correctly handle IPv6 addresses.
if (address.indexOf(':') !== -1) {
address = '[' + address + ']'
}
console.log('Listening on http://' + address + ':' + port)
})
.on('error', done)
.on('close', function onClose () {
done()
})
})

View File

@@ -1,7 +1,7 @@
{
"private": false,
"name": "xo-web",
"version": "5.2.0",
"version": "5.7.9",
"license": "AGPL-3.0",
"description": "Web interface client for Xen-Orchestra",
"keywords": [
@@ -33,76 +33,91 @@
"devDependencies": {
"ansi_up": "^1.3.0",
"asap": "^2.0.4",
"ava": "^0.16.0",
"babel-eslint": "^6.0.0",
"babel-eslint": "^7.0.0",
"babel-plugin-dev": "^1.0.0",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-react-constant-elements": "^6.5.0",
"babel-plugin-transform-react-inline-elements": "^6.6.5",
"babel-plugin-transform-react-jsx-self": "^6.11.0",
"babel-plugin-transform-react-jsx-source": "^6.9.0",
"babel-plugin-transform-runtime": "^6.6.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.16.3",
"babel-runtime": "^6.6.1",
"babelify": "^7.2.0",
"benchmark": "^2.1.0",
"bootstrap": "github:twbs/bootstrap#v4-dev",
"browserify": "^13.0.0",
"bootstrap": "4.0.0-alpha.5",
"browserify": "^14.1.0",
"bundle-collapser": "^1.2.1",
"chartist-plugin-legend": "^0.5.0",
"chartist": "^0.10.1",
"chartist-plugin-legend": "^0.6.1",
"chartist-plugin-tooltip": "0.0.11",
"classnames": "^2.2.3",
"connect": "^3.4.1",
"cookies-js": "^1.2.2",
"d3": "^4.0.0-alpha.50",
"d3": "^4.2.8",
"dependency-check": "^2.5.1",
"font-awesome": "^4.5.0",
"enzyme": "^2.6.0",
"enzyme-to-json": "^1.4.4",
"event-to-promise": "^0.7.0",
"font-awesome": "^4.7.0",
"font-mfizz": "github:fizzed/font-mfizz",
"get-stream": "^2.3.0",
"ghooks": "^1.1.1",
"globby": "^6.0.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-autoprefixer": "^3.1.0",
"gulp-csso": "^2.0.0",
"gulp-csso": "^3.0.0",
"gulp-embedlr": "^0.5.2",
"gulp-jade": "^1.1.0",
"gulp-plumber": "^1.1.0",
"gulp-pug": "^3.1.0",
"gulp-refresh": "^1.1.0",
"gulp-sass": "^2.2.0",
"gulp-sass": "^3.0.0",
"gulp-sourcemaps": "^2.2.3",
"gulp-uglify": "^2.0.0",
"gulp-watch": "^4.3.5",
"human-format": "^0.6.0",
"human-format": "^0.7.0",
"husky": "^0.13.1",
"index-modules": "^0.3.0",
"is-ip": "^1.0.0",
"jsonrpc-websocket-client": "0.0.1-5",
"jest": "^19.0.2",
"jsonrpc-websocket-client": "^0.1.1",
"kindof": "^2.0.0",
"later": "^1.2.0",
"lodash": "^4.6.1",
"loose-envify": "^1.1.0",
"make-error": "^1.2.1",
"marked": "^0.3.5",
"modular-css": "^0.27.1",
"modular-css": "^4.1.1",
"moment": "^2.13.0",
"moment-timezone": "^0.5.4",
"notifyjs": "^2.0.1",
"notifyjs": "^3.0.0",
"novnc-node": "^0.5.3",
"promise-toolbox": "^0.5.0",
"promise-toolbox": "^0.8.0",
"random-password": "^0.1.2",
"react": "^15.0.0",
"react": "^15.4.1",
"react-addons-shallow-compare": "^15.1.0",
"react-addons-test-utils": "^15.4.1",
"react-bootstrap-4": "^0.29.1",
"react-chartist": "^0.10.1",
"react-chartist": "^0.12.0",
"react-copy-to-clipboard": "^4.0.2",
"react-debounce-input": "^2.4.0",
"react-dnd": "^2.1.4",
"react-dnd-html5-backend": "^2.1.2",
"react-document-title": "^2.0.2",
"react-dom": "^15.0.0",
"react-dom": "^15.4.1",
"react-dropzone": "^3.5.0",
"react-intl": "^2.0.1",
"react-key-handler": "^0.2.0",
"react-key-handler": "^0.3.0",
"react-notify": "^2.0.1",
"react-redux": "^4.4.0",
"react-router": "^3.0.0-alpha.1",
"react-select": "^1.0.0-beta13",
"react-overlays": "^0.6.0",
"react-redux": "^5.0.0",
"react-router": "^3.0.0",
"react-select": "^1.0.0-rc.3",
"react-shortcuts": "^1.3.1",
"react-sparklines": "^1.5.0",
"react-virtualized": "^7.4.0",
"react-virtualized": "^8.0.8",
"readable-stream": "^2.0.6",
"redux": "^3.3.1",
"redux-devtools": "^3.1.1",
@@ -110,27 +125,31 @@
"redux-devtools-log-monitor": "^1.0.5",
"redux-thunk": "^2.0.1",
"reselect": "^2.2.1",
"serve-static": "^1.10.2",
"standard": "^8.0.0",
"superagent": "^2.0.0",
"semver": "^5.3.0",
"standard": "^10.0.0",
"styled-components": "^1.4.4",
"superagent": "^3.5.0",
"tar-stream": "^1.5.2",
"vinyl": "^1.1.1",
"uncontrollable-input": "^0.0.1",
"vinyl": "^2.0.0",
"watchify": "^3.7.0",
"xml2js": "^0.4.17",
"xo-acl-resolver": "^0.2.1",
"xo-acl-resolver": "^0.2.3",
"xo-common": "0.1.0",
"xo-lib": "^0.8.0",
"xo-remote-parser": "^0.3"
},
"scripts": {
"benchmarks": "./tools/run-benchmarks.js 'src/**/*.bench.js'",
"build": "npm run build-indexes && NODE_ENV=production gulp build",
"build-indexes": "./tools/generate-index src/common/intl/locales",
"dev": "npm run build-indexes && gulp build server",
"dev-test": "ava --watch",
"build-indexes": "index-modules --auto src",
"commitmsg": "npm test",
"dev": "npm run build-indexes && NODE_ENV=development gulp build",
"dev-test": "jest --watch",
"lint": "standard",
"posttest": "npm run lint",
"prepublish": "npm run build",
"test": "ava"
"test": "jest"
},
"browserify": {
"transform": [
@@ -138,17 +157,14 @@
"loose-envify"
]
},
"ava": {
"babel": "inherit",
"files": [
"src/**/*.spec.js"
],
"require": [
"babel-register"
]
},
"babel": {
"env": {
"development": {
"plugins": [
"transform-react-jsx-self",
"transform-react-jsx-source"
]
},
"production": {
"plugins": [
"transform-react-constant-elements",
@@ -157,6 +173,8 @@
}
},
"plugins": [
"dev",
"lodash",
"transform-decorators-legacy",
"transform-runtime"
],
@@ -166,12 +184,15 @@
"stage-0"
]
},
"config": {
"ghooks": {
"commit-msg": "npm test"
}
"jest": {
"snapshotSerializers": [
"enzyme-to-json/serializer"
]
},
"standard": {
"globals": [
"__DEV__"
],
"ignore": [
"dist"
],

View File

@@ -4,16 +4,16 @@
$ct-series-colors: (
$brand-success,
$brand-primary,
#60bd68,
#f17cb0,
#b2912f,
#b276b2,
#decf3f,
#f15854,
#4d4d4d,
#dda458,
#eacf7d,
#86797d,
#b276b2,
#f15854,
#b2912f,
#decf3f,
#dda458,
#60bd68,
#4d4d4d,
#eacf7d,
#b2c326,
#6188e2,
#a748ca
@@ -27,6 +27,13 @@ $ct-series-colors: (
flex-direction: column-reverse;
}
// safari has a bug in flex computing that prevent charts from showing see #1755
// by fixing the height with a value found in Chrome it seems like it fixes the issue without breaking the layout
// elsewhere
.dashboardItem .ct-chart {
height: 150px;
}
// Line in charts with only 2px in width
.ct-line {
stroke-width: 2px;

View File

@@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Col 1`] = `
<div
className="col-xs-12"
/>
`;
exports[`Container 1`] = `
<div
className="container-fluid"
/>
`;
exports[`Row 1`] = `
<div
className=" row"
/>
`;

View File

@@ -1,30 +1,36 @@
import _ from 'intl'
import ActionButton from 'action-button'
import map from 'lodash/map'
import React from 'react'
import Tooltip from 'tooltip'
import {
ButtonGroup
} from 'react-bootstrap-4/lib'
import {
noop
} from 'utils'
import { map, noop } from 'lodash'
import _ from './intl'
import ActionButton from './action-button'
import ButtonGroup from './button-group'
const ActionBar = ({ actions, param }) => (
<ButtonGroup>
{map(actions, ({ handler, handlerParam = param, label, icon, redirectOnSuccess }, index) => (
<Tooltip key={index} content={_(label)}>
<ActionButton
key={index}
btnStyle='secondary'
handler={handler || noop}
handlerParam={handlerParam}
icon={icon}
redirectOnSuccess={redirectOnSuccess}
size='large'
/>
</Tooltip>
))}
{map(actions, (button, index) => {
if (!button) {
return
}
const {
handler,
handlerParam = param,
icon,
label,
pending,
redirectOnSuccess
} = button
return <ActionButton
key={index}
handler={handler || noop}
handlerParam={handlerParam}
icon={icon}
pending={pending}
redirectOnSuccess={redirectOnSuccess}
size='large'
tooltip={_(label)}
/>
})}
</ButtonGroup>
)
ActionBar.propTypes = {

View File

@@ -1,57 +1,82 @@
import Icon from 'icon'
import isFunction from 'lodash/isFunction'
import React from 'react'
import { Button } from 'react-bootstrap-4/lib'
import Button from './button'
import Component from './base-component'
import Icon from './icon'
import logError from './log-error'
import propTypes from './prop-types'
import Tooltip from './tooltip'
import { error as _error } from './notification'
@propTypes({
btnStyle: propTypes.string,
// React element to use as button content
children: propTypes.node,
// whether this button is disabled (default to false)
disabled: propTypes.bool,
// form identifier
//
// if provided, this button and its action are associated to this
// form for the submit event
form: propTypes.string,
// function to call when the action is triggered (via a clik on the
// button or submit on the form)
handler: propTypes.func.isRequired,
// optional value which will be passed as first param to the handler
handlerParam: propTypes.any,
// XO icon to use for this button
icon: propTypes.string.isRequired,
// whether the action of this action is already underway
pending: propTypes.bool,
// path to redirect to when the triggered action finish successfully
//
// if a function, it will be called with the result of the action to
// compute the path
redirectOnSuccess: propTypes.oneOfType([
propTypes.func,
propTypes.string
]),
size: propTypes.oneOf([
'large',
'small'
])
// React element to use tooltip for the component
tooltip: propTypes.node
})
export default class ActionButton extends Component {
static contextTypes = {
router: React.PropTypes.object
router: propTypes.object
}
async _execute () {
if (this.state.working) {
if (this.props.pending || this.state.working) {
return
}
const {
children,
handler,
handlerParam
handlerParam,
tooltip
} = this.props
try {
this.setState({
error: null,
error: undefined,
working: true
})
const result = await handler(handlerParam)
let { redirectOnSuccess } = this.props
const { redirectOnSuccess } = this.props
if (redirectOnSuccess) {
if (isFunction(redirectOnSuccess)) {
redirectOnSuccess = redirectOnSuccess(result)
}
return this.context.router.push(redirectOnSuccess)
return this.context.router.push(
isFunction(redirectOnSuccess) ? redirectOnSuccess(result) : redirectOnSuccess
)
}
this.setState({
@@ -62,7 +87,12 @@ export default class ActionButton extends Component {
error,
working: false
})
logError(error)
// ignore when undefined because it usually means that the action has been canceled
if (error !== undefined) {
logError(error)
_error(children || tooltip || error.name, error.message || String(error))
}
}
}
_execute = ::this._execute
@@ -91,29 +121,36 @@ export default class ActionButton extends Component {
render () {
const {
props: {
btnStyle,
children,
className,
disabled,
form,
icon,
size: bsSize,
style
pending,
tooltip,
...props
},
state: { error, working }
} = this
return <Button
bsStyle={error ? 'warning' : btnStyle}
form={form}
onClick={!form && this._execute}
disabled={working || disabled}
type={form ? 'submit' : 'button'}
{...{ bsSize, className, style }}
>
<Icon icon={working ? 'loading' : icon} fixedWidth />
if (error !== undefined) {
props.btnStyle = 'warning'
}
if (pending || working) {
props.disabled = true
}
delete props.handler
delete props.handlerParam
if (props.form === undefined) {
props.onClick = this._execute
}
delete props.redirectOnSuccess
const button = <Button {...props}>
<Icon icon={pending || working ? 'loading' : icon} fixedWidth />
{children && ' '}
{children}
</Button>
return tooltip
? <Tooltip content={tooltip}>{button}</Tooltip>
: button
}
}

View File

@@ -3,18 +3,21 @@ import includes from 'lodash/includes'
import isArray from 'lodash/isArray'
import forEach from 'lodash/forEach'
import map from 'lodash/map'
import { Component } from 'react'
import { PureComponent } from 'react'
import getEventValue from './get-event-value'
import invoke from './invoke'
import shallowEqual from './shallow-equal'
// Should components logs every renders?
//
// Usually set to process.env.NODE_ENV !== 'production'.
const VERBOSE = false
const cowSet = (object, path, value, depth) => {
if (depth >= path.length) {
return value
}
object = clone(object)
object = object != null ? clone(object) : {}
const prop = path[depth]
object[prop] = cowSet(object[prop], path, value, depth + 1)
return object
@@ -31,7 +34,7 @@ const get = (object, path, depth) => {
: get(object[prop], path, depth)
}
export default class BaseComponent extends Component {
export default class BaseComponent extends PureComponent {
constructor (props, context) {
super(props, context)
@@ -40,12 +43,12 @@ export default class BaseComponent extends Component {
this._linkedState = null
if (process.env.NODE_ENV !== 'production') {
this.render = invoke(this.render, render => () => {
if (VERBOSE) {
this.render = (render => () => {
console.log('render', this.constructor.name)
return render.call(this)
})
})(this.render)
}
}
@@ -97,7 +100,7 @@ export default class BaseComponent extends Component {
if (includes(name, '.')) {
const path = name.split('.')
return (linkedState[path] = event => {
this.setState(cowSet(this.state, path, !get(this.state, path), 0))
this.setState(cowSet(this.state, path, !get(this.state, path, 0), 0))
})
}
@@ -107,16 +110,9 @@ export default class BaseComponent extends Component {
})
})
}
shouldComponentUpdate (newProps, newState) {
return !(
shallowEqual(this.props, newProps) &&
shallowEqual(this.state, newState)
)
}
}
if (process.env.NODE_ENV !== 'production') {
if (VERBOSE) {
const diff = (name, old, cur) => {
const keys = []

View File

@@ -0,0 +1,8 @@
import React from 'react'
const ButtonGroup = ({ children }) =>
<div className='btn-group' role='group'>
{children}
</div>
export { ButtonGroup as default }

56
src/common/button.js Normal file
View File

@@ -0,0 +1,56 @@
import classNames from 'classnames'
import React from 'react'
import propTypes from './prop-types'
const Button = ({
active,
block,
btnStyle = 'secondary',
children,
outline,
size,
...props
}) => {
props.className = classNames(
props.className,
'btn',
`btn${outline ? '-outline' : ''}-${btnStyle}`,
active !== undefined && 'active',
block && 'btn-block',
size === 'large' ? 'btn-lg' : size === 'small' ? 'btn-sm' : null
)
if (props.type === undefined && props.form === undefined) {
props.type = 'button'
}
return <button {...props}>{children}</button>
}
propTypes(Button)({
active: propTypes.bool,
block: propTypes.bool,
// Bootstrap button style
//
// See https://v4-alpha.getbootstrap.com/components/buttons/#examples
//
// The default value (secondary) is not listed here because it does
// not make sense to explicit it.
btnStyle: propTypes.oneOf([
'danger',
'info',
'link',
'primary',
'success',
'warning'
]),
outline: propTypes.bool,
size: propTypes.oneOf([
'large',
'small'
])
})
export { Button as default }

View File

@@ -1,5 +1,6 @@
import React from 'react'
import Button from './button'
import Component from './base-component'
import Icon from './icon'
import propTypes from './prop-types'
@@ -7,9 +8,14 @@ import propTypes from './prop-types'
@propTypes({
children: propTypes.any.isRequired,
className: propTypes.string,
buttonText: propTypes.any.isRequired
buttonText: propTypes.any.isRequired,
defaultOpen: propTypes.bool
})
export default class Collapse extends Component {
state = {
isOpened: this.props.defaultOpen
}
_onClick = () => {
this.setState({
isOpened: !this.state.isOpened
@@ -22,9 +28,9 @@ export default class Collapse extends Component {
return (
<div className={props.className}>
<button className='btn btn-lg btn-primary btn-block' onClick={this._onClick}>
<Button block btnStyle='primary' size='large' onClick={this._onClick}>
{props.buttonText} <Icon icon={`chevron-${isOpened ? 'up' : 'down'}`} />
</button>
</Button>
{isOpened && props.children}
</div>
)

64
src/common/combobox.js Normal file
View File

@@ -0,0 +1,64 @@
import React from 'react'
import uncontrollableInput from 'uncontrollable-input'
import { isEmpty, map } from 'lodash'
import {
DropdownButton,
MenuItem
} from 'react-bootstrap-4/lib'
import Component from './base-component'
import propTypes from './prop-types'
@uncontrollableInput({
defaultValue: ''
})
@propTypes({
disabled: propTypes.bool,
options: propTypes.oneOfType([
propTypes.arrayOf(propTypes.string),
propTypes.objectOf(propTypes.string)
]),
onChange: propTypes.func.isRequired,
value: propTypes.string.isRequired
})
export default class Combobox extends Component {
_handleChange = event => {
this.props.onChange(event.target.value)
}
_setText (value) {
this.props.onChange(value)
}
render () {
const { options, ...props } = this.props
props.className = 'form-control'
props.onChange = this._handleChange
const Input = <input {...props} />
if (isEmpty(options)) {
return Input
}
return (
<div className='input-group'>
<div className='input-group-btn'>
<DropdownButton
bsStyle='secondary'
disabled={props.disabled}
id='selectInput'
title=''
>
{map(options, option =>
<MenuItem key={option} onClick={() => this._setText(option)}>
{option}
</MenuItem>
)}
</DropdownButton>
</div>
{Input}
</div>
)
}
}

View File

@@ -1,3 +0,0 @@
.button {
border-radius: 0px;
};

View File

@@ -1,101 +0,0 @@
import map from 'lodash/map'
import React from 'react'
import size from 'lodash/size'
import Component from '../base-component'
import propTypes from '../prop-types'
import { ensureArray } from '../utils'
import {
DropdownButton,
MenuItem
} from 'react-bootstrap-4/lib'
import styles from './index.css'
@propTypes({
defaultValue: propTypes.any,
disabled: propTypes.bool,
options: propTypes.oneOfType([
propTypes.arrayOf(propTypes.string),
propTypes.number,
propTypes.objectOf(propTypes.string),
propTypes.string
]),
onChange: propTypes.func,
placeholder: propTypes.string,
required: propTypes.bool,
step: propTypes.any,
type: propTypes.string,
value: propTypes.any
})
export default class Combobox extends Component {
static defaultProps = {
type: 'text'
}
get value () {
return this.refs.input.value
}
set value (value) {
this.refs.input.value = value
}
_handleChange = event => {
const { onChange } = this.props
if (onChange) {
onChange(event.target.value)
}
}
_setText (value) {
this.refs.input.value = value
}
render () {
const { props } = this
const options = ensureArray(props.options)
const Input = (
<input
className='form-control'
defaultValue={props.defaultValue}
disabled={props.disabled}
options={options}
onChange={this._handleChange}
placeholder={props.placeholder}
ref='input'
required={props.required}
step={props.step}
type={props.type}
value={props.value}
/>
)
if (!size(options)) {
return Input
}
return (
<div className='input-group'>
<div className='input-group-btn'>
<DropdownButton
bsStyle='secondary'
className={styles.button}
disabled={props.disabled}
id='selectInput'
title=''
>
{map(options, option => (
<MenuItem key={option} onClick={() => this._setText(option)}>
{option}
</MenuItem>
))}
</DropdownButton>
</div>
{Input}
</div>
)
}
}

View File

@@ -3,10 +3,11 @@ import {
createOr,
createNot,
createProperty,
createString
createString,
createTruthyProperty
} from './'
export const pattern = 'foo !"\\\\ \\"" name:|(wonderwoman batman)'
export const pattern = 'foo !"\\\\ \\"" name:|(wonderwoman batman) hasCape?'
export const ast = createAnd([
createString('foo'),
@@ -14,5 +15,6 @@ export const ast = createAnd([
createProperty('name', createOr([
createString('wonderwoman'),
createString('batman')
]))
])),
createTruthyProperty('hasCape')
])

View File

@@ -56,19 +56,22 @@ export const createProperty = (name, child) => ({ type: 'property', name, child
export const createString = value => ({ type: 'string', value })
export const createTruthyProperty = name => ({ type: 'truthyProperty', name })
// -------------------------------------------------------------------
// *and = terms
// terms = term+
// term = ws (groupedAnd | or | not | property | string) ws
// ws = ' '*
// groupedAnd = "(" and ")"
// *or = "|" ws "(" terms ")"
// *not = "!" term
// *property = string ws ":" term
// *string = quotedString | rawString
// quotedString = "\"" ( /[^"\]/ | "\\\\" | "\\\"" )+
// rawString = /[a-z0-9-_.]+/i
// *and = terms
// terms = term+
// term = ws (groupedAnd | or | not | property | truthyProperty | string) ws
// ws = ' '*
// groupedAnd = "(" and ")"
// *or = "|" ws "(" terms ")"
// *not = "!" term
// *property = string ws ":" term
// *truthyProperty = string ws "?"
// *string = quotedString | rawString
// quotedString = "\"" ( /[^"\]/ | "\\\\" | "\\\"" )+
// rawString = /[a-z0-9-_.]+/i
export const parse = invoke(() => {
let i
let n
@@ -108,6 +111,7 @@ export const parse = invoke(() => {
parseOr() ||
parseNot() ||
parseProperty() ||
parseTruthyProperty() ||
parseString()
)
if (child) {
@@ -203,6 +207,16 @@ export const parse = invoke(() => {
return value
}
}
const parseTruthyProperty = backtrace(() => {
let name
if (
(name = parseString()) &&
parseWs() &&
input[i++] === '?'
) {
return createTruthyProperty(name.value)
}
})
return input_ => {
if (!input_) {
@@ -280,10 +294,10 @@ export const getPropertyClausesStrings = function () {
export const removePropertyClause = function (name) {
let type
if (
!this ||
(type = this.type) === 'property' && this.name === name
) {
if (!this || (
(type = this.type) === 'property' &&
this.name === name
)) {
return
}
@@ -321,7 +335,7 @@ export const setPropertyClause = function (name, child) {
return _addAndClause(
this,
property,
node => node.type === 'property' && node.name === name,
node => node.type === 'property' && node.name === name
)
}
@@ -341,6 +355,7 @@ export const execute = invoke(() => {
property: ({ name, child }, value) => (
value != null && child::execute(value[name])
),
truthyProperty: ({ name }, value) => !!value[name],
string: invoke(() => {
const match = (pattern, value) => {
if (isString(value)) {
@@ -378,7 +393,8 @@ export const toString = invoke(() => {
property: ({ name, child }) => `${toString(createString(name))}:${toString(child)}`,
string: ({ value }) => isRawString(value)
? value
: `"${value.replace(/\\|"/g, match => `\\${match}`)}"`
: `"${value.replace(/\\|"/g, match => `\\${match}`)}"`,
truthyProperty: ({ name }) => `${toString(createString(name))}?`
}
const toString = node => visitors[node.type](node)

View File

@@ -1,4 +1,4 @@
import test from 'ava'
/* eslint-env jest */
import {
getPropertyClausesStrings,
@@ -11,43 +11,36 @@ import {
pattern
} from './index.fixtures'
test('getPropertyClausesStrings', t => {
let tmp = parse('foo bar:baz baz:|(foo bar)')::getPropertyClausesStrings()
t.deepEqual(
tmp,
{
bar: [ 'baz' ],
baz: [ 'foo', 'bar' ]
}
)
it('getPropertyClausesStrings', () => {
const tmp = parse('foo bar:baz baz:|(foo bar)')::getPropertyClausesStrings()
expect(tmp).toEqual({
bar: [ 'baz' ],
baz: [ 'foo', 'bar' ]
})
})
test('parse', t => {
t.deepEqual(parse(pattern), ast)
it('parse', () => {
expect(parse(pattern)).toEqual(ast)
})
test('setPropertyClause', t => {
t.is(
null::setPropertyClause('foo', 'bar')::toString(),
'foo:bar'
)
it('setPropertyClause', () => {
expect(
null::setPropertyClause('foo', 'bar')::toString()
).toBe('foo:bar')
t.is(
parse('baz')::setPropertyClause('foo', 'bar')::toString(),
'baz foo:bar'
)
expect(
parse('baz')::setPropertyClause('foo', 'bar')::toString()
).toBe('baz foo:bar')
t.is(
parse('plip foo:baz plop')::setPropertyClause('foo', 'bar')::toString(),
'plip plop foo:bar'
)
expect(
parse('plip foo:baz plop')::setPropertyClause('foo', 'bar')::toString()
).toBe('plip plop foo:bar')
t.is(
parse('foo:|(baz plop)')::setPropertyClause('foo', 'bar')::toString(),
'foo:bar'
)
expect(
parse('foo:|(baz plop)')::setPropertyClause('foo', 'bar')::toString()
).toBe('foo:bar')
})
test('toString', t => {
t.is(pattern, ast::toString())
it('toString', () => {
expect(pattern).toBe(ast::toString())
})

View File

@@ -1,30 +1,31 @@
import _ from 'intl'
import CopyToClipboard from 'react-copy-to-clipboard'
import classNames from 'classnames'
import Tooltip from 'tooltip'
import React, { createElement } from 'react'
import _ from '../intl'
import Button from '../button'
import Icon from '../icon'
import propTypes from '../prop-types'
import Tooltip from '../tooltip'
import styles from './index.css'
const Copiable = propTypes({
data: propTypes.string,
tagName: propTypes.string
})(props => createElement(
props.tagName || 'span',
})(({ className, tagName = 'span', ...props }) => createElement(
tagName,
{
...props,
className: classNames(styles.container, props.className)
className: classNames(styles.container, className)
},
props.children,
' ',
<Tooltip content={_('copyToClipboard')}>
<CopyToClipboard text={props.data || props.children}>
<button className={classNames('btn btn-sm btn-secondary', styles.button)}>
<Button className={styles.button} size='small'>
<Icon icon='clipboard' />
</button>
</Button>
</CopyToClipboard>
</Tooltip>
))

View File

@@ -1,7 +1,9 @@
import React, { Component, PropTypes } from 'react'
import { isPromise } from 'promise-toolbox'
const toString = value => JSON.stringify(value, null, 2)
const toString = value => value === undefined
? 'undefined'
: JSON.stringify(value, null, 2)
// This component does not handle changes in its `promise` property.
class DebugAsync extends Component {
@@ -35,8 +37,8 @@ class DebugAsync extends Component {
return <pre>
{'Promise { '}
{status === 'rejected' && '<rejected> '}
{toString(value)}
{status === 'rejected' && '<rejected> '}
{toString(value)}
{' }'}
</pre>
}

View File

@@ -0,0 +1,22 @@
@value dropzoneColor: #8f8686;
.dropzone {
border-radius: 4px;
border: 2px dashed dropzoneColor;
cursor: pointer;
display: flex;
height: 12em;
margin-bottom: 20px;
width: 100%;
}
.activeDropzone {
background: #f0f0f0;
border-style: solid;
}
.dropzoneText {
color: dropzoneColor;
font-size: 1.2em;
margin: auto;
}

View File

@@ -0,0 +1,20 @@
import Component from 'base-component'
import propTypes from 'prop-types'
import React from 'react'
import ReactDropzone from 'react-dropzone'
import styles from './index.css'
@propTypes({
onDrop: propTypes.func,
message: propTypes.node
})
export default class Dropzone extends Component {
render () {
const { onDrop, message } = this.props
return <ReactDropzone onDrop={onDrop} className={styles.dropzone} activeClassName={styles.activeDropzone}>
<div className={styles.dropzoneText}>{message}</div>
</ReactDropzone>
}
}

View File

@@ -0,0 +1,13 @@
.clickToEdit * {
cursor: context-menu !important;
}
.shortClick {
border-bottom: 1px dashed #ccc;
}
.select {
padding: 0px;
}
.size {
width: 10rem;
}

View File

@@ -1,3 +1,4 @@
import classNames from 'classnames'
import findKey from 'lodash/findKey'
import isFunction from 'lodash/isFunction'
import isString from 'lodash/isString'
@@ -5,37 +6,32 @@ import map from 'lodash/map'
import pick from 'lodash/pick'
import React from 'react'
import _ from './intl'
import Component from './base-component'
import Icon from './icon'
import logError from './log-error'
import propTypes from './prop-types'
import Tooltip from './tooltip'
import { formatSize } from './utils'
import { SizeInput } from './form'
import _ from '../intl'
import Component from '../base-component'
import getEventValue from '../get-event-value'
import Icon from '../icon'
import logError from '../log-error'
import propTypes from '../prop-types'
import Tooltip from '../tooltip'
import { formatSize } from '../utils'
import { SizeInput } from '../form'
import {
SelectHost,
SelectIp,
SelectNetwork,
SelectPool,
SelectRemote,
SelectResourceSetIp,
SelectSr,
SelectSubject,
SelectTag,
SelectVm,
SelectVmTemplate
} from './select-objects'
} from '../select-objects'
import styles from './index.css'
const LONG_CLICK = 400
const SELECT_STYLE = { padding: '0px' }
const SIZE_STYLE = { width: '10rem' }
const EDITABLE_STYLE = {
borderBottom: '1px dashed #ccc',
cursor: 'context-menu'
}
const LONG_EDITABLE_STYLE = {
cursor: 'context-menu'
}
@propTypes({
alt: propTypes.node.isRequired
@@ -140,7 +136,8 @@ class Editable extends Component {
this._closeEdition()
} catch (error) {
this.setState({
error: isString(error) ? error : error.message,
// `error` may be undefined if the action has been cancelled
error: error !== undefined && (isString(error) ? error : error.message),
saving: false
})
logError(error)
@@ -164,7 +161,7 @@ class Editable extends Component {
const { useLongClick } = props
const success = <Icon icon='success' />
return <span style={useLongClick ? LONG_EDITABLE_STYLE : EDITABLE_STYLE}>
return <span className={classNames(styles.clickToEdit, !useLongClick && styles.shortClick)}>
<span
onClick={!useLongClick && this._openEdition}
onMouseDown={useLongClick && this.__startTimer}
@@ -264,7 +261,8 @@ export class Text extends Editable {
readOnly={saving}
ref='input'
style={{
width: `${value.length + 1}ex`
width: `${value.length + 1}ex`,
maxWidth: '50ex'
}}
type={this._isPassword ? 'password' : 'text'}
/>
@@ -311,61 +309,66 @@ export class Number extends Component {
}
@propTypes({
labelProp: propTypes.string.isRequired,
options: propTypes.oneOfType([
propTypes.array,
propTypes.object
]).isRequired
]).isRequired,
renderer: propTypes.func
})
export class Select extends Editable {
constructor (props) {
super()
this._defaultValue = findKey(props.options, option => option === props.value)
componentWillReceiveProps (props) {
if (
props.value !== this.props.value ||
props.options !== this.props.options
) {
this.setState({ valueKey: findKey(props.options, option => option === props.value) })
}
}
get value () {
return this.props.options[this._select.value]
return this.props.options[this.state.valueKey]
}
_onChange = event => {
this._save()
this.setState({ valueKey: getEventValue(event) }, this._save)
}
_optionToJsx = (option, index) => {
const { labelProp } = this.props
_optionToJsx = (option, key) => {
const { renderer } = this.props
return <option
key={index}
value={index}
key={key}
value={key}
>
{labelProp ? option[labelProp] : option}
{renderer ? renderer(option) : option}
</option>
}
_onEditionMount = ref => {
this._select = ref
// Seems to work in Google Chrome (not in Firefox)
ref && ref.dispatchEvent(new window.MouseEvent('mousedown'))
}
_renderDisplay () {
return this.props.children ||
<span>{this.props.value[this.props.labelProp]}</span>
const { children, renderer, value } = this.props
return children ||
<span>{renderer ? renderer(value) : value}</span>
}
_renderEdition () {
const { saving } = this.state
const { saving, valueKey } = this.state
const { options } = this.props
return <select
autoFocus
className='form-control'
defaultValue={this._defaultValue}
className={classNames('form-control', styles.select)}
onBlur={this._closeEdition}
onChange={this._onChange}
onKeyDown={this._onKeyDown}
readOnly={saving}
ref={this._onEditionMount}
style={SELECT_STYLE}
value={valueKey}
>
{map(options, this._optionToJsx)}
</select>
@@ -378,6 +381,7 @@ const MAP_TYPE_SELECT = {
network: SelectNetwork,
pool: SelectPool,
remote: SelectRemote,
resourceSetIp: SelectResourceSetIp,
SR: SelectSr,
subject: SelectSubject,
tag: SelectTag,
@@ -387,15 +391,14 @@ const MAP_TYPE_SELECT = {
@propTypes({
labelProp: propTypes.string.isRequired,
predicate: propTypes.func,
value: propTypes.oneOfType([
propTypes.string,
propTypes.object
]).isRequired
])
})
export class XoSelect extends Editable {
get value () {
return this.refs.select.value
return this.state.value
}
_renderDisplay () {
@@ -403,16 +406,14 @@ export class XoSelect extends Editable {
<span>{this.props.value[this.props.labelProp]}</span>
}
_onChange = object => {
object ? this._save() : this._closeEdition()
}
_onChange = object =>
this.setState({ value: object }, object && this._save)
_renderEdition () {
const {
placeholder,
predicate,
saving,
xoType
xoType,
...props
} = this.props
const Select = MAP_TYPE_SELECT[xoType]
@@ -426,12 +427,10 @@ export class XoSelect extends Editable {
// when this element is clicked.
return <a onBlur={this._closeEdition}>
<Select
{...props}
autoFocus
disabled={saving}
onChange={this._onChange}
placeholder={placeholder}
predicate={predicate}
ref='select'
/>
</a>
}
@@ -463,15 +462,18 @@ export class Size extends Editable {
const { value } = this.props
return <span
// SizeInput uses `input-group` which makes it behave as a block element (display: table).
// `form-inline` to use it as an inline element
className='form-inline'
onBlur={this._closeEditionIfUnfocused}
onFocus={this._focus}
onKeyDown={this._onKeyDown}
>
<SizeInput
autoFocus
className={styles.size}
ref='input'
readOnly={saving}
style={SIZE_STYLE}
defaultValue={value}
/>
</span>

View File

@@ -1,4 +1,4 @@
import test from 'ava'
/* eslint-env jest */
import filterReduce from './filter-reduce'
@@ -6,23 +6,20 @@ const add = (a, b) => a + b
const data = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
const isEven = x => !(x & 1)
test('filterReduce', t => {
it('filterReduce', () => {
// Returns all elements not matching the predicate and the result of
// a reduction over those who do.
t.deepEqual(
filterReduce(data, isEven, add),
expect(filterReduce(data, isEven, add)).toEqual(
[ 1, 3, 5, 7, 9, 20 ]
)
// The default reducer is the identity.
t.deepEqual(
filterReduce(data, isEven),
expect(filterReduce(data, isEven)).toEqual(
[ 1, 3, 5, 7, 9, 0 ]
)
// If an initial value is passed it is used.
t.deepEqual(
filterReduce(data, isEven, add, 22),
expect(filterReduce(data, isEven, add, 22)).toEqual(
[ 1, 3, 5, 7, 9, 42 ]
)
})

View File

@@ -5,12 +5,16 @@ import map from 'lodash/map'
import randomPassword from 'random-password'
import React from 'react'
import round from 'lodash/round'
import SingleLineRow from 'single-line-row'
import { Container, Col } from 'grid'
import {
DropdownButton,
MenuItem
} from 'react-bootstrap-4/lib'
import Button from '../button'
import Component from '../base-component'
import getEventValue from '../get-event-value'
import propTypes from '../prop-types'
import {
firstDefined,
@@ -36,7 +40,16 @@ export class Password extends Component {
}
_generate = () => {
this.refs.field.value = randomPassword(8)
const value = randomPassword(8)
const isControlled = this.props.value !== undefined
if (isControlled) {
this.props.onChange(value)
} else {
this.refs.field.value = value
}
// FIXME: in controlled mode, visibility should only be updated
// when the value prop is changed according to the emitted value.
this.setState({
visible: true
})
@@ -58,9 +71,9 @@ export class Password extends Component {
return <div className='input-group'>
{enableGenerator && <span className='input-group-btn'>
<button type='button' className='btn btn-secondary' onClick={this._generate}>
<Button onClick={this._generate}>
<Icon icon='password' />
</button>
</Button>
</span>}
<input
{...props}
@@ -69,9 +82,9 @@ export class Password extends Component {
type={visible ? 'text' : 'password'}
/>
<span className='input-group-btn'>
<button type='button' className='btn btn-secondary' onClick={this._toggleVisibility}>
<Button onClick={this._toggleVisibility}>
<Icon icon={visible ? 'shown' : 'hidden'} />
</button>
</Button>
</span>
</div>
}
@@ -80,68 +93,45 @@ export class Password extends Component {
// ===================================================================
@propTypes({
defaultValue: propTypes.number,
max: propTypes.number.isRequired,
min: propTypes.number.isRequired,
onChange: propTypes.func,
step: propTypes.number,
onChange: propTypes.func
value: propTypes.number
})
export class Range extends Component {
constructor (props) {
super()
this.state = {
value: props.defaultValue || props.min
componentDidMount () {
const { min, onChange, value } = this.props
if (!value) {
onChange && onChange(min)
}
}
get value () {
return this.state.value
}
set value (value) {
this.setState({
value: +value
})
}
_handleChange = event => {
const { onChange } = this.props
const { value } = event.target
if (value === this.state.value) {
return
}
this.setState({
value
}, onChange && (() => onChange(value)))
}
_onChange = value =>
this.props.onChange(getEventValue(value))
render () {
const {
props
} = this
const step = props.step || 1
const { value } = this.state
const { max, min, step, value } = this.props
return (
<div className='form-group row'>
<label className='col-sm-2 control-label'>
{value}
</label>
<div className='col-sm-10'>
return <Container>
<SingleLineRow>
<Col size={2}>
<span className='pull-right'>{value}</span>
</Col>
<Col size={10}>
<input
className='form-control'
type='range'
min={props.min}
max={props.max}
max={max}
min={min}
onChange={this._onChange}
step={step}
type='range'
value={value}
onChange={this._handleChange}
/>
</div>
</div>
)
</Col>
</SingleLineRow>
</Container>
}
}
@@ -159,86 +149,125 @@ const DEFAULT_UNIT = 'GiB'
readOnly: propTypes.bool,
required: propTypes.bool,
style: propTypes.object,
value: propTypes.number
value: propTypes.oneOfType([
propTypes.number,
propTypes.oneOf([ null ])
])
})
export class SizeInput extends BaseComponent {
constructor (props) {
super(props)
this.state = this._createStateFromBytes(firstDefined(props.value, props.defaultValue, 0))
this.state = this._createStateFromBytes(firstDefined(props.value, props.defaultValue, null))
}
componentWillReceiveProps (newProps) {
const { value } = newProps
if (value == null && value === this.props.value) {
return
}
const { _bytes, _unit, _value } = this
this._bytes = this._unit = this._value = null
if (value === _bytes) {
// Update input value
this.setState({
unit: _unit,
value: _value
})
} else {
componentWillReceiveProps (props) {
const { value } = props
if (value !== undefined && value !== this.props.value) {
this.setState(this._createStateFromBytes(value))
}
}
_createStateFromBytes = bytes => {
const humanSize = bytes && formatSizeRaw(bytes)
_createStateFromBytes (bytes) {
if (bytes === this._bytes) {
return {
input: this._input,
unit: this._unit
}
}
if (bytes === null) {
return {
input: '',
unit: this.props.defaultUnit || DEFAULT_UNIT
}
}
const { prefix, value } = formatSizeRaw(bytes)
return {
unit: humanSize && humanSize.value ? humanSize.prefix + 'B' : this.props.defaultUnit || DEFAULT_UNIT,
value: humanSize ? round(humanSize.value, 3) : ''
input: String(round(value, 2)),
unit: `${prefix}B`
}
}
get value () {
const { unit, value } = this.state
return parseSize(value + ' ' + unit)
const { input, unit } = this.state
if (!input) {
return null
}
return parseSize(`${+input} ${unit}`)
}
set value (newValue) {
set value (value) {
if (
process.env.NODE_ENV !== 'production' &&
this.props.value != null
this.props.value !== undefined
) {
throw new Error('cannot set value of controlled SizeInput')
}
this.setState(this._createStateFromBytes(newValue))
this.setState(this._createStateFromBytes(value))
}
_onChange = value =>
this.props.onChange && this.props.onChange(value)
_onChange (input, unit) {
const { onChange } = this.props
_updateValue = event => {
const { value } = event.target
if (this.props.value != null) {
this._value = value
this._unit = this.state.unit
this._bytes = parseSize((value || 0) + ' ' + this.state.unit)
// Empty input equals null.
const bytes = input
? parseSize(`${+input} ${unit}`)
: null
this._onChange(this._bytes)
} else {
this.setState({ value }, () => {
this._onChange(this.value)
})
}
}
_updateUnit = unit => {
if (this.props.value != null) {
this._value = this.state.value
const isControlled = this.props.value !== undefined
if (isControlled) {
// Store input and unit for this change to update correctly on new
// props.
this._bytes = bytes
this._input = input
this._unit = unit
this._bytes = parseSize((this.state.value || 0) + ' ' + unit)
this._onChange(this._bytes)
} else {
this.setState({ unit }, () => {
this._onChange(this.value)
})
this.setState({ input, unit })
// onChange is optional in uncontrolled mode.
if (!onChange) {
return
}
}
onChange(bytes)
}
_updateNumber = event => {
const input = event.target.value
if (!input) {
return this._onChange(input, this.state.unit)
}
const number = +input
// NaN: do not ack this change.
if (number !== number) { // eslint-disable-line no-self-compare
return
}
// Same numeric value: simply update the input.
const prevInput = this.state.input
if (prevInput && +prevInput === number) {
return this.setState({ input })
}
this._onChange(input, this.state.unit)
}
_updateUnit = unit => {
const { input } = this.state
// 0 is always 0, no matter the unit.
if (+input) {
this._onChange(input, unit)
} else {
this.setState({ unit })
}
}
@@ -246,39 +275,30 @@ export class SizeInput extends BaseComponent {
const {
autoFocus,
className,
placeholder,
readOnly,
placeholder,
required,
style
} = this.props
const {
value,
unit
} = this.state
return <span
className={classNames(className, 'input-group')}
style={style}
>
return <span className={classNames('input-group', className)} style={style}>
<input
autoFocus={autoFocus}
className='form-control'
min={0}
onChange={this._updateValue}
disabled={readOnly}
onChange={this._updateNumber}
placeholder={placeholder}
readOnly={readOnly}
required={required}
type='number'
value={value}
type='text'
value={this.state.input}
/>
<span className='input-group-btn'>
<DropdownButton
bsStyle='secondary'
disabled={readOnly}
id='size'
pullRight
title={unit}
disabled={readOnly}
title={this.state.unit}
>
{map(UNITS, unit =>
<MenuItem

View File

@@ -1,6 +1,8 @@
import uncontrollableInput from 'uncontrollable-input'
import Component from 'base-component'
import find from 'lodash/find'
import map from 'lodash/map'
import React, { Component } from 'react'
import React from 'react'
import propTypes from '../prop-types'
@@ -8,7 +10,6 @@ import Select from './select'
@propTypes({
autoFocus: propTypes.bool,
defaultValue: propTypes.any,
disabled: propTypes.bool,
optionRenderer: propTypes.func,
multi: propTypes.bool,
@@ -16,13 +17,26 @@ import Select from './select'
options: propTypes.array,
placeholder: propTypes.string,
predicate: propTypes.func,
required: propTypes.bool
required: propTypes.bool,
value: propTypes.any
})
@uncontrollableInput()
export default class SelectPlainObject extends Component {
constructor (props) {
super(props)
this.state = {
value: this._computeValue(props.defaultValue, props)
componentDidMount () {
const { options, value } = this.props
this.setState({
options: this._computeOptions(options),
value: this._computeValue(value, this.props)
})
}
componentWillReceiveProps (newProps) {
if (newProps !== this.props) {
this.setState({
options: this._computeOptions(newProps.options),
value: this._computeValue(newProps.value, newProps)
})
}
}
@@ -36,25 +50,10 @@ export default class SelectPlainObject extends Component {
}
return map(value, reduceValue)
}
return reduceValue(value)
}
componentWillMount () {
const { options } = this.props
this.setState({
options: this._computeOptions(options)
})
}
componentWillReceiveProps (newProps) {
const { options } = newProps
this.setState({
options: this._computeOptions(options)
})
}
_computeOptions (options) {
const { optionKey = 'id' } = this.props
const { optionRenderer = o => o.label || o[optionKey] || o } = this.props
@@ -64,10 +63,13 @@ export default class SelectPlainObject extends Component {
}))
}
get value () {
const { optionKey = 'id' } = this.props
const { value } = this.state
const { options } = this.props
_getObject (value) {
if (value == null) {
return undefined
}
const { optionKey = 'id', options } = this.props
const pickValue = value => {
value = value.value || value
return find(options, option => option[optionKey] === value || option === value)
@@ -80,18 +82,12 @@ export default class SelectPlainObject extends Component {
return pickValue(value)
}
set value (value) {
this.setState({
value: this._computeValue(value)
})
}
_handleChange = value => {
const { onChange } = this.props
this.setState({
value: this._computeValue(value)
}, onChange && (() => { onChange(this.value) }))
if (onChange) {
onChange(this._getObject(value))
}
}
_renderOption = option => option.label
@@ -111,7 +107,8 @@ export default class SelectPlainObject extends Component {
placeholder={props.placeholder}
required={props.required}
value={state.value}
valueRenderer={this._renderOption} />
valueRenderer={this._renderOption}
/>
)
}
}

View File

@@ -1,8 +1,11 @@
import map from 'lodash/map'
import React, { Component } from 'react'
import ReactSelect from 'react-select'
import sum from 'lodash/sum'
import {
AutoSizer,
VirtualScroll
CellMeasurer,
List
} from 'react-virtualized'
import propTypes from '../prop-types'
@@ -15,15 +18,19 @@ const SELECT_STYLE = {
minWidth: '10em'
}
const LIST_STYLE = {
whiteSpace: 'normal'
}
const MAX_OPTIONS = 5
// See: https://github.com/bvaughn/react-virtualized-select/blob/master/source/VirtualizedSelect/VirtualizedSelect.js
@propTypes({
maxHeight: propTypes.number,
optionHeight: propTypes.number
maxHeight: propTypes.number
})
export default class Select extends Component {
static defaultProps = {
maxHeight: 200,
optionHeight: 40,
optionRenderer: (option, labelKey) => option[labelKey]
}
@@ -32,34 +39,52 @@ export default class Select extends Component {
options,
...otherOptions
}) => {
const {
maxHeight,
optionHeight
} = this.props
const { maxHeight } = this.props
const focusedOptionIndex = options.indexOf(focusedOption)
const height = Math.min(maxHeight, options.length * optionHeight)
let height = options.length > MAX_OPTIONS && maxHeight
const wrappedRowRenderer = ({ index }) =>
const wrappedRowRenderer = ({ index, key, style }) =>
this._optionRenderer({
...otherOptions,
focusedOption,
focusedOptionIndex,
key,
option: options[index],
options
options,
style
})
return (
<AutoSizer disableHeight>
{({ width }) => (
<VirtualScroll
height={height}
rowCount={options.length}
rowHeight={optionHeight}
rowRenderer={wrappedRowRenderer}
scrollToIndex={focusedOptionIndex}
width={width}
/>
width ? (
<CellMeasurer
cellRenderer={({ rowIndex }) => wrappedRowRenderer({ index: rowIndex })}
columnCount={1}
rowCount={options.length}
// FIXME: 16 px: ugly workaround to take into account the scrollbar
// during the offscreen render to measure the row height
// See https://github.com/bvaughn/react-virtualized/issues/401
width={width - 16}
>
{({ getRowHeight }) => {
if (options.length <= MAX_OPTIONS) {
height = sum(map(options, (_, index) => getRowHeight({ index })))
}
return <List
height={height}
rowCount={options.length}
rowHeight={getRowHeight}
rowRenderer={wrappedRowRenderer}
scrollToIndex={focusedOptionIndex}
style={LIST_STYLE}
width={width}
/>
}}
</CellMeasurer>
) : null
)}
</AutoSizer>
)
@@ -68,8 +93,10 @@ export default class Select extends Component {
_optionRenderer = ({
focusedOption,
focusOption,
key,
labelKey,
option,
style,
selectValue
}) => {
let className = 'Select-option'
@@ -91,7 +118,8 @@ export default class Select extends Component {
className={className}
onClick={!disabled && (() => selectValue(option))}
onMouseOver={!disabled && (() => focusOption(option))}
style={{ height: props.optionHeight }}
style={style}
key={key}
>
{props.optionRenderer(option, labelKey)}
</div>

View File

@@ -1,5 +1,6 @@
import React from 'react'
import classNames from 'classnames'
import uncontrollableInput from 'uncontrollable-input'
import Component from '../../base-component'
import Icon from '../../icon'
@@ -7,9 +8,9 @@ import propTypes from '../../prop-types'
import styles from './index.css'
@uncontrollableInput()
@propTypes({
className: propTypes.string,
defaultValue: propTypes.bool,
onChange: propTypes.func,
icon: propTypes.string,
iconOn: propTypes.string,
@@ -24,64 +25,27 @@ export default class Toggle extends Component {
iconSize: 2
}
get value () {
const { props } = this
const { value } = props
if (value != null) {
return value
}
const { input } = this.refs
if (input) {
return input.checked
}
return props.defaultValue || false
}
set value (value) {
if (
process.env.NODE_ENV !== 'production' &&
this.props.value != null
) {
throw new Error('cannot set value of controlled Toggle')
}
this.refs.input.checked = Boolean(value)
this.forceUpdate()
}
_onChange = event => {
if (this.props.value == null) {
this.forceUpdate()
}
const { onChange } = this.props
onChange && onChange(event.target.checked)
}
_onChange = event => this.props.onChange(event.target.checked)
render () {
const { props, value } = this
const { props } = this
return (
<label
className={classNames(
props.disabled ? 'text-muted' : value ? 'text-success' : null,
props.disabled ? 'text-muted' : props.value ? 'text-success' : null,
props.className
)}
>
<Icon
icon={props.icon || (value ? props.iconOn : props.iconOff)}
icon={props.icon || (props.value ? props.iconOn : props.iconOff)}
size={props.iconSize}
/>
<input
checked={props.value}
checked={props.value || false}
className={styles.checkbox}
defaultChecked={props.defaultValue}
disabled={props.disabled}
onChange={this._onChange}
ref='input'
type='checkbox'
/>
</label>

13
src/common/grid.spec.js Normal file
View File

@@ -0,0 +1,13 @@
/* eslint-env jest */
import React from 'react'
import { forEach } from 'lodash'
import { shallow } from 'enzyme'
import * as grid from './grid'
forEach(grid, (Component, name) => {
it(name, () => {
expect(shallow(<Component />)).toMatchSnapshot()
})
})

View File

@@ -1,4 +1,9 @@
const common = {
homeFilterNone: ''
}
export const VM = {
...common,
homeFilterPendingVms: 'current_operations:"" ',
homeFilterNonRunningVms: '!power_state:running ',
homeFilterHvmGuests: 'virtualizationMode:hvm ',
@@ -7,10 +12,22 @@ export const VM = {
}
export const host = {
...common,
homeFilterRunningHosts: 'power_state:running ',
homeFilterTags: 'tags:'
}
export const pool = {
...common,
homeFilterTags: 'tags:'
}
export const vmTemplate = {
...common,
homeFilterTags: 'tags:'
}
export const SR = {
...common,
homeFilterTags: 'tags:'
}

36
src/common/home-tags.js Normal file
View File

@@ -0,0 +1,36 @@
import React from 'react'
import Component from './base-component'
import propTypes from './prop-types'
import Tags from './tags'
import { createString, createProperty, toString } from './complex-matcher'
@propTypes({
labels: propTypes.arrayOf(React.PropTypes.string).isRequired,
onAdd: propTypes.func,
onChange: propTypes.func,
onDelete: propTypes.func,
type: propTypes.string
})
export default class HomeTags extends Component {
static contextTypes = {
router: React.PropTypes.object
}
_onClick = label => {
const s = encodeURIComponent(createProperty('tags', createString(label))::toString())
const t = encodeURIComponent(this.props.type)
this.context.router.push(`/home?t=${t}&s=${s}`)
}
render () {
return <Tags
labels={this.props.labels}
onAdd={this.props.onAdd}
onChange={this.props.onChange}
onClick={this._onClick}
onDelete={this.props.onDelete}
/>
}
}

View File

@@ -64,6 +64,15 @@ const POOLS_MISSING_PATCHES_COLUMNS = [{
sortCriteria: (host, { pools }) => pools[host.$pool].name_label
}].concat(MISSING_PATCHES_COLUMNS)
// Small component to homogenize Button usage in HostsPatchesTable
const ActionButton_ = ({ children, labelId, ...props }) =>
<ActionButton
{...props}
tooltip={_(labelId)}
>
{children}
</ActionButton>
// ===================================================================
class HostsPatchesTable extends Component {
@@ -150,15 +159,17 @@ class HostsPatchesTable extends Component {
const { props } = this
const Container = props.container || 'div'
const Button = props.useTabButton ? TabButton : ActionButton
const Button = this.props.useTabButton
? TabButton
: ActionButton_
const Buttons = (
<Container>
<Button
btnStyle='secondary'
handler={this._refreshMissingPatches}
icon='refresh'
labelId='refreshPatches'
labelId='checkForUpdates'
/>
<Button
btnStyle='primary'
@@ -174,15 +185,15 @@ class HostsPatchesTable extends Component {
<div>
{!noPatches
? (
<SortedTable
collection={hosts}
columns={props.displayPools ? POOLS_MISSING_PATCHES_COLUMNS : MISSING_PATCHES_COLUMNS}
userData={{
installAllHostPatches: this._installAllHostPatches,
missingPatches: this.state.missingPatches,
pools: props.pools
}}
/>
<SortedTable
collection={hosts}
columns={props.displayPools ? POOLS_MISSING_PATCHES_COLUMNS : MISSING_PATCHES_COLUMNS}
userData={{
installAllHostPatches: this._installAllHostPatches,
missingPatches: this.state.missingPatches,
pools: props.pools
}}
/>
) : <p>{_('patchNothing')}</p>
}
<Portal container={() => props.buttonsGroupContainer()}>

View File

@@ -62,11 +62,17 @@ export class IntlProvider extends Component {
render () {
const { lang, children } = this.props
// Adding a key prop is a work-around suggested by react-intl documentation
// to make sure changes to the locale trigger a re-render of the child components
// https://github.com/yahoo/react-intl/wiki/Components#dynamic-language-selection
//
// FIXME: remove the key prop when React context propagation is fixed (https://github.com/facebook/react/issues/2517)
return <IntlProvider_
key={lang}
locale={lang}
messages={locales[lang]}
>
{children}
{children}
</IntlProvider_>
}
}

View File

@@ -1 +0,0 @@
/index.js

View File

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -7,9 +7,13 @@ var isString = require('lodash/isString')
var messages = {
statusConnecting: 'Connecting',
statusDisconnected: 'Disconnected',
statusLoading: 'Loading…',
errorPageNotFound: 'Page not found',
errorNoSuchItem: 'no such item',
editableLongClickPlaceholder: 'Long click to edit',
editableClickPlaceholder: 'Click to edit',
browseFiles: 'Browse files',
// ----- Modals -----
alertOk: 'OK',
@@ -19,6 +23,8 @@ var messages = {
// ----- Filters -----
onError: 'On error',
successful: 'Successful',
filterNoSnapshots: 'Full disks only',
filterOnlySnapshots: 'Snapshots only',
// ----- Copiable component -----
copyToClipboard: 'Copy to clipboard',
@@ -31,14 +37,14 @@ var messages = {
homeVmPage: 'VMs',
homeHostPage: 'Hosts',
homePoolPage: 'Pools',
homeTemplatePage: 'Templates',
homeSrPage: 'Storages',
dashboardPage: 'Dashboard',
overviewDashboardPage: 'Overview',
overviewVisualizationDashboardPage: 'Visualizations',
overviewStatsDashboardPage: 'Statistics',
overviewHealthDashboardPage: 'Health',
selfServicePage: 'Self service',
selfServiceDashboardPage: 'Dashboard',
selfServiceAdminPage: 'Administration',
backupPage: 'Backup',
jobsPage: 'Jobs',
updatePage: 'Updates',
@@ -50,7 +56,9 @@ var messages = {
settingsPluginsPage: 'Plugins',
settingsLogsPage: 'Logs',
settingsIpsPage: 'IPs',
settingsConfigPage: 'Config',
aboutPage: 'About',
aboutXoaPlan: 'About XO {xoaPlan}',
newMenu: 'New',
taskMenu: 'Tasks',
taskPage: 'Tasks',
@@ -58,10 +66,12 @@ var messages = {
newSrPage: 'Storage',
newServerPage: 'Server',
newImport: 'Import',
xosan: 'XOSAN',
backupOverviewPage: 'Overview',
backupNewPage: 'New',
backupRemotesPage: 'Remotes',
backupRestorePage: 'Restore',
backupFileRestorePage: 'File restore',
schedule: 'Schedule',
newVmBackup: 'New VM backup',
editVmBackup: 'Edit VM backup',
@@ -76,15 +86,24 @@ var messages = {
customJob: 'Custom Job',
userPage: 'User',
// ----- Support -----
noSupport: 'No support',
freeUpgrade: 'Free upgrade!',
// ----- Sign out -----
signOut: 'Sign out',
// ----- User Profile -----
editUserProfile: 'Edit my settings {username}',
// ----- Home view ------
homeFetchingData: 'Fetching data…',
homeWelcome: 'Welcome on Xen Orchestra!',
homeWelcomeText: 'Add your XenServer hosts or pools',
homeConnectServerText: 'Some XenServers have been registered but are not connected',
homeHelp: 'Want some help?',
homeAddServer: 'Add server',
homeConnectServer: 'Connect servers',
homeOnlineDoc: 'Online Doc',
homeProSupport: 'Pro Support',
homeNoVms: 'There are no VMs!',
@@ -95,16 +114,18 @@ var messages = {
homeRestoreBackupMessage: 'Restore a backup from a remote store',
homeNewVmMessage: 'This will create a new VM',
homeFilters: 'Filters',
homeNoMatches: 'No results! Click here to reset your filters',
homeTypePool: 'Pool',
homeTypeHost: 'Host',
homeTypeVm: 'VM',
homeTypeSr: 'SR',
homeTypeVdi: 'VDI',
homeTypeVmTemplate: 'Template',
homeSort: 'Sort',
homeAllPools: 'Pools',
homeAllHosts: 'Hosts',
homeAllTags: 'Tags',
homeNewVm: 'New VM',
homeFilterNone: 'None',
homeFilterRunningHosts: 'Running hosts',
homeFilterDisabledHosts: 'Disabled hosts',
homeFilterRunningVms: 'Running VMs',
@@ -118,16 +139,24 @@ var messages = {
homeSortByRAM: 'RAM',
homeSortByvCPUs: 'vCPUs',
homeSortByCpus: 'CPUs',
homeSortByShared: 'Shared/Not shared',
homeSortBySize: 'Size',
homeSortByUsage: 'Usage',
homeSortByType: 'Type',
homeDisplayedItems: '{displayed, number}x {icon} (on {total, number})',
homeSelectedItems: '{selected, number}x {icon} selected (on {total, number})',
homeMore: 'More',
homeMigrateTo: 'Migrate to…',
homeMissingPaths: 'Missing patches',
homePoolMaster: 'Master:',
homeResourceSet: 'Resource set: {resourceSet}',
highAvailability: 'High Availability',
srSharedType: 'Shared {type}',
srNotSharedType: 'Not shared {type}',
// ----- Forms -----
add: 'Add',
selectAll: 'Select all',
remove: 'Remove',
preview: 'Preview',
item: 'Item',
@@ -153,7 +182,8 @@ var messages = {
selectTags: 'Select tag(s)…',
selectVdis: 'Select disk(s)…',
selectTimezone: 'Select timezone…',
selectIp: 'Select IP(s)...',
selectIp: 'Select IP(s)',
selectIpPool: 'Select IP pool(s)…',
fillRequiredInformations: 'Fill required informations.',
fillOptionalInformations: 'Fill informations (optional)',
selectTableReset: 'Reset',
@@ -161,29 +191,36 @@ var messages = {
// --- Dates/Scheduler ---
schedulingMonth: 'Month',
schedulingEveryNMonth: 'Every N month',
schedulingEachSelectedMonth: 'Each selected month',
schedulingMonthDay: 'Day of the month',
schedulingEachSelectedMonthDay: 'Each selected day',
schedulingWeekDay: 'Day of the week',
schedulingEachSelectedWeekDay: 'Each selected day',
schedulingDay: 'Day',
schedulingEveryNDay: 'Every N day',
schedulingEachSelectedDay: 'Each selected day',
schedulingSetWeekDayMode: 'Switch to week days',
schedulingSetMonthDayMode: 'Switch to month days',
schedulingHour: 'Hour',
schedulingEveryNHour: 'Every N hour',
schedulingEachSelectedHour: 'Each selected hour',
schedulingEveryNHour: 'Every N hour',
schedulingMinute: 'Minute',
schedulingEveryNMinute: 'Every N minute',
schedulingEachSelectedMinute: 'Each selected minute',
schedulingEveryNMinute: 'Every N minute',
selectTableAllMonth: 'Every month',
selectTableAllDay: 'Every day',
selectTableAllHour: 'Every hour',
selectTableAllMinute: 'Every minute',
schedulingReset: 'Reset',
unknownSchedule: 'Unknown',
timezonePickerServerValue: 'Xo-server timezone:',
timezonePickerUseLocalTime: 'Web browser timezone',
timezonePickerUseServerTime: 'Xo-server timezone',
serverTimezoneOption: 'Server timezone ({value})',
cronPattern: 'Cron Pattern:',
backupEditNotFoundTitle: 'Cannot edit backup',
backupEditNotFoundMessage: 'Missing required info for edition',
job: 'Job',
jobId: 'Job ID',
jobModalTitle: 'Job {job}',
jobId: 'ID',
jobType: 'Type',
jobName: 'Name',
jobNamePlaceholder: 'Name of your job (forbidden: "_")',
jobStart: 'Start',
jobEnd: 'End',
jobDuration: 'Duration',
@@ -192,8 +229,10 @@ var messages = {
jobTag: 'Tag',
jobScheduling: 'Scheduling',
jobState: 'State',
jobStateEnabled: 'Enabled',
jobStateDisabled: 'Disabled',
jobTimezone: 'Timezone',
jobServerTimezone: 'xo-server',
jobServerTimezone: 'Server',
runJob: 'Run job',
runJobVerbose: 'One shot running started. See overview for logs.',
jobStarted: 'Started',
@@ -208,12 +247,35 @@ var messages = {
noJobs: 'No jobs found.',
noSchedules: 'No schedules found',
jobActionPlaceHolder: 'Select a xo-server API command',
jobTimeoutPlaceHolder: ' Timeout (number of seconds after which a VM is considered failed)',
jobSchedules: 'Schedules',
jobScheduleNamePlaceHolder: 'Name of your schedule',
jobScheduleJobPlaceHolder: 'Select a Job',
jobOwnerPlaceholder: 'Job owner',
jobUserNotFound: 'This job\'s creator no longer exists',
backupUserNotFound: 'This backup\'s creator no longer exists',
backupOwner: 'Backup owner',
// ------ New backup -----
newBackupSelection: 'Select your backup type:',
smartBackupModeSelection: 'Select backup mode:',
normalBackup: 'Normal backup',
smartBackup: 'Smart backup',
localRemoteWarningTitle: 'Local remote selected',
localRemoteWarningMessage: 'Warning: local remotes will use limited XOA disk space. Only for advanced users.',
backupVersionWarning: 'Warning: this feature works only with XenServer 6.5 or newer.',
editBackupVmsTitle: 'VMs',
editBackupSmartStatusTitle: 'VMs statuses',
editBackupSmartResidentOn: 'Resident on',
editBackupSmartPools: 'Pools',
editBackupSmartTags: 'Tags',
editBackupSmartTagsTitle: 'VMs Tags',
editBackupNot: 'Reverse',
editBackupTagTitle: 'Tag',
editBackupReportTitle: 'Report',
editBackupReportEnable: 'Enable immediately after creation',
editBackupDepthTitle: 'Depth',
editBackupRemoteTitle: 'Remote',
// ------ New Remote -----
remoteList: 'Remote stores for backup',
@@ -229,12 +291,42 @@ var messages = {
remoteTestError: 'Error',
remoteTestStep: 'Test Step',
remoteTestFile: 'Test file',
remoteTestName: 'Test name',
remoteTestNameFailure: 'Remote name already exists!',
remoteTestSuccessMessage: 'The remote appears to work correctly',
remoteConnectionFailed: 'Connection failed',
// ------ Remote -----
remoteName: 'Name',
remotePath: 'Path',
remoteState: 'State',
remoteDevice: 'Device',
remoteShare: 'Share',
remoteAction: 'Action',
remoteAuth: 'Auth',
remoteMounted: 'Mounted',
remoteUnmounted: 'Unmounted',
remoteConnectTip: 'Connect',
remoteDisconnectTip: 'Disconnect',
remoteConnected: 'Connected',
remoteDisconnected: 'Disconnected',
remoteDeleteTip: 'Delete',
remoteNamePlaceHolder: 'remote name *',
remoteMyNamePlaceHolder: 'Name *',
remoteLocalPlaceHolderPath: '/path/to/backup',
remoteNfsPlaceHolderHost: 'host *',
remoteNfsPlaceHolderPath: 'path/to/backup',
remoteSmbPlaceHolderRemotePath: 'subfolder [path\\to\\backup]',
remoteSmbPlaceHolderUsername: 'Username',
remoteSmbPlaceHolderPassword: 'Password',
remoteSmbPlaceHolderDomain: 'Domain',
remoteSmbPlaceHolderAddressShare: '<address>\\<share> *',
remotePlaceHolderPassword: 'password(fill to edit)',
// ------ New Storage -----
newSrTitle: 'Create a new SR',
newSrGeneral: 'General',
newSrTypeSelection: 'Select Strorage Type:',
newSrTypeSelection: 'Select Storage Type:',
newSrSettings: 'Settings',
newSrUsage: 'Storage Usage',
newSrSummary: 'Summary',
@@ -253,11 +345,21 @@ var messages = {
newSrInUse: 'in use',
newSrSize: 'Size',
newSrCreate: 'Create',
newSrNamePlaceHolder: 'Storage name',
newSrDescPlaceHolder: 'Storage description',
newSrAddressPlaceHolder: 'Address',
newSrPortPlaceHolder: '[port]',
newSrUsernamePlaceHolder: 'Username',
newSrPasswordPlaceHolder: 'Password',
newSrLvmDevicePlaceHolder: 'Device, e.g /dev/sda…',
newSrLocalPathPlaceHolder: '/path/to/directory',
// ----- Acls, Users, Groups ------
subjectName: 'Users/Groups',
objectName: 'Object',
aclNoneFound: 'No acls found',
roleName: 'Role',
aclCreate: 'Create',
newGroupName: 'New Group Name',
createGroup: 'Create Group',
createGroupButton: 'Create',
@@ -266,6 +368,7 @@ var messages = {
removeUserFromGroup: 'Remove user from Group',
deleteUserConfirm: 'Are you sure you want to delete this user?',
deleteUser: 'Delete User',
noUser: 'no user',
unknownUser: 'unknown user',
noGroupFound: 'No group found',
groupNameColumn: 'Name',
@@ -285,6 +388,7 @@ var messages = {
selectPermission: 'Select Permission',
// ----- Plugins ------
noPlugins: 'No plugins found',
autoloadPlugin: 'Auto-load at server start',
savePluginConfiguration: 'Save configuration',
deletePluginConfiguration: 'Delete configuration',
@@ -339,15 +443,22 @@ var messages = {
// ----- SR actions -----
srRescan: 'Rescan all disks',
srReconnectAll: 'Connect to all hosts',
srDisconnectAll: 'Disconnect to all hosts',
srDisconnectAll: 'Disconnect from all hosts',
srForget: 'Forget this SR',
srsForget: 'Forget SRs',
srRemoveButton: 'Remove this SR',
srNoVdis: 'No VDIs in this storage',
// ----- Pool general -----
poolTitleRamUsage: 'Pool RAM usage:',
poolRamUsage: '{used} used on {total}',
poolMaster: 'Master:',
displayAllHosts: 'Display all hosts of this pool',
displayAllStorages: 'Display all storages of this pool',
displayAllVMs: 'Display all VMs of this pool',
// ----- Pool tabs -----
hostsTabName: 'Hosts',
vmsTabName: 'Vms',
srsTabName: 'Srs',
// ----- Pool advanced tab -----
poolHaStatus: 'High Availability',
poolHaEnabled: 'Enabled',
@@ -359,6 +470,7 @@ var messages = {
noHost: 'No hosts',
memoryLeftTooltip: '{used}% used ({free} free)',
// ----- Pool network tab -----
pif: 'PIF',
poolNetworkNameLabel: 'Name',
poolNetworkDescription: 'Description',
poolNetworkPif: 'PIFs',
@@ -366,6 +478,13 @@ var messages = {
poolNetworkMTU: 'MTU',
poolNetworkPifAttached: 'Connected',
poolNetworkPifDetached: 'Disconnected',
showPifs: 'Show PIFs',
hidePifs: 'Hide PIFs',
showDetails: 'Show details',
hideDetails: 'Hide details',
// ----- Pool stats tab -----
poolNoStats: 'No stats',
poolAllHosts: 'All hosts',
// ----- Pool actions ------
addSrLabel: 'Add SR',
addVmLabel: 'Add VM',
@@ -380,6 +499,11 @@ var messages = {
restartHostAgent: 'Restart toolstack',
forceRebootHostLabel: 'Force reboot',
rebootHostLabel: 'Reboot',
noHostsAvailableErrorTitle: 'Error while restarting host',
noHostsAvailableErrorMessage: 'Some VMs cannot be migrated before restarting this host. Please try force reboot.',
failHostBulkRestartTitle: 'Error while restarting hosts',
failHostBulkRestartMessage: '{failedHosts}/{totalHosts} host{failedHosts, plural, one {} other {s}} could not be restarted.',
rebootUpdateHostLabel: 'Reboot to apply updates',
emergencyModeLabel: 'Emergency mode',
// ----- Host tabs -----
storageTabName: 'Storage',
@@ -387,6 +511,7 @@ var messages = {
// ----- host stat tab -----
statLoad: 'Load average',
// ----- host advanced tab -----
memoryHostState: 'RAM Usage: {memoryUsed}',
hardwareHostSettingsLabel: 'Hardware',
hostAddress: 'Address',
hostStatus: 'Status',
@@ -406,12 +531,24 @@ var messages = {
hostLicenseType: 'Type',
hostLicenseSocket: 'Socket',
hostLicenseExpiry: 'Expiry',
supplementalPacks: 'Installed supplemental packs',
supplementalPackNew: 'Install new supplemental pack',
supplementalPackPoolNew: 'Install supplemental pack on every host',
supplementalPackTitle: '{name} (by {author})',
supplementalPackInstallStartedTitle: 'Installation started',
supplementalPackInstallStartedMessage: 'Installing new supplemental pack...',
supplementalPackInstallErrorTitle: 'Installation error',
supplementalPackInstallErrorMessage: 'The installation of the supplemental pack failed.',
supplementalPackInstallSuccessTitle: 'Installation success',
supplementalPackInstallSuccessMessage: 'Supplemental pack successfully installed.',
// ----- Host net tabs -----
networkCreateButton: 'Add a network',
networkCreateBondedButton: 'Add a bonded network',
pifDeviceLabel: 'Device',
pifNetworkLabel: 'Network',
pifVlanLabel: 'VLAN',
pifAddressLabel: 'Address',
pifModeLabel: 'Mode',
pifMacLabel: 'MAC',
pifMtuLabel: 'MTU',
pifStatusLabel: 'Status',
@@ -419,14 +556,26 @@ var messages = {
pifStatusDisconnected: 'Disconnected',
pifNoInterface: 'No physical interface detected',
pifInUse: 'This interface is currently in use',
pifAction: 'Action',
defaultLockingMode: 'Default locking mode',
pifConfigureIp: 'Configure IP address',
configIpErrorTitle: 'Invalid parameters',
configIpErrorMessage: 'IP address and netmask required',
staticIp: 'Static IP address',
netmask: 'Netmask',
dns: 'DNS',
gateway: 'Gateway',
// ----- Host storage tabs -----
addSrDeviceButton: 'Add a storage',
srNameLabel: 'Name',
srType: 'Type',
pdbStatus: 'Status',
pbdAction: 'Action',
pbdStatus: 'Status',
pbdStatusConnected: 'Connected',
pbdStatusDisconnected: 'Disconnected',
pbdConnect: 'Connect',
pbdDisconnect: 'Disconnect',
pbdForget: 'Forget',
srShared: 'Shared',
srNotShared: 'Not shared',
pbdNoSr: 'No storage detected',
@@ -449,11 +598,16 @@ var messages = {
// ----- Pool patch tabs -----
refreshPatches: 'Refresh patches',
installPoolPatches: 'Install pool patches',
checkForUpdates: 'Check for updates',
// ----- Pool storage tabs -----
defaultSr: 'Default SR',
setAsDefaultSr: 'Set as default SR',
// ----- VM tabs -----
generalTabName: 'General',
statsTabName: 'Stats',
consoleTabName: 'Console',
containersTabName: 'Container',
snapshotsTabName: 'Snapshots',
logsTabName: 'Logs',
advancedTabName: 'Advanced',
@@ -495,10 +649,23 @@ var messages = {
copyToClipboardLabel: 'Copy',
ctrlAltDelButtonLabel: 'Ctrl+Alt+Del',
tipLabel: 'Tip:',
tipConsoleLabel: 'non-US keyboard could have issues with console: switch your own layout to US.',
tipConsoleLabel: 'Due to a XenServer issue, non-US keyboard layouts aren\'t well supported. Switch your own layout to US to workaround it.',
hideHeaderTooltip: 'Hide infos',
showHeaderTooltip: 'Show infos',
// ----- VM container tab -----
containerName: 'Name',
containerCommand: 'Command',
containerCreated: 'Creation date',
containerStatus: 'Status',
containerAction: 'Action',
noContainers: 'No existing containers',
containerStop: 'Stop this container',
containerStart: 'Start this container',
containerPause: 'Pause this container',
containerResume: 'Resume this container',
containerRestart: 'Restart this container',
// ----- VM disk tab -----
vdiAction: 'Action',
vdiAttachDeviceButton: 'Attach disk',
@@ -510,11 +677,30 @@ var messages = {
vdiSize: 'Size',
vdiSr: 'SR',
vdiVm: 'VM',
vdiMigrate: 'Migrate VDI',
vdiMigrateSelectSr: 'Destination SR:',
vdiMigrateAll: 'Migrate all VDIs',
vdiMigrateNoSr: 'No SR',
vdiMigrateNoSrMessage: 'A target SR is required to migrate a VDI',
vdiForget: 'Forget',
vdiRemove: 'Remove VDI',
vdbBootableStatus: 'Boot flag',
vdbStatus: 'Status',
vbdStatusConnected: 'Connected',
vbdStatusDisconnected: 'Disconnected',
vbdNoVbd: 'No disks',
vbdConnect: 'Connect VBD',
vbdDisconnect: 'Disconnect VBD',
vdbBootable: 'Bootable',
vdbReadonly: 'Readonly',
vbdAction: 'Action',
vdbCreate: 'Create',
vdbNamePlaceHolder: 'Disk name',
vdbSizePlaceHolder: 'Size',
cdDriveNotInstalled: 'CD drive not completely installed',
cdDriveInstallation: 'Stop and start the VM to install the CD drive',
saveBootOption: 'Save',
resetBootOption: 'Reset',
// ----- VM network tab -----
vifCreateDeviceButton: 'New device',
@@ -526,12 +712,19 @@ var messages = {
vifStatusLabel: 'Status',
vifStatusConnected: 'Connected',
vifStatusDisconnected: 'Disconnected',
vifConnect: 'Connect',
vifDisconnect: 'Disconnect',
vifRemove: 'Remove',
vifIpAddresses: 'IP addresses',
vifMacAutoGenerate: 'Auto-generated if empty',
vifAllowedIps: 'Allowed IPs',
vifNoIps: 'No IPs',
vifLockedNetwork: 'Network is locked',
vifLockedNetworkNoIps: 'Network is locked and no IPs are allowed for this interface',
vifLockedNetwork: 'Network locked',
vifLockedNetworkNoIps: 'Network locked and no IPs are allowed for this interface',
vifUnLockedNetwork: 'Network not locked',
vifUnknownNetwork: 'Unknown network',
vifAction: 'Action',
vifCreate: 'Create',
// ----- VM snapshot tab -----
noSnapshots: 'No snapshots',
@@ -544,6 +737,7 @@ var messages = {
snapshotDate: 'Creation date',
snapshotName: 'Name',
snapshotAction: 'Action',
snapshotQuiesce: 'Quiesced snapshot',
// ----- VM log tab -----
logRemoveAll: 'Remove all logs',
@@ -575,6 +769,8 @@ var messages = {
osKernel: 'OS kernel',
autoPowerOn: 'Auto power on',
ha: 'HA',
vmAffinityHost: 'Affinity host',
noAffinityHost: 'None',
originalTemplate: 'Original template',
unknownOsName: 'Unknown',
unknownOsKernel: 'Unknown',
@@ -592,11 +788,19 @@ var messages = {
vmViewNamePlaceholder: 'Click to add a name',
vmViewDescriptionPlaceholder: 'Click to add a description',
// ----- Templates -----
templateHomeNamePlaceholder: 'Click to add a name',
templateHomeDescriptionPlaceholder: 'Click to add a description',
templateDelete: 'Delete template',
templateDeleteModalTitle: 'Delete VM template{templates, plural, one {} other {s}}',
templateDeleteModalBody: 'Are you sure you want to delete {templates, plural, one {this} other {these}} template{templates, plural, one {} other {s}}?',
// ----- Dashboard -----
poolPanel: 'Pool{pools, plural, one {} other {s}}',
hostPanel: 'Host{hosts, plural, one {} other {s}}',
vmPanel: 'VM{vms, plural, one {} other {s}}',
memoryStatePanel: 'RAM Usage',
memoryStatePanel: 'RAM Usage:',
cpuStatePanel: 'CPUs Usage',
vmStatePanel: 'VMs Power state',
taskStatePanel: 'Pending tasks',
@@ -615,6 +819,9 @@ var messages = {
srUsageStatePanel: 'Storage Usage',
srTopUsageStatePanel: 'Top 5 SR Usage (in %)',
vmsStates: '{running} running ({halted} halted)',
dashboardStatsButtonRemoveAll: 'Clear selection',
dashboardStatsButtonAddAllHost: 'Add all hosts',
dashboardStatsButtonAddAllVM: 'Add all VMs',
// --- Stats board --
weekHeatmapData: '{value} {date, date, medium}',
@@ -632,10 +839,10 @@ var messages = {
comingSoon: 'Coming soon!',
// ----- Health -----
orphanedVdis: 'Orphaned VDIs',
orphanedVms: 'Orphaned VMs',
orphanedVdis: 'Orphaned snapshot VDIs',
orphanedVms: 'Orphaned VMs snapshot',
noOrphanedObject: 'No orphans',
removeAllOrphanedObject: 'Remove all orphaned VDIs',
removeAllOrphanedObject: 'Remove all orphaned snapshot VDIs',
vmNameLabel: 'Name',
vmNameDescription: 'Description',
vmContainer: 'Resident on',
@@ -659,9 +866,13 @@ var messages = {
newVmPerfPanel: 'Performances',
newVmVcpusLabel: 'vCPUs',
newVmRamLabel: 'RAM',
newVmStaticMaxLabel: 'Static memory max',
newVmDynamicMinLabel: 'Dynamic memory min',
newVmDynamicMaxLabel: 'Dynamic memory max',
newVmInstallSettingsPanel: 'Install settings',
newVmIsoDvdLabel: 'ISO/DVD',
newVmNetworkLabel: 'Network',
newVmInstallNetworkPlaceHolder: 'e.g: http://httpredir.debian.org/debian',
newVmPvArgsLabel: 'PV Args',
newVmPxeLabel: 'PXE',
newVmInterfacesPanel: 'Interfaces',
@@ -669,7 +880,6 @@ var messages = {
newVmAddInterface: 'Add interface',
newVmDisksPanel: 'Disks',
newVmSrLabel: 'SR',
newVmBootableLabel: 'Bootable',
newVmSizeLabel: 'Size',
newVmAddDisk: 'Add disk',
newVmSummaryPanel: 'Summary',
@@ -695,12 +905,17 @@ var messages = {
newVmFirstIndex: 'First index:',
newVmNumberRecalculate: 'Recalculate VMs number',
newVmNameRefresh: 'Refresh VMs name',
newVmAffinityHost: 'Affinity host',
newVmAdvancedPanel: 'Advanced',
newVmShowAdvanced: 'Show advanced settings',
newVmHideAdvanced: 'Hide advanced settings',
newVmShare: 'Share this VM',
// ----- Self -----
resourceSets: 'Resource sets',
noResourceSets: 'No resource sets.',
loadingResourceSets: 'Loading resource sets',
resourceSetName: 'Resource set name',
resourceSetCreation: 'Creation and edition',
recomputeResourceSets: 'Recompute all limits',
saveResourceSet: 'Save',
resetResourceSet: 'Reset',
@@ -720,10 +935,13 @@ var messages = {
maxCpus: 'Maximum CPUs',
maxRam: 'Maximum RAM (GiB)',
maxDiskSpace: 'Maximum disk space',
ipPool: 'IP pool',
quantity: 'Quantity',
noResourceSetLimits: 'No limits.',
totalResource: 'Total:',
remainingResource: 'Remaining:',
usedResource: 'Used:',
resourceSetNew: 'New',
// ---- VM import ---
importVmsList: 'Try dropping some VMs files here, or click to select VMs to upload. Accept only .xva/.ova files.',
@@ -753,30 +971,49 @@ var messages = {
xsTasks: 'Currently, there are not any pending XenServer tasks',
// ---- Backup views ---
backupSchedules: 'Schedules',
getRemote: 'Get remote',
listRemote: 'List Remote',
simpleBackup: 'simple',
delta: 'delta',
restoreBackups: 'Restore Backups',
noRemotes: 'No remotes',
remoteEnabled: 'enabled',
remoteError: 'error',
restoreBackupsInfo: 'Click on a VM to display restore options',
remoteEnabled: 'Enabled',
remoteError: 'Error',
noBackup: 'No backup available',
backupVmNameColumn: 'VM Name',
backupTagColumn: 'Backup Tag',
backupTags: 'Tags',
lastBackupColumn: 'Last Backup',
availableBackupsColumn: 'Available Backups',
restoreColumn: 'Restore',
restoreTip: 'View restore options',
backupRestoreErrorTitle: 'Missing parameters',
backupRestoreErrorMessage: 'Choose a SR and a backup',
displayBackup: 'Display backups',
importBackupTitle: 'Import VM',
importBackupMessage: 'Starting your backup import',
vmsToBackup: 'VMs to backup',
// ----- Restore files view -----
listRemoteBackups: 'List remote backups',
restoreFiles: 'Restore backup files',
restoreFilesError: 'Invalid options',
restoreFilesFromBackup: 'Restore file from {name}',
restoreFilesSelectBackup: 'Select a backup…',
restoreFilesSelectDisk: 'Select a disk…',
restoreFilesSelectPartition: 'Select a partition…',
restoreFilesSelectFolderPath: 'Folder path',
restoreFilesSelectFiles: 'Select a file…',
restoreFileContentNotFound: 'Content not found',
restoreFilesNoFilesSelected: 'No files selected',
restoreFilesSelectedFiles: 'Selected files ({files}):',
restoreFilesDiskError: 'Error while scanning disk',
restoreFilesSelectAllFiles: 'Select all this folder\'s files',
restoreFilesUnselectAll: 'Unselect all files',
// ----- Modals -----
emergencyShutdownHostsModalTitle: 'Emergency shutdown Host{nHosts, plural, one {} other {s}}',
emergencyShutdownHostsModalMessage: 'Are you sure you want to shutdown {nHosts} Host{nHosts, plural, one {} other {s}}?',
stopHostModalTitle: 'Shutdown host',
stopHostModalMessage: 'This will shutdown your host. Do you want to continue?',
stopHostModalMessage: 'This will shutdown your host. Do you want to continue? If it\'s the pool master, your connection to the pool will be lost',
addHostModalTitle: 'Add host',
addHostModalMessage: 'Are you sure you want to add {host} to {pool}?',
restartHostModalTitle: 'Restart host',
@@ -821,11 +1058,14 @@ var messages = {
deleteVdiModalTitle: 'Delete VDI',
deleteVdiModalMessage: 'Are you sure you want to delete this disk? ALL DATA ON THIS DISK WILL BE LOST',
revertVmModalTitle: 'Revert your VM',
revertVmModalMessage: 'You are about to revert your VM to the snapshot state. This operation is irreversible',
deleteSnapshotModalTitle: 'Delete snapshot',
deleteSnapshotModalMessage: 'Are you sure you want to delete this snapshot?',
revertVmModalMessage: 'Are you sure you want to revert this VM to the snapshot state? This operation is irreversible.',
revertVmModalSnapshotBefore: 'Snapshot before',
importBackupModalTitle: 'Import a {name} Backup',
importBackupModalStart: 'Start VM after restore',
importBackupModalSelectBackup: 'Select your backup…',
removeAllOrphanedModalWarning: 'Are you sure you want to remove all orphaned VDIs?',
removeAllOrphanedModalWarning: 'Are you sure you want to remove all orphaned snapshot VDIs?',
removeAllLogsModalTitle: 'Remove all logs',
removeAllLogsModalWarning: 'Are you sure you want to remove all logs?',
definitiveMessageModal: 'This operation is definitive.',
@@ -839,13 +1079,27 @@ var messages = {
trialReadyModalText: 'During the trial period, XOA need to have a working internet connection. This limitation does not apply for our paid plans!',
// ----- Servers -----
serverLabel: 'Label',
serverHost: 'Host',
serverUsername: 'Username',
serverPassword: 'Password',
serverAction: 'Action',
serverReadOnly: 'Read Only',
serverConnect: 'Connect server',
serverDisconnect: 'Disconnect server',
serverPlaceHolderUser: 'username',
serverPlaceHolderPassword: 'password',
serverPlaceHolderAddress: 'address[:port]',
serverPlaceHolderLabel: 'label',
serverConnect: 'Connect',
serverError: 'Error',
serverAddFailed: 'Adding server failed',
serverStatus: 'Status',
serverConnectionFailed: 'Connection failed',
serverConnecting: 'Connecting...',
serverConnected: 'Connected',
serverDisconnected: 'Disconnected',
serverAuthFailed: 'Authentication error',
serverUnknownError: 'Unknown error',
// ----- Copy VM -----
copyVm: 'Copy VM',
@@ -866,6 +1120,7 @@ var messages = {
// ----- Network -----
newNetworkCreate: 'Create network',
newBondedNetworkCreate: 'Create bonded network',
newNetworkInterface: 'Interface',
newNetworkName: 'Name',
newNetworkDescription: 'Description',
@@ -873,9 +1128,13 @@ var messages = {
newNetworkDefaultVlan: 'No VLAN if empty',
newNetworkMtu: 'MTU',
newNetworkDefaultMtu: 'Default: 1500',
newNetworkNoNameErrorTitle: 'Name required',
newNetworkNoNameErrorMessage: 'A name is required to create a network',
newNetworkBondMode: 'Bond mode',
deleteNetwork: 'Delete network',
deleteNetworkConfirm: 'Are you sure you want to delete this network?',
networkInUse: 'This network is currently in use',
pillBonded: 'Bonded',
// ----- Add host -----
addHostSelectHost: 'Host',
@@ -884,11 +1143,11 @@ var messages = {
// ----- About View -----
xenOrchestra: 'Xen Orchestra',
xenOrchestraServer: 'server',
xenOrchestraWeb: 'web client',
xenOrchestraServer: 'Xen Orchestra server',
xenOrchestraWeb: 'Xen Orchestra web client',
noProSupport: 'No pro support provided!',
noProductionUse: 'Use in production at your own risks',
downloadXoa: 'You can download our turnkey appliance at',
downloadXoaFromWebsite: 'You can download our turnkey appliance at {website}',
bugTracker: 'Bug Tracker',
bugTrackerText: 'Issues? Report it!',
community: 'Community',
@@ -900,9 +1159,9 @@ var messages = {
documentation: 'Documentation',
documentationText: 'Read our official doc',
proSupportIncluded: 'Pro support included',
xoAccount: 'Acces your XO Account',
xoAccount: 'Access your XO Account',
openTicket: 'Report a problem',
openTicketText: 'Problem? Open a ticket !',
openTicketText: 'Problem? Open a ticket!',
// ----- Upgrade Panel -----
upgradeNeeded: 'Upgrade needed',
@@ -910,6 +1169,7 @@ var messages = {
or: 'Or',
tryIt: 'Try it for free!',
availableIn: 'This feature is available starting from {plan} Edition',
notAvailable: 'This feature is not available in your version, contact your administrator to know more.',
// ----- Updates View -----
updateTitle: 'Updates',
@@ -917,11 +1177,17 @@ var messages = {
trial: 'Trial',
settings: 'Settings',
proxySettings: 'Proxy settings',
proxySettingsHostPlaceHolder: 'Host (myproxy.example.org)',
proxySettingsPortPlaceHolder: 'Port (eg: 3128)',
proxySettingsUsernamePlaceHolder: 'Username',
proxySettingsPasswordPlaceHolder: 'Password',
updateRegistrationEmailPlaceHolder: 'Your email account',
updateRegistrationPasswordPlaceHolder: 'Your password',
update: 'Update',
refresh: 'Refresh',
upgrade: 'Upgrade',
noUpdaterCommunity: 'No updater available for Community Edition',
noUpdaterSubscribe: 'Please consider subscribe and try it with all features for free during 15 days on',
considerSubscribe: 'Please consider subscribe and try it with all features for free during 15 days on {link}.',
noUpdaterWarning: 'Manual update could break your current installation due to dependencies issues, do it with caution',
currentVersion: 'Current version:',
register: 'Register',
@@ -953,6 +1219,10 @@ var messages = {
disconnectPifConfirm: 'Are you sure you want to disconnect this PIF?',
deletePif: 'Delete PIF',
deletePifConfirm: 'Are you sure you want to delete this PIF?',
pifConnected: 'Connected',
pifDisconnected: 'Disconnected',
pifPhysicallyConnected: 'Physically connected',
pifPhysicallyDisconnected: 'Physically disconnected',
// ----- User -----
username: 'Username',
@@ -984,20 +1254,23 @@ var messages = {
others: 'Others',
// ----- Logs -----
loadingLogs: 'Loading logs...',
loadingLogs: 'Loading logs',
logUser: 'User',
logMethod: 'Method',
logParams: 'Params',
logMessage: 'Message',
logStack: 'Stack trace',
logError: 'Error',
logDisplayDetails: 'Display details',
logShowParams: 'ShowParams',
logTime: 'Date',
logNoStackTrace: 'No stack trace',
logNoParams: 'No params',
logDelete: 'Delete log',
logDeleteAll: 'Delete all logs',
logDeleteAllTitle: 'Delete all logs',
logDeleteAllMessage: 'Are you sure you want to delete all the logs?',
logIndicationToEnable: 'Click to enable',
logIndicationToDisable: 'Click to disable',
reportBug: 'Report a bug',
// ----- IPs ------
ipPoolName: 'Name',
@@ -1009,7 +1282,94 @@ var messages = {
ipsDeleteAllTitle: 'Delete all IP pools',
ipsDeleteAllMessage: 'Are you sure you want to delete all the IP pools?',
ipsVifs: 'VIFs',
ipsNotUsed: 'Not used'
ipsNotUsed: 'Not used',
ipPoolUnknownVif: 'unknown VIF',
ipPoolNameAlreadyExists: 'Name already exists',
// ----- Shortcuts -----
shortcutModalTitle: 'Keyboard shortcuts',
shortcut_XoApp: 'Global',
shortcut_GO_TO_HOSTS: 'Go to hosts list',
shortcut_GO_TO_POOLS: 'Go to pools list',
shortcut_GO_TO_VMS: 'Go to VMs list',
shortcut_GO_TO_SRS: 'Go to SRs list',
shortcut_CREATE_VM: 'Create a new VM',
shortcut_UNFOCUS: 'Unfocus field',
shortcut_HELP: 'Show shortcuts key bindings',
shortcut_Home: 'Home',
shortcut_SEARCH: 'Focus search bar',
shortcut_NAV_DOWN: 'Next item',
shortcut_NAV_UP: 'Previous item',
shortcut_SELECT: 'Select item',
shortcut_JUMP_INTO: 'Open',
// ----- Settings/ACLs -----
settingsAclsButtonTooltipVM: 'VM',
settingsAclsButtonTooltiphost: 'Hosts',
settingsAclsButtonTooltippool: 'Pool',
settingsAclsButtonTooltipSR: 'SR',
settingsAclsButtonTooltipnetwork: 'Network',
// ----- Config -----
noConfigFile: 'No config file selected',
importTip: 'Try dropping a config file here, or click to select a config file to upload.',
config: 'Config',
importConfig: 'Import',
importConfigSuccess: 'Config file successfully imported',
importConfigError: 'Error while importing config file',
exportConfig: 'Export',
downloadConfig: 'Download current config',
noConfigImportCommunity: 'No config import available for Community Edition',
// ----- SR -----
srReconnectAllModalTitle: 'Reconnect all hosts',
srReconnectAllModalMessage: 'This will reconnect this SR to all its hosts.',
srsReconnectAllModalMessage: 'This will reconnect each selected SR to its host (local SR) or to every hosts of its pool (shared SR).',
srDisconnectAllModalTitle: 'Disconnect all hosts',
srDisconnectAllModalMessage: 'This will disconnect this SR from all its hosts.',
srsDisconnectAllModalMessage: 'This will disconnect each selected SR from its host (local SR) or from every hosts of its pool (shared SR).',
srForgetModalTitle: 'Forget SR',
srsForgetModalTitle: 'Forget selected SRs',
srForgetModalMessage: 'Are you sure you want to forget this SR? VDIs on this storage won\'t be removed.',
srsForgetModalMessage: 'Are you sure you want to forget all the selected SRs? VDIs on these storages won\'t be removed.',
srAllDisconnected: 'Disconnected',
srSomeConnected: 'Partially connected',
srAllConnected: 'Connected',
// ----- XOSAN -----
xosanTitle: 'XOSAN',
xosanSrTitle: 'Xen Orchestra SAN SR',
xosanAvailableSrsTitle: 'Select local SRs (lvm)',
xosanSuggestions: 'Suggestions',
xosanName: 'Name',
xosanHost: 'Host',
xosanHosts: 'Hosts',
xosanVolumeId: 'Volume ID',
xosanSize: 'Size',
xosanUsedSpace: 'Used space',
xosanNeedPack: 'XOSAN pack needs to be installed on each host of the pool.',
xosanInstallIt: 'Install it now!',
xosanInstallPackTitle: 'Install XOSAN pack on {pool}',
xosanSelect2Srs: 'Select at least 2 SRs',
xosanLayout: 'Layout',
xosanRedundancy: 'Redundancy',
xosanCapacity: 'Capacity',
xosanAvailableSpace: 'Available space',
xosanDiskLossLegend: '* Can fail without data loss',
xosanCreate: 'Create',
xosanInstalling: 'Installing XOSAN. Please wait...',
xosanCommunity: 'No XOSAN available for Community Edition',
// Pack download modal
xosanInstallCloudPlugin: 'Install cloud plugin first',
xosanLoadCloudPlugin: 'Load cloud plugin first',
xosanLoading: 'Loading...',
xosanNotAvailable: 'XOSAN is not available at the moment',
xosanRegisterBeta: 'Register for the XOSAN beta',
xosanSuccessfullyRegistered: 'You have successfully registered for the XOSAN beta. Please wait until your request has been approved.',
xosanInstallPackOnHosts: 'Install XOSAN pack on these hosts:',
xosanInstallPack: 'Install {pack} v{version}?',
xosanNoPackFound: 'No compatible XOSAN pack found for your XenServer versions.',
xosanPackRequirements: 'At least one of these version requirements must be satisfied by all the hosts in this pool:'
}
forEach(messages, function (message, id) {

View File

@@ -28,7 +28,7 @@ function assertIpv4 (str, msg) {
if (!ipv4.test(str)) { throw new Error(msg) }
}
function *range (ip1, ip2) {
function * range (ip1, ip2) {
assertIpv4(ip1, 'argument "ip1" must be a valid IPv4 address')
assertIpv4(ip2, 'argument "ip2" must be a valid IPv4 address')

View File

@@ -1,8 +1,12 @@
import React from 'react'
import _ from 'intl'
import ActionButton from './action-button'
import Component from './base-component'
import Icon from 'icon'
import propTypes from './prop-types'
import Tooltip from 'tooltip'
import { alert } from 'modal'
import { connectStore } from './utils'
import { SelectVdi } from './select-objects'
import {
@@ -44,7 +48,18 @@ import {
export default class IsoDevice extends Component {
_getPredicate = createSelector(
() => this.props.vm.$pool,
poolId => sr => sr.$pool === poolId && sr.SR_type === 'iso'
() => this.props.vm.$container,
(vmPool, vmContainer) => sr => {
const vmRunning = vmContainer !== vmPool
const sameHost = vmContainer === sr.$container
const samePool = vmPool === sr.$pool
return (
samePool &&
(vmRunning ? sr.shared || sameHost : true) &&
(sr.SR_type === 'iso' || (sr.SR_type === 'udev' && sr.size))
)
}
)
_handleInsert = iso => {
@@ -59,25 +74,38 @@ export default class IsoDevice extends Component {
_handleEject = () => ejectCd(this.props.vm)
_showWarning = () => alert(_('cdDriveNotInstalled'), _('cdDriveInstallation'))
render () {
const { mountedIso } = this.props
const {cdDrive, mountedIso} = this.props
return (
<div className='input-group'>
<SelectVdi
srPredicate={this._getPredicate()}
onChange={this._handleInsert}
ref='selectIso'
value={mountedIso}
/>
<span className='input-group-btn'>
<ActionButton
btnStyle='secondary'
disabled={!mountedIso}
handler={this._handleEject}
icon='vm-eject'
/>
</span>
{mountedIso && !cdDrive.device &&
<Tooltip content={_('cdDriveNotInstalled')}>
<a
className='text-warning btn btn-link'
onClick={this._showWarning}
>
<Icon
icon='alarm'
size='lg'
/>
</a>
</Tooltip>
}
</div>
)
}

View File

@@ -1,26 +0,0 @@
import { Component } from 'react'
import propTypes from '../prop-types'
// ===================================================================
@propTypes({
disabled: propTypes.bool,
label: propTypes.any.isRequired,
onChange: propTypes.func,
placeholder: propTypes.string,
required: propTypes.bool,
schema: propTypes.object.isRequired,
uiSchema: propTypes.object,
defaultValue: propTypes.any
})
export default class AbstractInput extends Component {
set value (value) {
this.refs.input.value = value === undefined ? '' : String(value)
}
get value () {
const { value } = this.refs.input
return !value ? undefined : value
}
}

View File

@@ -1,10 +1,12 @@
import React, { Component, cloneElement } from 'react'
import map from 'lodash/map'
import filter from 'lodash/filter'
import React from 'react'
import uncontrollableInput from 'uncontrollable-input'
import { filter, map } from 'lodash'
import _ from '../intl'
import Button from '../button'
import Component from '../base-component'
import propTypes from '../prop-types'
import { propsEqual } from '../utils'
import { EMPTY_ARRAY } from '../utils'
import GenericInput from './generic-input'
import {
@@ -12,174 +14,110 @@ import {
forceDisplayOptionalAttr
} from './helpers'
// ===================================================================
class ArrayItem extends Component {
get value () {
return this.refs.input.value
}
set value (value) {
this.refs.input.value = value
}
render () {
const { children } = this.props
return (
<li className='list-group-item clearfix'>
{cloneElement(children, {
ref: 'input'
})}
<button disabled={children.props.disabled} className='btn btn-danger pull-xs-right' type='button' onClick={this.props.onDelete}>
{_('remove')}
</button>
</li>
)
}
}
// ===================================================================
@propTypes({
depth: propTypes.number,
disabled: propTypes.bool,
label: propTypes.any.isRequired,
required: propTypes.bool,
schema: propTypes.object.isRequired,
uiSchema: propTypes.object,
defaultValue: propTypes.array
uiSchema: propTypes.object
})
export default class ArrayInput extends Component {
constructor (props) {
super(props)
this.state = {
use: props.required || forceDisplayOptionalAttr(props),
children: this._makeChildren(props)
}
this._nextChildKey = 0
@uncontrollableInput()
export default class ObjectInput extends Component {
state = {
use: this.props.required || forceDisplayOptionalAttr(this.props)
}
get value () {
if (this.state.use) {
return map(this.refs, 'value')
}
_onAddItem = () => {
const { props } = this
props.onChange((props.value || EMPTY_ARRAY).concat(undefined))
}
set value (value = []) {
this.setState({
children: this._makeChildren({ ...this.props, value })
})
_onChangeItem = (value, name) => {
const key = Number(name)
const { props } = this
const newValue = (props.value || EMPTY_ARRAY).slice()
newValue[key] = value
props.onChange(newValue)
}
_handleOptionalChange = event => {
this.setState({
use: event.target.checked
})
}
_handleAdd = () => {
const { children } = this.state
this.setState({
children: children.concat(this._makeChild(this.props))
})
}
_remove (key) {
this.setState({
children: filter(this.state.children, child => child.key !== key)
})
}
_makeChild (props) {
const key = String(this._nextChildKey++)
const {
schema: {
items
}
} = props
return (
<ArrayItem key={key} onDelete={() => { this._remove(key) }}>
<GenericInput
depth={props.depth}
disabled={props.disabled}
label={items.title || _('item')}
required
schema={items}
uiSchema={props.uiSchema.items}
defaultValue={props.defaultValue}
/>
</ArrayItem>
)
}
_makeChildren ({ defaultValue, ...props }) {
return map(defaultValue, defaultValue => {
return (
this._makeChild({
...props,
defaultValue
})
)
})
}
componentWillReceiveProps (props) {
if (
!propsEqual(
this.props,
props,
[ 'depth', 'disabled', 'label', 'required', 'schema', 'uiSchema' ]
)
) {
this.setState({
children: this._makeChildren(props)
})
}
_onRemoveItem = key => {
const { props } = this
props.onChange(filter(props.value, (_, i) => i !== key))
}
render () {
const {
props,
state
props: {
depth = 0,
disabled,
label,
required,
schema,
uiSchema,
value = EMPTY_ARRAY
},
state: { use }
} = this
const {
disabled,
schema
} = props
const { use } = state
const depth = props.depth || 0
const childDepth = depth + 2
const itemSchema = schema.items
const itemUiSchema = uiSchema && uiSchema.items
const itemLabel = itemSchema.title || _('item')
return (
<div style={{'paddingLeft': `${depth}em`}}>
<legend>{props.label}</legend>
<legend>{label}</legend>
{descriptionRender(schema.description)}
<hr />
{!props.required &&
<div className='checkbox'>
<label>
<input
checked={use}
disabled={disabled}
onChange={this._handleOptionalChange}
type='checkbox'
/> {_('fillOptionalInformations')}
</label>
</div>
}
{use &&
<div className={'card-block'}>
<ul style={{'paddingLeft': 0}} >
{map(this.state.children, (child, index) =>
cloneElement(child, { ref: index })
)}
</ul>
<button disabled={disabled} className='btn btn-primary pull-xs-right m-t-1 m-r-1' type='button' onClick={this._handleAdd}>
{_('add')}
</button>
</div>
}
{!required && <div className='checkbox'>
<label>
<input
checked={use}
disabled={disabled}
onChange={this.linkState('use')}
type='checkbox'
/> {_('fillOptionalInformations')}
</label>
</div>}
{use && <div className='card-block'>
<ul style={{'paddingLeft': 0}} >
{map(value, (value, key) =>
<li className='list-group-item clearfix' key={key}>
<GenericInput
depth={childDepth}
disabled={disabled}
label={itemLabel}
name={key}
onChange={this._onChangeItem}
required
schema={itemSchema}
uiSchema={itemUiSchema}
value={value}
/>
<Button
btnStyle='danger'
className='pull-right'
disabled={disabled}
name={key}
onClick={() => this._onRemoveItem(key)}
>
{_('remove')}
</Button>
</li>
)}
</ul>
<Button
btnStyle='primary'
className='pull-right mt-1 mr-1'
disabled={disabled}
onClick={this._onAddItem}
>
{_('add')}
</Button>
</div>}
</div>
)
}

View File

@@ -1,32 +1,30 @@
import React from 'react'
import { Toggle } from 'form'
import AbstractInput from './abstract-input'
import uncontrollableInput from 'uncontrollable-input'
import Component from '../base-component'
import { Toggle } from '../form'
import { PrimitiveInputWrapper } from './helpers'
// ===================================================================
export default class BooleanInput extends AbstractInput {
get value () {
return this.refs.input.value
}
set value (value) {
this.refs.input.value = value
}
@uncontrollableInput()
export default class BooleanInput extends Component {
render () {
const { props } = this
const {
disabled,
onChange,
value,
...props
} = this.props
return (
<PrimitiveInputWrapper {...props}>
<div className='checkbox form-control'>
<Toggle
defaultValue={props.defaultValue}
disabled={props.disabled}
onChange={props.onChange}
ref='input'
disabled={disabled}
onChange={onChange}
value={value}
/>
</div>
</PrimitiveInputWrapper>

View File

@@ -1,33 +1,54 @@
import React from 'react'
import _ from 'intl'
import map from 'lodash/map'
import uncontrollableInput from 'uncontrollable-input'
import Component from 'base-component'
import React from 'react'
import { createSelector } from 'reselect'
import { findIndex, map } from 'lodash'
import AbstractInput from './abstract-input'
import { PrimitiveInputWrapper } from './helpers'
// ===================================================================
export default class EnumInput extends AbstractInput {
@uncontrollableInput()
export default class EnumInput extends Component {
_getSelectedIndex = createSelector(
() => this.props.schema.enum,
() => {
const {
schema,
value = schema.default
} = this.props
return value
},
(enumValues, value) => {
const index = findIndex(enumValues, current => current === value)
return index === -1 ? '' : index
}
)
_onChange = event => {
this.props.onChange(this.props.schema.enum[event.target.value])
}
render () {
const { props } = this
const {
onChange,
disabled,
schema: { enum: enumValues, enumNames = enumValues },
required
} = props
} = this.props
return (
<PrimitiveInputWrapper {...props}>
<PrimitiveInputWrapper {...this.props}>
<select
className='form-control'
defaultValue={props.defaultValue || ''}
disabled={props.disabled}
onChange={onChange && (event => onChange(event.target.value))}
ref='input'
disabled={disabled}
onChange={this._onChange}
required={required}
value={this._getSelectedIndex()}
>
{_('noSelectedValue', message => <option value=''>{message}</option>)}
{map(props.schema.enum, (value, index) =>
<option value={value} key={index}>{value}</option>
{map(enumNames, (name, index) =>
<option value={index} key={index}>{name}</option>
)}
</select>
</PrimitiveInputWrapper>

View File

@@ -1,6 +1,8 @@
import React, { Component } from 'react'
import getEventValue from '../get-event-value'
import propTypes from '../prop-types'
import uncontrollableInput from 'uncontrollable-input'
import { EMPTY_OBJECT } from '../utils'
import ArrayInput from './array-input'
@@ -30,35 +32,31 @@ const InputByType = {
depth: propTypes.number,
disabled: propTypes.bool,
label: propTypes.any.isRequired,
onChange: propTypes.func,
required: propTypes.bool,
schema: propTypes.object.isRequired,
uiSchema: propTypes.object,
defaultValue: propTypes.any
uiSchema: propTypes.object
})
@uncontrollableInput()
export default class GenericInput extends Component {
get value () {
return this.refs.input.value
}
set value (value) {
this.refs.input.value = value
_onChange = event => {
const { name, onChange } = this.props
onChange && onChange(getEventValue(event), name)
}
render () {
const {
schema,
defaultValue = schema.default,
value = schema.default,
uiSchema = EMPTY_OBJECT,
...opts
} = this.props
const props = {
...opts,
defaultValue,
onChange: this._onChange,
schema,
uiSchema,
ref: 'input'
value
}
// Enum, special case.

View File

@@ -62,19 +62,19 @@ export const PrimitiveInputWrapper = ({ label, required = false, schema, childre
// ===================================================================
export const forceDisplayOptionalAttr = ({ schema, defaultValue }) => {
if (!schema || !defaultValue) {
export const forceDisplayOptionalAttr = ({ schema, value }) => {
if (!schema || !value) {
return false
}
// Array
if (schema.items && Array.isArray(defaultValue)) {
if (schema.items && Array.isArray(value)) {
return true
}
// Object
for (const key in schema.properties) {
if (defaultValue[key]) {
if (value[key]) {
return true
}
}

View File

@@ -1,38 +1,42 @@
import React from 'react'
import AbstractInput from './abstract-input'
import uncontrollableInput from 'uncontrollable-input'
import Combobox from '../combobox'
import Component from '../base-component'
import getEventValue from '../get-event-value'
import { PrimitiveInputWrapper } from './helpers'
// ===================================================================
export default class IntegerInput extends AbstractInput {
get value () {
const { value } = this.refs.input
return !value ? undefined : +value
}
set value (value) {
// Getter/Setter are always inherited together.
// `get value` is defined in the subclass, so `set value`
// must be defined too.
super.value = value
@uncontrollableInput()
export default class IntegerInput extends Component {
_onChange = event => {
const value = getEventValue(event)
this.props.onChange(value ? +value : undefined)
}
render () {
const { props } = this
const { schema } = props
const { required, schema } = this.props
const {
disabled,
onChange, // eslint-disable-line no-unused-vars
placeholder = schema.default,
value,
...props
} = this.props
return (
<PrimitiveInputWrapper {...props}>
<Combobox
defaultValue={props.defaultValue}
disabled={props.disabled}
onChange={props.onChange}
value={value === undefined ? '' : String(value)}
disabled={disabled}
max={schema.max}
min={schema.min}
onChange={this._onChange}
options={schema.defaults}
placeholder={props.placeholder || schema.default}
ref='input'
required={props.required}
placeholder={placeholder}
required={required}
step={1}
type='number'
/>

View File

@@ -1,38 +1,42 @@
import React from 'react'
import AbstractInput from './abstract-input'
import uncontrollableInput from 'uncontrollable-input'
import Combobox from '../combobox'
import Component from '../base-component'
import getEventValue from '../get-event-value'
import { PrimitiveInputWrapper } from './helpers'
// ===================================================================
export default class NumberInput extends AbstractInput {
get value () {
const { value } = this.refs.input
return !value ? undefined : +value
}
set value (value) {
// Getter/Setter are always inherited together.
// `get value` is defined in the subclass, so `set value`
// must be defined too.
super.value = value
@uncontrollableInput()
export default class NumberInput extends Component {
_onChange = event => {
const value = getEventValue(event)
this.props.onChange(value ? +value : undefined)
}
render () {
const { props } = this
const { schema } = props
const { required, schema } = this.props
const {
disabled,
onChange, // eslint-disable-line no-unused-vars
placeholder = schema.default,
value,
...props
} = this.props
return (
<PrimitiveInputWrapper {...props}>
<Combobox
defaultValue={props.defaultValue}
disabled={props.disabled}
onChange={props.onChange}
value={value === undefined ? '' : String(value)}
disabled={disabled}
max={schema.max}
min={schema.min}
onChange={this._onChange}
options={schema.defaults}
placeholder={props.placeholder || schema.default}
ref='input'
required={props.required}
placeholder={placeholder}
required={required}
step='any'
type='number'
/>

View File

@@ -1,163 +1,97 @@
import _ from 'intl'
import React, { Component, cloneElement } from 'react'
import forEach from 'lodash/forEach'
import includes from 'lodash/includes'
import map from 'lodash/map'
import React from 'react'
import uncontrollableInput from 'uncontrollable-input'
import { createSelector } from 'reselect'
import { keyBy, map } from 'lodash'
import _ from '../intl'
import Component from '../base-component'
import propTypes from '../prop-types'
import { propsEqual } from '../utils'
import { EMPTY_OBJECT } from '../utils'
import GenericInput from './generic-input'
import {
descriptionRender,
forceDisplayOptionalAttr
} from './helpers'
// ===================================================================
class ObjectItem extends Component {
get value () {
return this.refs.input.value
}
set value (value) {
this.refs.input.value = value
}
render () {
const { props } = this
return (
<div className='p-b-1'>
{cloneElement(props.children, {
ref: 'input'
})}
</div>
)
}
}
// ===================================================================
@propTypes({
depth: propTypes.number,
disabled: propTypes.bool,
label: propTypes.any.isRequired,
required: propTypes.bool,
schema: propTypes.object.isRequired,
uiSchema: propTypes.object,
defaultValue: propTypes.object
uiSchema: propTypes.object
})
@uncontrollableInput()
export default class ObjectInput extends Component {
constructor (props) {
super(props)
this.state = {
use: Boolean(props.required) || forceDisplayOptionalAttr(props),
children: this._makeChildren(props)
}
state = {
use: this.props.required || forceDisplayOptionalAttr(this.props)
}
get value () {
if (!this.state.use) {
return
}
const obj = {}
forEach(this.refs, (instance, key) => {
obj[key] = instance.value
})
return obj
}
set value (value = {}) {
forEach(this.refs, (instance, id) => {
instance.value = value[id]
_onChildChange = (value, key) => {
this.props.onChange({
...this.props.value,
[key]: value
})
}
_handleOptionalChange = event => {
const { checked } = event.target
this.setState({
use: checked
})
}
_makeChildren (props) {
const {
depth = 0,
schema,
uiSchema = {},
defaultValue = {}
} = props
const obj = {}
const { properties } = uiSchema
forEach(schema.properties, (childSchema, key) => {
obj[key] = (
<ObjectItem key={key}>
<GenericInput
depth={depth + 2}
disabled={props.disabled}
label={childSchema.title || key}
required={includes(schema.required, key)}
schema={childSchema}
uiSchema={properties && properties[key]}
defaultValue={defaultValue[key]}
/>
</ObjectItem>
)
})
return obj
}
componentWillReceiveProps (props) {
if (
!propsEqual(
this.props,
props,
[ 'depth', 'disabled', 'label', 'required', 'schema', 'uiSchema' ]
)
) {
this.setState({
children: this._makeChildren(props)
})
}
}
_getRequiredProps = createSelector(
() => this.props.schema.required,
required => required
? keyBy(required)
: EMPTY_OBJECT
)
render () {
const { props, state } = this
const { use } = state
const depth = props.depth || 0
const {
props: {
depth = 0,
disabled,
label,
required,
schema,
uiSchema,
value = EMPTY_OBJECT
},
state: { use }
} = this
const childDepth = depth + 2
const properties = (uiSchema != null && uiSchema.properties) || EMPTY_OBJECT
const requiredProps = this._getRequiredProps()
return (
<div style={{'paddingLeft': `${depth}em`}}>
<legend>{props.label}</legend>
{descriptionRender(props.schema.description)}
<legend>{label}</legend>
{descriptionRender(schema.description)}
<hr />
{!props.required &&
<div className='checkbox'>
<label>
<input
checked={use}
disabled={props.disabled}
onChange={this._handleOptionalChange}
type='checkbox'
/> {_('fillOptionalInformations')}
</label>
</div>
}
{use &&
<div className='card-block'>
{map(state.children, (child, index) =>
cloneElement(child, { ref: index })
)}
</div>
}
{!required && <div className='checkbox'>
<label>
<input
checked={use}
disabled={disabled}
onChange={this.linkState('use')}
type='checkbox'
/> {_('fillOptionalInformations')}
</label>
</div>}
{use && <div className='card-block'>
{map(schema.properties, (childSchema, key) =>
<div className='pb-1' key={key}>
<GenericInput
depth={childDepth}
disabled={disabled}
label={childSchema.title || key}
name={key}
onChange={this._onChildChange}
required={Boolean(requiredProps[key])}
schema={childSchema}
uiSchema={properties[key]}
value={value[key]}
/>
</div>
)}
</div>}
</div>
)
}

View File

@@ -1,8 +1,10 @@
import React from 'react'
import AbstractInput from './abstract-input'
import uncontrollableInput from 'uncontrollable-input'
import Combobox from '../combobox'
import Component from '../base-component'
import propTypes from '../prop-types'
import { PrimitiveInputWrapper } from './helpers'
// ===================================================================
@@ -10,22 +12,29 @@ import { PrimitiveInputWrapper } from './helpers'
@propTypes({
password: propTypes.bool
})
export default class StringInput extends AbstractInput {
@uncontrollableInput()
export default class StringInput extends Component {
render () {
const { props } = this
const { schema } = props
const { required, schema } = this.props
const {
disabled,
onChange,
password,
placeholder = schema.default,
value,
...props
} = this.props
return (
<PrimitiveInputWrapper {...props}>
<Combobox
defaultValue={props.defaultValue}
disabled={props.disabled}
onChange={props.onChange}
value={value || ''}
disabled={disabled}
onChange={onChange}
options={schema.defaults}
placeholder={props.placeholder || schema.default}
ref='input'
required={props.required}
type={props.password && 'password'}
placeholder={placeholder || schema.default}
required={required}
type={password && 'password'}
/>
</PrimitiveInputWrapper>
)

View File

@@ -1,11 +1,16 @@
import _ from 'intl'
import Icon from 'icon'
import isArray from 'lodash/isArray'
import isString from 'lodash/isString'
import React, { Component, cloneElement } from 'react'
import { Button, Modal as ReactModal } from 'react-bootstrap-4/lib'
import { Modal as ReactModal } from 'react-bootstrap-4/lib'
import _ from './intl'
import Button from './button'
import Icon from './icon'
import propTypes from './prop-types'
import {
disable as disableShortcuts,
enable as enableShortcuts
} from './shortcuts'
let instance
@@ -15,7 +20,7 @@ const modal = (content, onClose) => {
} else if (instance.state.showModal) {
throw new Error('Other modal still open.')
}
instance.setState({ content, onClose, showModal: true })
instance.setState({ content, onClose, showModal: true }, disableShortcuts)
}
export const alert = (title, body) => {
@@ -60,7 +65,10 @@ const _addRef = (component, ref) => {
class Confirm extends Component {
_resolve = () => {
const { body } = this.refs
this.props.resolve(body && body.value || body.getWrappedInstance && body.getWrappedInstance().value)
this.props.resolve(body && (body.getWrappedInstance
? body.getWrappedInstance().value
: body.value
))
instance.close()
}
_reject = () => {
@@ -68,8 +76,6 @@ class Confirm extends Component {
instance.close()
}
_style = { marginRight: '0.5em' }
render () {
const { Body, Footer, Header, Title } = ReactModal
const { title, icon } = this.props
@@ -79,9 +85,10 @@ class Confirm extends Component {
return <div>
<Header closeButton>
<Title>
{icon
? <span><Icon icon={icon} /> {title}</span>
: title}
{icon
? <span><Icon icon={icon} /> {title}</span>
: title
}
</Title>
</Header>
<Body>
@@ -89,14 +96,14 @@ class Confirm extends Component {
</Body>
<Footer>
<Button
bsStyle='primary'
btnStyle='primary'
onClick={this._resolve}
style={this._style}
>
{_('confirmOk')}
</Button>
{' '}
<Button
bsStyle='secondary'
onClick={this._reject}
>
{_('confirmCancel')}
@@ -130,18 +137,22 @@ export default class Modal extends Component {
constructor () {
super()
this.state = { showModal: false }
}
componentDidMount () {
if (instance) {
throw new Error('Modal is a singleton!')
}
instance = this
}
componentWillMount () {
this.setState({ showModal: false })
componentWillUnmount () {
instance = undefined
}
close () {
this.setState({ showModal: false })
this.setState({ showModal: false }, enableShortcuts)
}
_onHide = () => {

View File

@@ -8,15 +8,17 @@ export let info
export let success
export class Notification extends Component {
constructor () {
super()
componentDidMount () {
if (instance) {
throw new Error('Notification is a singleton!')
}
instance = this
}
componentWillUnmount () {
instance = undefined
}
// This special component never have to rerender!
shouldComponentUpdate () {
return false

View File

@@ -6,6 +6,7 @@ import {
parse as parseUrl,
resolve as resolveUrl
} from 'url'
import { enable as enableShortcuts, disable as disableShortcuts } from 'shortcuts'
import propTypes from './prop-types'
@@ -70,11 +71,17 @@ export default class NoVnc extends Component {
this._rfb = null
rfb.disconnect()
}
enableShortcuts()
}
_connect = () => {
this._clean()
const { canvas } = this.refs
if (!canvas) {
return
}
const url = parseRelativeUrl(this.props.url)
fixProtocol(url)
@@ -92,6 +99,7 @@ export default class NoVnc extends Component {
})
rfb.connect(formatUrl(url))
disableShortcuts()
}
componentDidMount () {
@@ -120,6 +128,8 @@ export default class NoVnc extends Component {
rfb.get_keyboard().grab()
rfb.get_mouse().grab()
disableShortcuts()
}
}
@@ -128,6 +138,8 @@ export default class NoVnc extends Component {
if (rfb) {
rfb.get_keyboard().ungrab()
rfb.get_mouse().ungrab()
enableShortcuts()
}
}

View File

@@ -1,4 +1,5 @@
import React, { Component } from 'react'
import _ from 'intl'
import React from 'react'
import Icon from './icon'
import propTypes from './prop-types'
@@ -122,6 +123,12 @@ const xoItemToRender = {
<Icon icon='ip' /> {ipPool.name}
</span>
),
ipAddress: ({label, used}) => {
if (used) {
return <strong className='text-warning'>{label}</strong>
}
return <span>{label}</span>
},
// XO objects.
pool: pool => (
@@ -158,7 +165,7 @@ const xoItemToRender = {
// PIF.
PIF: pif => (
<span>
<Icon icon='network' /> {pif.device}
<Icon icon='network' /> {pif.device} ({pif.deviceName})
</span>
),
@@ -175,7 +182,14 @@ const renderXoItem = (item, {
} = {}) => {
const { id, type, label } = item
if (!type && label) {
if (item.removed) {
return <span key={id} className='text-danger'> <Icon icon='alarm' /> {id}</span>
}
if (!type) {
if (process.env.NODE_ENV !== 'production' && !label) {
throw new Error(`an item must have at least either a type or a label`)
}
return (
<span key={id} className={className}>
{label}
@@ -208,7 +222,7 @@ const GenericXoItem = connectStore(() => {
})
})(({ xoItem, ...props }) => xoItem
? renderXoItem(xoItem, props)
: <span className='text-muted'>no such item</span>
: <span className='text-muted'>{_('errorNoSuchItem')}</span>
)
export const renderXoItemFromId = (id, props) => <GenericXoItem {...props} id={id} />

View File

@@ -1,39 +1,53 @@
import includes from 'lodash/includes'
import join from 'lodash/join'
import classNames from 'classnames'
import later from 'later'
import map from 'lodash/map'
import React from 'react'
import sortedIndex from 'lodash/sortedIndex'
import { FormattedDate, FormattedTime } from 'react-intl'
import {
Tab,
Tabs
} from 'react-bootstrap-4/lib'
forEach,
includes,
isArray,
map,
sortedIndex
} from 'lodash'
import _ from './intl'
import Button from './button'
import Component from './base-component'
import propTypes from './prop-types'
import TimezonePicker from './timezone-picker'
import Icon from './icon'
import Tooltip from './tooltip'
import { Card, CardHeader, CardBlock } from './card'
import { Col, Row } from './grid'
import { Range } from './form'
import { Range, Toggle } from './form'
// ===================================================================
// By default later use UTC but we use this line for futures versions.
// By default, later uses UTC but we use this line for future versions.
later.date.UTC()
// ===================================================================
const NAV_EACH_SELECTED = 1
const NAV_EVERY_N = 2
const CLICKABLE = { cursor: 'pointer' }
const PREVIEW_SLIDER_STYLE = { width: '400px' }
// ===================================================================
const UNITS = [ 'minute', 'hour', 'monthDay', 'month', 'weekDay' ]
const MINUTES_RANGE = [2, 30]
const HOURS_RANGE = [2, 12]
const MONTH_DAYS_RANGE = [2, 15]
const MONTHS_RANGE = [2, 6]
const MIN_PREVIEWS = 5
const MAX_PREVIEWS = 20
const MONTHS = [
[ 0, 1, 2, 3, 4, 5 ],
[ 6, 7, 8, 9, 10, 11 ]
[ 0, 1, 2 ],
[ 3, 4, 5 ],
[ 6, 7, 8 ],
[ 9, 10, 11 ]
]
const DAYS = (() => {
@@ -52,7 +66,11 @@ const DAYS = (() => {
return days
})()
const WEEK_DAYS = [[ 0, 1, 2, 3, 4, 5, 6 ]]
const WEEK_DAYS = [
[ 0, 1, 2 ],
[ 3, 4, 5 ],
[ 6 ]
]
const HOURS = (() => {
const hours = []
@@ -124,24 +142,20 @@ const getDayName = (dayNum) =>
cronPattern: propTypes.string.isRequired
})
export class SchedulePreview extends Component {
_handleChange = value => {
this.setState({
value
})
}
render () {
const { cronPattern } = this.props
const { value } = this.state
const cronSched = later.parse.cron(cronPattern)
const dates = later.schedule(cronSched).next(this.state.value || MIN_PREVIEWS)
const dates = later.schedule(cronSched).next(value)
return (
<div>
<div className='alert alert-info' role='alert'>
{_('cronPattern')} <strong>{cronPattern}</strong>
</div>
<div className='form-inline p-b-1'>
<Range min={MIN_PREVIEWS} max={MAX_PREVIEWS} onChange={this._handleChange} />
<div className='mb-1' style={PREVIEW_SLIDER_STYLE}>
<Range min={MIN_PREVIEWS} max={MAX_PREVIEWS} onChange={this.linkState('value')} value={+value} />
</div>
<ul className='list-group'>
{map(dates, (date, id) => (
@@ -173,7 +187,7 @@ class ToggleTd extends Component {
render () {
const { props } = this
return (
<td style={{ cursor: 'pointer' }} className={props.value ? 'table-success' : ''} onClick={this._onClick}>
<td style={CLICKABLE} className={props.value ? 'table-success' : ''} onClick={this._onClick}>
{props.children}
</td>
)
@@ -183,14 +197,15 @@ class ToggleTd extends Component {
// ===================================================================
@propTypes({
labelId: propTypes.string.isRequired,
options: propTypes.array.isRequired,
optionsRenderer: propTypes.func,
optionRenderer: propTypes.func,
onChange: propTypes.func.isRequired,
value: propTypes.array.isRequired
})
class TableSelect extends Component {
static defaultProps = {
optionsRenderer: value => value
optionRenderer: value => value
}
_reset = () => {
@@ -220,214 +235,271 @@ class TableSelect extends Component {
render () {
const {
labelId,
options,
optionsRenderer,
optionRenderer,
value
} = this.props
const { length } = options[0]
return (
<div>
<table className='table table-bordered table-sm'>
<tbody>
{map(options, (line, i) => (
<tr key={i}>
{map(line, (tdOption, j) => {
const tdId = length * i + j
return (
<ToggleTd
children={optionsRenderer(tdOption)}
tdId={tdId}
key={tdId}
onChange={this._handleChange}
value={includes(value, tdId)}
/>
)
})}
</tr>
))}
</tbody>
</table>
<button className='btn btn-secondary pull-xs-right' onClick={this._reset}>
{_('selectTableReset')}
</button>
</div>
)
return <div>
<table className='table table-bordered table-sm'>
<tbody>
{map(options, (line, i) => (
<tr key={i}>
{map(line, tdOption => (
<ToggleTd
children={optionRenderer(tdOption)}
tdId={tdOption}
key={tdOption}
onChange={this._handleChange}
value={includes(value, tdOption)}
/>
))}
</tr>
))}
</tbody>
</table>
<Button
className='pull-right'
onClick={this._reset}
>
{_(`selectTableAll${labelId}`)} {value && !value.length && <Icon icon='success' />}
</Button>
</div>
}
}
// ===================================================================
// "2,7" => [2,7] "*/2" => 2 "*" => []
const cronToValue = (cron, range) => {
if (cron.indexOf('/') === 1) {
return +cron.split('/')[1]
}
if (cron === '*') {
return []
}
return map(cron.split(','), Number)
}
// [2,7] => "2,7" 2 => "*/2" [] => "*"
const valueToCron = value => {
if (!isArray(value)) {
return `*/${value}`
}
if (!value.length) {
return '*'
}
return value.join(',')
}
@propTypes({
optionsRenderer: propTypes.func,
headerAddon: propTypes.node,
optionRenderer: propTypes.func,
onChange: propTypes.func.isRequired,
range: propTypes.array,
labelId: propTypes.string.isRequired,
value: propTypes.any.isRequired,
valueRenderer: propTypes.func
value: propTypes.any.isRequired
})
class TimePicker extends Component {
static defaultProps = {
valueRenderer: e => +e
}
_update = cron => {
const { tableValue, rangeValue } = this.state
constructor () {
super()
this.state = {
activeKey: NAV_EACH_SELECTED,
tableValue: []
}
}
const newValue = cronToValue(cron)
const periodic = !isArray(newValue)
_update (props) {
const { value, valueRenderer } = props
if (value.indexOf('/') === 1) {
this.setState({
activeKey: NAV_EVERY_N
}, () => { this.refs.range.value = value.split('/')[1] })
} else {
this.setState({
activeKey: NAV_EACH_SELECTED,
tableValue: value === '*'
? []
: map(value.split(','), valueRenderer)
})
}
}
componentWillMount () {
this._update(this.props)
}
componentWillReceiveProps (props) {
this._update(props)
}
_selectTab = activeKey => {
this.setState({
activeKey
}, () => {
const { activeKey, tableValue } = this.state
const { onChange } = this.props
const { refs } = this
if (activeKey === NAV_EACH_SELECTED) {
onChange(tableValue)
} else {
onChange(refs.range.value)
}
periodic,
tableValue: periodic ? tableValue : newValue,
rangeValue: periodic ? newValue : rangeValue
})
}
_handleTableValue = tableValue => {
this.setState({
tableValue
}, () => this.props.onChange(tableValue))
componentWillReceiveProps (props) {
if (props.value !== this.props.value) {
this._update(props.value)
}
}
componentDidMount () {
this._update(this.props.value)
}
_onChange = value => {
this.props.onChange(valueToCron(value))
}
_tableTab = () => this._onChange(this.state.tableValue || [])
_periodicTab = () => this._onChange(this.state.rangeValue || this.props.range[0])
render () {
const {
onChange,
headerAddon,
labelId,
options,
optionsRenderer,
range,
labelId
optionRenderer,
range
} = this.props
const { tableValue } = this.state
const tableSelect = (
<TableSelect
onChange={this._handleTableValue}
options={options}
optionsRenderer={optionsRenderer}
value={tableValue}
/>
const {
periodic,
tableValue,
rangeValue
} = this.state
return <Card>
<CardHeader>
{_(`scheduling${labelId}`)}
{headerAddon}
</CardHeader>
<CardBlock>
{range && <ul className='nav nav-tabs mb-1'>
<li className='nav-item'>
<a onClick={this._tableTab} className={classNames('nav-link', !periodic && 'active')} style={CLICKABLE}>
{_(`schedulingEachSelected${labelId}`)}
</a>
</li>
<li className='nav-item'>
<a onClick={this._periodicTab} className={classNames('nav-link', periodic && 'active')} style={CLICKABLE}>
{_(`schedulingEveryN${labelId}`)}
</a>
</li>
</ul>}
{periodic
? <Range ref='range' min={range[0]} max={range[1]} onChange={this._onChange} value={rangeValue} />
: <TableSelect
labelId={labelId}
onChange={this._onChange}
options={options}
optionRenderer={optionRenderer}
value={tableValue || []}
/>
}
</CardBlock>
</Card>
}
}
const isWeekDayMode = ({ monthDayPattern, weekDayPattern }) => {
if (monthDayPattern === '*' && weekDayPattern === '*') {
return
}
return weekDayPattern !== '*'
}
@propTypes({
monthDayPattern: propTypes.string.isRequired,
weekDayPattern: propTypes.string.isRequired
})
class DayPicker extends Component {
state = {
weekDayMode: isWeekDayMode(this.props)
}
componentWillReceiveProps (props) {
const weekDayMode = isWeekDayMode(props)
if (weekDayMode !== undefined) {
this.setState({ weekDayMode })
}
}
_setWeekDayMode = weekDayMode => {
this.props.onChange([ '*', '*' ])
this.setState({ weekDayMode })
}
_onChange = cron => {
const isMonthDayPattern = !this.state.weekDayMode || includes(cron, '/')
this.props.onChange([
isMonthDayPattern ? cron : '*',
isMonthDayPattern ? '*' : cron
])
}
render () {
const { monthDayPattern, weekDayPattern } = this.props
const { weekDayMode } = this.state
const dayModeToggle = (
<Tooltip content={_(weekDayMode ? 'schedulingSetMonthDayMode' : 'schedulingSetWeekDayMode')}>
<span className='pull-right'><Toggle onChange={this._setWeekDayMode} iconSize={1} value={weekDayMode} /></span>
</Tooltip>
)
return (
<Card>
<CardHeader>
{_(`scheduling${labelId}`)}
</CardHeader>
<CardBlock>
{range
? (
<Tabs bsStyle='tabs' activeKey={this.state.activeKey} onSelect={this._selectTab}>
<Tab tabClassName='nav-item' eventKey={NAV_EACH_SELECTED} title={_(`schedulingEachSelected${labelId}`)}>
{tableSelect}
</Tab>
<Tab tabClassName='nav-item' eventKey={NAV_EVERY_N} title={_(`schedulingEveryN${labelId}`)}>
<Range ref='range' min={range[0]} max={range[1]} onChange={onChange} />
</Tab>
</Tabs>
) : tableSelect
}
</CardBlock>
</Card>
)
return <TimePicker
headerAddon={dayModeToggle}
key={weekDayMode ? 'week' : 'month'}
labelId='Day'
optionRenderer={weekDayMode ? getDayName : undefined}
options={weekDayMode ? WEEK_DAYS : DAYS}
onChange={this._onChange}
range={MONTH_DAYS_RANGE}
setWeekDayMode={this._setWeekDayMode}
value={weekDayMode ? weekDayPattern : monthDayPattern}
/>
}
}
// ===================================================================
const HOURS_RANGE = [2, 12]
const MINUTES_RANGE = [2, 30]
const decrement = e => e - 1
@propTypes({
cronPattern: propTypes.string.isRequired,
cronPattern: propTypes.string,
onChange: propTypes.func,
timezone: propTypes.string
timezone: propTypes.string,
value: propTypes.shape({
cronPattern: propTypes.string.isRequired,
timezone: propTypes.string
})
})
export default class Scheduler extends Component {
_update (type, value) {
if (Array.isArray(value)) {
if (!value.length) {
value = '*'
} else {
value = join(
(type === 'monthDay' || type === 'month')
? map(value, n => n + 1)
: value,
','
)
}
} else {
value = `*/${value}`
constructor (props) {
super(props)
this._onCronChange = newCrons => {
const cronPattern = this._getCronPattern().split(' ')
forEach(newCrons, (cron, unit) => {
cronPattern[PICKTIME_TO_ID[unit]] = cron
})
this.props.onChange({
cronPattern: cronPattern.join(' '),
timezone: this._getTimezone()
})
}
const { props } = this
const cronPattern = props.cronPattern.split(' ')
cronPattern[PICKTIME_TO_ID[type]] = value
forEach(UNITS, unit => {
this[`_${unit}Change`] = cron => this._onCronChange({ [unit]: cron })
})
this._dayChange = ([ monthDay, weekDay ]) => this._onCronChange({ monthDay, weekDay })
}
_onTimezoneChange = timezone => {
this.props.onChange({
cronPattern: cronPattern.join(' '),
timezone: props.timezone
cronPattern: this._getCronPattern(),
timezone
})
}
_onHourChange = value => this._update('hour', value)
_onMinuteChange = value => this._update('minute', value)
_onMonthChange = value => this._update('month', value)
_onMonthDayChange = value => this._update('monthDay', value)
_onWeekDayChange = value => this._update('weekDay', value)
_getCronPattern = () => {
const { value, cronPattern = value.cronPattern } = this.props
return cronPattern
}
_onTimezoneChange = timezone => {
const { props } = this
props.onChange({
cronPattern: props.cronPattern,
timezone
})
_getTimezone = () => {
const { value, timezone = value && value.timezone } = this.props
return timezone
}
render () {
const {
cronPattern,
timezone
} = this.props
const cronPatternArr = cronPattern.split(' ')
const cronPatternArr = this._getCronPattern().split(' ')
const timezone = this._getTimezone()
return (
<div className='card-block'>
@@ -435,25 +507,16 @@ export default class Scheduler extends Component {
<Col mediumSize={6}>
<TimePicker
labelId='Month'
optionsRenderer={getMonthName}
optionRenderer={getMonthName}
options={MONTHS}
onChange={this._onMonthChange}
onChange={this._monthChange}
range={MONTHS_RANGE}
value={cronPatternArr[PICKTIME_TO_ID['month']]}
valueRenderer={decrement}
/>
<TimePicker
labelId='MonthDay'
options={DAYS}
onChange={this._onMonthDayChange}
value={cronPatternArr[PICKTIME_TO_ID['monthDay']]}
valueRenderer={decrement}
/>
<TimePicker
labelId='WeekDay'
optionsRenderer={getDayName}
options={WEEK_DAYS}
onChange={this._onWeekDayChange}
value={cronPatternArr[PICKTIME_TO_ID['weekDay']]}
<DayPicker
onChange={this._dayChange}
monthDayPattern={cronPatternArr[PICKTIME_TO_ID['monthDay']]}
weekDayPattern={cronPatternArr[PICKTIME_TO_ID['weekDay']]}
/>
</Col>
<Col mediumSize={6}>
@@ -461,14 +524,14 @@ export default class Scheduler extends Component {
labelId='Hour'
options={HOURS}
range={HOURS_RANGE}
onChange={this._onHourChange}
onChange={this._hourChange}
value={cronPatternArr[PICKTIME_TO_ID['hour']]}
/>
<TimePicker
labelId='Minute'
options={MINS}
range={MINUTES_RANGE}
onChange={this._onMinuteChange}
onChange={this._minuteChange}
value={cronPatternArr[PICKTIME_TO_ID['minute']]}
/>
</Col>

View File

@@ -0,0 +1,32 @@
import _ from 'intl'
import Component from 'base-component'
import Icon from 'icon'
import propTypes from 'prop-types'
import React from 'react'
import { omit } from 'lodash'
@propTypes({
multi: propTypes.bool,
label: propTypes.node,
onChange: propTypes.func.isRequired
})
export default class SelectFiles extends Component {
_onChange = e => {
const { multi, onChange } = this.props
const { files } = e.target
onChange(multi ? files : files[0])
}
render () {
return <label className='btn btn-secondary btn-file hidden'>
<Icon icon='file' /> {this.props.label || _('browseFiles')}
<input
{...omit(this.props, [ 'hidden', 'label', 'onChange', 'multi' ])}
hidden
onChange={this._onChange}
type='file'
/>
</label>
}
}

View File

@@ -1,25 +1,38 @@
import React from 'react'
import assign from 'lodash/assign'
import classNames from 'classnames'
import filter from 'lodash/filter'
import flatten from 'lodash/flatten'
import forEach from 'lodash/forEach'
import groupBy from 'lodash/groupBy'
import keyBy from 'lodash/keyBy'
import keys from 'lodash/keys'
import map from 'lodash/map'
import mapValues from 'lodash/mapValues'
import pick from 'lodash/pick'
import sortBy from 'lodash/sortBy'
import store from 'store'
import { parse as parseRemote } from 'xo-remote-parser'
import {
assign,
filter,
flatten,
forEach,
groupBy,
includes,
isArray,
isEmpty,
isInteger,
isString,
keyBy,
keys,
map,
mapValues,
pick,
sortBy,
toArray
} from 'lodash'
import _ from './intl'
import Button from './button'
import Component from './base-component'
import Icon from './icon'
import propTypes from './prop-types'
import renderXoItem from './render-xo-item'
import store from './store'
import Tooltip from './tooltip'
import uncontrollableInput from 'uncontrollable-input'
import { Select } from './form'
import {
createCollectionWrapper,
createFilter,
createGetObjectsOfType,
createGetTags,
@@ -27,8 +40,8 @@ import {
getObject
} from './selectors'
import {
addSubscriptions,
connectStore,
mapPlus,
resolveResourceSets
} from './utils'
import {
@@ -44,6 +57,26 @@ import {
// ===================================================================
// react-select's line-height is 1.4
// https://github.com/JedWatson/react-select/blob/916ab0e62fc7394be8e24f22251c399a68de8b1c/less/multi.less#L33
// while bootstrap button's line-height is 1.25
// https://github.com/twbs/bootstrap/blob/959c4e527c6ef69623928db638267ba1c370479d/scss/_variables.scss#L342
const ADDON_BUTTON_STYLE = { lineHeight: '1.4' }
const getIds = value => value == null || isString(value) || isInteger(value)
? value
: isArray(value)
? map(value, getIds)
: value.id
const getOption = (object, container) => ({
label: container
? `${getLabel(object)} ${getLabel(container)}`
: getLabel(object),
value: object.id,
xoItem: object
})
const getLabel = object =>
object.name_label ||
object.name ||
@@ -52,6 +85,10 @@ const getLabel = object =>
object.value ||
object.label
const options = props => ({
defaultValue: props.multi ? [] : undefined
})
// ===================================================================
/*
@@ -83,12 +120,11 @@ const getLabel = object =>
@propTypes({
autoFocus: propTypes.bool,
clearable: propTypes.bool,
defaultValue: propTypes.any,
disabled: propTypes.bool,
hasSelectAll: propTypes.bool,
multi: propTypes.bool,
onChange: propTypes.func,
placeholder: propTypes.any.isRequired,
predicate: propTypes.func,
required: propTypes.bool,
value: propTypes.any,
xoContainers: propTypes.array,
@@ -98,202 +134,170 @@ const getLabel = object =>
]).isRequired
})
export class GenericSelect extends Component {
constructor (props) {
super(props)
this.state = {
value: this._setValue(props.value || props.defaultValue, props)
}
}
_getObjectsById = createSelector(
() => this.props.xoObjects,
objects => keyBy(
isArray(objects)
? objects
: flatten(toArray(objects)),
'id'
)
)
_getValue (xoObjectsById = this.state.xoObjectsById, props = this.props) {
const { value } = this.state
_getOptions = createSelector(
() => this.props.xoContainers,
() => this.props.xoObjects,
(containers, objects) => { // createCollectionWrapper with a depth?
const { name } = this.constructor
if (props.multi) {
// Returns the values of the selected objects
// if they are contained in xoObjectsById.
return mapPlus(value, (value, push) => {
const o = xoObjectsById[value.value !== undefined ? value.value : value]
if (o) {
push(o)
let options = []
if (!containers) {
if (__DEV__ && !isArray(objects)) {
throw new Error(`${name}: without xoContainers, xoObjects must be an array`)
}
options = map(objects, getOption)
} else if (__DEV__ && isArray(objects)) {
throw new Error(`${name}: with xoContainers, xoObjects must be an object`)
}
forEach(containers, container => {
options.push({
disabled: true,
xoItem: container
})
forEach(objects[container.id], object => {
options.push(getOption(object, container))
})
})
}
return xoObjectsById[value.value || value] || ''
}
// Supports id strings and objects.
_setValue (value, props = this.props) {
if (props.multi) {
return map(value, object => object.id !== undefined ? object.id : object)
}
return (value != null)
? value.id !== undefined ? value.id : value
: ''
}
componentWillMount () {
const { props } = this
this.setState({
...this._computeOptions(props)
})
}
componentWillReceiveProps (newProps) {
const { props } = this
const { value, xoContainers, xoObjects } = newProps
if (
xoContainers !== props.xoContainers ||
xoObjects !== props.xoObjects
) {
const {
options,
xoObjectsById
} = this._computeOptions(newProps)
const value = this._getValue(xoObjectsById, newProps)
this.setState({
options,
value: this._setValue(value, newProps),
xoObjectsById
})
}
if (value !== props.value) {
this.setState({
value: this._setValue(value, newProps)
})
}
}
_computeOptions ({ xoContainers, xoObjects }) {
if (!xoContainers) {
if (process.env.NODE_ENV !== 'production') {
if (!Array.isArray(xoObjects)) {
throw new Error('without xoContainers, xoObjects must be an array')
const values = this._getSelectValue()
const objectsById = this._getObjectsById()
const addIfMissing = val => {
if (val && !objectsById[val]) {
options.push({
disabled: true,
id: val,
label: val,
value: val,
xoItem: {
id: val,
removed: true
}
})
}
}
return {
xoObjectsById: keyBy(xoObjects, 'id'),
options: map(xoObjects, object => ({
label: getLabel(object),
value: object.id,
xoItem: object
}))
if (isArray(values)) {
forEach(values, addIfMissing)
} else {
addIfMissing(values)
}
return options
}
)
if (process.env.NODE_ENV !== 'production') {
if (Array.isArray(xoObjects)) {
throw new Error('with xoContainers, xoObjects must be an object')
}
}
_getSelectValue = createSelector(
() => this.props.value,
createCollectionWrapper(getIds)
)
const options = []
const xoObjectsById = {}
_getNewSelectedObjects = createSelector(
this._getObjectsById,
value => value,
(objectsById, value) => value == null
? value
: isArray(value)
? map(value, value => objectsById[value.value])
: objectsById[value.value]
)
forEach(xoContainers, container => {
const containerObjects = keyBy(xoObjects[container.id], 'id')
assign(xoObjectsById, containerObjects)
options.push({
disabled: true,
xoItem: container
})
options.push.apply(options, map(containerObjects, object => ({
label: `${getLabel(object)} ${getLabel(container)}`,
value: object.id,
xoItem: object
})))
})
return { xoObjectsById, options }
}
get value () {
return this._getValue()
}
set value (value) {
this.setState({
value: this._setValue(value)
})
}
_handleChange = value => {
_onChange = value => {
const { onChange } = this.props
if (onChange) {
onChange(this._getNewSelectedObjects(value))
}
}
this.setState({
value: this._setValue(value)
}, onChange && (() => onChange(this.value)))
_selectAll = () => {
this._onChange(
filter(this._getOptions(), ({ disabled }) => !disabled)
)
}
// GroupBy: Display option with margin if not disabled and containers exists.
_renderOption = option => (
_renderOption = option =>
<span
className={classNames(
!option.disabled && this.props.xoContainers && 'm-l-1'
!option.disabled && this.props.xoContainers && 'ml-1'
)}
>
{renderXoItem(option.xoItem)}
</span>
)
render () {
const { props, state } = this
const {
autoFocus,
disabled,
hasSelectAll,
multi,
placeholder,
required,
return (
<Select
autofocus={props.autoFocus}
clearable={props.clearable}
disabled={props.disabled}
multi={props.multi}
onChange={this._handleChange}
openOnFocus
optionRenderer={this._renderOption}
options={state.options}
placeholder={props.placeholder}
required={props.required}
value={state.value}
valueRenderer={this._renderOption}
/>
)
clearable = Boolean(multi || !required)
} = this.props
const select = <Select
{...{
autofocus: autoFocus,
clearable,
disabled,
multi,
placeholder,
required
}}
onChange={this._onChange}
openOnFocus
optionRenderer={this._renderOption}
options={this._getOptions()}
value={this._getSelectValue()}
valueRenderer={this._renderOption}
/>
if (!multi || !hasSelectAll) {
return select
}
// `hasSelectAll` should be provided by react-select after this pull request has been merged:
// https://github.com/JedWatson/react-select/pull/748
// TODO: remove once it has been merged upstream.
return <div className='input-group'>
{select}
<span className='input-group-btn'>
<Tooltip content={_('selectAll')}>
<Button onClick={this._selectAll} style={ADDON_BUTTON_STYLE}>
<Icon icon='add' />
</Button>
</Tooltip>
</span>
</div>
}
}
const makeStoreSelect = (createSelectors, props) => connectStore(
createSelectors,
{ withRef: true }
)(
class extends Component {
get value () {
return this.refs.select.value
}
set value (value) {
this.refs.select.value = value
}
render () {
return (
<GenericSelect
ref='select'
{...props}
{...this.props}
/>
)
}
}
const makeStoreSelect = (createSelectors, defaultProps) => uncontrollableInput(options)(
connectStore(createSelectors)(
props =>
<GenericSelect
{...defaultProps}
{...props}
/>
)
)
const makeSubscriptionSelect = (subscribe, props) => (
const makeSubscriptionSelect = (subscribe, props) => uncontrollableInput(options)(
class extends Component {
constructor (props) {
super(props)
@@ -322,14 +326,6 @@ const makeSubscriptionSelect = (subscribe, props) => (
)
}
get value () {
return this.refs.select.value
}
set value (value) {
this.refs.select.value = value
}
componentWillMount () {
this.componentWillUnmount = subscribe(::this.setState)
}
@@ -337,7 +333,6 @@ const makeSubscriptionSelect = (subscribe, props) => (
render () {
return (
<GenericSelect
ref='select'
{...props}
{...this.props}
xoObjects={this._getFilteredXoObjects()}
@@ -464,7 +459,7 @@ export const SelectVmTemplate = makeStoreSelect(() => {
xoObjects: getVmTemplatesByPool,
xoContainers: getPools
}
}, { placeholder: _('selectVms') })
}, { placeholder: _('selectVmTemplates') })
// ===================================================================
@@ -518,11 +513,11 @@ export const SelectTag = makeStoreSelect((_, props) => ({
}), { placeholder: _('selectTags') })
export const SelectHighLevelObject = makeStoreSelect(() => {
const getHosts = createGetObjectsOfType('host')
const getNetworks = createGetObjectsOfType('network')
const getPools = createGetObjectsOfType('pool')
const getSrs = createGetObjectsOfType('SR')
const getVms = createGetObjectsOfType('VM')
const getHosts = createGetObjectsOfType('host').filter(getPredicate)
const getNetworks = createGetObjectsOfType('network').filter(getPredicate)
const getPools = createGetObjectsOfType('pool').filter(getPredicate)
const getSrs = createGetObjectsOfType('SR').filter(getPredicate)
const getVms = createGetObjectsOfType('VM').filter(getPredicate)
const getHighLevelObjects = createSelector(
getHosts,
@@ -654,14 +649,6 @@ export class SelectResourceSetsVmTemplate extends Component {
this.refs.select.value = value
}
componentWillMount () {
this.componentWillUnmount = subscribeResourceSets(resourceSets => {
this.setState({
resourceSets: resolveResourceSets(resourceSets)
})
})
}
_getTemplates = createSelector(
() => this.props.resourceSet,
({ objectsByType }) => {
@@ -693,15 +680,6 @@ export class SelectResourceSetsSr extends Component {
set value (value) {
this.refs.select.value = value
}
componentWillMount () {
this.componentWillUnmount = subscribeResourceSets(resourceSets => {
this.setState({
resourceSets: resolveResourceSets(resourceSets)
})
})
}
_getSrs = createSelector(
() => this.props.resourceSet,
({ objectsByType }) => {
@@ -734,14 +712,6 @@ export class SelectResourceSetsVdi extends Component {
this.refs.select.value = value
}
componentWillMount () {
this.componentWillUnmount = subscribeResourceSets(resourceSets => {
this.setState({
resourceSets: resolveResourceSets(resourceSets)
})
})
}
_getObject (id) {
return getObject(store.getState(), id, true)
}
@@ -783,14 +753,6 @@ export class SelectResourceSetsNetwork extends Component {
this.refs.select.value = value
}
componentWillMount () {
this.componentWillUnmount = subscribeResourceSets(resourceSets => {
this.setState({
resourceSets: resolveResourceSets(resourceSets)
})
})
}
_getNetworks = createSelector(
() => this.props.resourceSet,
({ objectsByType }) => {
@@ -814,6 +776,78 @@ export class SelectResourceSetsNetwork extends Component {
// ===================================================================
// Pass a function to @addSubscriptions to ensure subscribeIpPools and subscribeResourceSets
// are correctly imported before they are called
@addSubscriptions(() => ({
ipPools: subscribeIpPools,
resourceSets: subscribeResourceSets
}))
@propTypes({
containerPredicate: propTypes.func,
predicate: propTypes.func,
resourceSetId: propTypes.string.isRequired
})
export class SelectResourceSetIp extends Component {
get value () {
return this.refs.select.value
}
set value (value) {
this.refs.select.value = value
}
_getResourceSetIpPools = createSelector(
() => this.props.ipPools,
() => this.props.resourceSets,
() => this.props.resourceSetId,
(allIpPools, allResourceSets, resourceSetId) => {
const { ipPools } = allResourceSets[resourceSetId]
return filter(allIpPools, ({ id }) => includes(ipPools, id))
}
)
_getIpPools = createSelector(
() => this.props.ipPools,
() => this.props.containerPredicate,
(ipPools, predicate) => predicate
? filter(ipPools, predicate)
: ipPools
)
_getIps = createSelector(
this._getIpPools,
() => this.props.predicate,
() => this.props.ipPools,
(ipPools, predicate, resolvedIpPools) => {
return flatten(
map(ipPools, ipPool => {
const poolIps = map(ipPool.addresses, (address, ip) => ({
...address,
id: ip,
label: ip,
type: 'ipAddress',
used: !isEmpty(address.vifs)
}))
return predicate ? filter(poolIps, predicate) : poolIps
})
)
}
)
render () {
return (
<GenericSelect
ref='select'
placeholder={_('selectIpPool')}
{...this.props}
xoObjects={this._getIps()}
/>
)
}
}
// ===================================================================
export class SelectSshKey extends Component {
get value () {
return this.refs.select.value
@@ -857,7 +891,9 @@ export const SelectIp = makeSubscriptionSelect(subscriber => {
ipPools => map(ipPools[0].addresses, (address, ip) => ({
...address,
id: ip,
label: ip
label: ip,
type: 'ipAddress',
used: !isEmpty(address.vifs)
}))
)
const xoContainers = map(sortedIpPools, ipPool => ({
@@ -869,3 +905,15 @@ export const SelectIp = makeSubscriptionSelect(subscriber => {
return unsubscribeIpPools
}, { placeholder: _('selectIp') })
// ===================================================================
export const SelectIpPool = makeSubscriptionSelect(subscriber => {
const unsubscribeIpPools = subscribeIpPools(ipPools => {
subscriber({
xoObjects: map(sortBy(ipPools, 'name'), ipPool => ({ ...ipPool, type: 'ipPool' }))
})
})
return unsubscribeIpPools
}, { placeholder: _('selectIpPool') })

View File

@@ -7,6 +7,7 @@ import isArray from 'lodash/isArray'
import isArrayLike from 'lodash/isArrayLike'
import isFunction from 'lodash/isFunction'
import keys from 'lodash/keys'
import map from 'lodash/map'
import orderBy from 'lodash/orderBy'
import pickBy from 'lodash/pickBy'
import size from 'lodash/size'
@@ -36,12 +37,16 @@ export {
// Use case: in connect, to avoid rerendering a component where the
// objects are still the same.
const _createCollectionWrapper = selector => {
let cache
let cache, previous
return (...args) => {
const value = selector(...args)
if (!shallowEqual(value, cache)) {
cache = value
if (value !== previous) {
previous = value
if (!shallowEqual(value, cache)) {
cache = value
}
}
return cache
}
@@ -141,10 +146,10 @@ export const createPicker = (object, props) =>
// - predicate == null → no filtering
// - predicate === false → everything is filtered out
export const createFilter = (collection, predicate) =>
_createCollectionWrapper(
_create2(
collection,
predicate,
_create2(
collection,
predicate,
_createCollectionWrapper(
(collection, predicate) => predicate === false
? (isArrayLike(collection) ? EMPTY_ARRAY : EMPTY_OBJECT)
: predicate
@@ -167,17 +172,18 @@ export const createGroupBy = (collection, getter) =>
groupBy
)
export const createPager = (array, page, n = 25) => _createCollectionWrapper(
export const createPager = (array, page, n = 25) =>
_create2(
array,
page,
n,
(array, page, n) => {
const start = (page - 1) * n
return slice(array, start, start + n)
}
_createCollectionWrapper(
(array, page, n) => {
const start = (page - 1) * n
return slice(array, start, start + n)
}
)
)
)
export const createSort = (
collection,
@@ -186,11 +192,11 @@ export const createSort = (
) => _create2(collection, getter, order, orderBy)
export const createTop = (collection, iteratee, n) =>
_createCollectionWrapper(
_create2(
collection,
iteratee,
n,
_create2(
collection,
iteratee,
n,
_createCollectionWrapper(
(objects, iteratee, n) => {
let results = orderBy(objects, iteratee, 'desc')
if (n < results.length) {
@@ -216,6 +222,36 @@ export const getStatus = state => state.status
export const getUser = state => state.user
export const getCheckPermissions = invoke(() => {
const getPredicate = create(
state => state.permissions,
state => state.objects,
(permissions, objects) => {
objects = objects.all
const getObject = id => (objects[id] || EMPTY_OBJECT)
return (id, permission) => checkPermissions(permissions, getObject, id, permission)
}
)
const isTrue = () => true
const isFalse = () => false
return state => {
const user = getUser(state)
if (!user) {
return isFalse
}
if (user.permission === 'admin') {
return isTrue
}
return getPredicate(state)
}
})
const _getPermissionsPredicate = invoke(() => {
const getPredicate = create(
state => state.permissions,
@@ -242,6 +278,12 @@ const _getPermissionsPredicate = invoke(() => {
}
})
export const isAdmin = (...args) => {
const user = getUser(...args)
return user && user.permission === 'admin'
}
// ===================================================================
// Common selector creators.
@@ -305,7 +347,7 @@ export const createSortForType = invoke(() => {
return (type, collection) => createSort(
collection,
autoSelector(type, getIteratees),
autoSelector(type, getOrders),
autoSelector(type, getOrders)
)
})
@@ -322,7 +364,11 @@ const _extendCollectionSelector = (selector, objectsType) => {
return selector
}
_addGroupBy(selector)
selector.find = predicate => createFinder(selector, predicate)
const _addFind = selector => {
selector.find = predicate => createFinder(selector, predicate)
return selector
}
_addFind(selector)
// groupBy can be chained.
const _addSort = selector => {
@@ -342,9 +388,9 @@ const _extendCollectionSelector = (selector, objectsType) => {
_addFilter(selector)
// filter, groupBy and sort can be chained.
selector.pick = idsSelector => _addFilter(_addGroupBy(_addSort(
selector.pick = idsSelector => _addFind(_addFilter(_addGroupBy(_addSort(
createPicker(selector, idsSelector)
)))
))))
return selector
}
@@ -362,7 +408,7 @@ const _extendCollectionSelector = (selector, objectsType) => {
// - groupBy: returns a selector which returns the objects grouped by
// a value determined by a getter selector
// - pick: returns a selector which returns only the objects with given
// ids (filter, groupBy and sort can be chained)
// ids (filter, find, groupBy and sort can be chained)
// - sort: returns a selector which returns the objects appropriately
// sorted (groupBy can be chained)
export const createGetObjectsOfType = type => {
@@ -416,23 +462,50 @@ export const createGetObjectMessages = objectSelector =>
// ...
export const getObject = createGetObject((_, id) => id)
export const createGetHostMetrics = hostSelector => _createCollectionWrapper(
export const createDoesHostNeedRestart = hostSelector => {
// Returns the first patch of the host which requires it to be
// restarted.
const restartPoolPatch = createGetObjectsOfType('pool_patch').pick(
create(
createGetObjectsOfType('host_patch').pick(
(state, props) => {
const host = hostSelector(state, props)
return host && host.patches
}
).filter(create(
(state, props) => {
const host = hostSelector(state, props)
return host && host.startTime
},
startTime => patch => patch.time > startTime
)),
hostPatches => map(hostPatches, hostPatch => hostPatch.pool_patch)
)
).find([ ({ guidance }) => find(guidance, action =>
action === 'restartHost' || action === 'restartXapi'
) ])
return (state, props) => restartPoolPatch(state, props) !== undefined
}
export const createGetHostMetrics = hostSelector =>
create(
hostSelector,
hosts => {
const metrics = {
count: 0,
cpus: 0,
memoryTotal: 0,
memoryUsage: 0
_createCollectionWrapper(
hosts => {
const metrics = {
count: 0,
cpus: 0,
memoryTotal: 0,
memoryUsage: 0
}
forEach(hosts, host => {
metrics.count++
metrics.cpus += host.cpus.cores
metrics.memoryTotal += host.memory.size
metrics.memoryUsage += host.memory.usage
})
return metrics
}
forEach(hosts, host => {
metrics.count++
metrics.cpus += host.cpus.cores
metrics.memoryTotal += host.memory.size
metrics.memoryUsage += host.memory.usage
})
return metrics
}
)
)
)

View File

@@ -1,3 +1,5 @@
import kindOf from 'kindof'
// Tests that two collections (arrays or objects) have strictly equals
// values (items or properties)
const shallowEqual = (c1, c2) => {
@@ -5,8 +7,8 @@ const shallowEqual = (c1, c2) => {
return true
}
const type = typeof c1
if (type !== typeof c2) {
const type = kindOf(c1)
if (type !== kindOf(c2)) {
return false
}
@@ -25,6 +27,10 @@ const shallowEqual = (c1, c2) => {
return true
}
if (type !== 'object') {
return false
}
let n = 0
for (const _ in c2) { // eslint-disable-line no-unused-vars
++n

35
src/common/shortcuts.js Normal file
View File

@@ -0,0 +1,35 @@
import Component from 'base-component'
import forEach from 'lodash/forEach'
import React from 'react'
import remove from 'lodash/remove'
import { Shortcuts as ReactShortcuts } from 'react-shortcuts'
let enabled = true
const instances = []
const updateInstances = () => {
forEach(instances, instance => instance.forceUpdate())
}
export const enable = () => {
enabled = true
updateInstances()
}
export const disable = () => {
enabled = false
updateInstances()
}
export default class Shortcuts extends Component {
componentDidMount () {
instances.push(this)
}
componentWillUnmount () {
remove(instances, this)
}
render () {
return enabled ? <ReactShortcuts {...this.props} /> : null
}
}

View File

@@ -1,8 +1,12 @@
.clickableColumn {
cursor: pointer;
cursor: pointer;
}
.clickableColumn:hover {
color: #fff;
background-color: #96b8d1;
color: #fff;
background-color: #96b8d1;
}
.clickableRow {
cursor: pointer;
}

View File

@@ -1,6 +1,8 @@
import _ from 'intl'
import ceil from 'lodash/ceil'
import classNames from 'classnames'
import debounce from 'lodash/debounce'
import findIndex from 'lodash/findIndex'
import isEmpty from 'lodash/isEmpty'
import isFunction from 'lodash/isFunction'
import map from 'lodash/map'
@@ -10,6 +12,7 @@ import DropdownMenu from 'react-bootstrap-4/lib/DropdownMenu' // https://phabric
import DropdownToggle from 'react-bootstrap-4/lib/DropdownToggle' // https://phabricator.babeljs.io/T6662 so Dropdown.Toggle won't work https://react-bootstrap.github.io/components.html#btn-dropdowns-custom
import { Portal } from 'react-overlays'
import Button from '../button'
import Component from '../base-component'
import Icon from '../icon'
import propTypes from '../prop-types'
@@ -78,9 +81,9 @@ class TableFilter extends Component {
className='form-control'
/>
<div className='input-group-btn'>
<button className='btn btn-secondary' onClick={this._cleanFilter}>
<Button onClick={this._cleanFilter}>
<Icon icon='clear-search' />
</button>
</Button>
</div>
</div>
)
@@ -91,7 +94,7 @@ class TableFilter extends Component {
@propTypes({
columnId: propTypes.number.isRequired,
name: propTypes.any.isRequired,
name: propTypes.node,
sort: propTypes.func,
sortIcon: propTypes.string
})
@@ -102,25 +105,25 @@ class ColumnHead extends Component {
}
render () {
const { name, sortIcon } = this.props
const { name, sortIcon, textAlign } = this.props
if (!this.props.sort) {
return <th>{name}</th>
return <th className={textAlign && `text-xs-${textAlign}`}>{name}</th>
}
let className = styles.clickableColumn
if (sortIcon === 'asc' || sortIcon === 'desc') {
className += ' bg-info'
}
const isSelected = sortIcon === 'asc' || sortIcon === 'desc'
return (
<th
className={className}
className={classNames(
textAlign && `text-xs-${textAlign}`,
styles.clickableColumn,
isSelected && classNames('text-white', 'bg-info')
)}
onClick={this._sort}
>
{name}
<span className='pull-xs-right'>
<span className='pull-right'>
<Icon icon={sortIcon} />
</span>
</th>
@@ -139,18 +142,21 @@ const DEFAULT_ITEMS_PER_PAGE = 10
propTypes.object
]).isRequired,
columns: propTypes.arrayOf(propTypes.shape({
name: propTypes.node.isRequired,
default: propTypes.bool,
name: propTypes.node,
itemRenderer: propTypes.func.isRequired,
sortCriteria: propTypes.oneOfType([
propTypes.func,
propTypes.string
]),
sortOrder: propTypes.string
sortOrder: propTypes.string,
textAlign: propTypes.string
})).isRequired,
filterContainer: propTypes.func,
filters: propTypes.object,
itemsPerPage: propTypes.number,
paginationContainer: propTypes.func,
rowAction: propTypes.func,
rowLink: propTypes.oneOfType([
propTypes.func,
propTypes.string
@@ -161,8 +167,17 @@ export default class SortedTable extends Component {
constructor (props) {
super(props)
let selectedColumn = props.defaultColumn
if (selectedColumn == null) {
selectedColumn = findIndex(props.columns, 'default')
if (selectedColumn === -1) {
selectedColumn = 0
}
}
this.state = {
selectedColumn: props.defaultColumn || 0,
selectedColumn,
itemsPerPage: props.itemsPerPage || DEFAULT_ITEMS_PER_PAGE
}
@@ -252,6 +267,7 @@ export default class SortedTable extends Component {
paginationContainer,
filterContainer,
filters,
rowAction,
rowLink,
userData
} = props
@@ -289,7 +305,9 @@ export default class SortedTable extends Component {
<tr>
{map(props.columns, (column, key) => (
<ColumnHead
textAlign={column.textAlign}
columnId={key}
key={key}
name={column.name}
sort={column.sortCriteria && this._sort}
@@ -301,7 +319,7 @@ export default class SortedTable extends Component {
<tbody>
{map(this._getVisibleItems(), (item, i) => {
const columns = map(props.columns, (column, key) => (
<td key={key}>
<td key={key} className={column.textAlign && `text-xs-${column.textAlign}`}>
{column.itemRenderer(item, userData)}
</td>
))
@@ -314,7 +332,13 @@ export default class SortedTable extends Component {
tagName='tr'
to={isFunction(rowLink) ? rowLink(item, userData) : rowLink}
>{columns}</BlockLink>
: <tr key={id}>{columns}</tr>
: <tr
className={rowAction && styles.clickableRow}
key={id}
onClick={rowAction && (() => rowAction(item, userData))}
>
{columns}
</tr>
})}
</tbody>
</table>
@@ -324,19 +348,19 @@ export default class SortedTable extends Component {
<Col mediumSize={8}>
{paginationContainer
? (
// Rebuild container function to refresh Portal component.
<Portal container={() => paginationContainer()}>
{paginationInstance}
</Portal>
// Rebuild container function to refresh Portal component.
<Portal container={() => paginationContainer()}>
{paginationInstance}
</Portal>
) : paginationInstance
}
</Col>
<Col mediumSize={4}>
{filterContainer
? (
<Portal container={() => filterContainer()}>
{filterInstance}
</Portal>
<Portal container={() => filterContainer()}>
{filterInstance}
</Portal>
) : filterInstance
}
</Col>

View File

@@ -0,0 +1,38 @@
import React from 'react'
import styled from 'styled-components'
import ActionButton from './action-button'
import propTypes from './prop-types'
const Button = styled(ActionButton)`
background-color: ${p => p.theme[`${p.state ? 'enabled' : 'disabled'}StateBg`]}
border: 2px solid ${p => p.theme[`${p.state ? 'enabled' : 'disabled'}StateColor`]}
color: ${p => p.theme[`${p.state ? 'enabled' : 'disabled'}StateColor`]}
`
const StateButton = ({
disabledHandler,
disabledLabel,
disabledTooltip,
enabledLabel,
enabledTooltip,
enabledHandler,
state,
...props
}) =>
<Button
handler={state ? enabledHandler : disabledHandler}
tooltip={state ? enabledTooltip : disabledTooltip}
{...props}
icon={state ? 'running' : 'halted'}
size='small'
state={state}
>
{state ? enabledLabel : disabledLabel}
</Button>
export default propTypes({
state: propTypes.bool.isRequired
})(StateButton)

View File

@@ -1,33 +1,22 @@
import isFunction from 'lodash/isFunction'
// ===================================================================
const createAction = (() => {
const { defineProperty } = Object
const noop = function () {
if (arguments.length) {
throw new Error('this action expects no payload!')
}
}
return (type, payloadCreator = noop) => {
const createActionObject = payload => {
// Thunks
if (isFunction(payload)) {
return payload
}
return (type, payloadCreator) => defineProperty(
payloadCreator
? (...args) => ({
type,
payload: payloadCreator(...args)
})
: (action => function () {
if (arguments.length) {
throw new Error('this action expects no payload!')
}
return payload === undefined
? { type }
: { type, payload }
}
return defineProperty(
(...args) => createActionObject(payloadCreator(...args)),
'toString',
{ value: () => type }
)
}
return action
})({ type }),
'toString',
{ value: () => type }
)
})()
// ===================================================================

View File

@@ -102,16 +102,20 @@ export default {
for (const id in updates) {
const object = updates[id]
const previous = all[id]
if (object) {
const { type } = object
all[id] = object
get(object.type)[id] = object
} else {
const previous = all[id]
if (previous) {
delete all[id]
get(type)[id] = object
if (previous && previous.type !== type) {
delete get(previous.type)[id]
}
} else if (previous) {
delete all[id]
delete get(previous.type)[id]
}
}

View File

@@ -1,14 +1,44 @@
import React from 'react'
import filter from 'lodash/filter'
import includes from 'lodash/includes'
import map from 'lodash/map'
import React from 'react'
import Component from './base-component'
import Icon from './icon'
import propTypes from './prop-types'
const INPUT_STYLE = {
margin: '2px',
maxWidth: '4em'
}
const TAG_STYLE = {
backgroundColor: '#2598d9',
borderRadius: '0.5em',
color: 'white',
fontSize: '0.6em',
margin: '0.2em',
marginTop: '-0.1em',
padding: '0.3em',
verticalAlign: 'middle'
}
const LINK_STYLE = {
cursor: 'pointer'
}
const ADD_TAG_STYLE = {
cursor: 'pointer',
fontSize: '0.8em',
marginLeft: '0.2em'
}
const REMOVE_TAG_STYLE = {
cursor: 'pointer'
}
@propTypes({
labels: propTypes.arrayOf(React.PropTypes.string).isRequired,
onDelete: propTypes.func,
onAdd: propTypes.func
onAdd: propTypes.func,
onChange: propTypes.func,
onClick: propTypes.func,
onDelete: propTypes.func
})
export default class Tags extends Component {
componentWillMount () {
@@ -22,56 +52,85 @@ export default class Tags extends Component {
this.setState({ editing: false })
}
_addTag = newTag => {
const { labels, onAdd, onChange } = this.props
if (!includes(labels, newTag)) {
onAdd && onAdd(newTag)
onChange && onChange([ ...labels, newTag ])
}
}
_deleteTag = tag => {
const { onChange, onDelete } = this.props
onDelete && onDelete(tag)
onChange && onChange(filter(this.props.labels, t => t !== tag))
}
_onKeyDown = event => {
const { keyCode, target } = event
if (keyCode === 13) {
if (target.value) {
this._addTag(target.value)
target.value = ''
}
} else if (keyCode === 27) {
this._stopEdit()
} else {
return
}
event.preventDefault()
}
render () {
const {
labels,
onDelete,
onAdd
onAdd,
onChange,
onClick,
onDelete
} = this.props
const deleteTag = (onDelete || onChange) && this._deleteTag
return (
<span className='form-group' style={{ color: '#999' }}>
<Icon icon='tags' />
{' '}
<span>
{map(labels.sort(), (label, index) =>
<Tag label={label} onDelete={onDelete} key={index} />
<Tag label={label} onDelete={deleteTag} key={index} onClick={onClick} />
)}
</span>
{onAdd
? !this.state.editing
? <span className='add-tag-action' onClick={this._startEdit} style={{cursor: 'pointer'}}>
<Icon icon='add-tag' />
</span>
: <span>
<input
type='text'
autoFocus
style={{maxWidth: '4em', margin: '2px'}}
onKeyDown={event => {
const { target } = event
if (event.keyCode === 13 && target.value) {
onAdd(target.value)
target.value = ''
} else if (event.keyCode === 27) {
this._stopEdit()
}
}}
onBlur={this._stopEdit}
/>
</span>
: []
{(onAdd || onChange) && !this.state.editing
? <span onClick={this._startEdit} style={ADD_TAG_STYLE}>
<Icon icon='add-tag' />
</span>
: <span>
<input
type='text'
autoFocus
style={INPUT_STYLE}
onKeyDown={this._onKeyDown}
onBlur={this._stopEdit}
/>
</span>
}
</span>
)
}
}
export const Tag = ({ label, onDelete }) => (
<span className='xo-tag'>
{label}{' '}
export const Tag = ({ type, label, onDelete, onClick }) => (
<span style={TAG_STYLE}>
<span onClick={onClick && (() => onClick(label))} style={onClick && LINK_STYLE}>
{label}
</span>
{' '}
{onDelete
? <span onClick={onDelete && (() => onDelete(label))} style={{cursor: 'pointer'}}>
? <span onClick={onDelete && (() => onDelete(label))} style={REMOVE_TAG_STYLE}>
<Icon icon='remove-tag' />
</span>
: []

View File

View File

@@ -0,0 +1,6 @@
export default {
disabledStateBg: '#fff',
disabledStateColor: '#c0392b',
enabledStateBg: '#fff',
enabledStateColor: '#27ae60'
}

View File

@@ -9,91 +9,78 @@ import propTypes from './prop-types'
import { getXoServerTimezone } from './xo'
import { Select } from './form'
const XO_SERVER_TIMEZONE = 'xo-server'
const SERVER_TIMEZONE_TAG = 'server'
const LOCAL_TIMEZONE = moment.tz.guess()
@propTypes({
defaultValue: propTypes.string,
onChange: propTypes.func.isRequired,
required: propTypes.bool,
value: propTypes.string
})
export default class TimezonePicker extends Component {
constructor (props) {
super(props)
this.state.options = map(moment.tz.names(), value => ({ label: value, value }))
}
get value () {
const value = this.refs.select.value
return (value === XO_SERVER_TIMEZONE) ? null : value
}
set value (value) {
this.refs.select.value = value || XO_SERVER_TIMEZONE
}
_updateTimezone (value) {
this.props.onChange(value)
}
_handleChange = option => {
return this._updateTimezone(
!option || option.value === XO_SERVER_TIMEZONE
? null
: option.value
)
}
_useServerTime = () => {
this._updateTimezone(null)
}
_useLocalTime = () => {
this._updateTimezone(moment.tz.guess())
}
componentWillMount () {
// Use local timezone (Web browser) if no default value.
if (this.props.value === undefined) {
this._useLocalTime()
}
componentDidMount () {
getXoServerTimezone.then(serverTimezone => {
this.setState({
options: [{
label: _('serverTimezoneOption', {
value: serverTimezone
}),
value: XO_SERVER_TIMEZONE
}].concat(this.state.options),
serverTimezone
timezone: this.props.value || this.props.defaultValue || SERVER_TIMEZONE_TAG,
options: [
...map(moment.tz.names(), value => ({ label: value, value })),
{
label: _('serverTimezoneOption', {
value: serverTimezone
}),
value: SERVER_TIMEZONE_TAG
}
]
})
})
}
componentWillReceiveProps (props) {
if (props.value !== this.props.value) {
this.setState({ timezone: props.value || SERVER_TIMEZONE_TAG })
}
}
get value () {
return this.state.timezone === SERVER_TIMEZONE_TAG ? null : this.state.timezone
}
set value (value) {
this.setState({ timezone: value || SERVER_TIMEZONE_TAG })
}
_onChange = option => {
if (option && option.value === this.state.timezone) {
return
}
this.setState({
timezone: (option != null && option.value) || SERVER_TIMEZONE_TAG
}, () =>
this.props.onChange(this.state.timezone === SERVER_TIMEZONE_TAG ? null : this.state.timezone)
)
}
_useLocalTime = () => {
this._onChange({ value: LOCAL_TIMEZONE })
}
render () {
const { props, state } = this
const { timezone, options } = this.state
return (
<div>
<div className='alert alert-info' role='alert'>
{_('timezonePickerServerValue')} <strong>{state.serverTimezone}</strong>
</div>
<Select
className='m-b-1'
defaultValue={props.defaultValue}
onChange={this._handleChange}
options={state.options}
className='mb-1'
onChange={this._onChange}
options={options}
placeholder={_('selectTimezone')}
ref='select'
value={props.value || XO_SERVER_TIMEZONE}
required={this.props.required}
value={timezone}
/>
<div className='pull-right'>
<ActionButton
btnStyle='primary'
className='m-r-1'
handler={this._useServerTime}
icon='time'
>
{_('timezonePickerUseServerTime')}
</ActionButton>
<ActionButton
btnStyle='secondary'
handler={this._useLocalTime}
icon='time'
>

View File

@@ -280,8 +280,8 @@ const getParent = (currentTarget) => {
currentParent = currentParent.parentElement
}
const parentTop = currentParent && currentParent.getBoundingClientRect().top || 0
const parentLeft = currentParent && currentParent.getBoundingClientRect().left || 0
const parentTop = currentParent && currentParent.getBoundingClientRect().top
const parentLeft = currentParent && currentParent.getBoundingClientRect().left
return {parentTop, parentLeft}
}

View File

@@ -1,7 +1,7 @@
.tooltipEnabled {
background-color: #222;
border-radius: 3px;
border: 1px solid $fff;
border: 1px solid #fff;
color: #fff;
display: inline-block;
font-size: 13px;
@@ -12,7 +12,7 @@
pointer-events: none;
position: fixed;
transition: opacity 0.3s ease-out, margin-top 0.3s ease-out, margin-left 0.3s ease-out;
z-index: 999;
z-index: 9999;
}
.tooltipDisabled {

View File

@@ -17,11 +17,18 @@ export class TooltipViewer extends Component {
constructor () {
super()
this.state.place = 'top'
}
componentDidMount () {
if (instance) {
throw new Error('Tooltip viewer is a singleton!')
}
instance = this
this.state.place = 'top'
}
componentWillUnmount () {
instance = undefined
}
render () {

View File

@@ -50,3 +50,23 @@ Element.propTypes = {
value: PropTypes.number.isRequired
}
export { Element as UsageElement }
export const Limits = ({ used, toBeUsed, limit }) => {
const available = limit - used
return <span className='limits'>
<span
className='limits-used'
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 + '%' }}
/>
</span>
}
Limits.propTypes = {
used: PropTypes.number,
toBeUsed: PropTypes.number,
limit: PropTypes.number.isRequired
}

View File

@@ -1,4 +1,3 @@
import * as actions from 'store/actions'
import escapeRegExp from 'lodash/escapeRegExp'
import every from 'lodash/every'
import forEach from 'lodash/forEach'
@@ -16,12 +15,15 @@ import mapValues from 'lodash/mapValues'
import React from 'react'
import ReadableStream from 'readable-stream'
import replace from 'lodash/replace'
import store from 'store'
import startsWith from 'lodash/startsWith'
import { connect } from 'react-redux'
import { getObject } from 'selectors'
import _ from './intl'
import * as actions from './store/actions'
import BaseComponent from './base-component'
import invoke from './invoke'
import store from './store'
import { getObject } from './selectors'
export const EMPTY_ARRAY = Object.freeze([ ])
export const EMPTY_OBJECT = Object.freeze({ })
@@ -50,6 +52,8 @@ export const propsEqual = (o1, o2, props) => {
// ===================================================================
// `subscriptions` can be a function if we want to ensure that the subscription
// callbacks have been correctly initialized when there are circular dependencies
export const addSubscriptions = subscriptions => Component => {
class SubscriptionWrapper extends BaseComponent {
constructor () {
@@ -59,14 +63,23 @@ export const addSubscriptions = subscriptions => Component => {
}
componentWillMount () {
this._unsubscribes = map(subscriptions, (subscribe, prop) =>
subscribe(value => this.setState({ [prop]: value }))
this._unsubscribes = map(isFunction(subscriptions) ? subscriptions() : subscriptions, (subscribe, prop) =>
subscribe(value => this._setState({ [prop]: value }))
)
}
componentDidMount () {
this._setState = this.setState
}
componentWillUnmount () {
forEach(this._unsubscribes, unsubscribe => unsubscribe())
this._unsubscribes = null
delete this._setState
}
_setState (nextState) {
this.state = { ...this.state, nextState }
}
render () {
@@ -182,11 +195,12 @@ export const firstDefined = function () {
const n = arguments.length
for (let i = 0; i < n; ++i) {
const arg = arguments[i]
if (arg != null) {
if (arg !== undefined) {
return arg
}
}
}
// -------------------------------------------------------------------
// Returns the current XOA Plan or the Plan name if number given
@@ -224,10 +238,10 @@ export const noop = () => {}
export const osFamily = invoke({
centos: [ 'centos' ],
debian: [ 'debian' ],
docker: [ 'coreos' ],
fedora: [ 'fedora' ],
freebsd: [ 'freebsd' ],
gentoo: [ 'gentoo' ],
linux: [ 'coreos' ],
'linux-mint': [ 'linux-mint' ],
netbsd: [ 'netbsd' ],
oracle: [ 'oracle' ],
@@ -283,7 +297,7 @@ export const normalizeXenToolsStatus = status => {
// -------------------------------------------------------------------
const _NotFound = () => <h1>Page not found</h1>
const _NotFound = () => <h1>{_('errorPageNotFound')}</h1>
// Decorator to declare routes on a component.
//
@@ -361,38 +375,44 @@ export function rethrow (cb) {
// ===================================================================
export const resolveResourceSets = resourceSets => (
map(resourceSets, resourceSet => {
const { objects, ...attrs } = resourceSet
const resolvedObjects = {}
const resolvedSet = {
...attrs,
missingObjects: [],
objectsByType: resolvedObjects
export const resolveResourceSet = resourceSet => {
if (!resourceSet) {
return
}
const { objects, ipPools, ...attrs } = resourceSet
const resolvedObjects = {}
const resolvedSet = {
...attrs,
missingObjects: [],
objectsByType: resolvedObjects,
ipPools
}
const state = store.getState()
forEach(objects, id => {
const object = getObject(state, id, true) // true: useResourceSet to bypass permissions
// Error, missing resource.
if (!object) {
resolvedSet.missingObjects.push(id)
return
}
const state = store.getState()
forEach(objects, id => {
const object = getObject(state, id, true) // true: useResourceSet to bypass permissions
const { type } = object
// Error, missing resource.
if (!object) {
resolvedSet.missingObjects.push(id)
return
}
const { type } = object
if (!resolvedObjects[type]) {
resolvedObjects[type] = [ object ]
} else {
resolvedObjects[type].push(object)
}
})
return resolvedSet
if (!resolvedObjects[type]) {
resolvedObjects[type] = [ object ]
} else {
resolvedObjects[type].push(object)
}
})
)
return resolvedSet
}
export const resolveResourceSets = resourceSets =>
map(resourceSets, resolveResourceSet)
// -------------------------------------------------------------------
@@ -452,3 +472,68 @@ export const htmlFileToStream = file => {
return stream
}
// ===================================================================
export const resolveId = value =>
(value != null && typeof value === 'object' && 'id' in value)
? value.id
: value
export const resolveIds = params => {
for (const key in params) {
const param = params[key]
if (param != null && typeof param === 'object' && 'id' in param) {
params[key] = param.id
}
}
return params
}
// ===================================================================
const OPs = {
'<': a => a < 0,
'<=': a => a <= 0,
'===': a => a === 0,
'>': a => a > 0,
'>=': a => a >= 0
}
const makeNiceCompare = compare => function () {
const { length } = arguments
if (length === 2) {
return compare(arguments[0], arguments[1])
}
let i = 1
let v1 = arguments[0]
let op, v2
while (i < length) {
op = arguments[i++]
v2 = arguments[i++]
if (!OPs[op](compare(v1, v2))) {
return false
}
v1 = v2
}
return true
}
export const compareVersions = makeNiceCompare((v1, v2) => {
v1 = v1.split('.')
v2 = v2.split('.')
for (let i = 0; i < Math.max(v1.length, v2.length); i++) {
const n1 = +v1[i] || 0
const n2 = +v2[i] || 0
if (n1 < n2) return -1
if (n1 > n2) return 1
}
return 0
})
export const isXosanPack = ({ name }) =>
startsWith(name, 'XOSAN')

View File

@@ -1,20 +1,21 @@
import map from 'lodash/map'
import AbstractInput from '../json-schema-input/abstract-input'
import { PureComponent } from 'react'
import getEventValue from '../get-event-value'
// ===================================================================
export default class XoAbstractInput extends AbstractInput {
get value () {
const value = this.refs.input.value
const getId = value => (value != null && value.id) || value
if (this.props.schema.type === 'array') {
return map(value, object => object.id || object)
}
export default class XoAbstractInput extends PureComponent {
_onChange = event => {
const value = getEventValue(event)
const { props } = this
return value.id || value
}
set value (value) {
this.refs.input.value = value
return props.onChange(
props.schema.type === 'array'
? map(value, getId)
: getId(value)
)
}
}

View File

@@ -14,11 +14,12 @@ export default class HighLevelObjectInput extends XoAbstractInput {
<PrimitiveInputWrapper {...props}>
<SelectHighLevelObject
disabled={props.disabled}
hasSelectAll
multi={props.multi}
onChange={props.onChange}
onChange={this._onChange}
ref='input'
required={props.required}
defaultValue={props.defaultValue}
value={props.value}
/>
</PrimitiveInputWrapper>
)

View File

@@ -14,11 +14,12 @@ export default class HostInput extends XoAbstractInput {
<PrimitiveInputWrapper {...props}>
<SelectHost
disabled={props.disabled}
hasSelectAll
multi={props.multi}
onChange={props.onChange}
onChange={this._onChange}
ref='input'
required={props.required}
defaultValue={props.defaultValue}
value={props.value}
/>
</PrimitiveInputWrapper>
)

View File

@@ -14,11 +14,12 @@ export default class PoolInput extends XoAbstractInput {
<PrimitiveInputWrapper {...props}>
<SelectPool
disabled={props.disabled}
hasSelectAll
multi={props.multi}
onChange={props.onChange}
onChange={this._onChange}
ref='input'
required={props.required}
defaultValue={props.defaultValue}
value={props.value}
/>
</PrimitiveInputWrapper>
)

View File

@@ -14,11 +14,12 @@ export default class RemoteInput extends XoAbstractInput {
<PrimitiveInputWrapper {...props}>
<SelectRemote
disabled={props.disabled}
hasSelectAll
multi={props.multi}
onChange={props.onChange}
onChange={this._onChange}
ref='input'
required={props.required}
defaultValue={props.defaultValue}
value={props.value}
/>
</PrimitiveInputWrapper>
)

View File

@@ -14,11 +14,12 @@ export default class RoleInput extends XoAbstractInput {
<PrimitiveInputWrapper {...props}>
<SelectRole
disabled={props.disabled}
hasSelectAll
multi={props.multi}
onChange={props.onChange}
onChange={this._onChange}
ref='input'
required={props.required}
defaultValue={props.defaultValue}
value={props.value}
/>
</PrimitiveInputWrapper>
)

View File

@@ -14,11 +14,12 @@ export default class SrInput extends XoAbstractInput {
<PrimitiveInputWrapper {...props}>
<SelectSr
disabled={props.disabled}
hasSelectAll
multi={props.multi}
onChange={props.onChange}
onChange={this._onChange}
ref='input'
required={props.required}
defaultValue={props.defaultValue}
value={props.value}
/>
</PrimitiveInputWrapper>
)

View File

@@ -14,11 +14,12 @@ export default class SubjectInput extends XoAbstractInput {
<PrimitiveInputWrapper {...props}>
<SelectSubject
disabled={props.disabled}
hasSelectAll
multi={props.multi}
onChange={props.onChange}
onChange={this._onChange}
ref='input'
required={props.required}
defaultValue={props.defaultValue}
value={props.value}
/>
</PrimitiveInputWrapper>
)

View File

@@ -14,11 +14,12 @@ export default class TagInput extends XoAbstractInput {
<PrimitiveInputWrapper {...props}>
<SelectTag
disabled={props.disabled}
hasSelectAll
multi={props.multi}
onChange={props.onChange}
onChange={this._onChange}
ref='input'
required={props.required}
defaultValue={props.defaultValue}
value={props.value}
/>
</PrimitiveInputWrapper>
)

View File

@@ -14,11 +14,12 @@ export default class VmInput extends XoAbstractInput {
<PrimitiveInputWrapper {...props}>
<SelectVm
disabled={props.disabled}
hasSelectAll
multi={props.multi}
onChange={props.onChange}
onChange={this._onChange}
ref='input'
required={props.required}
defaultValue={props.defaultValue}
value={props.value}
/>
</PrimitiveInputWrapper>
)

View File

@@ -1,4 +1,4 @@
.dashedLine {
stroke: black;
stroke-dasharray: 4px 5px;
stroke: black;
stroke-dasharray: 4px 2px;
}

View File

@@ -1,12 +1,19 @@
import ChartistGraph from 'react-chartist'
import ChartistLegend from 'chartist-plugin-legend'
import ChartistTooltip from 'chartist-plugin-tooltip'
import map from 'lodash/map'
import React from 'react'
import size from 'lodash/size'
import values from 'lodash/values'
import { injectIntl } from 'react-intl'
import find from 'lodash/find'
import { messages } from 'intl'
import {
find,
flatten,
floor,
map,
max,
size,
sum,
values
} from 'lodash'
import propTypes from '../prop-types'
import { computeArraysSum } from '../xo-stats'
@@ -53,7 +60,7 @@ const makeOptions = ({ intl, nValues, endTimestamp, interval, valueTransform })
// ===================================================================
const makeLabelInterpolationFnc = (intl, nValues, endTimestamp, interval) => {
const labelSpace = Math.floor(nValues / N_LABELS_X)
const labelSpace = floor(nValues / N_LABELS_X)
let format
if (interval === 3600) {
@@ -150,7 +157,7 @@ export const CpuLineChart = injectIntl(propTypes({
nValues: length,
endTimestamp: data.endTimestamp,
interval: data.interval,
valueTransform: value => `${value}%`
valueTransform: value => `${floor(value)}%`
}),
high: !addSumSeries ? 100 : stats.length * 100,
...options
@@ -159,6 +166,54 @@ export const CpuLineChart = injectIntl(propTypes({
)
}))
export const PoolCpuLineChart = injectIntl(propTypes({
addSumSeries: propTypes.bool,
data: propTypes.object.isRequired,
options: propTypes.object
})(({ addSumSeries, data, options = {}, intl }) => {
const firstHostData = data[0]
const length = getStatsLength(firstHostData.stats.cpus)
if (!length) {
return templateError
}
const series = map(data, ({ host, stats }) => ({
name: host,
data: computeArraysSum(stats.cpus)
}))
if (addSumSeries) {
series.push({
name: intl.formatMessage(messages.poolAllHosts),
data: computeArraysSum(map(series, 'data')),
className: styles.dashedLine
})
}
const nbCpusByHost = map(data, ({ stats }) => stats.cpus.length)
return (
<ChartistGraph
type='Line'
data={{
series
}}
options={{
...makeOptions({
intl,
nValues: length,
endTimestamp: firstHostData.endTimestamp,
interval: firstHostData.interval,
valueTransform: value => `${floor(value)}%`
}),
high: 100 * (addSumSeries ? sum(nbCpusByHost) : max(nbCpusByHost)),
...options
}}
/>
)
}))
export const MemoryLineChart = injectIntl(propTypes({
data: propTypes.object.isRequired,
options: propTypes.object
@@ -196,6 +251,57 @@ export const MemoryLineChart = injectIntl(propTypes({
)
}))
export const PoolMemoryLineChart = injectIntl(propTypes({
addSumSeries: propTypes.bool,
data: propTypes.object.isRequired,
options: propTypes.object
})(({ addSumSeries, data, options = {}, intl }) => {
const firstHostData = data[0]
const {
memory,
memoryUsed
} = firstHostData.stats
if (!memory || !memoryUsed) {
return templateError
}
const series = map(data, ({ host, stats }) => ({
name: host,
data: stats.memoryUsed
}))
if (addSumSeries) {
series.push({
name: intl.formatMessage(messages.poolAllHosts),
data: computeArraysSum(map(data, 'stats.memoryUsed')),
className: styles.dashedLine
})
}
const currentMemoryByHost = map(data, ({ stats }) => stats.memory[stats.memory.length - 1])
return (
<ChartistGraph
type='Line'
data={{
series
}}
options={{
...makeOptions({
intl,
nValues: firstHostData.stats.memoryUsed.length,
endTimestamp: firstHostData.endTimestamp,
interval: firstHostData.interval,
valueTransform: formatSize
}),
high: addSumSeries ? sum(currentMemoryByHost) : max(currentMemoryByHost),
...options
}}
/>
)
}))
export const XvdLineChart = injectIntl(propTypes({
addSumSeries: propTypes.bool,
data: propTypes.object.isRequired,
@@ -292,6 +398,51 @@ export const PifLineChart = injectIntl(propTypes({
)
}))
const ios = ['rx', 'tx']
export const PoolPifLineChart = injectIntl(propTypes({
addSumSeries: propTypes.bool,
data: propTypes.object.isRequired,
options: propTypes.object
})(({ addSumSeries, data, options = {}, intl }) => {
const firstHostData = data[0]
const length = firstHostData.stats && getStatsLength(firstHostData.stats.pifs.rx)
if (!length) {
return templateError
}
const series = addSumSeries
? map(ios, io => ({
name: `${intl.formatMessage(messages.poolAllHosts)} (${io})`,
data: computeArraysSum(map(data, ({ stats }) => computeArraysSum(stats.pifs[io])))
}))
: flatten(map(data, ({ stats, host }) =>
map(ios, io => ({
name: `${host} (${io})`,
data: computeArraysSum(stats.pifs[io])
}))
))
return (
<ChartistGraph
type='Line'
data={{
series
}}
options={{
...makeOptions({
intl,
nValues: length,
endTimestamp: firstHostData.endTimestamp,
interval: firstHostData.interval,
valueTransform: formatSize
}),
...options
}}
/>
)
}))
export const LoadLineChart = injectIntl(propTypes({
data: propTypes.object.isRequired,
options: propTypes.object
@@ -325,3 +476,48 @@ export const LoadLineChart = injectIntl(propTypes({
/>
)
}))
export const PoolLoadLineChart = injectIntl(propTypes({
addSumSeries: propTypes.bool,
data: propTypes.object.isRequired,
options: propTypes.object
})(({ addSumSeries, data, options = {}, intl }) => {
const firstHostData = data[0]
const length = firstHostData.stats && firstHostData.stats.load.length
if (!length) {
return templateError
}
const series = map(data, ({ host, stats }) => ({
name: host,
data: stats.load
}))
if (addSumSeries) {
series.push({
name: intl.formatMessage(messages.poolAllHosts),
data: computeArraysSum(map(data, 'stats.load')),
className: styles.dashedLine
})
}
return (
<ChartistGraph
type='Line'
data={{
series
}}
options={{
...makeOptions({
intl,
nValues: length,
endTimestamp: firstHostData.endTimestamp,
interval: firstHostData.interval,
valueTransform: value => `${value.toPrecision(3)}`
}),
...options
}}
/>
)
}))

View File

@@ -14,6 +14,7 @@ const STYLE = {}
const WIDTH = 120
const HEIGHT = 20
const STROKE_WIDTH = 0.5
// ===================================================================
@@ -26,7 +27,7 @@ const templateError =
export const CpuSparkLines = propTypes({
data: propTypes.object.isRequired
})(({ data }) => {
})(({ data, width = WIDTH, height = HEIGHT, strokeWidth = STROKE_WIDTH }) => {
const { cpus } = data.stats
if (!cpus) {
@@ -34,15 +35,15 @@ export const CpuSparkLines = propTypes({
}
return (
<Sparklines style={STYLE} data={computeArraysAvg(cpus)} max={100} min={0} width={WIDTH} height={HEIGHT}>
<SparklinesLine style={{ strokeWidth: 0.5, stroke: '#366e98', fill: '#366e98', fillOpacity: 0.5 }} color='#2598d9' />
<Sparklines style={STYLE} data={computeArraysAvg(cpus)} max={100} min={0} width={width} height={height}>
<SparklinesLine style={{ strokeWidth, stroke: '#366e98', fill: '#366e98', fillOpacity: 0.5 }} color='#2598d9' />
</Sparklines>
)
})
export const MemorySparkLines = propTypes({
data: propTypes.object.isRequired
})(({ data }) => {
})(({ data, width = WIDTH, height = HEIGHT, strokeWidth = STROKE_WIDTH }) => {
const { memory, memoryUsed } = data.stats
if (!memory || !memoryUsed) {
@@ -50,15 +51,15 @@ export const MemorySparkLines = propTypes({
}
return (
<Sparklines style={STYLE} data={memoryUsed} max={memory[memory.length - 1]} min={0} width={WIDTH} height={HEIGHT}>
<SparklinesLine style={{ strokeWidth: 0.5, stroke: '#990822', fill: '#990822', fillOpacity: 0.5 }} color='#cc0066' />
<Sparklines style={STYLE} data={memoryUsed} max={memory[memory.length - 1]} min={0} width={width} height={height}>
<SparklinesLine style={{ strokeWidth, stroke: '#990822', fill: '#990822', fillOpacity: 0.5 }} color='#cc0066' />
</Sparklines>
)
})
export const XvdSparkLines = propTypes({
data: propTypes.object.isRequired
})(({ data }) => {
})(({ data, width = WIDTH, height = HEIGHT, strokeWidth = STROKE_WIDTH }) => {
const { xvds } = data.stats
if (!xvds) {
@@ -66,15 +67,15 @@ export const XvdSparkLines = propTypes({
}
return (
<Sparklines style={STYLE} data={computeObjectsAvg(xvds)} min={0} width={WIDTH} height={HEIGHT}>
<SparklinesLine style={{ strokeWidth: 0.5, stroke: '#089944', fill: '#089944', fillOpacity: 0.5 }} color='#33cc33' />
<Sparklines style={STYLE} data={computeObjectsAvg(xvds)} min={0} width={width} height={height}>
<SparklinesLine style={{ strokeWidth, stroke: '#089944', fill: '#089944', fillOpacity: 0.5 }} color='#33cc33' />
</Sparklines>
)
})
export const VifSparkLines = propTypes({
data: propTypes.object.isRequired
})(({ data }) => {
})(({ data, width = WIDTH, height = HEIGHT, strokeWidth = STROKE_WIDTH }) => {
const { vifs } = data.stats
if (!vifs) {
@@ -82,15 +83,15 @@ export const VifSparkLines = propTypes({
}
return (
<Sparklines style={STYLE} data={computeObjectsAvg(vifs)} min={0} width={WIDTH} height={HEIGHT}>
<SparklinesLine style={{ strokeWidth: 0.5, stroke: '#eca649', fill: '#eca649', fillOpacity: 0.5 }} color='#ffd633' />
<Sparklines style={STYLE} data={computeObjectsAvg(vifs)} min={0} width={width} height={height}>
<SparklinesLine style={{ strokeWidth, stroke: '#eca649', fill: '#eca649', fillOpacity: 0.5 }} color='#ffd633' />
</Sparklines>
)
})
export const PifSparkLines = propTypes({
data: propTypes.object.isRequired
})(({ data }) => {
})(({ data, width = WIDTH, height = HEIGHT, strokeWidth = STROKE_WIDTH }) => {
const { pifs } = data.stats
if (!pifs) {
@@ -98,15 +99,15 @@ export const PifSparkLines = propTypes({
}
return (
<Sparklines style={STYLE} data={computeObjectsAvg(pifs)} min={0} width={WIDTH} height={HEIGHT}>
<SparklinesLine style={{ strokeWidth: 0.5, stroke: '#eca649', fill: '#eca649', fillOpacity: 0.5 }} color='#ffd633' />
<Sparklines style={STYLE} data={computeObjectsAvg(pifs)} min={0} width={width} height={height}>
<SparklinesLine style={{ strokeWidth, stroke: '#eca649', fill: '#eca649', fillOpacity: 0.5 }} color='#ffd633' />
</Sparklines>
)
})
export const LoadSparkLines = propTypes({
data: propTypes.object.isRequired
})(({ data }) => {
})(({ data, width = WIDTH, height = HEIGHT, strokeWidth = STROKE_WIDTH }) => {
const { load } = data.stats
if (!load) {
@@ -114,8 +115,8 @@ export const LoadSparkLines = propTypes({
}
return (
<Sparklines style={STYLE} data={load} min={0} width={WIDTH} height={HEIGHT}>
<SparklinesLine style={{ strokeWidth: 0.5, stroke: '#33cc33', fill: '#33cc33', fillOpacity: 0.5 }} color='#33cc33' />
<Sparklines style={STYLE} data={load} min={0} width={width} height={height}>
<SparklinesLine style={{ strokeWidth, stroke: '#33cc33', fill: '#33cc33', fillOpacity: 0.5 }} color='#33cc33' />
</Sparklines>
)
})

View File

@@ -378,10 +378,10 @@ export default class XoWeekCharts extends Component {
return (
<div>
<div>
<p className='m-t-1'>
<p className='mt-1'>
{_('weeklyChartsScaleInfo')}
{' '}
<Toggle iconSize={1} icon='scale' className='btn btn-secondary' onChange={this._updateScale} />
<Toggle iconSize={1} icon='scale' onChange={this._updateScale} />
</p>
</div>
<div

View File

@@ -1,24 +1,46 @@
import _ from 'intl'
import BaseComponent from 'base-component'
import every from 'lodash/every'
import React from 'react'
import SingleLineRow from 'single-line-row'
import { SelectHost } from 'select-objects'
import { Col } from 'grid'
import { connectStore } from 'utils'
import { createGetObjectsOfType } from 'selectors'
import { createCollectionWrapper, createGetObjectsOfType, createSelector } from 'selectors'
import { forEach } from 'lodash'
import { SelectHost } from 'select-objects'
@connectStore(() => ({
hosts: createGetObjectsOfType('host')
singleHosts: createSelector(
(_, { pool }) => pool && pool.id,
createGetObjectsOfType('host'),
createCollectionWrapper((poolId, hosts) => {
const visitedPools = {}
const singleHosts = {}
forEach(hosts, host => {
const { $pool } = host
if ($pool !== poolId) {
const previousHost = visitedPools[$pool]
if (previousHost) {
delete singleHosts[previousHost]
} else {
const { id } = host
singleHosts[id] = true
visitedPools[$pool] = id
}
}
})
return singleHosts
})
)
}), { withRef: true })
export default class AddHostModal extends BaseComponent {
get value () {
return this.state
}
_hostPredicate = host =>
host.$pool !== this.props.pool.id &&
every(this.props.hosts, h => h.$pool !== host.$pool || h.id === host.id)
_getHostPredicate = createSelector(
() => this.props.singleHosts,
singleHosts => host => singleHosts[host.id]
)
render () {
return <div>
@@ -27,7 +49,7 @@ export default class AddHostModal extends BaseComponent {
<Col size={6}>
<SelectHost
onChange={this.linkState('host')}
predicate={this._hostPredicate}
predicate={this._getHostPredicate()}
value={this.state.host}
/>
</Col>

View File

@@ -9,6 +9,8 @@ import { Toggle } from '../../form'
import { injectIntl } from 'react-intl'
class CopyVmModalBody extends Component {
state = { compress: false }
get value () {
const { state } = this
return {

View File

@@ -0,0 +1,109 @@
import Component from 'base-component'
import map from 'lodash/map'
import React from 'react'
import { createGetObject, createSelector } from 'selectors'
import { getBondModes } from 'xo'
import { injectIntl } from 'react-intl'
import _, { messages } from '../../intl'
import { Col } from '../../grid'
import { connectStore } from '../../utils'
import { SelectPif } from '../../select-objects'
import SingleLineRow from '../../single-line-row'
@connectStore(() => ({
poolMaster: createSelector(
createGetObject(
(_, props) => props.pool
),
pool => pool.master
)
}), { withRef: true })
class CreateBondedNetworkModalBody extends Component {
componentWillMount () {
getBondModes().then(
bondModes => this.setState({ bondModes, bondMode: bondModes[0] })
)
}
_getPifPredicate = createSelector(
() => this.props.poolMaster,
hostId => pif =>
pif.$host === hostId && pif.vlan === -1
)
get value () {
const { name, description, pifs, mtu, bondMode } = this.state
return {
pool: this.props.pool,
name,
description,
pifs: map(pifs, pif => pif.id),
mtu,
bondMode
}
}
render () {
const { formatMessage } = this.props.intl
return <div>
<SingleLineRow>
<Col size={6}>{_('newNetworkInterface')}</Col>
<Col size={6}>
<SelectPif
multi
onChange={this.linkState('pifs')}
predicate={this._getPifPredicate()}
/>
</Col>
</SingleLineRow>
&nbsp;
<SingleLineRow>
<Col size={6}>{_('newNetworkName')}</Col>
<Col size={6}>
<input
className='form-control'
onChange={this.linkState('name')}
type='text'
/>
</Col>
</SingleLineRow>
&nbsp;
<SingleLineRow>
<Col size={6}>{_('newNetworkDescription')}</Col>
<Col size={6}>
<input
className='form-control'
onChange={this.linkState('description')}
type='text'
/>
</Col>
</SingleLineRow>
&nbsp;
<SingleLineRow>
<Col size={6}>{_('newNetworkMtu')}</Col>
<Col size={6}>
<input
className='form-control'
onChange={this.linkState('mtu')}
placeholder={formatMessage(messages.newNetworkDefaultMtu)}
type='text'
/>
</Col>
</SingleLineRow>
&nbsp;
<SingleLineRow>
<Col size={6}>{_('newNetworkBondMode')}</Col>
<Col size={6}>
<select
className='form-control'
onChange={this.linkState('bondMode')}
>
{map(this.state.bondModes, mode => <option value={mode}>{mode}</option>)}
</select>
</Col>
</SingleLineRow>
</div>
}
}
export default injectIntl(CreateBondedNetworkModalBody, { withRef: true })

View File

@@ -20,7 +20,7 @@ class CreateNetworkModalBody extends Component {
const { refs } = this
const { container } = this.props
return {
pool: container === 'pool' ? container.id : container.$pool,
pool: container.$pool,
name: refs.name.value,
description: refs.description.value,
pif: refs.pif.value.id,

Some files were not shown because too many files have changed in this diff Show More