Almost everything is broken!

This commit is contained in:
Julien Fontanet 2013-11-12 18:09:54 +01:00
parent 3491c111b8
commit 355e3946b6
39 changed files with 2264 additions and 10756 deletions

View File

@ -1,3 +1,3 @@
{
"directory": "app/bower_components"
"directory": "app/bower_components"
}

View File

@ -1,20 +1,21 @@
# EditorConfig is awesome: http://EditorConfig.org
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
#
# Tab indentation (size of 4 spaces)
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespaces = true
# Special settings for Bower and NPM files.
[/{bower,package}.json]
indent_size = 2
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 2
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto

9
.gitignore vendored
View File

@ -1,4 +1,5 @@
/.sass-cache/
/app/bower_components/
/dist/
/node_modules/
node_modules
dist
.tmp
.sass-cache
app/bower_components

View File

@ -1,23 +1,24 @@
{
"bitwise": true,
"browser": true,
"curly": true,
"eqeqeq": true,
"immed": false,
"latedef": true,
"laxbreak": true,
"maxcomplexity": 10,
"maxdepth": 5,
"maxlen": 80,
"maxparams": 4,
"maxstatements": 20,
"newcap": true,
"noempty": true,
"nonew": true,
"quotmark": true,
"smarttabs": true,
"strict": false,
"trailing": true,
"undef": true,
"unused": true
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"angular": false
}
}

7
.travis.yml Normal file
View File

@ -0,0 +1,7 @@
language: node_js
node_js:
- '0.8'
- '0.10'
before_script:
- 'npm install -g bower grunt-cli'
- 'bower install'

661
COPYING
View File

@ -1,661 +0,0 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

View File

@ -1,129 +1,369 @@
// Generated on 2013-11-12 using generator-angular 0.6.0-rc.1
'use strict';
// # Globbing
// for performance reasons only one level down is matched:
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
grunt.initConfig({
clean: {
dist: {
files: [{
dot: true,
src: 'dist/*'
}]
}
},
grunt.initConfig({
yeoman: {
// configurable paths
app: require('./bower.json').appPath || 'app',
dist: 'dist'
},
watch: {
coffee: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
tasks: ['coffee:dist']
},
coffeeTest: {
files: ['test/spec/{,*/}*.coffee'],
tasks: ['coffee:test']
},
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:server', 'autoprefixer']
},
styles: {
files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
tasks: ['copy:styles', 'autoprefixer']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= yeoman.app %>/{,*/}*.html',
'.tmp/styles/{,*/}*.css',
'{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
autoprefixer: {
options: ['last 1 version'],
dist: {
files: [{
expand: true,
cwd: '.tmp/styles/',
src: '{,*/}*.css',
dest: '.tmp/styles/'
}]
}
},
connect: {
options: {
port: 9000,
// Change this to '0.0.0.0' to access the server from outside.
hostname: 'localhost',
livereload: 35729
},
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= yeoman.app %>'
]
}
},
test: {
options: {
port: 9001,
base: [
'.tmp',
'test',
'<%= yeoman.app %>'
]
}
},
dist: {
options: {
base: '<%= yeoman.dist %>'
}
}
},
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/*',
'!<%= yeoman.dist %>/.git*'
]
}]
},
server: '.tmp'
},
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
coffee: {
options: {
sourceMap: true,
sourceRoot: ''
},
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/scripts',
src: '{,*/}*.coffee',
dest: '.tmp/scripts',
ext: '.js'
}]
},
test: {
files: [{
expand: true,
cwd: 'test/spec',
src: '{,*/}*.coffee',
dest: '.tmp/spec',
ext: '.js'
}]
}
},
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/fonts',
importPath: '<%= yeoman.app %>/bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/fonts',
relativeAssets: false
},
dist: {},
server: {
options: {
debugInfo: true
}
}
},
// not used since Uglify task does concat,
// but still available if needed
/*concat: {
dist: {}
},*/
rev: {
dist: {
files: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
}
},
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>'
}
},
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: ['<%= yeoman.dist %>']
}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.svg',
dest: '<%= yeoman.dist %>/images'
}]
}
},
cssmin: {
// By default, your `index.html` <!-- Usemin Block --> will take care of
// minification. This option is pre-configured if you do not wish to use
// Usemin blocks.
// dist: {
// files: {
// '<%= yeoman.dist %>/styles/main.css': [
// '.tmp/styles/{,*/}*.css',
// '<%= yeoman.app %>/styles/{,*/}*.css'
// ]
// }
// }
},
htmlmin: {
dist: {
options: {
/*removeCommentsFromCDATA: true,
// https://github.com/yeoman/grunt-usemin/issues/44
//collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeOptionalTags: true*/
},
files: [{
expand: true,
cwd: '<%= yeoman.app %>',
src: ['*.html', 'views/*.html'],
dest: '<%= yeoman.dist %>'
}]
}
},
// Put files not handled in other tasks here
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
'bower_components/**/*',
'images/{,*/}*.{gif,webp}',
'fonts/*'
]
}, {
expand: true,
cwd: '.tmp/images',
dest: '<%= yeoman.dist %>/images',
src: [
'generated/*'
]
}]
},
styles: {
expand: true,
cwd: '<%= yeoman.app %>/styles',
dest: '.tmp/styles/',
src: '{,*/}*.css'
}
},
concurrent: {
server: [
'coffee:dist',
'compass:server',
'copy:styles'
],
test: [
'coffee',
'compass',
'copy:styles'
],
dist: [
'coffee',
'compass:dist',
'copy:styles',
'imagemin',
'svgmin',
'htmlmin'
]
},
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
}
},
cdnify: {
dist: {
html: ['<%= yeoman.dist %>/*.html']
}
},
ngmin: {
dist: {
files: [{
expand: true,
cwd: '.tmp/concat/scripts',
src: '*.js',
dest: '.tmp/concat/scripts'
}]
}
},
uglify: {
dist: {
files: {
'<%= yeoman.dist %>/scripts/scripts.js': [
'<%= yeoman.dist %>/scripts/scripts.js'
]
}
}
}
});
copy: {
dist: {
files: [{
expand: true,
matchBase: true,
cwd: 'app',
src: ['*', '!*.{s{a,c}ss,coffee}'],
dest: 'dist',
}],
},
},
grunt.registerTask('server', function (target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
compass: {
compile: {
options: {
sassDir: 'app/styles',
cssDir: 'dist/styles',
generatedImagesDir: 'dist/images/generated',
imagesDir: 'app/images',
javascriptsDir: 'app/scripts',
fontsDir: 'app/styles/fonts',
importPath: 'app/bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false,
assetCacheBuster: false
},
},
},
grunt.task.run([
'clean:server',
'concurrent:server',
'autoprefixer',
'connect:livereload',
'watch'
]);
});
coffee: {
compile: {
files: [{
expand: true,
cwd: 'app/scripts',
src: '{,*/}*.coffee',
dest: 'dist/scripts',
ext: '.js'
}]
}
},
grunt.registerTask('test', [
'clean:server',
'concurrent:test',
'autoprefixer',
'connect:test',
'karma'
]);
connect: {
livereload: {
options: {
hostname: 'localhost',
port: 9000,
grunt.registerTask('build', [
'clean:dist',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'ngmin',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'rev',
'usemin'
]);
livereload: 35729,
open: true,
base: [
'dist',
]
}
}
},
watch: {
coffee: {
files: ['app/styles/{,*/}*.coffee'],
tasks: ['coffee:compile']
},
compass: {
files: ['app/styles/{,*/}*.s{c,a}ss'],
tasks: ['compass:compile' /*, 'autoprefixer'*/]
},
livereload: {
options: {
livereload: '<%= connect.livereload.options.livereload %>'
},
files: [
'app/*.html',
'dist/styles/{,*/}*.css',
'{dist,app}/scripts/{,*/}*.js',
'app/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
]
}
},
concurrent: {
dist: [
'copy',
'compass',
'coffee',
]
}
});
grunt.registerTask('build', [
'clean',
'concurrent',
]);
grunt.registerTask('server', [
'connect',
'watch',
]);
grunt.registerTask('default', [
'build',
'server'
]);
grunt.registerTask('default', [
'jshint',
'test',
'build'
]);
};

View File

@ -1,22 +0,0 @@
# Xen Orchestra Web
XO-Web is part of [Xen Orchestra](https://github.com/vatesfr/xo), a web interface for XenServer or XAPI enabled hosts.
It is a web client for [XO-Server](https://github.com/vatesfr/xo-server).
__XO is currently under development and may be subject to important bugs.__
## Installation
_There is currently no package available for XO-Web, you must therefore use the following procedure._
1. Download the code, you may either use git `git clone git://github.com/vatesfr/xo-web` or download a [Zip archive](https://github.com/vatesfr/xo-web/archive/master.zip).
2. [Install XO-Server](https://github.com/vatesfr/xo-server/tree/nodejs), and run it
3. Enter the IP/Url of you XO hosts in your browser (by default, XO-Server runs on 8080 port)
4. You can add a server by clicking on the button, but do not forget to login before (with default credentials)
## How to report a bug?
If you are certain the bug is exclusively related to XO-Web, you may use the [bugtracker of this repository](https://github.com/vatesfr/xo-web/issues).
Otherwise, please consider using the [bugtracker of the general repository](https://github.com/vatesfr/xo/issues).

1
app/.buildignore Normal file
View File

@ -0,0 +1 @@
*.coffee

543
app/.htaccess Normal file
View File

@ -0,0 +1,543 @@
# Apache Configuration File
# (!) Using `.htaccess` files slows down Apache, therefore, if you have access
# to the main server config file (usually called `httpd.conf`), you should add
# this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html.
# ##############################################################################
# # CROSS-ORIGIN RESOURCE SHARING (CORS) #
# ##############################################################################
# ------------------------------------------------------------------------------
# | Cross-domain AJAX requests |
# ------------------------------------------------------------------------------
# Enable cross-origin AJAX requests.
# http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
# http://enable-cors.org/
# <IfModule mod_headers.c>
# Header set Access-Control-Allow-Origin "*"
# </IfModule>
# ------------------------------------------------------------------------------
# | CORS-enabled images |
# ------------------------------------------------------------------------------
# Send the CORS header for images when browsers request it.
# https://developer.mozilla.org/en/CORS_Enabled_Image
# http://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
# http://hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
<FilesMatch "\.(gif|ico|jpe?g|png|svg|svgz|webp)$">
SetEnvIf Origin ":" IS_CORS
Header set Access-Control-Allow-Origin "*" env=IS_CORS
</FilesMatch>
</IfModule>
</IfModule>
# ------------------------------------------------------------------------------
# | Web fonts access |
# ------------------------------------------------------------------------------
# Allow access from all domains for web fonts
<IfModule mod_headers.c>
<FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
# ##############################################################################
# # ERRORS #
# ##############################################################################
# ------------------------------------------------------------------------------
# | 404 error prevention for non-existing redirected folders |
# ------------------------------------------------------------------------------
# Prevent Apache from returning a 404 error for a rewrite if a directory
# with the same name does not exist.
# http://httpd.apache.org/docs/current/content-negotiation.html#multiviews
# http://www.webmasterworld.com/apache/3808792.htm
Options -MultiViews
# ------------------------------------------------------------------------------
# | Custom error messages / pages |
# ------------------------------------------------------------------------------
# You can customize what Apache returns to the client in case of an error (see
# http://httpd.apache.org/docs/current/mod/core.html#errordocument), e.g.:
ErrorDocument 404 /404.html
# ##############################################################################
# # INTERNET EXPLORER #
# ##############################################################################
# ------------------------------------------------------------------------------
# | Better website experience |
# ------------------------------------------------------------------------------
# Force IE to render pages in the highest available mode in the various
# cases when it may not: http://hsivonen.iki.fi/doctype/ie-mode.pdf.
<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=edge"
# `mod_headers` can't match based on the content-type, however, we only
# want to send this header for HTML pages and not for the other resources
<FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$">
Header unset X-UA-Compatible
</FilesMatch>
</IfModule>
# ------------------------------------------------------------------------------
# | Cookie setting from iframes |
# ------------------------------------------------------------------------------
# Allow cookies to be set from iframes in IE.
# <IfModule mod_headers.c>
# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
# </IfModule>
# ------------------------------------------------------------------------------
# | Screen flicker |
# ------------------------------------------------------------------------------
# Stop screen flicker in IE on CSS rollovers (this only works in
# combination with the `ExpiresByType` directives for images from below).
# BrowserMatch "MSIE" brokenvary=1
# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
# BrowserMatch "Opera" !brokenvary
# SetEnvIf brokenvary 1 force-no-vary
# ##############################################################################
# # MIME TYPES AND ENCODING #
# ##############################################################################
# ------------------------------------------------------------------------------
# | Proper MIME types for all files |
# ------------------------------------------------------------------------------
<IfModule mod_mime.c>
# Audio
AddType audio/mp4 m4a f4a f4b
AddType audio/ogg oga ogg
# JavaScript
# Normalize to standard type (it's sniffed in IE anyways):
# http://tools.ietf.org/html/rfc4329#section-7.2
AddType application/javascript js jsonp
AddType application/json json
# Video
AddType video/mp4 mp4 m4v f4v f4p
AddType video/ogg ogv
AddType video/webm webm
AddType video/x-flv flv
# Web fonts
AddType application/font-woff woff
AddType application/vnd.ms-fontobject eot
# Browsers usually ignore the font MIME types and sniff the content,
# however, Chrome shows a warning if other MIME types are used for the
# following fonts.
AddType application/x-font-ttf ttc ttf
AddType font/opentype otf
# Make SVGZ fonts work on iPad:
# https://twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
# Other
AddType application/octet-stream safariextz
AddType application/x-chrome-extension crx
AddType application/x-opera-extension oex
AddType application/x-shockwave-flash swf
AddType application/x-web-app-manifest+json webapp
AddType application/x-xpinstall xpi
AddType application/xml atom rdf rss xml
AddType image/webp webp
AddType image/x-icon ico
AddType text/cache-manifest appcache manifest
AddType text/vtt vtt
AddType text/x-component htc
AddType text/x-vcard vcf
</IfModule>
# ------------------------------------------------------------------------------
# | UTF-8 encoding |
# ------------------------------------------------------------------------------
# Use UTF-8 encoding for anything served as `text/html` or `text/plain`.
AddDefaultCharset utf-8
# Force UTF-8 for certain file formats.
<IfModule mod_mime.c>
AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml
</IfModule>
# ##############################################################################
# # URL REWRITES #
# ##############################################################################
# ------------------------------------------------------------------------------
# | Rewrite engine |
# ------------------------------------------------------------------------------
# Turning on the rewrite engine and enabling the `FollowSymLinks` option is
# necessary for the following directives to work.
# If your web host doesn't allow the `FollowSymlinks` option, you may need to
# comment it out and use `Options +SymLinksIfOwnerMatch` but, be aware of the
# performance impact: http://httpd.apache.org/docs/current/misc/perf-tuning.html#symlinks
# Also, some cloud hosting services require `RewriteBase` to be set:
# http://www.rackspace.com/knowledge_center/frequently-asked-question/why-is-mod-rewrite-not-working-on-my-site
<IfModule mod_rewrite.c>
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On
# RewriteBase /
</IfModule>
# ------------------------------------------------------------------------------
# | Suppressing / Forcing the "www." at the beginning of URLs |
# ------------------------------------------------------------------------------
# The same content should never be available under two different URLs especially
# not with and without "www." at the beginning. This can cause SEO problems
# (duplicate content), therefore, you should choose one of the alternatives and
# redirect the other one.
# By default option 1 (no "www.") is activated:
# http://no-www.org/faq.php?q=class_b
# If you'd prefer to use option 2, just comment out all the lines from option 1
# and uncomment the ones from option 2.
# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME!
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Option 1: rewrite www.example.com → example.com
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Option 2: rewrite example.com → www.example.com
# Be aware that the following might not be a good idea if you use "real"
# subdomains for certain parts of your website.
# <IfModule mod_rewrite.c>
# RewriteCond %{HTTPS} !=on
# RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# </IfModule>
# ##############################################################################
# # SECURITY #
# ##############################################################################
# ------------------------------------------------------------------------------
# | Content Security Policy (CSP) |
# ------------------------------------------------------------------------------
# You can mitigate the risk of cross-site scripting and other content-injection
# attacks by setting a Content Security Policy which whitelists trusted sources
# of content for your site.
# The example header below allows ONLY scripts that are loaded from the current
# site's origin (no inline scripts, no CDN, etc). This almost certainly won't
# work as-is for your site!
# To get all the details you'll need to craft a reasonable policy for your site,
# read: http://html5rocks.com/en/tutorials/security/content-security-policy (or
# see the specification: http://w3.org/TR/CSP).
# <IfModule mod_headers.c>
# Header set Content-Security-Policy "script-src 'self'; object-src 'self'"
# <FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$">
# Header unset Content-Security-Policy
# </FilesMatch>
# </IfModule>
# ------------------------------------------------------------------------------
# | File access |
# ------------------------------------------------------------------------------
# Block access to directories without a default document.
# Usually you should leave this uncommented because you shouldn't allow anyone
# to surf through every directory on your server (which may includes rather
# private places like the CMS's directories).
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Block access to hidden files and directories.
# This includes directories used by version control systems such as Git and SVN.
<IfModule mod_rewrite.c>
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]
</IfModule>
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Block access to backup and source files.
# These files may be left by some text editors and can pose a great security
# danger when anyone has access to them.
<FilesMatch "(^#.*#|\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|sw[op])|~)$">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
# ------------------------------------------------------------------------------
# | Secure Sockets Layer (SSL) |
# ------------------------------------------------------------------------------
# Rewrite secure requests properly to prevent SSL certificate warnings, e.g.:
# prevent `https://www.example.com` when your certificate only allows
# `https://secure.example.com`.
# <IfModule mod_rewrite.c>
# RewriteCond %{SERVER_PORT} !^443
# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L]
# </IfModule>
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Force client-side SSL redirection.
# If a user types "example.com" in his browser, the above rule will redirect him
# to the secure version of the site. That still leaves a window of opportunity
# (the initial HTTP connection) for an attacker to downgrade or redirect the
# request. The following header ensures that browser will ONLY connect to your
# server via HTTPS, regardless of what the users type in the address bar.
# http://www.html5rocks.com/en/tutorials/security/transport-layer-security/
# <IfModule mod_headers.c>
# Header set Strict-Transport-Security max-age=16070400;
# </IfModule>
# ------------------------------------------------------------------------------
# | Server software information |
# ------------------------------------------------------------------------------
# Avoid displaying the exact Apache version number, the description of the
# generic OS-type and the information about Apache's compiled-in modules.
# ADD THIS DIRECTIVE IN THE `httpd.conf` AS IT WILL NOT WORK IN THE `.htaccess`!
# ServerTokens Prod
# ##############################################################################
# # WEB PERFORMANCE #
# ##############################################################################
# ------------------------------------------------------------------------------
# | Compression |
# ------------------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force compression for mangled headers.
# http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
# Compress all output labeled with one of the following MIME-types
# (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
# and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
# as `AddOutputFilterByType` is still in the core directives).
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/rss+xml \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/x-web-app-manifest+json \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/html \
text/plain \
text/x-component \
text/xml
</IfModule>
</IfModule>
# ------------------------------------------------------------------------------
# | Content transformations |
# ------------------------------------------------------------------------------
# Prevent some of the mobile network providers from modifying the content of
# your site: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5.
# <IfModule mod_headers.c>
# Header set Cache-Control "no-transform"
# </IfModule>
# ------------------------------------------------------------------------------
# | ETag removal |
# ------------------------------------------------------------------------------
# Since we're sending far-future expires headers (see below), ETags can
# be removed: http://developer.yahoo.com/performance/rules.html#etags.
# `FileETag None` is not enough for every server.
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
FileETag None
# ------------------------------------------------------------------------------
# | Expires headers (for better cache control) |
# ------------------------------------------------------------------------------
# The following expires headers are set pretty far in the future. If you don't
# control versioning with filename-based cache busting, consider lowering the
# cache time for resources like CSS and JS to something like 1 week.
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 year"
# Data interchange
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
# Favicon (cannot be renamed!)
ExpiresByType image/x-icon "access plus 1 week"
# HTML components (HTCs)
ExpiresByType text/x-component "access plus 1 month"
# HTML
ExpiresByType text/html "access plus 0 seconds"
# JavaScript
ExpiresByType application/javascript "access plus 1 year"
# Manifest files
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Media
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# Web feeds
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
# Web fonts
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
</IfModule>
# ------------------------------------------------------------------------------
# | Filename-based cache busting |
# ------------------------------------------------------------------------------
# If you're not using a build process to manage your filename version revving,
# you might want to consider enabling the following directives to route all
# requests such as `/css/style.12345.css` to `/css/style.css`.
# To understand why this is important and a better idea than `*.css?v231`, read:
# http://stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring
# <IfModule mod_rewrite.c>
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L]
# </IfModule>
# ------------------------------------------------------------------------------
# | File concatenation |
# ------------------------------------------------------------------------------
# Allow concatenation from within specific CSS and JS files, e.g.:
# Inside of `script.combined.js` you could have
# <!--#include file="libs/jquery.js" -->
# <!--#include file="plugins/jquery.idletimer.js" -->
# and they would be included into this single file.
# <IfModule mod_include.c>
# <FilesMatch "\.combined\.js$">
# Options +Includes
# AddOutputFilterByType INCLUDES application/javascript application/json
# SetOutputFilter INCLUDES
# </FilesMatch>
# <FilesMatch "\.combined\.css$">
# Options +Includes
# AddOutputFilterByType INCLUDES text/css
# SetOutputFilter INCLUDES
# </FilesMatch>
# </IfModule>
# ------------------------------------------------------------------------------
# | Persistent connections |
# ------------------------------------------------------------------------------
# Allow multiple requests to be sent over the same TCP connection:
# http://httpd.apache.org/docs/current/en/mod/core.html#keepalive.
# Enable if you serve a lot of static content but, be aware of the
# possible disadvantages!
# <IfModule mod_headers.c>
# Header set Connection Keep-Alive
# </IfModule>

157
app/404.html Normal file
View File

@ -0,0 +1,157 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Not Found :(</title>
<style>
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
html {
padding: 30px 10px;
font-size: 20px;
line-height: 1.4;
color: #737373;
background: #f0f0f0;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
html,
input {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
max-width: 500px;
_width: 500px;
padding: 30px 20px 50px;
border: 1px solid #b3b3b3;
border-radius: 4px;
margin: 0 auto;
box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
background: #fcfcfc;
}
h1 {
margin: 0 10px;
font-size: 50px;
text-align: center;
}
h1 span {
color: #bbb;
}
h3 {
margin: 1.5em 0 0.5em;
}
p {
margin: 1em 0;
}
ul {
padding: 0 0 0 40px;
margin: 1em 0;
}
.container {
max-width: 380px;
_width: 380px;
margin: 0 auto;
}
/* google search */
#goog-fixurl ul {
list-style: none;
padding: 0;
margin: 0;
}
#goog-fixurl form {
margin: 0;
}
#goog-wm-qt,
#goog-wm-sb {
border: 1px solid #bbb;
font-size: 16px;
line-height: normal;
vertical-align: top;
color: #444;
border-radius: 2px;
}
#goog-wm-qt {
width: 220px;
height: 20px;
padding: 5px;
margin: 5px 10px 0 0;
box-shadow: inset 0 1px 1px #ccc;
}
#goog-wm-sb {
display: inline-block;
height: 32px;
padding: 0 10px;
margin: 5px 0 0;
white-space: nowrap;
cursor: pointer;
background-color: #f5f5f5;
background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
*overflow: visible;
*display: inline;
*zoom: 1;
}
#goog-wm-sb:hover,
#goog-wm-sb:focus {
border-color: #aaa;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
background-color: #f8f8f8;
}
#goog-wm-qt:hover,
#goog-wm-qt:focus {
border-color: #105cb6;
outline: 0;
color: #222;
}
input::-moz-focus-inner {
padding: 0;
border: 0;
}
</style>
</head>
<body>
<div class="container">
<h1>Not found <span>:(</span></h1>
<p>Sorry, but the page you were trying to view does not exist.</p>
<p>It looks like this was the result of either:</p>
<ul>
<li>a mistyped address</li>
<li>an out-of-date link</li>
</ul>
<script>
var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
</script>
<script src="//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
</div>
</body>
</html>

BIN
app/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 995 B

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
# robotstxt.org
User-agent: *
Disallow: /

14
app/scripts/app.coffee Normal file
View File

@ -0,0 +1,14 @@
'use strict'
angular.module('xoWebApp', [
'ngCookies',
'ngSanitize',
'ngRoute'
])
.config ($routeProvider) ->
$routeProvider
.when '/',
templateUrl: 'views/main.html'
controller: 'MainCtrl'
.otherwise
redirectTo: '/'

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,148 @@
'use strict'
angular.module('xoWebApp')
.controller 'MainCtrl', ($scope) ->
$scope.pools = [
{
name_label: 'Pool1'
SRs: [
{
name_label: 'DataCore'
enable: true
size: 100 # in bytes
usage: 60 # in bytes
}
{
name_label: 'ZFS'
enable: true
size: 100 # in bytes
usage: 20 # in bytes
}
]
hosts: [
{
name_label: 'XServ1'
address: '192.168.1.1'
memory: {
size: 100 # in bytes
usage: 5 # in bytes
}
#VMs: []
}
{
name_label: 'XServ2'
address: '192.168.1.2'
memory: {
size: 100 # in bytes
usage: 80 # in bytes
}
VMs: [
{
name_label: 'Web1'
name_description: 'Apache2 + PHP5 FPM + node VM'
address: '192.168.1.141'
power_state: 'Running'
CPU_usage: 5 # in percentages
memory: {
size: 1024 # in bytes
usage: 599 # in bytes
}
}
{
name_label: 'Test CentOS'
name_description: 'Testing VM for CentOS 6 Pv Drivers'
#address: ''
power_state: 'Halted'
CPU_usage: 3 # in percentages
memory: {
size: 2048 # in bytes
usage: 599 # in bytes
}
}
{
name_label: 'Web2'
name_description: 'NGinx FrontEnd'
address: '192.168.1.15'
power_state: 'Running'
CPU_usage: 3 # in percentages
memory: {
size: 4096 # in bytes
usage: 599 # in bytes
}
}
{
name_label: 'PG1 Prod'
name_description: 'Postgres 9.1 VM'
address: '192.168.1.124'
power_state: 'Running'
CPU_usage: 3 # in percentages
memory: {
size: 4096 # in bytes
usage: 599 # in bytes
}
}
{
name_label: 'FreeBSD'
name_description: 'FreeBSD 9 ZFS VM'
address: '192.168.1.171'
power_state: 'Running'
CPU_usage: 3 # in percentages
memory: {
size: 1024 # in bytes
usage: 599 # in bytes
}
}
]
}
]
}
{
name_label: 'Dev Pool2'
#SRs: []
hosts: [
{
name_label: 'Host Dev1'
#enable: false
address: '192.168.1.101'
#memory: {}
#VMs: []
}
{
name_label: 'Host Dev2'
enable: true
address: '192.168.1.102'
memory: {
size: 100 # in bytes
usage: 80 # in bytes
}
VMs: [
{
name_label: 'VDev1'
name_description: 'Dev VM for IT'
address: '192.168.1.241'
power_state: 'Running'
CPU_usage: 30 # in percentages
memory: {
size: 512 # in bytes
usage: 128 # in bytes
}
}
]
}
]
}
]
# Compute additional info.
for pool in $scope.pools
pool.n_hosts = pool.hosts?.length or 0
pool.n_VMs = 0
pool.n_running_VMs = 0
for host in pool.hosts or []
host.n_VMs = host.VMs?.length or 0
pool.n_VMs += host.n_VMs
host.n_running_VMs = 0
++host.n_running_VMs for VM in host.VMs or [] when VM.power_state == 'Running'
pool.n_running_VMs += host.n_running_VMs

View File

@ -0,0 +1,5 @@
'use strict'
angular.module('xoWebApp')
.controller 'NavBarCtrl', ($scope) ->
$scope.user = 'admin@admin.net'

View File

@ -1,109 +0,0 @@
/**
* This file is a part of Xen Orchestra Web.
*
* Xen Orchestra Web is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Xen Orchestra Web is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xen Orchestra Web. If not, see
* <http://www.gnu.org/licenses/>.
*
* @author Olivier Lambert <olivier.lambert@vates.fr>
* @author Julien Fontanet <julien.fontanet@vates.fr>
* @license http://www.gnu.org/licenses/agpl-3.0-standalone.html GNU AGPLv3
*
* @package Xen Orchestra Web
*/
// Require.js configuration. (http://requirejs.org/)
require.config({
// http://requirejs.org/docs/api.html#config-paths
paths: {
/* jshint maxlen: false */
text: '../bower_components/requirejs-text/text',
// The version we are using currently does not embbed a
// compiled version of the JavaScript.
// @todo Fix when switching to Bootstrap 3.
bootstrap: 'bootstrap',
backbone: '../bower_components/backbone/backbone',
bootstrap_wizard: '../bower_components/twitter-bootstrap-wizard/jquery.bootstrap.wizard',
d3: '../bower_components/d3/d3',
jquery: '../bower_components/jquery/jquery',
marionette: '../bower_components/marionette/lib/backbone.marionette',
moment: '../bower_components/momentjs/moment',
q: '../bower_components/q/q',
select2: '../bower_components/select2/select2',
underscore: '../bower_components/underscore/underscore',
// noVNC (cat base64.js, display.js, input.js, jsunzip.js, rfb.js util.js websock.js).
rfb: 'rfb',
},
// http://requirejs.org/docs/api.html#config-shim
shim: {
backbone: {
deps: ['jquery', 'underscore'],
exports: 'Backbone',
},
bootstrap: {
deps: ['jquery'],
exports: 'jQuery',
},
bootstrap_wizard: {
deps: ['jquery'],
exports: 'jQuery',
},
d3: {
exports: 'd3',
},
marionette: {
deps: ['backbone'],
exports: 'Marionette',
},
select2: {
deps: ['jquery'],
exports: 'Seelect2',
},
underscore: {
exports: '_',
},
rfb: {
exports: 'RFB',
}
}
});
require([
'app',
'xo',
], function (app, XO) {
'use strict';
var loc = window.location;
var protocol = ('https:' === loc.protocol) ? 'wss' : 'ws';
var host = loc.host;
var path = loc.pathname;
app.start({
'xo': new XO(protocol +'://'+ host + path +'api/'),
});
});

View File

@ -1,442 +0,0 @@
/**
* This file is a part of Xen Orchestra Web.
*
* Xen Orchestra Web is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Xen Orchestra Web is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xen Orchestra Web. If not, see
* <http://www.gnu.org/licenses/>.
*
* @author Julien Fontanet <julien.fontanet@vates.fr>
* @license http://www.gnu.org/licenses/agpl-3.0-standalone.html GNU AGPLv3
*
* @package Xen Orchestra Web
*/
define([
'underscore',
'd3',
], function (_, d3) {
'use strict';
function create_picker(property)
{
return function (object) {
return object[property];
};
}
return function network_graph() {
// Customizable settings.
var cfg = {
'width': 800,
'height': 600,
};
// Node types.
var TYPE_POOL = 0;
var TYPE_HOST = 1;
var TYPE_VM = 2;
// Force layout settings.
var alpha = 0.1;
var charge = -30;
var friction = 0.9;
var gravity = 0;
var iterations = 1e3;
var link_length = function (link) { return link.length || 20; };
var link_strength = 5;
// Other graph settings.
var distance_pool = 50;
var distance_host = 100;
var distance_vm = 125;
var node_radius = 10;
function create_nodes_and_links(pools)
{
var links = [];
var hosts = [];
var vms = [];
_.each(pools, function (pool) {
pool.type = TYPE_POOL;
pool.id = pool.id || _.uniqueId();
_.each(pool.hosts, function (host) {
hosts.push(host);
host.type = TYPE_HOST;
host.id = host.id || _.uniqueId();
links.push({
'id': pool.id +'-'+ host.id,
'source': pool,
'target': host,
'length': distance_host,
});
host.pool = pool; // @todo Necessary?
_.each(host.vms, function (vm) {
vms.push(vm);
vm.type = TYPE_VM;
vm.id = vm.id || _.uniqueId();
links.push({
'id': host.id +'-'+ vm.id,
'source': host,
'target': vm,
'length': distance_vm,
});
vm.host = host; // @todo Necessary?
});
});
});
// Initially places pools, hosts and VMs on concentric
// circles.
var mid_w = cfg.width / 2;
var mid_h = cfg.height / 2;
var TWO_PI = 2 * Math.PI;
var alpha = TWO_PI / pools.length;
var radius = distance_pool;
_.each(pools, function (pool, i) {
var alpha_i = alpha * i;
pool.x = Math.cos(alpha_i) * radius + mid_w;
pool.y = Math.sin(alpha_i) * radius + mid_h;
pool.fixed = true;
});
alpha = TWO_PI / hosts.length;
radius += distance_host;
_.each(hosts, function (host, i) {
var alpha_i = alpha * i;
host.x = Math.cos(alpha_i) * radius + mid_w;
host.y = Math.sin(alpha_i) * radius + mid_h;
});
alpha = TWO_PI / vms.length;
radius += distance_vm;
_.each(vms, function (vm, i) {
var alpha_i = alpha * i;
vm.x = Math.cos(alpha_i) * radius + mid_w;
vm.y = Math.sin(alpha_i) * radius + mid_h;
});
return [
pools, hosts, vms,
links,
];
}
function polygon(edges, radius, alpha)
{
var angle = 2 * Math.PI / edges;
if (undefined === alpha)
{
alpha = 0;
}
var coords = [];
for (var i = 0; i < edges; ++i)
{
var angle_i = i * angle + alpha;
coords.push(
Math.cos(angle_i) * radius, // x
Math.sin(angle_i) * radius // y
);
}
var path = 'M'+ coords.join(' ') +'Z';
return function (selection) {
return selection.append('path')
.attr('class', 'symbol')
.attr('d', path)
;
};
}
function transform(translate, scale)
{
var transform = [];
if (translate)
{
transform.push('translate('+ translate.join(', ') +')');
}
if (scale)
{
transform.push('scale('+ scale +')');
}
return transform.join(' ');
}
function graph(g)
{
// Variables definition.
var width = cfg.width;
var height = cfg.height;
var left = -width/2;
var top = -height/2;
var data = g.datum();
//--------------------------------------
// @todo Find a way to remove all existing elements in g.
// Clipping element.
g.append('defs').append('clipPath')
.attr('id', 'clip-network-graph') // @todo Unique id.
.append('rect')
.attr('x', left)
.attr('y', top)
.attr('width', width)
.attr('height', height)
;
//--------------------------------------
// Root element for the graph.
g = g.append('g')
.attr('pointer-events', 'all')
.attr('clip-path', 'url(#clip-network-graph)')
;
//--------------------------------------
// Background element which allows us to get pointer events.
g.append('rect')
.attr('class', 'background')
.attr('x', left)
.attr('y', top)
.attr('width', width)
.attr('height', height)
;
//--------------------------------------
// Group used by the network to apply dragging and zooming.
var scene = g.append('g')
.attr('transform', transform([left, top]))
;
//--------------------------------------
var zoomer = d3.behavior.zoom().translate([left, top])
.on('zoom', function () {
var e = d3.event;
scene.attr('transform', transform(e.translate, e.scale));
})
;
g.call(zoomer)
.on('dblclick', function () {
zoomer.translate([left, top]).scale(1);
scene.transition()
.attr('transform', transform([left, top]))
;
})
.on('dblclick.zoom', null)
;
//--------------------------------------
// Force layout.
var force = d3.layout.force()
.alpha(alpha)
.charge(charge)
.friction(friction)
.gravity(gravity)
.linkDistance(link_length)
.linkStrength(link_strength)
.size([width, height])
;
////////////////////////////////////////
// Update.
////////////////////////////////////////
// Creates pools, hosts and vms nodes and, links.
var pools, hosts, vms, links;
(function () {
var tmp = create_nodes_and_links(data);
pools = tmp[0];
hosts = tmp[1];
vms = tmp[2];
links = tmp[3];
})();
// Adds them to the force layout.
force
.links(links)
.nodes(pools.concat(hosts, vms))
;
// Runs the force layout.
force.start();
for (var i = 0; i < iterations; ++i)
{
force.tick();
}
force.stop();
//--------------------------------------
var id_picker = create_picker('id');
var label_picker = create_picker('label');
//--------------------------------------
var link = scene.selectAll('.link').data(links, id_picker);
link.enter().append('line')
.attr('class', 'link')
.attr('x1', 0)
.attr('y1', 0)
.attr('x2', 0)
.attr('y2', 0)
;
link.transition()
.attr('x1', function (d) { return d.source.x; })
.attr('y1', function (d) { return d.source.y; })
.attr('x2', function (d) { return d.target.x; })
.attr('y2', function (d) { return d.target.y; })
;
link.exit().transition()
.style('opacity', 0)
.remove()
;
//--------------------------------------
// @todo Manage all nodes together?
//--------------------------------------
var pool = scene.selectAll('.pool').data(pools, id_picker);
pool.enter().append('a')
.attr('class', 'node pool')
.attr('xlink:href', function (d) {
return '#pools/'+ d.id;
})
.call(function (selection) {
selection.append('circle')
.attr('class', 'symbol')
.attr('r', node_radius)
;
})
.append('text')
.text(label_picker)
;
pool.transition()
.attr('transform', function (d) {
return transform([d.x, d.y]);
})
;
pool.exit().transition()
.style('opacity', 0)
.remove()
;
//--------------------------------------
var host = scene.selectAll('.host').data(hosts, id_picker);
host.enter().append('a')
.attr('class', 'node host')
.attr('xlink:href', function (d) {
return '#hosts/'+ d.id;
})
.call(polygon(4, node_radius))
.append('text')
.text(label_picker)
;
host.transition()
.attr('transform', function (d) {
return transform([d.x, d.y]);
})
;
host.exit().transition()
.style('opacity', 0)
.remove()
;
//--------------------------------------
var vm = scene.selectAll('.vm').data(vms, id_picker);
vm.enter().append('a')
.attr('class', 'node vm')
.attr('xlink:href', function (d) {
return '#vms/'+ d.id;
})
.call(polygon(3, node_radius))
.append('text')
.text(label_picker)
;
vm.transition()
.attr('transform', function (d) {
return transform([d.x, d.y]);
})
;
vm.select('.symbol').transition()
.attr('transform', function (d) {
var x = d.host.x - d.x;
var y = d.host.y - d.y;
var angle = Math.acos(x / Math.sqrt(x*x + y*y)) / Math.PI * 180 + 180;
return 'rotate('+ (y < 0 ? -angle : angle) +')';
})
;
vm.exit().transition()
.style('opacity', 0)
.remove()
;
}
// Add helper and setter for customizable settings.
_.each(cfg, function (value, setting) {
graph[setting] = function (setting) {
return function (value) {
// Getter.
if (undefined === value)
{
return cfg[setting];
}
// Setter.
cfg[setting] = value;
return graph;
};
}(setting);
});
return graph;
};
});

File diff suppressed because it is too large Load Diff

View File

@ -1,458 +0,0 @@
/**
* This file is a part of Xen Orchestra Web.
*
* Xen Orchestra Web is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Xen Orchestra Web is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xen Orchestra Web. If not, see
* <http://www.gnu.org/licenses/>.
*
* @author Olivier Lambert <olivier.lambert@vates.fr>
* @author Julien Fontanet <julien.fontanet@vates.fr>
* @license http://www.gnu.org/licenses/agpl-3.0-standalone.html GNU AGPLv3
*
* @package Xen Orchestra Web
*/
//////////////////////////////////////////////////////////////////////
// Template helpers.
//////////////////////////////////////////////////////////////////////
define([
'underscore',
'backbone',
'moment',
], function (_, Backbone, moment) {
'use strict';
return {
/**
* Moment.js
*/
'moment': moment,
/**
* @todo Documentation
*
* @param {integer} seconds Number of seconds of the duration.
* @param {integer=} precision Number of significant units to use.
* (Default is 2).
*
* @return {string}
*/
'formatDuration': function(seconds, precision) {
/* jshint bitwise:false */
var units = [
['years', 31556952], // 365.2425 days per year due to leap-years.
['months', 2629746], // Divided by 12 months.
['days', 86400], // 24 hours.
['hours', 3600], // 60 minutes.
['minutes', 60], // 60 seconds.
['seconds', 1],
];
var i = 0;
var n = units.length;
precision = precision ? precision|0 : 2;
// Find the first non null unit.
while ((i < n) && (seconds < units[i][1]))
{
++i;
}
var parts = [];
for (; i < n; ++i)
{
var m = (seconds / units[i][1])|0;
seconds %= units[i][1];
if (m)
{
parts.push(m +' '+ units[i][0]);
}
if (--precision <= 0)
{
break;
}
}
n = parts.length - 1;
// Exactly one part.
if (!n)
{
return parts[0];
}
// More than one part.
return (parts.slice(0, n).join(', ') + ' and ' + parts[n]);
},
/**
* Helper for xo.formatDuration() which format the duration
* between a moment in the past and now.
*
* @param {integer} timestamp Unix timestamp of the past moment.
* @param {string=} precision Last unit that should be used
* (Default is seconds).
*
* @return {string}
*/
'formatDuration_fromNow': function(timestamp, precision) {
return this.formatDuration(
Math.floor(Date.now() / 1000 - timestamp),
precision
);
},
/**
* [description]
*
* @todo Documentation
*
* @param {integer} size [description]
* @param {string=} unit [description]
* @param {integer=} base
*
* @return string
*/
'formatSize': function(size, unit, base){
/* jshint bitwise:false */
size = +size;
unit = (undefined !== unit) ? ''+unit : 'B';
base = (undefined !== base) ? base|0 : 1024;
var powers = ['', 'K', 'M', 'G', 'T', 'P'];
for (var i = 0; size > base; ++i)
{
size /= base;
}
// Maximum 1 decimals.
size = ((size * 10)|0) / 10;
return (size + powers[i] + unit);
},
/**
*
*/
'get': function (/* scope, */ path, def) {
var current = this;
if (!_.isArray(path))
{
if (_.isObject(path))
{
current = path;
path = def;
def = arguments[2];
}
if (_.isString(path))
{
path = path.split('.');
}
}
for (var i = 0, n = path.length; i < n; ++i)
{
var part = path[i];
if (current instanceof Backbone.Model)
{
current = current.get(current);
}
else
{
current = current[part];
}
if (_.isString(current))
{
if ('OpaqueRef:NULL' === current)
{
current = null;
}
else if (0 === current.indexOf('OpaqueRef:'))
{
var tmp = this.app.xobjs[current];
if (tmp)
{
current = tmp;
}
}
}
if (!current)
{
break;
}
}
if ((i < n) || (undefined === current))
{
return def;
}
if (_.isString(current))
{
return _.escape(current);
}
return current;
},
/**
*
*/
'getMessages': function () {
var uuid = this.uuid;
return this.app.collections.message.subset(function (message) {
return (uuid === message.get('obj_uuid'));
});
},
/**
*
*/
'link': function (label, path) {
if (_.isArray(path))
{
path = path.join('/');
}
return [
'<a href="#', path, '">',
label,
'</a>',
].join('');
},
/**
* [description]
*
* @todo Documentation
*
* @param {array} bars [description]
* @param {object=} options [description]
*
* @return string
*/
'progressBar': function (bars, options) {
var has_labels = false;
// Normalizes bars.
if (!_.isArray(bars))
{
bars = [bars];
}
_.each(bars, function (bar, i) {
if (_.isNumber(bar))
{
bars[i] = bar = {
'value': bar
};
}
if ((bar.value = Math.round(bar.value)) <= 0)
{
bar.value += 100;
}
has_labels = has_labels || !!bar.label;
_.defaults(bar, {
'color': 'info',
'title': bar.value +'%',
'label': '',
});
});
// Normalizes global options.
if (!options)
{
options = {};
}
has_labels = has_labels || !!options.label;
_.defaults(options, {
'size': has_labels ? 'normal' : 'small',
'title': (1 === bars.length) ? bars[0].title : '',
});
// HTML generation.
var html = [
'<div class="progress',
(options.size in {'small':0, 'big':0}) // @todo Ugly.
? ' progress-'+ options.size
: '',
'" title="', options.title, '">'];
_.each(bars, function (bar) {
html.push(
'<div class="bar bar-', bar.color, '" title="', bar.title,
'" style="width: ', bar.value, '%">', bar.label, '</div>'
);
});
html.push(options.label, '</div>');
return html.join('');
},
/**
* [description]
*
* @todo Documentation
*
* @param {string} power_state [description]
*
* @return string
*/
'powerState': function () {
var state_to_colors = {
'Running': 'success',
'Paused': 'info',
'Halted': 'important',
};
var state = this.power_state;
return [
'<span class="label label-', state_to_colors[state], '">',
state,
'</span>',
].join('');
},
/**
* [description]
*
* @todo Documentation
*
* @param {string} actionButtons [description]
*
* @return string
*/
'actionButtons': function () {
switch (this.power_state)
{
case 'Running':
return [
'<button class="btn btn-small js-pause" data-id="',
this.id, '" title="Pause">',
'<i class="fa fa-pause"></i></button> ',
'<button class="btn btn-small js-clean-reboot" data-id="',
this.id, '" title="Restart">',
'<i class="fa fa-refresh"></i></button> ',
'<button class="btn btn-small js-clean-shutdown" data-id="',
this.id, '" title="Stop">',
'<i class="fa fa-stop"></i></button>',
].join('');
case 'Paused':
return '<button class="btn btn-small js-unpause" data-id="'+ this.id +'" title="Unpause"><i class="fa fa-play"></i></button>';
case 'Halted':
return '<button class="btn btn-small js-start" data-id="'+ this.id +'" title="Start"><i class="fa fa-play"></i></button>';
}
},
/**
* [description]
*
* @todo Documentation
*
* @param {string} actionButtons [description]
*
* @return string
*/
'statusIcon': function () {
switch (this.power_state)
{
case 'Running':
return '<i class="fa fa-circle-o" title="Status: running" style="color:green"></i>';
case 'Paused':
return '<i class="fa fa-circle-o" title="Status: paused" style="color:#005599"></i>';
case 'Halted':
return '<i class="fa fa-circle-o" title="Status: halted" style="color:#d60000"></i>';
default:
return '<i class="fa fa-circle-o" title="Status: unknown" style="color:black"></i>';
}
},
/**
* [description]
*
* @todo Documentation
*
* @param {boolean} currently_attached [description]
*
* @return string
*/
'linkState': function () {
if (this.currently_attached) {
return '<span class="label label-success">Connected</span>';
}
return '<span class="label label-important">Not connected</span>';
},
/**
* [description]
*
* @todo Documentation
*
* @param {boolean} truth [description]
*
* @return string
*/
'yesNo': function (truth) {
return (truth ? 'Yes' : 'No');
},
/**
* [description]
*
* @todo Documentation
*
* @param {string} selected Selected permission if any.
*
* @return string
*/
'permissionsList': function (selected) {
var perms = {
'none': 'None',
'read': 'Read',
'write': 'Write',
'admin': 'Administration',
};
if (!selected)
{
selected = this.permission;
}
var html = [];
for (var perm in perms)
{
html.push('<option value="', perm, '"');
if (selected === perm)
{
html.push(' selected="selected"');
}
html.push('>', perms[perm], '</option>');
}
return html.join('');
},
};
});

View File

@ -1,134 +0,0 @@
/**
* This file is a part of Xen Orchestra Web.
*
* Xen Orchestra Web is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Xen Orchestra Web is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xen Orchestra Web. If not, see
* <http://www.gnu.org/licenses/>.
*
* @author Olivier Lambert <olivier.lambert@vates.fr>
* @author Julien Fontanet <julien.fontanet@vates.fr>
* @license http://www.gnu.org/licenses/agpl-3.0-standalone.html GNU AGPLv3
*
* @package Xen Orchestra Web
*/
//////////////////////////////////////////////////////////////////////
// Connection to XO.
//////////////////////////////////////////////////////////////////////
define([
'q',
], function (Q) {
'use strict';
return function XO(url) {
var xo = this;
// Identifier of the next request.
var next_id = 0;
// Promises linked to the requests.
var deferreds = {};
// When the socket is closed, request are enqueued.
var queue = [];
// Websocket used to connect to XO-Server.
var socket = new WebSocket(url);
// Function used to send requests when the socket is opened.
var send = function (method, params, deferred) {
var id = next_id++;
socket.send(JSON.stringify({
'jsonrpc': '2.0',
'id': id,
'method': method,
'params': params || [],
}));
deferreds[id] = deferred || Q.defer();
return deferreds[id].promise;
};
// Function used to enqueue requests when the socket is closed.
var enqueue = function (method, params) {
var deferred = Q.defer();
queue.push([method, params, deferred]);
return deferred.promise;
};
// When the websocket opens, send any requests enqueued.
socket.addEventListener('open', function () {
// New requests are sent directly.
xo.call = send;
var query;
while ( (query = queue.shift()) )
{
send(query[0], query[1], query[2]);
}
});
// When the websocket closes, requests are not sent directly
// but enqueud.
socket.addEventListener('close', function () {
xo.call = enqueue;
});
// When a message is received, we call the corresponding
// deferred (if any).
socket.addEventListener('message', function (event) {
var response = JSON.parse(event.data);
var id = response.id;
var deferred = deferreds[id];
delete deferreds[id];
var error = response.error;
if (undefined !== error)
{
deferred.reject(error);
return;
}
var result = response.result;
if (undefined === result)
{
/* jshint devel:true */
deferred.reject({
'message': 'a message with no error nor result has been' +
' received',
'object': response,
});
return;
}
deferred.resolve(result);
});
// @todo What to do if there is an error in the websocket.
socket.addEventListener('error', function (error) {
console.error(error);
});
// The default way to send a request is by enqueuing it.
xo.call = enqueue;
// @todo
xo.clone = function () {
return new XO(url);
};
};
});

View File

@ -1,149 +1,32 @@
////
// Bootstrap 2.
////
@import sass-bootstrap/lib/bootstrap
@import sass-bootstrap/lib/responsive
// When the navbar is fixed on top (on desktop), add a padding to
// `body` to prevent the navbar from overlapping.
@media (min-width: 981px)
body
padding-top: 60px
//////////////////////////////////////////////////////////////////////
// Bootstrap
//////////////////////////////////////////////////////////////////////
////
$icon-font-path: "/bower_components/sass-bootstrap/fonts/"
@import sass-bootstrap/lib/bootstrap
//////////////////////////////////////////////////////////////////////
// Font-Awesome 4.
////
//////////////////////////////////////////////////////////////////////
$fa-font-path: "../bower_components/font-awesome/fonts"
@import font-awesome/scss/font-awesome
//////////////////////////////////////////////////////////////////////
////
// Select2.
////
@import ../bower_components/select2/select2.css
// TODO: The styles in this file should be
// - commented;
// - converted to SASS;
// - move into this file.
@import to-clean
//////////////////////////////////////////////////////////////////////
// Modals containing a form as body are displayed incorrectly (not
// wide enough).
.modal-form
width: 100%
// MAC addresses are displayed using a monospace font.
.mac-address
font-family: Monaco, Menlo, Consolas, "Courier New", monospace
// @todo Comment this style.
.leaderboard
padding: 60px
margin-bottom: 30px
background-color: #eee
-webkit-border-radius: 6px
-moz-border-radius: 6px
border-radius: 6px
border: 1px solid #ddd
h1
font-size: 40px
margin-bottom: 5px
line-height: 1
letter-spacing: -1px
color: #D40000
p
font-size: 18px
font-weight: 200
line-height: 27px
// @todo Comment this style.
.center
text-align: center !important
// @todo Comment this style.
.progress-small
height: 0.8em
margin-top: 0.3em
margin-bottom: -1em
overflow: hidden
background-color: #f7f7f7
background-image: -moz-linear-gradient(top, #ddd, #f5f5f5)
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ddd), to(#f5f5f5))
background-image: -webkit-linear-gradient(top, #ddd, #f5f5f5)
background-image: -o-linear-gradient(top, #ddd, #f5f5f5)
background-image: linear-gradient(to bottom, #ddd, #f5f5f5)
background-repeat: repeat-x
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ddd', endColorstr='#f5f5f5', GradientType=0)
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1)
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1)
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1)
-webkit-border-radius: 4px
-moz-border-radius: 4px
border-radius: 4px
// @todo Comment this style.
.progress-big
height: 3em
margin-top: 0.3em
margin-bottom: 0em
overflow: hidden
background-color: #f7f7f7
background-image: -moz-linear-gradient(top, #ddd, #f5f5f5)
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ddd), to(#f5f5f5))
background-image: -webkit-linear-gradient(top, #ddd, #f5f5f5)
background-image: -o-linear-gradient(top, #ddd, #f5f5f5)
background-image: linear-gradient(to bottom, #ddd, #f5f5f5)
background-repeat: repeat-x
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ddd', endColorstr='#f5f5f5', GradientType=0)
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1)
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1)
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1)
-webkit-border-radius: 4px
-moz-border-radius: 4px
border-radius: 4px
// For caret navbar like FontAwesome website.
// @todo Clarify this comment.
.navbar .nav > li.dropdown-split-left > a
padding-right: 0px
.navbar .nav > li > a
padding: 12px 10px 9px
// For BootstrapWizard: Prev and Next button at the same height if possible
.tab-pane.active
min-height: 21em
//////////////////////////////////////////////////////////////////////
////
// Network graph.
////
.network-graph
.background
visibility: hidden
.link
stroke: #000
.symbol
stroke: #000 // @todo fix
stroke-width: 0.3
.pool .symbol
fill: #1f77b4
.host .symbol
fill: #9467bd
.vm .symbol
fill: #d62728
.node text
display: none
.node:hover text
display: block
// Style applied to a message for outdated browsers (IE <= 7).
.browsehappy
margin: 0.2em 0
background: #ccc
color: #000
padding: 0.2em 0

230
app/styles/to-clean.scss Normal file
View File

@ -0,0 +1,230 @@
/* Brand color */
.navbar-brand {color: #bf0000;}
input.form-control.inverse {background-color: #666; color: #f8f8f8; border: 0px;}
/* Search bar */
.popover { width: 300px; }
/* search button in main bar */
.btn-search {background-color: #3a87ad; color: #f8f8f8;}
.btn-search:hover {background-color: #1d4457; color: #f8f8f8;}
/* only useful if Google like action menu enabled */
/*.google {margin-bottom: 1em;}*/
html {
background-color: #edece4;
/* Possibility to get a wallpaper for the background: see later in admin maybe, for the lulz */
/*background: url(bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;*/
}
body {
padding-top: 50px;
background-color: transparent;
}
.home-page {
padding-top: 50px;
}
.navbar-under { background-color: #f8f8f8;}
td.vcenter {
vertical-align: middle;
}
input[type="checkbox"]{
padding-top: 0px;
line-height: normal;
}
input.inverse {margin: 0; padding-top: 1em;}
/* progress bar */
.progress-small {
height: 0.6em;
width: 4em;
display: inline-block;
float: center;
margin: 3px;
}
.i-progress { float: center; margin-right: 0em;}
.pool-block { margin-left: 1em; margin-right: 1em; margin-top: 0.5em; margin-bottom: 0;}
.pool-cell { margin-bottom: 0.5em; margin-left: 2em; margin-right: 1em; min-height: 6em; max-width: 190px; background-color: white; }
/* row for all hosts/vms in a pool */
.hosts-vms-cells { min-height: 6em; margin-right: -0.5em; }
/* individual host element */
.host-cell { max-width: 156px; background-color: white; margin-bottom: 0.5em;}
/* pool size mini : 195 px ; host : 161 px; */
.vm-cell {
margin-left: 0.5em;
margin-bottom: 0.5em;
background-color: white;
/* allow empty space */
/*align-self: flex-start;*/
}
.grey {color: #666; font-size: 0.9em;}
/* drodown head link for pools/hosts */
.dropdown-pool { border-bottom: 1px solid #edece4; text-align: center;}
.dropdown-pool a {
text-decoration: none;
color: #333;
}
.pool-name {font-size: 1.8em;}
.host-name {font-size: 20px;}
.big-caret {font-size: 1.4em;}
/* for dropdown menu not centered */
.dropdown-menu {background-color: white;}
.left {text-align: left;}
/* grab zone on VM table, for drag and drop */
td.grab {padding: 0 !important; margin: 0 !important; width: 6px !important;}
tr:hover .grab {background: url("grippy_large_dark.png") no-repeat scroll 1px 50% transparent !important}
table { table-layout: fixed; }
table th, table td { overflow: hidden; }
/* the main bar */
.navbar-inverse
{
background-color: #242628;
border-color: #2e3133;
font-variant:small-caps;
}
.fa {font-variant: normal;}
/* the big subbar */
.sub-bar
{
height:50px;
top:50px;
position: fixed;
background:#242628;
border-bottom:1px solid #2e3133;
width:100%;
margin:0px auto;
z-index: 1020;
}
/* Black theme: inversed colors for drop down menus */
a.dropdown-toggle.inverse:hover {background-color:#2e3133 !important;}
a.dropdown-toggle.inverse:active {background-color:#2e3133 !important;}
a.dropdown-toggle.inverse:focus {background-color:#2e3133 !important;}
ul.inverse {background:#2e3133;}
ul.inverse a {color:#f8f8f8;}
ul.inverse a:hover {background-color:#242628; color: #f8f8f8 ;}
ul.inverse li.divider {background-color:#222;}
/* Inversed (black) buttons */
button.btn.navbar-btn.btn-default.inversed {background-color:#444; border-color: #222; color: #999999;}
a.btn.navbar-btn.btn-default.dropdown-toggle.inversed {background-color:#444; border-color: #222; color: #999999; margin-left: 0.5em;}
/* change caret color for inversed button */
.grey-caret {border-top-color: #999999 !important; border-bottom-color: #999999 !important;}
/* stats bar */
.overview { padding: 1em; color: #a6a6a6 ; max-width: 346px;}
.overview i {font-weight: normal;}
.small {font-size: 10pt; font-style: normal;}
/* stats pool */
.overview-pool {text-align: center; margin-top: 1em; margin-bottom: 0.4em; padding-bottom: 0.4em; }
.overview-pool a {text-decoration: none; color: #a6a6a6; margin-right: 0.6em;}
.overview-pool a:hover {text-decoration: none; color: #333;}
.sr-name {font-size: 10pt;}
/* "actionbar" which is select and buttons when one or more VM selected */
.before-action-bar { margin-left: 1em;}
.action-bar {display: inline;}
/* buttons displayed on VM lines when hover*/
tr:hover .quick-buttons {visibility: visible;}
.quick-buttons {display: inline; font-size: 10.5pt; float: right; visibility: hidden;}
.quick-buttons a {text-decoration: none; color: #666; }
.quick-buttons a:hover {text-decoration: none; color: #000;}
/* each button */
.quick-button {display: inline; margin-right: 0.3em;}
/* last button of quick button */
.last {margin-left: 0.5em;}
.quick-button:hover {color: #333;}
/* SR table (in host and pool) */
.no-border {border-top: 0px !important;}
/* vm name in table */
.vm {display: inline; font-size: 10.5pt; margin: 0;}
.no-vm {font-size: 1.5em; margin-top: 1.8em; color: #999;}
.vm-cell table {margin: 0;}
.vm-cell td {border-bottom: 1px solid #edece4 !important;; border-top: 0px !important;}
/* ip display */
.vm-ip {color: #666; text-align: right;}
.host-ip {color: #666;}
.cpu {display: inline;}
.cpu a {text-decoration: none; color: #a6a6a6; margin-left: 0.9em;}
.cpu a:hover {text-decoration: none; color: #333;}
/* tooltip hack to avoid be hidden by other elements */
.tooltip {
position: fixed;
}
.select-vm {
width: 1.5em;
height: 20px;
}
/* useful global class */
.center {text-align: center;}
.right {text-align: right;}
.small-caps {font-variant:small-caps;}
.big {font-size: 4em;}
/* flex */
.grid {
display: flex;
}
.grid-cell {
flex: 1;
border-radius: 3px 3px 3px 3px;
}
/* stats name in a grid cell */
.stat-name {margin-top: 1em; text-align: center; font-variant: small-caps;}
/* flat view */
.flat-cell {border-radius: 0px; margin-left: 1em; margin-right: 1em; margin-top: 0.5em; margin-bottom: 0.5em;}
.flat-cell-name {max-width: 150px; min-width: 150px;}
.flat-cell-description {max-width: 250px; min-width: 250px;}
.flat-cell-type {max-width: 40px; font-size: 2em; text-align: center; margin: auto; margin-left: 0.5em;}
.flat-cell-tag {font-size: 11pt; margin: auto; min-height: 2.5em; padding-top: 0.4em; padding-left: 1em; opacity: 0.8;}
.flat-object {margin: 0.5em; background-color: #fff; border-radius: 3px 3px 3px 3px; margin-top: 0.5em; margin-bottom: 0.5em;}
.flat-object:hover {background-color: #f8f8f8;}
.flat-panel {background-color: white; margin: 0.5em; border-radius: 3px 3px 3px 3px; padding-left: 0.5em; padding-right: 0.5em;}
.page-title {text-align: center; font-size: 2em; margin: 0;}
.flat-panel-title {border-bottom: 1px solid #edece4; text-align: center; font-size: 1.5em;}
.flat-panel-title a {float: right; text-decoration: none; color: black; visibility: hidden;}
div.grid-cell:hover a.edit-button {visibility: visible;}
/* With gutters */
.grid--gutters {
margin-left: -0.5em;
}
.grid--gutters > .grid-cell {
padding-left: 0.5em;
}

374
app/views/main.html Normal file
View File

@ -0,0 +1,374 @@
<div class="sub-bar">
<div class="grid">
<div class="grid-cell overview">
<!--Stats-->
<i class="normal" data-toggle="tooltip" title="2 pools"><i class="small">2x </i><i class="fa fa-cloud" data-toggle="tooltip" data-placement="bottom"></i></i>&nbsp;&nbsp;
<i class="normal" data-toggle="tooltip" title="3 hosts"><i class="small">3x </i><i class="fa fa-square" data-toggle="tooltip" data-placement="bottom"></i></i>&nbsp;&nbsp;
<i class="normal" data-toggle="tooltip" title="6 of 8 VMs running"><i class="small">6x </i><i class="fa fa-desktop"></i></i>&nbsp;&nbsp;
<i class="normal" data-toggle="tooltip" title="32 vCPUs used of 12 CPUs"><i class="small">32x </i><i class="fa fa-dashboard"></i></i>&nbsp;&nbsp;
<i class="normal" data-toggle="tooltip" title="32GB RAM allocated of 64GB"><i class="small">32GB </i><i class="fa fa-tasks"></i></i>
</div>
<div class="grid-cell">
<div class="btn-group before-action-bar">
<a type="button" class="btn navbar-btn btn-default dropdown-toggle inversed" data-toggle="dropdown">
<input type="checkbox" class="inverse">
<i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu inverse" role="menu">
<li><a href="#">All</a></li>
<li><a href="#">On host1</a></li>
<li><a href="#">On host2</a></li>
<li><a href="#">On host3</a></li>
</ul>
</div>
<div class="action-bar">
<div class="btn-group">
<button type="button" class="btn navbar-btn btn-default inversed"><i class="fa fa-stop"></i></button>
<button type="button" class="btn navbar-btn btn-default inversed"><i class="fa fa-play"></i></button>
<button type="button" class="btn navbar-btn btn-default inversed"><i class="fa fa-refresh"></i></button>
</div>
<button type="button" class="btn navbar-btn btn-default inversed"><i class="fa fa-share"></i></button>
<div class="btn-group">
<button type="button" class="btn navbar-btn btn-default dropdown-toggle inversed" data-toggle="dropdown">More <i class="fa fa-caret-down"></i></button>
<ul class="dropdown-menu inverse" role="menu">
<li><a href="#"><i class="fa fa-bolt"></i> Force reboot</a></li>
<li><a href="#"><i class="fa fa-power-off"></i> Force shutdown</a></li>
<li class="divider"></li>
<li><a href="#"><i class="fa fa-trash-o"></i> Delete</a></li>
<li><a href="#"><i class="fa fa-camera"></i> Take a snapshot</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- Ugly trick to force the pools to be under the sub bar. -->
<div style="margin-top: 50px; visibility: hidden; height: 0">.</div>
<!-- Contains a pool and all its children (hosts). -->
<div ng-repeat="pool in pools" class="grid pool-block">
<!-- Contains information about the pool. -->
<div class="grid-cell grid--gutters pool-cell">
<!-- Header (name + dropdown menu). -->
<div class="dropdown dropdown-pool">
<a class="pool-name" href="#">{{pool.name_label}}</a>
<a data-toggle="dropdown" href="#">&nbsp;<i class="fa fa-caret-down big-caret"></i>&nbsp;</a>
<ul class="dropdown-menu left" role="menu">
<li><a href="#"><i class="fa fa-hdd-o"></i>&nbsp; Add SR</a></li>
<li><a href="#"><i class="fa fa-desktop"></i> Add VM</a></li>
<li><a href="#"><i class="fa fa-cloud-download"></i> Add Host</a></li>
<li class="divider"></li>
<li><a href="#"><i class="fa fa-unlink"></i> Disconnect</a></li>
</ul>
</div>
<!-- Stats & SRs list. -->
<div>
<!-- Stats. -->
<ul class="list-unstyled overview-pool">
<li>
<i data-toggle="tooltip" title="{{pool.n_hosts}} hosts connected">
<i class="small">{{pool.n_hosts}}x</i>
<i class="fa fa-square" data-toggle="tooltip" data-placement="bottom"></i>
</i>
&nbsp;
<i data-toggle="tooltip" title="{{pool.n_running_VMs}} of {{pool.n_VMs}} VMs running">
<i class="small">{{pool.n_running_VMs}}x</i>
<i class="fa fa-desktop"></i>
</i>
</li>
<li>Master: <a href="#">Host1</a></li>
</ul>
<!-- SRs. -->
<p class="center small-caps">Shared Sr:</p>
<table class="table table-hover table-condensed">
<tr>
<td class="col-md-6 sr-name no-border"><i class="fa fa-hdd-o i-progress">&nbsp;</i>DataCore</td>
<td class="col-md-6 right no-border"><div class="progress progress-small"><div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;"></div></div></td>
</tr>
<tr>
<td class="col-md-6 sr-name no-border"><i class="fa fa-hdd-o i-progress">&nbsp;</i>ZFS</td>
<td class="col-md-6 right no-border"><div class="progress progress-small"><div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 20%;"></div></div></td>
</tr>
</table>
</div>
</div>
<!-- HOSTS AND VM CELLS -->
<div class="grid-cell grid--gutters hosts-vms-cells">
<div class="grid ">
<!-- HOST BLOCK -->
<div class=" grid-cell host-cell">
<div class="dropdown dropdown-pool">
<a class="host-name" href="#">XServ2</a>
<a data-toggle="dropdown" href="#">&nbsp;<i class="fa fa-caret-down"></i>&nbsp;</a>
<ul class="dropdown-menu left" role="menu">
<li><a href="#"><i class="fa fa-hdd-o"></i>&nbsp; Add SR</a></li>
<li><a href="#"><i class="fa fa-desktop"></i> Add VM</a></li>
<li class="divider"></li>
<li><a href="#"><i class="fa fa-refresh"></i> Reboot</a></li>
<li><a href="#"><i class="fa fa-power-off"></i> Shutdown</a></li>
<li><a href="#"><i class="fa fa-retweet"></i> Restart toolstack</a></li>
<li><a href="#"><i class="fa fa-cloud-upload"></i> Remove from pool</a></li>
</ul>
</div>
<ul class="list-unstyled overview-pool">
<li class="host-ip"><i class="fa fa-sitemap"></i>&nbsp;192.168.1.2</li>
</ul>
<ul class="list-unstyled overview-pool">
<li><i class="fa fa-tasks i-progress">&nbsp;</i><div class="progress progress-small">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 80%;"></div></div></li>
</ul>
</div>
<!-- VM TABLE/BLOCK -->
<div class="grid-cell vm-cell">
<table class="table table-hover table-condensed">
<tr>
<td class="grab"></td>
<td class="select-vm">
<input type="checkbox" class="checkbox-vm"/>
</td>
<!-- Vm state, name and buttons -->
<td class="col-md-4">
<div class="row">
<!-- Vm name -->
<div class="col-md-7">
<i class="fa fa-circle" style="color:green;" data-toggle="tooltip" title="VM is Running"></i>
<p class="vm" data-toggle="tooltip" title="Apache2+PHP FPM Vm">Web1</p>
</div>
<!-- Vm quick buttons -->
<div class="col-md-5">
<div class="quick-buttons">
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Shutdown VM"><i class="fa fa-stop"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Start VM"><i class="fa fa-play"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Reboot VM"><i class="fa fa-refresh"></i></a>
</div>
<div class="quick-button last">
<a href="#" data-toggle="tooltip" title="VM Console"><i class="fa fa-desktop"></i></a>
</div>
</div>
</div>
</div>
</td>
<!-- Vm description -->
<td class="col-md-4">
Apache2 + PHP5 FPM + node VM
</td>
<!-- Vm metrics -->
<td class="col-md-2">
<div class="cpu">
<a href="#" data-toggle="tooltip" title="CPU Load: 3%" class="cpu">&nbsp;<i class="fa fa-dashboard" style="color: green;"></i></a>
</div>
<div class="cpu">
<a href="#" data-toggle="tooltip" title="599MB used" class="cpu">1024MB</a>
</div>
</td>
<!-- Vm IP -->
<td class="col-md-2 vm-ip" data-toggle="tooltip" title="other IP: 192.168.1.102, 2001:0db8:0:85a3::ac1f:8001, 2001:0db8:0:85a3::ac1f:8001">192.168.1.141</td>
</tr>
<tr>
<td class="grab"></td>
<td class="select-vm">
<input type="checkbox" class="checkbox-vm"/>
</td>
<!-- Vm state, name and buttons -->
<td class="col-md-4">
<div class="row">
<!-- Vm name -->
<div class="col-md-7">
<i class="fa fa-circle" style="color:red;" data-toggle="tooltip" title="VM is Running"></i>
<p class="vm" data-toggle="tooltip" title="Apache2+PHP FPM Vm">Test CentOS</p>
</div>
<!-- Vm quick buttons -->
<div class="col-md-5">
<div class="quick-buttons">
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Shutdown VM"><i class="fa fa-stop"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Start VM"><i class="fa fa-play"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Reboot VM"><i class="fa fa-refresh"></i></a>
</div>
<div class="quick-button last">
<a href="#" data-toggle="tooltip" title="VM Console"><i class="fa fa-desktop"></i></a>
</div>
</div>
</div>
</div>
</td>
<!-- Vm description -->
<td class="col-md-4">
Testing VM for CentOS 6 Pv Drivers
</td>
<!-- Vm metrics -->
<td class="col-md-2">
<div class="cpu">
<a href="#" data-toggle="tooltip" title="CPU Load: 3%" class="cpu">&nbsp;<i class="fa fa-dashboard" style="color: black;"></i></a>
</div>
<div class="cpu">
<a href="#" data-toggle="tooltip" title="599MB used" class="cpu">2048MB</a>
</div>
</td>
<!-- Vm IP -->
<td class="col-md-2 vm-ip" data-toggle="tooltip" title="other IP: 192.168.1.102, 2001:0db8:0:85a3::ac1f:8001, 2001:0db8:0:85a3::ac1f:8001">-</td>
</tr>
<tr>
<td class="grab"></td>
<td class="select-vm">
<input type="checkbox" class="checkbox-vm"/>
</td>
<!-- Vm state, name and buttons -->
<td class="col-md-4">
<div class="row">
<!-- Vm name -->
<div class="col-md-7">
<i class="fa fa-circle" style="color:green;" data-toggle="tooltip" title="VM is Running"></i>
<p class="vm" data-toggle="tooltip" title="Apache2+PHP FPM Vm">Web2</p>
</div>
<!-- Vm quick buttons -->
<div class="col-md-5">
<div class="quick-buttons">
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Shutdown VM"><i class="fa fa-stop"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Start VM"><i class="fa fa-play"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Reboot VM"><i class="fa fa-refresh"></i></a>
</div>
<div class="quick-button last">
<a href="#" data-toggle="tooltip" title="VM Console"><i class="fa fa-desktop"></i></a>
</div>
</div>
</div>
</div>
</td>
<!-- Vm description -->
<td class="col-md-4">
NGinx FrontEnd
</td>
<!-- Vm metrics -->
<td class="col-md-2">
<div class="cpu">
<a href="#" data-toggle="tooltip" title="CPU Load: 3%" class="cpu">&nbsp;<i class="fa fa-dashboard" style="color: green;"></i></a>
</div>
<div class="cpu">
<a href="#" data-toggle="tooltip" title="599MB used" class="cpu">4096MB</a>
</div>
</td>
<!-- Vm IP -->
<td class="col-md-2 vm-ip" data-toggle="tooltip" title="other IP: 192.168.1.102, 2001:0db8:0:85a3::ac1f:8001, 2001:0db8:0:85a3::ac1f:8001">192.168.1.15</td>
</tr>
<tr>
<td class="grab"></td>
<td class="select-vm">
<input type="checkbox" class="checkbox-vm"/>
</td>
<!-- Vm state, name and buttons -->
<td class="col-md-4">
<div class="row">
<!-- Vm name -->
<div class="col-md-7">
<i class="fa fa-circle" style="color:green;" data-toggle="tooltip" title="VM is Running"></i>
<p class="vm" data-toggle="tooltip" title="Apache2+PHP FPM Vm">PG1 Prod</p>
</div>
<!-- Vm quick buttons -->
<div class="col-md-5">
<div class="quick-buttons">
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Shutdown VM"><i class="fa fa-stop"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Start VM"><i class="fa fa-play"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Reboot VM"><i class="fa fa-refresh"></i></a>
</div>
<div class="quick-button last">
<a href="#" data-toggle="tooltip" title="VM Console"><i class="fa fa-desktop"></i></a>
</div>
</div>
</div>
</div>
</td>
<!-- Vm description -->
<td class="col-md-4">
Postgres 9.1 VM
</td>
<!-- Vm metrics -->
<td class="col-md-2">
<div class="cpu">
<a href="#" data-toggle="tooltip" title="CPU Load: 3%" class="cpu">&nbsp;<i class="fa fa-dashboard" style="color: green;"></i></a>
</div>
<div class="cpu">
<a href="#" data-toggle="tooltip" title="599MB used" class="cpu">4096MB</a>
</div>
</td>
<!-- Vm IP -->
<td class="col-md-2 vm-ip" data-toggle="tooltip" title="other IP: 192.168.1.102, 2001:0db8:0:85a3::ac1f:8001, 2001:0db8:0:85a3::ac1f:8001">192.168.1.124</td>
</tr>
<tr>
<td class="grab"></td>
<td class="select-vm">
<input type="checkbox" class="checkbox-vm"/>
</td>
<!-- Vm state, name and buttons -->
<td class="col-md-4">
<div class="row">
<!-- Vm name -->
<div class="col-md-7">
<i class="fa fa-circle" style="color:green;" data-toggle="tooltip" title="VM is Running"></i>
<p class="vm" data-toggle="tooltip" title="Apache2+PHP FPM Vm">FreeBSD</p>
</div>
<!-- Vm quick buttons -->
<div class="col-md-5">
<div class="quick-buttons">
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Shutdown VM"><i class="fa fa-stop"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Start VM"><i class="fa fa-play"></i></a>
</div>
<div class="quick-button">
<a href="#" data-toggle="tooltip" title="Reboot VM"><i class="fa fa-refresh"></i></a>
</div>
<div class="quick-button last">
<a href="#" data-toggle="tooltip" title="VM Console"><i class="fa fa-desktop"></i></a>
</div>
</div>
</div>
</div>
</td>
<!-- Vm description -->
<td class="col-md-4">
FreeBSD 9 ZFS VM
</td>
<!-- Vm metrics -->
<td class="col-md-2">
<div class="cpu">
<a href="#" data-toggle="tooltip" title="CPU Load: 3%" class="cpu">&nbsp;<i class="fa fa-dashboard" style="color: green;"></i></a>
</div>
<div class="cpu">
<a href="#" data-toggle="tooltip" title="599MB used" class="cpu">1024MB</a>
</div>
</td>
<!-- Vm IP -->
<td class="col-md-2 vm-ip" data-toggle="tooltip" title="other IP: 192.168.1.102, 2001:0db8:0:85a3::ac1f:8001, 2001:0db8:0:85a3::ac1f:8001">192.168.1.171</td>
</tr>
</table>
</div> <!-- end of vm-cell -->
</div> <!-- end of grid for hosts and vm -->
</div> <!-- END OF HOSTS AND VM CELLS -->
</div> <!-- end of grid poolblock -->

49
app/views/nav-bar.html Normal file
View File

@ -0,0 +1,49 @@
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="fa fa-bar"></span>
<span class="fa fa-bar"></span>
<span class="fa fa-bar"></span>
</button>
<a href="#" class="navbar-brand" data-toggle="dropdown">Xen Orchestra</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<!-- navbar forced width 250px, bootstrap issue with chrome browsers
see https://github.com/twbs/bootstrap/issues/9950
-->
<form class="navbar-form navbar-left" role="search" style="width: 250px;">
<div class="input-group">
<input type="text" class="form-control inverse" placeholder="">
<span class="input-group-btn">
<button type="submit" class="btn btn-search"><i class="fa fa-search"></i></button>
</span>
</div>
</form>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle inverse" data-toggle="dropdown"><i class="fa fa-th"></i></a>
<ul class="dropdown-menu inverse">
<li><a href="flat-view.html"><i class="fa fa-list"></i>&nbsp;&nbsp;Flat view</a></li>
<li class="disabled"><a href="#"><i class="fa fa-sitemap"></i>&nbsp;&nbsp;Graphs view</a></li>
<li class="divider"></li>
<li><a href="#"><i class="fa fa-plus-circle" style="color:#5cb85c"></i>&nbsp;&nbsp;Add server</a></li>
<li class="disabled"><a href="#"><i class="fa fa-clock-o"></i>&nbsp;&nbsp;Scheduler</a></li>
<li><a href="settings-view.html"><i class="fa fa-cog"></i>&nbsp;&nbsp;Settings</a></li>
<li class="divider"></li>
<li><a href="#"><i class="fa fa-info-circle" style="color:#5bc0de"></i>&nbsp; About</a></li>
</ul>
</li>
<li ng-if="!!user"><a><i class="fa fa-user"></i> {{user}}</a></li>
<li ng-if="!!user"><a><i class="fa fa-sign-out"></i></a></li>
<li ng-if="!user"><a>@todo</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</nav>

View File

@ -1,34 +0,0 @@
#/bin/sh -eu
# This file is a part of Xen Orchestra Server.
#
# Xen Orchestra Server is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Xen Orchestra Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Xen Orchestra Server. If not, see
# <http://www.gnu.org/licenses/>.
#
# @author Julien Fontanet <julien.fontanet@vates.fr>
# @license http://www.gnu.org/licenses/gpl-3.0-standalone.html GPLv3
#
# @package Xen Orchestra Server
# Installs required Node packages (e.g. Bower, Grunt).
npm install
# Adds the Node packages binaries to the PATH.
PATH=node_modules/.bin:$PATH
# Installs external components (e.g. Underscore, Bootstrap).
bower install
# Builds XO-Web (e.g. compile SASS, CoffeeScript).
grunt build

View File

@ -1,20 +1,20 @@
{
"name": "xo-web",
"private": true,
"version": "0.0.0",
"dependencies": {
"d3": "~3.3.9",
"font-awesome": "~4.0.1",
"jquery": "~2.0.3",
"marionette": "~1.2.0",
"modernizr": "~2.6.2",
"momentjs": "~2.4.0",
"q": "~0.9.7",
"requirejs": "~2.1.9",
"requirejs-text": "~2.0.10",
"sass-bootstrap": "~2.3.2",
"select2": "~3.4.4",
"twitter-bootstrap-wizard": "~1.0.0",
"underscore": "~1.5.2"
"angular": "~1.2.0",
"angular-animate": "~1.2.0",
"angular-cookies": "~1.2.0",
"angular-route": "~1.2.0",
"angular-sanitize": "~1.2.0",
"es5-shim": "~2.1.0",
"font-awesome": "~4.0.3",
"jquery": "~1.10.0",
"json3": "~3.2.4",
"sass-bootstrap": "~3.0.0"
},
"devDependencies": {}
"devDependencies": {
"angular-mocks": "~1.2.0",
"angular-scenario": "~1.2.0"
}
}

54
karma-e2e.conf.js Normal file
View File

@ -0,0 +1,54 @@
// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['ng-scenario'],
// list of files / patterns to load in the browser
files: [
'test/e2e/**/*.coffee'
],
// list of files / patterns to exclude
exclude: [],
// web server port
port: 8080,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
// Uncomment the following lines if you are using grunt's server to run the tests
// proxies: {
// '/': 'http://localhost:9000/'
// },
// URL root prevent conflicts with the site root
// urlRoot: '_karma_'
});
};

55
karma.conf.js Normal file
View File

@ -0,0 +1,55 @@
// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/bower_components/angular-cookies/angular-cookies.js',
'app/bower_components/angular-sanitize/angular-sanitize.js',
'app/bower_components/angular-route/angular-route.js',
'app/scripts/*.coffee',
'app/scripts/**/*.coffee',
'test/mock/**/*.coffee',
'test/spec/**/*.coffee'
],
// list of files / patterns to exclude
exclude: [],
// web server port
port: 8080,
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['Chrome'],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};

View File

@ -1,28 +1,38 @@
{
"name": "xo-web",
"name": "xoweb",
"version": "0.0.0",
"description": "Web interface for Xen-Orchestra.",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/vatesfr/xo-web"
},
"author": "Julien Fontanet <julien.fontanet@vates.fr>",
"license": "AGPLv3",
"dependencies": {
"bower": "~1.2.7",
"gifsicle": "~0.1.3"
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9",
"grunt-autoprefixer": "~0.4.0",
"grunt-concurrent": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-coffee": "~0.7.0",
"grunt-contrib-compass": "~0.6.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-imagemin": "~0.3.0",
"grunt-contrib-jshint": "~0.7.1",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "~0.5.2",
"grunt-google-cdn": "~0.2.0",
"grunt-ngmin": "~0.0.2",
"grunt-rev": "~0.1.0",
"grunt-svgmin": "~0.2.0",
"grunt-usemin": "~2.0.0",
"jshint-stylish": "~0.1.3",
"load-grunt-tasks": "~0.2.0",
"time-grunt": "~0.1.1"
"time-grunt": "~0.2.0"
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "grunt test"
}
}

35
test/.jshintrc Normal file
View File

@ -0,0 +1,35 @@
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"after": false,
"afterEach": false,
"angular": false,
"before": false,
"beforeEach": false,
"browser": false,
"describe": false,
"expect": false,
"inject": false,
"it": false,
"spyOn": false
}
}

10
test/runner.html Normal file
View File

@ -0,0 +1,10 @@
<!doctype html>
<html lang="en">
<head>
<title>End2end Test Runner</title>
<script src="vendor/angular-scenario.js" ng-autotest></script>
<script src="scenarios.js"></script>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,19 @@
'use strict'
describe 'Controller: MainCtrl', () ->
# load the controller's module
beforeEach module 'xoWebApp'
MainCtrl = {}
scope = {}
# Initialize the controller and a mock scope
beforeEach inject ($controller, $rootScope) ->
scope = $rootScope.$new()
MainCtrl = $controller 'MainCtrl', {
$scope: scope
}
it 'should attach a list of awesomeThings to the scope', () ->
expect(scope.awesomeThings.length).toBe 3

View File

@ -0,0 +1,19 @@
'use strict'
describe 'Controller: NavBarCtrl', () ->
# load the controller's module
beforeEach module 'xoWebApp'
NavBarCtrl = {}
scope = {}
# Initialize the controller and a mock scope
beforeEach inject ($controller, $rootScope) ->
scope = $rootScope.$new()
NavBarCtrl = $controller 'NavBarCtrl', {
$scope: scope
}
it 'should attach a list of awesomeThings to the scope', () ->
expect(scope.awesomeThings.length).toBe 3