Compare commits

..

57 commits

Author SHA1 Message Date
matthewalanpenning
31f878a586 v3.8.0 2023-08-31 05:02:29 -04:00
matthewalanpenning
2c2acd2c4c v3.7.0 2023-03-20 05:12:22 -04:00
Matthew Penning
74b2a1ab3f
Merge pull request #61 from danieldean/master
Close exec websockets on exit.
2023-01-07 13:04:43 -05:00
Daniel Dean
dfffdb7efe Close exec websockets on exit. 2022-12-24 18:26:19 +00:00
matthewalanpenning
7dd0561e41 v3.6.0 2022-12-09 10:17:03 -05:00
Matthew Penning
031554e100
Merge pull request #44 from fthorns/master
Cloud-init support for LXC containers
2022-12-09 09:59:37 -05:00
matthewalanpenning
c538f09a3a v3.5.0 2022-10-23 22:35:53 -04:00
matthewalanpenning
229a085075 v3.5.0 2022-10-23 22:33:34 -04:00
Matthew Penning
9f7c3f6e46
Merge pull request #42 from kay0u/master
Fix some MySQL queries
2022-10-22 11:48:26 -04:00
Fabian Thorns
426b3eb451 Cloud-init support for LXC containers 2022-08-22 11:15:35 +02:00
Kay0u
58d60ae1a6
fix MySQL date 2022-06-20 13:16:59 +02:00
Kay0u
6d38fe8da9
fix MySQL AUTO_INCREMENT 2022-06-20 13:16:34 +02:00
matthewalanpenning
bf5a33664a v3.4.0 2022-04-03 17:00:40 -04:00
matthewalanpenning
db310f6afd v3.3.0 2022-03-31 20:24:40 -04:00
matthewalanpenning
28730dbea1 v3.3.0 2022-03-31 20:22:18 -04:00
matthewalanpenning
fbff359d99 v3.2.0 2022-03-21 05:30:46 -04:00
matthewalanpenning
426f632ba5 v3.1.0 2021-12-17 14:34:39 -05:00
matthewalanpenning
2f4e458d44 v3.1.0 2021-12-17 14:22:03 -05:00
matthewalanpenning
22732a6504 v3.0.0 2021-11-30 21:23:20 -05:00
matthewalanpenning
b782fbb2cb v3.0.0 2021-11-30 21:20:27 -05:00
matthewalanpenning
2c40dd5743 v2.3.0 2021-09-24 15:45:54 -04:00
matthewalanpenning
84c2246c22 v2.2.0 2021-09-05 08:43:12 -04:00
matthewalanpenning
3489a20e46 v2.1.0 2021-07-31 15:44:58 -04:00
matthewalanpenning
471a830153 v2.0.3 2021-05-25 22:30:12 -04:00
matthewalanpenning
82b6a31495 v2.0.2 2021-05-18 21:04:22 -04:00
matthewalanpenning
8e5c256f00 v2.0.1 2021-05-17 19:28:51 -04:00
matthewalanpenning
6272ce7a55 v2.0.0 2021-05-14 15:01:34 -04:00
matthewalanpenning
c55eaefd38 v2.0.0 2021-05-14 14:50:10 -04:00
matthewalanpenning
3ae6f4c6fb v1.2.8 2021-03-09 19:49:18 -05:00
matthewalanpenning
6a1a9e550c v1.2.7 2021-03-03 20:53:48 -05:00
matthewalanpenning
ae6f846085 v1.2.6 2021-03-01 20:47:25 -05:00
matthewalanpenning
9cdbc2aac8 v1.2.5 2021-02-18 22:14:11 -05:00
matthewalanpenning
c9b59fa68e v1.2.4 2021-02-08 17:02:54 -05:00
Matthew Penning
fc3433fb70
Merge pull request #1 from coocn-cn/master
Repair the operations obtained after switching the project is still the default project
2021-02-08 06:30:00 -05:00
Your Name
f9073b99e2 fixbug: repair the operations obtained after switching the project is still the default project 2021-02-08 10:19:59 +00:00
matthewalanpenning
b1fda33e18 v1.2.3 2021-02-07 15:20:45 -05:00
matthewalanpenning
0b5a58f331 v1.2.2 2021-02-04 19:16:54 -05:00
matthewalanpenning
a0eaaccfc6 v1.2.1 2021-02-02 21:09:35 -05:00
matthewalanpenning
a58de52501 v1.2.0 2021-01-31 16:49:06 -05:00
matthewalanpenning
7d6e73dba3 v1.1.9 2021-01-30 14:05:33 -05:00
matthewalanpenning
8c089d4dc9 v1.1.8 2021-01-24 22:29:22 -05:00
matthewalanpenning
39b9c44d46 v1.1.7 2021-01-21 06:16:37 -05:00
matthewalanpenning
f0836a537d v1.1.6 2021-01-19 20:22:19 -05:00
matthewalanpenning
893225a6e2 v1.1.5 2021-01-17 17:52:57 -05:00
matthewalanpenning
4fccbe96de v1.1.4 2021-01-16 16:05:15 -05:00
matthewalanpenning
395a5f96de v1.1.3 2021-01-16 15:02:33 -05:00
matthewalanpenning
ee0e3c69da v1.1.2 2020-10-22 12:04:59 -04:00
matthewalanpenning
d477f951ba v1.1.1 2020-10-19 12:31:17 -04:00
matthewalanpenning
6734caf945 v1.1.0 2020-10-14 12:17:51 -04:00
matthewalanpenning
2f36c7cf22 v1.0.9 2020-09-15 07:33:23 -04:00
matthewalanpenning
fcbf9590f8 v1.0.8 2020-09-04 13:02:46 -04:00
matthewalanpenning
6904e50326 v1.0.7 2020-09-02 21:42:57 -04:00
matthewalanpenning
ecba3a4bc8 v1.0.6 2020-08-28 13:55:57 -04:00
matthewalanpenning
620cf9fde3 v1.0.6 2020-08-28 13:44:20 -04:00
matthewalanpenning
86cb3c0b35 v1.0.5 2020-08-27 12:10:17 -04:00
matthewalanpenning
f1c00d3271 v1.0.4 2020-08-26 12:28:13 -04:00
matthewalanpenning
f8d03b06e4 v1.0.3 2020-08-25 17:04:07 -04:00
3751 changed files with 172087 additions and 143321 deletions

50
CHANGELOG.md Normal file
View file

@ -0,0 +1,50 @@
# v3.8.0
- Added a check for a null config in storage pools
- Added image token cleanup with downloading images while in a cluster
# v3.7.0
- Set console/exec terminal height to 25 rows because xterm.js defaults to 24 and lxd defaults to 25 there was a single row mismatch
- Added qemu.conf to virtual machine configuration options
- Changed cloud-init user data to use POST method rather than GET
- Merged pull request improving websocket close on exec/console websockets
- Added check for empty storage pool source configuration array item
# v3.6.0
- Merged pull request adding cloud init user data option for new containers via form
- Fixed typo preventing OS version number from showing in remotes-single.php page, under LXD Information
# v3.5.0
- Updated container image catalog based on results from from https://us.lxd.images
- Merged pull request updating MySQL statements for auto increment and now time
# v3.4.0
- Added additional delete option for powered-off instances on the containers and virtual machines pages
- Fixed bug in populating both profile and cluster member options in drop-down box for virtual machine configurations
- Added verification for numeric values in instance memory gauge display
# v3.3.0
- Updated PDO try-catch exception for PHP 8
- Created recursive PHP in_array for SQLite Pragma array search in PHP 8
- Improved handling of external port for remotes
- Fixed bug with scope of curl variables
# v3.2.0
- added removal confirmation of remote hosts
- added preference choices for logging and logs page
- added preferences for custom page refresh rates
- added preferences for custom API connection and operation timeout
- improved CPU gauge, changing from top to /proc/stat readings
- improved handling connection to unresponsive remote hosts
- fixed bug with adding hosts due to data type
# v3.1.0
- improved performance of page loads
- updated instance backups to include a filesize of exported files
- updated exporting backup image to using a script to spawn it off into a background process
- updated remote host table header
- updated link to display all volume types on storage volumes page
- reduced curl connection timeout
# v3.0.0
- initial release of the LXDWARE LXD dashboard version 3.0.0

View file

@ -1,44 +1,30 @@
FROM ubuntu:20.04
#Setting ENV variables, ADMIN_PASS can/should be overridden when running container
#Setting ENV variables
ENV DEBIAN_FRONTEND=noninteractive
ENV ADMIN_PASS=lxdware
#Update and Upgrade repository
RUN apt-get update
RUN apt-get upgrade -y
#Install Curl for API calls
RUN apt-get install curl -y
#Install sudo to be able to run lxc commands as www-data without password
RUN apt-get install sudo -y
#Install web server requirements
RUN apt-get install apache2-utils -y
RUN apt-get install nginx -y
RUN apt-get install php-fpm -y
RUN apt-get install php-curl -y
#Install database requirements
RUN apt-get install sqlite3 -y
RUN apt-get install php-sqlite3 -y
#LXD Setup. Copy compiled lxc binary from source code, version 4.02
RUN apt-get install libc6 -y
COPY lxc /usr/bin/
RUN apt-get install php-mysql -y
#Open up port 80 for web traffic
EXPOSE 80
#Set the no password option for running lxc commands
RUN echo "www-data ALL=(ALL) NOPASSWD: /usr/bin/lxc, /usr/bin/curl" >> /etc/sudoers
#Setup web directory and files
COPY default /etc/nginx/sites-available/
COPY index.html /var/www/html/
RUN mkdir -p /var/www/html/admin
ADD admin /var/www/html/admin
RUN chown -R www-data:www-data /var/www/html/
RUN mkdir -p /var/www/html/lxd-dashboard
ADD lxd-dashboard /var/www/html/lxd-dashboard
RUN chown -R www-data:www-data /var/www/html/lxd-dashboard
RUN service nginx restart
#Copy and run the startup script

141
LICENSE
View file

@ -1,5 +1,5 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
@ -7,17 +7,15 @@
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
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,
the GNU General Public License is intended to guarantee your freedom to
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. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
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
@ -26,44 +24,34 @@ 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.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
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.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
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.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
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.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
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.
@ -72,7 +60,7 @@ modification follow.
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"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.
@ -549,35 +537,45 @@ 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. Use with the GNU Affero General Public License.
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 Affero General Public License into a single
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 special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
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 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
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 General
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 General Public License, you may choose any version ever published
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 General Public License can be used, that proxy's
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.
@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
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 General Public License as published by
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 General Public License for more details.
GNU Affero General Public License for more details.
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
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 GPL, see
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View file

@ -1,19 +1,22 @@
# dashboard
This LXD dashboard by LXDWARE is a full-featured web interface that makes it easy to manage the containers and virtual machines on your LXD servers. Some of the features include:
# lxd-dashboard
This open source LXD dashboard is developed by LXDWARE and provides a web-based user interface capable of managing multiple LXD servers from a single location. Some of the features include:
- Creating/launching new LXD container and virtual machine instances
- Starting, stopping, renaming, and deleting LXD instances
- Cloning/Copying instances
- Creating, restoring and deleting snapshots of instances
- Downloading LXD container and virtual machine images to your host
- Creating, editing, and applying LXD profiles
- Creating and editing networks, storage pools, and projects
- Selecting between projects on a host
- Connect and manage multiple LXD servers
- Create LXD container and virtual machine instances from either a form or JSON input
- Start, stop, rename, and delete LXD instances
- Copy instances to create new instances
- Create, restore and delete snapshots of instances
- Create instances from snaphots
- Migrate instances between hosts on an LXD cluster
- Download LXD container and virtual machine images to LXD hosts
- Create, edit, apply, and remove LXD profiles
- Create, edit, and delete networks, storage pools, storage volumes, and projects
- Switch between projects on an LXD host
- Interact with instances using web-based terminal
- Create and download backups of LXD instance to your local computer
- Create local users and groups
- Apply role based access control
This project is an HTML5 web based dashboard used to control the LXD/LXC containers of remote servers. The software runs within a Docker container and is built using Ubuntu, NGINX, and PHP.
The LXD dashboard can be deployed on either an LXC or Docker container. The software is built primarily using Ubuntu, NGINX, and PHP.
To get started using this web dashboard first install docker on your computer. Then for a persistent container run:
docker run -d --name dashboard -p 80:80 -e ADMIN_PASS="lxdware" -v ~/lxdware/data:/var/lxdware/data lxdware/dashboard
For more information visit https://lxdware.com or view the docker information at https://hub.docker.com/r/lxdware/dashboard
Installation instructions can be found on the LXDWARE web site located at https://lxdware.com/installation

View file

@ -1,378 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="certificatesBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Certificate List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Certificates</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addCertificateModal">Add Certificate</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="certificateListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Certificate List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Add Certificate Modal-->
<div class="modal fade" id="addCertificateModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add Certificate</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonCreateInput" rows="16" placeholder="Enter JSON data"></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="addCertificate()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- View Certificate Modal-->
<div class="modal fade" id="viewCertificateModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">View Certificate</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label" id="certificateNameEditInput"></label>
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonEditInput" rows="16" ></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadCertificateTable = true;
var operationNumber = "";
var certificateToUpdate = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404 || operationData.status_code == 200){
operationNumber = "";
$('#spinner').hide();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadCertificateTable == false){
$('#certificateListTable').DataTable().ajax.reload();
}
if (loadCertificateTable == true){
$('#certificateListTable').DataTable( {
ajax: "./php/lxd/certificate-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Name" },
{ title: "Type" },
{ title: "Fingerprint" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadCertificateTable = false;
}
}
//API uses sync
function addCertificate(){
var certificateCreateJSON = $("#jsonCreateInput").val();
console.log("Info: adding certificate");
$.post("./php/lxd/certificates.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=addCertificate", {json: certificateCreateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//Called by Edit action, loads JSON data of project
function loadCertificateJson(certificateToLoad){
console.log("Info: loading certificate " + certificateToLoad);
certificateToUpdate = certificateToLoad;
$.get("./php/lxd/certificates.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&certificate=" + encodeURI(certificateToLoad) + "&action=loadCertificate", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
$("#certificateNameEditInput").text("Fingerprint: " + certificateToLoad);
$("#jsonEditInput").val(JSON.stringify(operationData.metadata, null, 2));
$("#viewCertificateModal").modal('show');
});
}
function updateCertificate(){
var certificateUpdateJSON = $("#jsonEditInput").val();
console.log("Info: updating certificate " + certificateToUpdate);
$.post("./php/lxd/certificates.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&certificate=" + encodeURI(certificateToUpdate) + "&action=updateCertificate", {json: certificateUpdateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function deleteCertificate(certificateToDelete){
console.log("Info: deleting certificate " + certificateToDelete);
$.get("./php/lxd/certificates.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&certificate=" + encodeURI(certificateToDelete) + "&action=deleteCertificate", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#certificatesBreadCrumb').text("certificates");
//Load the card contents
loadPageContent();
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,278 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="clusterMembersBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Cluster Members List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Cluster Members</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="clusterMemberListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Cluster Members List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadClusterMemberTable = true;
var operationNumber = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404 || operationData.status_code == 200){
operationNumber = "";
$('#spinner').hide();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadClusterMemberTable == false){
$('#clusterMemberListTable').DataTable().ajax.reload();
}
if (loadClusterMemberTable == true){
$('#clusterMemberListTable').DataTable( {
ajax: "./php/lxd/cluster-member-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Server Name" },
{ title: "URL" },
{ title: "Database" },
{ title: "Status" },
{ title: "Message" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadClusterMemberTable = false;
}
}
//API uses sync
function deleteClusterMember(memberToDelete){
console.log("Info: deleting cluster member " + memberToDelete);
$.get("./php/lxd/cluster.php?remote=" + encodeURI(remoteName) + "&name=" + encodeURI(memberToDelete) + "&action=deleteClusterMember", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#clusterMembersBreadCrumb').text("cluster members");
//Load the card contents
loadPageContent();
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,200 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item active" aria-current="page" id="remoteBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- LXD Host Details -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">LXD Host Details</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div id="hostCard">
</div>
</div>
</div>
<!-- End LXD Host Details -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/chart.js/Chart.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
$(document).ready(function(){
$("#sidebarLinks").load("./sidebar.html");
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$("#hostCard").load("./php/lxd/host-single.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,438 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="imagesBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Image List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Images</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#downloadImageModal">Download Image</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="imageListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Image List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Download Image Modal-->
<div class="modal fade" id="downloadImageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Download Image</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-3 col-form-label text-right">Image/Alias: </label>
<div class="col-8">
<div class="form-group">
<input type="text" class="form-control" id="imageNameInput" required="required" placeholder="" name="image">
</div>
</div>
<label class="col-3 col-form-label text-right">Repository:</label>
<div class="col-8 text-right">
<div class="form-group">
<select id="selectRepoInput" class="form-control" name="repo">
</select>
</div>
</div>
<label class="col-3 col-form-label text-right">Image Type:</label>
<div class="col-8 text-right">
<div class="form-group">
<select id="selectTypeInput" class="form-control" name="image_type">
<option value="container" selected>container</option>
<option value="virtual-machine">virtual-machine</option>
</select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="downloadImage()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Edit Image Modal-->
<div class="modal fade" id="editImageModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Image</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label" id="imageNameEditInput"></label>
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonEditInput" rows="16" ></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="updateImage()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadImageTable = true;
var selectList = "";
var operationNumber = "";
var imageToUpdate = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404){ //remains status code 200 throughout download
operationNumber = "";
$('#spinner').hide();
} else {
if (operationData.status_code == 200){
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadImageTable == false){
$('#imageListTable').DataTable().ajax.reload();
}
if (loadImageTable == true){
$('#imageListTable').DataTable( {
ajax: "./php/lxd/image-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Description" },
{ title: "Fingerprint" },
{ title: "Type" },
{ title: "Size" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadImageTable = false;
}
//Load the select List for Download Image Modal
$.get("./php/lxd/simplestreams-list-select.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
if (selectList != data){
$("#selectRepoInput").html(data);
selectList = data;
}
});
}
//API uses async
function refreshImage(imageFingerprint){
console.log("Info: refreshing image " + imageFingerprint);
$.get("./php/lxd/images.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&fingerprint=" + encodeURI(imageFingerprint) + "&action=refreshImage", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
loadPageContent();
});
}
//API uses async
function deleteImage(imageFingerprint){
console.log("Info: deleting image " + imageFingerprint);
$.get("./php/lxd/images.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&fingerprint=" + encodeURI(imageFingerprint) + "&action=deleteImage", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
loadPageContent();
});
}
//API uses async
function downloadImage(){
var imageName = $("#imageNameInput").val();
var repoName = $("#selectRepoInput").val();
var imageType = $("#selectTypeInput").val();
console.log("Info: downloading image " + imageName + " from " + repoName);
$.get("./php/lxd/images.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&image=" + encodeURI(imageName) + "&repo=" + encodeURI(repoName) + "&image_type=" + encodeURI(imageType) + "&action=downloadImage", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
loadPageContent();
});
}
//Called by Edit action, loads JSON data of project
function loadImageJson(imageToLoad){
console.log("Info: loading iname " + imageToLoad);
imageToUpdate = imageToLoad;
$.get("./php/lxd/images.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&fingerprint=" + encodeURI(imageToLoad) + "&action=loadImage", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
$("#imageNameEditInput").text("Name: " + imageToLoad);
$("#jsonEditInput").val(JSON.stringify(operationData.metadata, null, 2));
$("#editImageModal").modal('show');
});
}
function updateImage(){
var imageUpdateJSON = $("#jsonEditInput").val();
console.log("Info: updating image " + imageToUpdate);
$.post("./php/lxd/images.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&fingerprint=" + encodeURI(imageToUpdate) + "&action=updateImage", {json: imageUpdateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#imagesBreadCrumb').text("images");
//Load the card contents
loadPageContent();
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,369 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<!-- Sidebar - Brand -->
<a class="sidebar-brand d-flex align-items-center justify-content-center" href="index.html">
<div class="sidebar-brand-icon rotate-n-0">
<!--<img src="theme/images/logo-white.png" style="width: 2rem;"></img>-->
<i class="fas fa-cube" style="width: 2rem;"></i>
</div>
<div class="sidebar-brand-text mx-3"><span style="color: #e95420;">LXD</span>WARE</div>
</a>
<!-- Divider -->
<hr class="sidebar-divider">
<!-- Nav Item - Dashboard -->
<li class="nav-item">
<a class="nav-link" href="index.html">
<i class="fas fa-fw fa-server"></i>
<span>Hosts</span></a>
</li>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#" data-toggle="modal" data-target="#clientCertModal">
<span class="mr-2 d-none d-lg-inline small text-primary">
Client Certificate
</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" data-toggle="modal" data-target="#addLxdModal">
<span class="mr-2 d-none d-lg-inline small text-primary">
Add Remote Host
</span>
</a>
</li>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Remote Host Configuration</h1>
</div>
<div class="row">
<div class="col-12">
<!-- LXD Host List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">LXD Remote Hosts</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#clientCertModal">Client Certificate</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addLxdModal">Add Remote Host</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="row">
<div class="col-8">
<div class="table-responsive">
<table class="table" id="lxdListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
<div class="col-4">
<p>Before adding a remote host, first
copy the client <a href="#" data-toggle="modal" data-target="#clientCertModal">certificate</a>
information and paste it into a new file on your remote server such as <strong><em>lxdware.crt</em></strong>.
Then import the certificate on your remote LXD server by running the command: <code>lxc config trust add lxdware.crt</code>.</p>
<p>The remote server must also be listening for remote connections. If this was not setup during the initial setup,
use <code>lxc config set core.https_address [::]</code> on the remote server to allow connections.</p>
</div>
</div>
</div>
</div>
<!-- End LXD Host List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Client Cert Modal-->
<div class="modal fade" id="clientCertModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">LXD Client Cert</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<pre><div id="clientCert"></div></pre>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Dismiss</button>
</div>
</div>
</div>
</div>
<!-- Remote Host Modal-->
<div class="modal fade" id="addLxdModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add LXD Remote Host</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-3 col-form-label text-right">Address: </label>
<div class="col-7">
<div class="form-group">
<input type="text" class="form-control" id="hostInput" required="required" placeholder="IP address or FQDN of LXD server" name="host">
</div>
</div>
</div>
<div class="row">
<label class="col-3 col-form-label text-right">Port: </label>
<div class="col-7">
<div class="form-group">
<input type="text" class="form-control" id="portInput" required="required" placeholder="8443" value="8443" name="port">
</div>
</div>
</div>
<div class="row">
<label class="col-3 col-form-label text-right">Alias: </label>
<div class="col-7">
<div class="form-group">
<input type="text" class="form-control" id="aliasInput" placeholder="Enter name of server" name="alias">
</div>
</div>
</div>
</div> <!-- End Modal Body-->
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="addRemote()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- Delete Remote Host Modal-->
<div class="modal fade" id="removeRemote" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Remove Remote Host</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">Are you sure you want to remove this host?</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="removeRemote()" data-dismiss="modal">Yes</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
</body>
<script>
var remoteList = "";
var clientCert = "";
function loadPageContent(){
//Load the basic info for the remote card if changed
$.get("./php/lxd/remote-list.php", function (data) {
if (remoteList != data){
$("#lxdListTable").html(data);
remoteList = data;
}
});
//Load the basic info for the certificate if changed
$.get("./php/lxd/lxc-cert.php", function (data) {
if (clientCert != data){
$("#clientCert").html(data);
clientCert = data;
}
});
}
function addRemote(){
var hostName = $("#hostInput").val();
var portNumber = $("#portInput").val();
var aliasName = $("#aliasInput").val();
console.log("Info: adding remote host " + hostName + ":" + portNumber);
$.get("./php/lxd/remotes.php?host=" + encodeURI(hostName) + "&port=" + encodeURI(portNumber) + "&alias=" + encodeURI(aliasName) + "&action=addRemote", function (data) {
console.log(data);
loadPageContent();
});
}
function removeRemote(remoteID){
console.log("Info: removing remote host, id number " + remoteID);
$.get("./php/lxd/remotes.php?id=" + encodeURI(remoteID) + "&action=removeRemote", function (data) {
console.log(data);
loadPageContent();
});
}
$(document).ready(function(){
//Load the host list quickly first, offline hosts slow the page load
$.get("./php/lxd/remote-list.php?action=quickLoad", function (data) {
if (remoteList != data){
$("#lxdListTable").html(data);
remoteList = data;
}
});
//Load the card contents
loadPageContent();
//Set page reload every 10 seconds
setInterval(function(){loadPageContent()}, 10000);
});
</script>
</html>

View file

@ -1,817 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item"><a href="#" id="instancesBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="instanceBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Instance Details -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Details</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" onclick="startInstance()" id="startInstanceOption">Start</a>
<a class="dropdown-item" href="#" onclick="stopInstance()" id="stopInstanceOption">Stop</a>
<a class="dropdown-item" href="#" onclick="restartInstance()" id="restartInstanceOption">Restart</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameInstanceModal" id="renameInstanceOption">Rename</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#copyInstanceModal" id="copyInstanceOption">Copy</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#publishInstanceModal" id="publishInstanceOption">Publish</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#deleteInstanceModal" id="deleteInstanceOption">Delete</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div id="instanceInfo"></div>
</div>
</div>
<!-- End Instance Details -->
</div>
<div class="col-12">
<!-- Snapshot List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Snapshots</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#snapshotInstanceModal">Create Snapshot</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="snapshotTableList" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Snapshot List -->
</div>
<div class="col-12">
<!-- Network Devices List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Network Devices</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="networkDeviceTableList" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Network Devices ist -->
</div>
<div class="col-12">
<!-- Disk Device List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Disk Devices</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="diskDeviceTableList" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Disk Device ist -->
</div>
<div class="col-12">
<!-- Proxy Device List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Proxy Devices</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="proxyDeviceTableList" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Proxy Device ist -->
</div>
<div class="col-12">
<!-- Profile List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Profiles</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#attachProfileModal">Attach Profile</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="profileTableList" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Profile List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- New Snapshot Modal-->
<div class="modal fade" id="snapshotInstanceModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Create Snapshot</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label text-right">Name: </label>
<div class="col-8">
<div class="form-group">
<input type="text" id="snapshotName" class="form-control" placeholder="Snapshot Name" name="snapshot">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="snapshotInstance()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Rename Instance Modal-->
<div class="modal fade" id="renameInstanceModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Rename Instance</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label text-right">Name:</label>
<div class="col-8">
<div class="form-group">
<input type="text" id="newInstanceName" class="form-control" placeholder="Instance name">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="renameInstance()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Copy Instance Modal-->
<div class="modal fade" id="copyInstanceModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Copy Instance</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label text-right">Name:</label>
<div class="col-8">
<div class="form-group">
<input type="text" id="copyName" class="form-control" placeholder="Instance name" name="copy">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="copyInstance()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Delete Instance Modal-->
<div class="modal fade" id="deleteInstanceModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Delete Instance</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">Are you sure you want to delete this instance?</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="deleteInstance()" data-dismiss="modal">Yes</a>
</div>
</div>
</div>
</div>
<!-- Attach Profile Modal-->
<div class="modal fade" id="attachProfileModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Attach Profile</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-2 col-form-label text-right">Profile:</label>
<div class="col-9">
<div class="form-group">
<select id="selectProfileInput" class="form-control" name="profile">
</select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="attachProfile()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Publish Instance Modal-->
<div class="modal fade" id="publishInstanceModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Publish Instance</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-3 col-form-label text-right">Description: </label>
<div class="col-9">
<div class="form-group">
<input type="text" id="publishInstanceDescriptionInput" class="form-control" placeholder="Enter Description" name="description">
</div>
</div>
</div>
<div class="row">
<label class="col-3 col-form-label text-right">Public:</label>
<div class="col-9">
<div class="form-group">
<select id="publishInstancePublicInput" class="form-control" name="public">
<option value="false" selected>false</option>
<option value="true">true</option>
</select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="publishInstance()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const instanceName = urlParams.get('instance');
const projectName = urlParams.get('project');
var operationNumber = "";
var instanceDetails = "";
var snapshotDetails = "";
var networkDeviceDetails = "";
var diskDeviceDetails = "";
var proxyDeviceDetails = "";
var profileDetails = "";
var redirectURL = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404 || operationData.status_code == 200){
operationNumber = "";
$('#spinner').hide();
if (redirectURL != ""){
window.location.replace(redirectURL);
}
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
function displayMenuOptions(data){
jsonData = JSON.parse(data);
if (jsonData.metadata.status == "Stopped"){
$('#startInstanceOption').show();
$('#stopInstanceOption').hide();
$('#restartInstanceOption').hide();
$('#renameInstanceOption').show();
$('#copyInstanceOption').show();
$('#publishInstanceOption').show();
$('#deleteInstanceOption').show();
}
else {
$('#startInstanceOption').hide();
$('#stopInstanceOption').show();
$('#restartInstanceOption').show();
$('#renameInstanceOption').hide();
$('#copyInstanceOption').hide();
$('#publishInstanceOption').hide();
$('#deleteInstanceOption').hide();
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
//Display instance menu options based on state
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&action=status", displayMenuOptions)
//Load the basic info for the instance card if changed
$.get("./php/lxd/instance-single.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
if (instanceDetails != data){
$("#instanceInfo").html(data);
instanceDetails = data;
}
});
//Load the snapshot info for the snapshot card if changed
$.get("./php/lxd/instance-single-snapshot-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
if (snapshotDetails != data){
$("#snapshotTableList").html(data);
snapshotDetails = data;
}
});
//Load the network info for the network interfaces card if changed
$.get("./php/lxd/instance-single-network-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
if (networkDeviceDetails != data){
$("#networkDeviceTableList").html(data);
networkDeviceDetails = data;
}
});
//Load the disk info for the disk devices card if changed
$.get("./php/lxd/instance-single-disk-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
if (diskDeviceDetails != data){
$("#diskDeviceTableList").html(data);
diskDeviceDetails = data;
}
});
//Load the proxy info for the proxy devices card if changed
$.get("./php/lxd/instance-single-proxy-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
if (proxyDeviceDetails != data){
$("#proxyDeviceTableList").html(data);
proxyDeviceDetails = data;
}
});
//Load the profile info for the profile card if changed
$.get("./php/lxd/instance-single-profile-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
if (profileDetails != data){
$("#profileTableList").html(data);
profileDetails = data;
}
});
}
function startInstance(){
console.log("Info: starting instance " + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&action=startInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
});
}
function stopInstance(){
console.log("Info: stoping instance" + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&action=stopInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
});
}
function restartInstance(){
console.log("Info: restarting instance" + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&action=restartInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
});
}
function snapshotInstance(){
var snapshotName = $("#snapshotName").val();
console.log("Info: creating snapshot " + snapshotName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&name=" + encodeURI(snapshotName) + "&action=snapshotInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
});
}
function renameInstance(){
var newInstanceName = $("#newInstanceName").val();
console.log("Info: renaming instance " + instanceName + " to " + newInstanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&name=" + encodeURI(newInstanceName) + "&action=renameInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
redirectURL = "instance.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(newInstanceName);
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
});
}
function copyInstance(){
var copyName = $("#copyName").val();
console.log("Info: copying instance " + instanceName + " to " + copyName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&name=" + encodeURI(copyName) + "&action=copyInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
});
}
function deleteInstance(){
console.log("Info: deleting instance " + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&action=deleteInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
redirectURL = "instances.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName)
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err)
}
});
}
function attachProfile(){
var profileName = $("#selectProfileInput").val();
console.log("Info: attaching profile " + profileName + " to instance " + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&name=" + encodeURI(profileName) + "&action=attachProfile", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
});
}
function detachProfile(profileName){
console.log("Info: detaching profile " + profileName + " from instance " + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&name=" + encodeURI(profileName) + "&action=detachProfile", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
});
}
function restoreSnapshot(snapshotName){
console.log("Info: restoring snapshot " + snapshotName + " to instance " + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&name=" + encodeURI(snapshotName) + "&action=restoreSnapshot", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.error_code >= 400){
alert(operationData.error);
}
});
}
function deleteSnapshot(snapshotName){
console.log("Info: deleting snapshot " + snapshotName + " from instance " + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&name=" + encodeURI(snapshotName) + "&action=deleteSnapshot", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.error_code >= 400){
alert(operationData.error);
}
});
}
function publishInstance(){
var description = $("#publishInstanceDescriptionInput").val();
var publicDownload = $("#publishInstancePublicInput").val();
console.log("Info: publishing instance " + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&description=" + encodeURI(description) + "&public=" + encodeURI(publicDownload) + "&action=publishInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#instancesBreadCrumb').text("instances");
$('#instancesBreadCrumb').attr("href", "instances.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#instanceBreadCrumb').text(instanceName);
//Load the card contents
loadPageContent();
//Populate the select options fields used in modals
//$("#selectRemoteInput").load("./php/lxd/remote-list-select.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#selectProfileInput").load("./php/lxd/profile-list-select.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,388 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="instancesBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Instance List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Instances</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#launchInstanceModal">Launch Instance</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="instanceListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Instance List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Launch Instance Modal-->
<div class="modal fade" id="launchInstanceModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Launch New Instance</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-2 col-form-label text-right">Name: </label>
<div class="col-9">
<div class="form-group">
<input type="text" id="instanceNameInput" class="form-control" required="required" placeholder="Enter name of instance" name="name">
</div>
</div>
</div>
<div class="row">
<label class="col-2 col-form-label text-right">Type:</label>
<div class="col-9 text-right">
<div class="form-group">
<select id="selectTypeInput" onchange="changeImageInput()" class="form-control" name="instance_type">
<option value="container" selected>container</option>
<option value="virtual-machine">virtual-machine</option>
</select>
</div>
</div>
</div>
<div class="row">
<label class="col-2 col-form-label text-right">Image: </label>
<div class="col-9">
<div class="form-group">
<select id="selectImageInput" class="form-control" name="fingerprint">
</select>
</div>
</div>
</div>
<div class="row">
<label class="col-2 col-form-label text-right">Profile: </label>
<div class="col-9">
<div class="form-group">
<select id="selectProfileInput" class="form-control" name="profile">
</select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="createInstance()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadInstanceTable = true;
var operationNumber = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404){
operationNumber = "";
$('#spinner').hide();
} else {
if (operationData.status_code == 200){
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
}
}
function loadPageContent(){
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadInstanceTable == false){
$('#instanceListTable').DataTable().ajax.reload();
}
if (loadInstanceTable == true){
$('#instanceListTable').DataTable( {
ajax: "./php/lxd/instance-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Name" },
{ title: "Image" },
{ title: "Type" },
{ title: "Architecture" },
{ title: "Status" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadInstanceTable = false;
}
}
function createInstance(){
var instanceName = $("#instanceNameInput").val();
var profileName = $("#selectProfileInput").val();
var fingerprint = $("#selectImageInput").val();
var instanceType = $("#selectTypeInput").val();
console.log("Info: creating instance " + instanceName + " with profile " + profileName + " and fingerprint " + fingerprint);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&name=" + encodeURI(instanceName) + "&profile=" + encodeURI(profileName) + "&fingerprint=" + encodeURI(fingerprint)+ "&instance_type=" + encodeURI(instanceType) + "&action=createInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
if (operationData.error_code >= 400){
alert(operationData.error);
}
});
}
function startInstance(instanceName){
console.log("Info: starting instance " + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&action=startInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
});
}
function stopInstance(instanceName){
console.log("Info: stoping instance " + instanceName);
$.get("./php/lxd/instances.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&action=stopInstance", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.status_code == 100 && operationData.metadata.status_code < 400){
$('#spinner').show();
operationNumber = operationData.metadata.id;
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
});
}
function changeImageInput(){
var imageType = $("#selectTypeInput").val();
$("#selectImageInput").load("./php/lxd/image-list-select.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName)+ "&image_type=" + encodeURI(imageType));
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#instancesBreadCrumb').text("instances");
//Load the card contents
loadPageContent();
//Populate the select options fields used in modals
//$("#selectImageInput").load("./php/lxd/image-list-select.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
changeImageInput();
$("#selectProfileInput").load("./php/lxd/profile-list-select.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,472 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="networksBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Network List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Networks</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#createNetworkModal">Create Network</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="networkListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Network List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Create Network Modal-->
<div class="modal fade" id="createNetworkModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Create Network</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="form-tab" data-toggle="tab" href="#form" role="tab" aria-controls="form" aria-selected="true">Form</a>
</li>
<li class="nav-item">
<a class="nav-link" id="json-tab" data-toggle="tab" href="#json" role="tab" aria-controls="json" aria-selected="false">JSON</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="form" role="tabpanel" aria-labelledby="form-tab">
<br />
<div class="row">
<label class="col-3 col-form-label text-right">Name: </label>
<div class="col-7">
<div class="form-group">
<input type="text" id="networkNameCreate" class="form-control" placeholder="Network Name" name="network_name">
</div>
</div>
</div>
<div class="row">
<label class="col-3 col-form-label text-right">Description: </label>
<div class="col-7">
<div class="form-group">
<input type="text" id="networkDescriptionCreate" class="form-control" placeholder="Enter Description" name="network_description">
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="createNetworkForm()" data-dismiss="modal">Submit</a>
</div>
</div>
<div class="tab-pane fade" id="json" role="tabpanel" aria-labelledby="json-tab">
<br />
<div class="row">
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonCreateInput" rows="16" placeholder="Enter JSON data"></textarea>
</pre>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="createNetworkJson()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Edit Network Modal-->
<div class="modal fade" id="editNetworkModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Network</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label" id="networkNameEditInput"></label>
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonEditInput" rows="16" ></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="updateNetwork()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- Rename Network Modal-->
<div class="modal fade" id="renameNetworkModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Rename Network</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label text-right" id="newNetworkName">Name:</label>
<div class="col-8">
<div class="form-group">
<input type="text" id="newInstanceName" class="form-control" placeholder="Network name">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="renameNetwork()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadNetworkTable = true;
var operationNumber = "";
var networkToUpdate = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404 || operationData.status_code == 200){
operationNumber = "";
$('#spinner').hide();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadNetworkTable == false){
$('#networkListTable').DataTable().ajax.reload();
}
if (loadNetworkTable == true){
$('#networkListTable').DataTable( {
ajax: "./php/lxd/network-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Name" },
{ title: "Description" },
{ title: "Type" },
{ title: "Managed" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadNetworkTable = false;
}
}
function createNetworkForm(){
var networkNameCreate = $("#networkNameCreate").val();
var networkDescriptionCreate = $("#networkDescriptionCreate").val();
console.log("Info: creating network");
$.get("./php/lxd/networks.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&name=" + encodeURI(networkNameCreate) + "&description=" + encodeURI(networkDescriptionCreate) + "&action=createNetworkForm", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function createNetworkJson(){
var networkCreateJSON = $("#jsonCreateInput").val();
console.log("Info: creating network");
$.post("./php/lxd/networks.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=createNetworkJson", {json: networkCreateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//Called by Edit action, loads JSON data of project
function loadNetworkJson(networkToLoad){
console.log("Info: loading network " + networkToLoad);
networkToUpdate = networkToLoad;
$.get("./php/lxd/networks.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&network=" + encodeURI(networkToLoad) + "&action=loadNetwork", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
$("#networkNameEditInput").text("Name: " + networkToLoad);
$("#jsonEditInput").val(JSON.stringify(operationData.metadata, null, 2));
$("#editNetworkModal").modal('show');
});
}
function updateNetwork(){
var networkUpdateJSON = $("#jsonEditInput").val();
console.log("Info: updating network " + networkToUpdate);
$.post("./php/lxd/networks.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&network=" + encodeURI(networkToUpdate) + "&action=updateNetwork", {json: networkUpdateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function renameNetwork(networkToRename){
console.log("Info: renaming network " + networkToRename);
$.get("./php/lxd/networks.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&name=" + encodeURI(networkToRename) + "&action=renameNetwork", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function deleteNetwork(networkToDelete){
console.log("Info: deleting network " + networkToDelete);
$.get("./php/lxd/networks.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&network=" + encodeURI(networkToDelete) + "&action=deleteNetwork", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#networksBreadCrumb').text("networks");
//Load the card contents
loadPageContent();
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,320 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="operationsBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Operations List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Operations</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<!-- <a class="dropdown-item" href="#" data-toggle="modal" data-target="#createTrustModal">Create Trust</a> -->
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="operationListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Operations List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- View Operation Modal-->
<div class="modal fade" id="viewOperationModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">View Operation</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label" id="operationNameEditInput"></label>
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonEditInput" rows="16" ></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadOperationsTable = true;
var operationNumber = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404 || operationData.status_code == 200){
operationNumber = "";
$('#spinner').hide();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadOperationsTable == false){
$('#operationListTable').DataTable().ajax.reload();
}
if (loadOperationsTable == true){
$('#operationListTable').DataTable( {
ajax: "./php/lxd/operation-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "ID" },
{ title: "Class" },
{ title: "Description" },
{ title: "Status" },
{ title: "Created" },
{ title: "Cancelable" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadOperationsTable = false;
}
}
//Called by Edit action, loads JSON data of project
function loadOperationJson(operationToLoad){
console.log("Info: loading operation " + operationToLoad);
$.get("./php/lxd/operations.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&operation=" + encodeURI(operationToLoad) + "&action=loadOperation", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
$("#operationNameEditInput").text("Name: " + operationToLoad);
$("#jsonEditInput").val(JSON.stringify(operationData.metadata, null, 2));
$("#viewOperationModal").modal('show');
});
}
//API uses sync
function deleteOperation(operationToDelete){
console.log("Info: deleting operation " + operationToDelete);
$.get("./php/lxd/operations.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&operation=" + encodeURI(operationToDelete) + "&action=deleteOperation", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#operationsBreadCrumb').text("operations");
//Load the card contents
loadPageContent();
//Set page reload every 3 seconds
setInterval(function(){loadPageContent()}, 3000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,70 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/certificates?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$certificate_urls = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($certificate_urls as $certificate_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $certificate_url . "?project=" . $project;
$certificate_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$certificate_data = json_decode($certificate_data, true);
$certificate_data = $certificate_data['metadata'];
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<a href='#' onclick=loadCertificateJson('".$certificate_data['fingerprint']."')> <i class='fas fa-wallet fa-lg' style='color:#4e73df'></i> </a>";
echo '",';
echo '"';
echo "<a href='#' onclick=loadCertificateJson('".$certificate_data['fingerprint']."')>".htmlentities($certificate_data['name'])."</a>";
echo '",';
echo '"' . htmlentities($certificate_data['type']) . '",';
echo '"' . htmlentities($certificate_data['fingerprint']) . '",';
echo '"';
echo "<div class='dropdown no-arrow'>";
echo "<a class='dropdown-toggle' href='#' role='button' id='dropdownMenuLink' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>";
echo "<i class='fas fa-ellipsis-v fa-lg fa-fw text-gray-400'></i>";
echo "</a>";
echo "<div class='dropdown-menu dropdown-menu-right shadow animated--fade-in' aria-labelledby='dropdownMenuLink'>";
echo "<div class='dropdown-header'>Options:</div>";
echo "<a class='dropdown-item' href='#' onclick=deleteCertificate('".$certificate_data['fingerprint']."')>Delete</a>";
echo "</div>";
echo "</div>";
echo '"';
echo " ]";
}
echo " ]}";
}
?>

View file

@ -1,50 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
if (isset($_GET['certificate']))
$certificate = filter_var(urldecode($_GET['certificate']), FILTER_SANITIZE_STRING);
//Instantiate the POST variable
if (isset($_POST['json']))
$json = $_POST['json'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Query DB to find remote
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Run the matching action
switch ($action) {
case "addCertificate":
$url = $url . "/1.0/certificates?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "deleteCertificate":
$url = $url . "/1.0/certificates/" . $certificate . "?project=" . $project;
$data = escapeshellarg('{}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE -d $data $url");
break;
case "loadCertificate":
$url = $url . "/1.0/certificates/" . $certificate . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
}
}
echo $results;
?>

View file

@ -1,69 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/cluster";
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$cluster_status = $remote_data['metadata'];
if ($cluster_status['enabled'] == false){
echo '{ "data": [';
}
else {
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/cluster/members";
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$member_urls = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($member_urls as $member_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $member_url;
$member_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$member_data = json_decode($member_data, true);
$member_data = $member_data['metadata'];
$database_status = ($member_data['database'])?"true":"false";
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<i class='fas fa-address-card fa-lg' style='color:#4e73df'></i>";
echo '",';
echo '"' . htmlentities($member_data['server_name']) . '",';
echo '"' . htmlentities($member_data['url']) . '",';
echo '"' . htmlentities($database_status) . '",';
echo '"' . htmlentities($member_data['status']) . '",';
echo '"' . htmlentities($member_data['message']) . '",';
echo '"';
echo '"';
echo " ]";
}
}
echo " ]}";
}
?>

View file

@ -1,60 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
if (isset($_GET['name']))
$name = filter_var(urldecode($_GET['name']), FILTER_SANITIZE_STRING);
if (isset($_GET['profile']))
$profile = filter_var(urldecode($_GET['profile']), FILTER_SANITIZE_STRING);
if (isset($_GET['fingerprint']))
$fingerprint = filter_var(urldecode($_GET['fingerprint']), FILTER_SANITIZE_STRING);
//Instantiate the POST variable
if (isset($_POST['json']))
$json = $_POST['json'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Query DB to find remote
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Run the matching action
switch ($action) {
case "deleteProject":
$url = $url . "/1.0/projects/" . $name;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE $url");
break;
case "createProject":
$url = $url . "/1.0/projects";
$data = escapeshellarg('{"name":"' . $name . '"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "loadProject":
$url = $url . "/1.0/projects/" . $name;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
case "updateProject":
$url = $url . "/1.0/projects/" . $project;
$data = $json;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d '$data' $url");
break;
}
}
echo $results;
?>

View file

@ -1,127 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
//Instance Data
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/resources?project=" . $project;
$resource_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$resource_data = json_decode($resource_data, true);
$resource_data = $resource_data['metadata'];
$system_vendor = $resource_data['system']['vendor'];
$system_product = $resource_data['system']['product'];
$architecture = $resource_data['cpu']['architecture']; //example: x86
$cpus = $resource_data['cpu']['total']; //total number of cpus
$sockets = $resource_data['cpu']['sockets']; //array of cpu info per socket
$storage_disks = $resource_data['storage']['disks']; //array of storage devices
$memory_total = number_format($resource_data['memory']['total']/1024/1024/1024,2); //total amount of memory used in GB
$memory_used = number_format($resource_data['memory']['used']/1024/1024/1024,2); //current amount of memory used in GB
$memory_free = $memory_total - $memory_used;
echo '<div class="row">';
echo '<div class="col-xl-6 col-lg-7">';
echo "<strong>System Vendor</strong>: " . htmlentities($system_vendor) . "<br />";
echo "<strong>System Product</strong>: " . htmlentities($system_product) . "<br />";
echo "<br />";
echo "<strong>CPU Information</strong>: <br />";
echo "<ul>";
echo "<li><strong>Architecture</strong>: " . htmlentities($architecture) . "</li>";
echo "<li><strong>CPU Count</strong>: " . htmlentities($cpus) . "</li>";
foreach($sockets as $socket){
echo "<li><strong>Socket " . $socket['socket'] . "</strong>: " . $socket['name'] . "</li>";
}
echo "</ul>";
echo "<strong>Memory Total</strong>: " . htmlentities($memory_total) . " GB<br />";
echo "<strong>Memory Used</strong>: " . htmlentities($memory_used) . " GB<br />";
echo "<br />";
echo "<strong>Disk Storage Information</strong>: <br />";
foreach($storage_disks as $disk){
if ($disk['type'] == "cdrom")
continue;
echo "<ul>";
echo "<li><strong>Disk ID</strong>: " . $disk['id'] . "</li>";
echo "<li><strong>Disk model</strong>: " . $disk['model'] . "</li>";
echo "<li><strong>Disk type</strong>: " . $disk['type'] . "</li>";
echo "<li><strong>Disk size</strong>: " . number_format($disk['size']/1024/1024/1024,2) . " GB</li>";
echo "</ul>";
}
echo '</div>';
echo '<!-- Donut Chart -->';
echo '<div class="col-xl-4 col-lg-5">';
echo '<div class="chart-pie pt-4">';
echo '<canvas id="memoryDoughnutChart"></canvas>';
echo '</div>';
echo '</div>';
echo '</div>';
}
?>
<script>
// Set new default font family and font color to mimic Bootstrap's default styling
Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
Chart.defaults.global.defaultFontColor = '#858796';
// Doughnut Pie Chart
var ctx = document.getElementById("memoryDoughnutChart");
var myPieChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: ["Used Memory (GB)", "Available Memory (GB)"],
datasets: [{
data: [<?php echo $memory_used;?>, <?php echo $memory_free;?>],
backgroundColor: ['#4e73df', '#1cc88a'],
hoverBackgroundColor: ['#2e59d9', '#17a673'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
},
options: {
maintainAspectRatio: false,
tooltips: {
backgroundColor: "rgb(255,255,255)",
bodyFontColor: "#858796",
borderColor: '#dddfeb',
borderWidth: 1,
xPadding: 15,
yPadding: 15,
displayColors: false,
caretPadding: 10,
},
legend: {
display: true,
position: 'right',
},
title: {
display: true,
text: 'Memory Usage',
fontSize: 18,
},
cutoutPercentage: 60,
},
});
</script>

View file

@ -1,39 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['image_type']))
$image_type = filter_var(urldecode($_GET['image_type']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/images?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$image_urls = $remote_data['metadata'];
foreach ($image_urls as $image_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $image_url . "?project=" . $project;
$image_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$image_data = json_decode($image_data, true);
$image_data = $image_data['metadata'];
if ($image_data['fingerprint'] == "" || $image_data['type'] != $image_type)
continue;
echo '<option value="' . $image_data['fingerprint'] . '">' . htmlentities($image_data['properties']['description']) . '</option>';
}
}
?>

View file

@ -1,70 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/images?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$image_urls = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($image_urls as $image_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $image_url . "?project=" . $project;
$image_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$image_data = json_decode($image_data, true);
$image_data = $image_data['metadata'];
if ($image_data['fingerprint'] == "")
continue;
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<i class='fas fa-box-open fa-lg' style='color:#4e73df'></i>";
echo '",';
echo '"' . htmlentities($image_data['properties']['description']) . '",';
echo '"' . htmlentities($image_data['fingerprint']) . '",';
echo '"' . htmlentities($image_data['type']) . '",';
echo '"' . htmlentities(number_format($image_data['size'] / 1048576, 2)) . ' MB",';
echo '"';
echo "<div class='dropdown no-arrow'>";
echo "<a class='dropdown-toggle' href='#' role='button' id='dropdownMenuLink' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>";
echo "<i class='fas fa-ellipsis-v fa-lg fa-fw text-gray-400'></i>";
echo "</a>";
echo "<div class='dropdown-menu dropdown-menu-right shadow animated--fade-in' aria-labelledby='dropdownMenuLink'>";
echo "<div class='dropdown-header'>Options:</div>";
echo "<a class='dropdown-item' href='#' onclick=refreshImage('".$image_data['fingerprint']."')>Refresh</a>";
echo "<a class='dropdown-item' href='#' onclick=loadImageJson('".$image_data['fingerprint']."')>Edit</a>";
echo "<a class='dropdown-item' href='#' onclick=deleteImage('".$image_data['fingerprint']."')>Delete</a>";
echo "</div>";
echo "</div>";
echo '"';
echo " ]";
}
echo " ]}";
}
?>

View file

@ -1,65 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
if (isset($_GET['fingerprint']))
$fingerprint = filter_var(urldecode($_GET['fingerprint']), FILTER_SANITIZE_STRING);
if (isset($_GET['image']))
$image = filter_var(urldecode($_GET['image']), FILTER_SANITIZE_STRING);
if (isset($_GET['repo']))
$repo = filter_var(urldecode($_GET['repo']), FILTER_SANITIZE_STRING);
if (isset($_GET['image_type']))
$image_type = filter_var(urldecode($_GET['image_type']), FILTER_SANITIZE_STRING);
//Instantiate the POST variable
if (isset($_POST['json']))
$json = $_POST['json'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Query DB to find remote
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Run the matching action
switch ($action) {
case "refreshImage":
$url = $url . "/1.0/images/" . $fingerprint . "/refresh?project=" . $project;
$data = escapeshellarg('{}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "deleteImage":
$url = $url . "/1.0/images/" . $fingerprint . "?project=" . $project;
$data = escapeshellarg('{}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE -d $data $url");
break;
case "downloadImage":
$url = $url . "/1.0/images?project=" . $project;
$data = escapeshellarg('{"source": {"type": "image", "protocol": "simplestreams", "server": "' . $repo . '", "alias": "' . $image . '","image_type": "' . $image_type . '"}}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "updateImage":
$url = $url . "/1.0/images/" . $fingerprint . "?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "loadImage":
$url = $url . "/1.0/images/" . $fingerprint . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
}
}
echo $results;
?>

View file

@ -1,84 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$instance_urls = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($instance_urls as $instance_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $instance_url . "?project=" . $project;
$instance_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$instance_data = json_decode($instance_data, true);
$instance_data = $instance_data['metadata'];
if ($instance_data['name'] == "")
continue;
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
if ($instance_data['status'] == "Running"){
echo '"';
echo "<a href='instance.html?instance=".$instance_data['name']."&remote=".$remote."&project=".$project."'><i class='fas fa-cube fa-lg' style='color:#4e73df'></i> </a>";
echo '",';
echo '"';
echo "<a href='instance.html?instance=".$instance_data['name']."&remote=".$remote."&project=".$project."'> ".$instance_data['name']."</a>";
echo '",';
}
else {
echo '"';
echo "<a href='instance.html?instance=".$instance_data['name']."&remote=".$remote."&project=".$project."'><i class='fas fa-cube fa-lg' style='color:#ddd'></i> </a>";
echo '",';
echo '"';
echo "<a href='instance.html?instance=".$instance_data['name']."&remote=".$remote."&project=".$project."'> ".$instance_data['name']."</a>";
echo '",';
}
echo '"' . $instance_data['config']['image.description'] . '",';
echo '"' . $instance_data['type'] . '",';
echo '"' . $instance_data['architecture'] . '",';
echo '"' . $instance_data['status'] . '",';
if ($instance_data['status'] == "Running"){
echo '"';
echo "<a href='#' onclick=stopInstance('".$instance_data['name']."')> <i class='fas fa-stop fa-lg' style='color:#ddd'></i> </a>";
echo '"';
}
else{
echo '"';
echo "<a href='#' onclick=startInstance('".$instance_data['name']."')> <i class='fas fa-play fa-lg' style='color:#ddd'></i> </a>";
echo '"';
}
echo " ]";
}
echo " ]}";
}
?>

View file

@ -1,82 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
echo "<thead>";
echo "<tr>";
echo "<th style='width:75px'></th>";
echo "<th>Name</th>";
echo "<th>Path</th>";
echo "<th>Usage</th>";
echo "<th>Type</th>";
echo "<th style='width:75px'></th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "/state?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$disk_names = $remote_data['metadata']['disk'];
foreach ($disk_names as $disk_name => $disk_data){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$device_names = $remote_data['metadata']['expanded_devices'];
foreach ($device_names as $device_name => $device_data){
if ($device_name == $disk_name){
$disk_path = $device_data['path'];
$disk_type = $device_data['type'];
}
}
echo "<tr>";
echo "<td> <i class='fas fa-hdd fa-lg' style='color:#4e73df'></i> </td>";
echo "<td>" . htmlentities($disk_name) . "</td>";
echo "<td>" . htmlentities($disk_path) . "</td>";
echo "<td>" . htmlentities(number_format($disk_data['usage']/1024/1024,2)) . " MB</td>";
echo "<td>" . htmlentities($disk_type) . "</td>";
echo "<td>";
echo '<div class="dropdown no-arrow">';
echo '<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
echo '<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>';
echo '</a>';
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">';
echo '<div class="dropdown-header">Options:</div>';
//echo '<a class="dropdown-item" href="#" onclick="detachProfile(' . escapeshellarg($network_name) . ')">Detach</a>';
echo '</div>';
echo '</div>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
?>

View file

@ -1,97 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
echo "<thead>";
echo "<tr>";
echo "<th style='width:75px'></th>";
echo "<th>Name</th>";
echo "<th>Hardware Address</th>";
echo "<th>IPv4 Address</th>";
echo "<th>IPv6 Address</th>";
echo "<th>State</th>";
echo "<th style='width:75px'></th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "/state?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$network_names = $remote_data['metadata']['network'];
foreach ($network_names as $network_name => $network_data){
echo "<tr>";
if ($network_data['state'] == "up")
echo "<td> <i class='fas fa-network-wired fa-lg' style='color:#4e73df'></i> </td>";
else
echo "<td> <i class='fas fa-network-wired fa-lg' style='color:#ddd'></i> </td>";
echo "<td>" . htmlentities($network_name) . "</td>";
echo "<td>" . htmlentities($network_data['hwaddr']) . "</td>";
echo "<td>";
$i = 0;
foreach ($network_data['addresses'] as $address){
if ($address['family'] == "inet"){
if ($i > 0)
echo "<br />";
echo htmlentities($address['address']) . "/" . htmlentities($address['netmask']);
$i++;
}
}
echo "</td>";
echo "<td>";
$i = 0;
foreach ($network_data['addresses'] as $address){
if ($address['family'] == "inet6"){
if ($i > 0)
echo "<br />";
echo htmlentities($address['address']);
$i++;
}
}
echo "</td>";
echo "<td>" . htmlentities($network_data['state']) . "</td>";
echo "<td>";
echo '<div class="dropdown no-arrow">';
echo '<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
echo '<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>';
echo '</a>';
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">';
echo '<div class="dropdown-header">Options:</div>';
//echo '<a class="dropdown-item" href="#" onclick="detachProfile(' . escapeshellarg($network_name) . ')">Detach</a>';
echo '</div>';
echo '</div>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
?>

View file

@ -1,71 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
echo "<thead>";
echo "<tr>";
echo "<th style='width:75px'></th>";
echo "<th>Name</th>";
echo "<th>Description</th>";
echo "<th style='width:75px'></th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$profile_names = $remote_data['metadata']['profiles'];
foreach ($profile_names as $profile_name){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/profiles/" . $profile_name . "?project=" . $project;
$profile_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$profile_data = json_decode($profile_data, true);
$profile_data = $profile_data['metadata'];
if ($profile_data['name'] == "")
continue;
echo "<tr>";
echo "<td> <i class='fas fa-address-card fa-lg' style='color:#4e73df'></i> </td>";
echo "<td>" . htmlentities($profile_data['name']) . "</td>";
echo "<td>" . htmlentities($profile_data['description']) . "</td>";
echo "<td>";
echo '<div class="dropdown no-arrow">';
echo '<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
echo '<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>';
echo '</a>';
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">';
echo '<div class="dropdown-header">Options:</div>';
echo '<a class="dropdown-item" href="#" onclick="detachProfile(' . escapeshellarg($profile_data['name']) . ')">Detach</a>';
echo '</div>';
echo '</div>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
?>

View file

@ -1,79 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
echo "<thead>";
echo "<tr>";
echo "<th style='width:75px'></th>";
echo "<th>Name</th>";
echo "<th>Connect</th>";
echo "<th>Listen</th>";
echo "<th>Type</th>";
echo "<th style='width:75px'></th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$device_names = $remote_data['metadata']['expanded_devices'];
foreach ($device_names as $device_name => $device_data){
if ($device_data['type'] == "proxy"){
echo "<tr>";
echo "<td> <i class='fas fa-exchange-alt fa-lg' style='color:#4e73df'></i> </td>";
echo "<td>" . htmlentities($device_name) . "</td>";
echo "<td>" . htmlentities($device_data['connect']) . "</td>";
echo "<td>" . htmlentities($device_data['listen']) . "</td>";
echo "<td>" . htmlentities($device_data['type']) . "</td>";
echo "<td>";
echo '<div class="dropdown no-arrow">';
echo '<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
echo '<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>';
echo '</a>';
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">';
echo '<div class="dropdown-header">Options:</div>';
//echo '<a class="dropdown-item" href="#" onclick="detachProfile(' . escapeshellarg($network_name) . ')">Detach</a>';
echo '</div>';
echo '</div>';
echo "</td>";
echo "</tr>";
}
else {
continue;
}
}
}
echo "</tbody>";
?>

View file

@ -1,79 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
echo '<thead>';
echo ' <tr>';
echo " <th style='width:75px'></th>";
echo ' <th>Name</th>';
echo ' <th>Stateful/Stateless</th>';
echo ' <th>Size</th>';
echo ' <th>Created At</th>';
echo " <th style='width:75px'></th>";
echo ' </tr>';
echo '</thead>';
echo '<tbody>';
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "/snapshots?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$snapshot_urls = $remote_data['metadata'];
foreach ($snapshot_urls as $snapshot_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $snapshot_url . "?project=" . $project;
$snapshot_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$snapshot_data = json_decode($snapshot_data, true);
$snapshot_data = $snapshot_data['metadata'];
if ($snapshot_data['name'] == "")
continue;
if ($snapshot_data['stateful'])
$state = "stateful";
else
$state = "stateless";
echo "<tr>";
echo "<td> <i class='fas fa-clone fa-lg' style='color:#4e73df'></i> </td>";
echo "<td>" . htmlentities($snapshot_data['name']) . "</td>";
echo "<td>" . htmlentities($state) . "</td>";
echo "<td>" . htmlentities(number_format($snapshot_data['size']/1024/1024,2)) . "MB</td>";
echo "<td>" . htmlentities($snapshot_data['created_at']) . "</td>";
echo "<td>";
echo '<div class="dropdown no-arrow">';
echo '<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
echo '<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>';
echo '</a>';
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">';
echo '<div class="dropdown-header">Options:</div>';
echo '<a class="dropdown-item" href="#" onclick="restoreSnapshot(' . escapeshellarg($snapshot_data['name']) . ')">Restore</a>';
echo '<a class="dropdown-item" href="#" onclick="deleteSnapshot(' . escapeshellarg($snapshot_data['name']) . ')">Delete</a>';
echo '</div>';
echo '</div>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
?>

View file

@ -1,61 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
//Instance Data
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "?project=" . $project;
$instance_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$instance_data = json_decode($instance_data, true);
$instance_data = $instance_data['metadata'];
//Instance State
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "/state?project=" . $project;
$instance_state = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$instance_state = json_decode($instance_state, true);
$instance_state = $instance_state['metadata'];
$name = $instance_data['name'];
$created = $instance_data['created_at'];
$description = $instance_data['description'];
$type = $instance_data['type'];
$image = $instance_data['config']['image.description'];
$status = $instance_data['status']; //ex Running
$memory = number_format($instance_state['memory']['usage'] / 1048576, 2);
echo '<div class="row">';
echo '<div class="col-12">';
echo "<strong>Name</strong>: " . htmlentities($name) . "<br />";
echo "<strong>Description</strong>: " . htmlentities($description) . "<br />";
echo "<strong>Type</strong>: " . htmlentities($type) . "<br />";
echo "<strong>Status</strong>: " . htmlentities($status) . "<br />";
echo "<strong>Image</strong>: " . htmlentities($image) . "<br />";
echo "<strong>Memory</strong>: " . htmlentities($memory) . " MB<br />";
echo '</div>';
echo '</div>';
}
?>

View file

@ -1,134 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
if (isset($_GET['name']))
$name = filter_var(urldecode($_GET['name']), FILTER_SANITIZE_STRING);
if (isset($_GET['profile']))
$profile = filter_var(urldecode($_GET['profile']), FILTER_SANITIZE_STRING);
if (isset($_GET['fingerprint']))
$fingerprint = filter_var(urldecode($_GET['fingerprint']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance_type']))
$instance_type = filter_var(urldecode($_GET['instance_type']), FILTER_SANITIZE_STRING);
if (isset($_GET['description']))
$description = filter_var(urldecode($_GET['description']), FILTER_SANITIZE_STRING);
if (isset($_GET['public']))
$public = filter_var(urldecode($_GET['public']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Run the matching action
switch ($action) {
case "createInstance":
$url = $url . "/1.0/instances?project=" . $project;
$data = escapeshellarg('{"name":"' . $name . '", "profiles": ["'. $profile . '"], "type": "' . $instance_type . '", "source": {"type": "image", "fingerprint": "' . $fingerprint . '"} }');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "status":
$url = $url . "/1.0/instances/" . $instance . "/state?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
case "stopInstance":
$url = $url . "/1.0/instances/" . $instance . "/state?project=" . $project;
$data = escapeshellarg('{"action": "stop"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "startInstance":
$url = $url . "/1.0/instances/" . $instance . "/state?project=" . $project;
$data = escapeshellarg('{"action": "start"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "restartInstance":
$url = $url . "/1.0/instances/" . $instance . "/state?project=" . $project;
$data = escapeshellarg('{"action": "restart"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "freeze":
$url = $url . "/1.0/instances/" . $instance . "/state?project=" . $project;
$data = escapeshellarg('{"action": "freeze"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "unfreeze":
$url = $url . "/1.0/instances/" . $instance . "/state?project=" . $project;
$data = escapeshellarg('{"action": "unfreeze"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "deleteInstance":
$url = $url . "/1.0/instances/" . $instance . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE $url");
break;
case "snapshotInstance":
$url = $url . "/1.0/instances/" . $instance . "/snapshots?project=" . $project;
$data = escapeshellarg('{"name": "'. $name . '"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "renameInstance":
$url = $url . "/1.0/instances/" . $instance . "?project=" . $project;
$data = escapeshellarg('{"name": "'. $name . '"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "copyInstance":
$url = $url . "/1.0/instances?project=" . $project;
$data = escapeshellarg('{"name": "'. $name . '", "source":{"type":"copy","source": "'. $instance . '"}}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "attachProfile":
$url = $url . "/1.0/instances/" . $instance . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$data = json_decode($results, true);
$data = $data['metadata']['profiles'];
array_push($data, $name);
$data = escapeshellarg('{"profiles":' . json_encode($data) . '}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PATCH -d $data $url");
break;
case "detachProfile":
$url = $url . "/1.0/instances/" . $instance . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$data = json_decode($results, true);
$data = $data['metadata']['profiles'];
$i = 0;
foreach ($data as $element){
if ($element == $name){
unset($data[$i]);
}
$i++;
}
$data = escapeshellarg('{"profiles":' . json_encode($data) . '}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PATCH -d $data $url");
break;
case "restoreSnapshot":
$url = $url . "/1.0/instances/" . $instance . "?project=" . $project;
$data = escapeshellarg('{"restore":"' . $name . '"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "deleteSnapshot":
$url = $url . "/1.0/instances/" . $instance . "/snapshots/" . $name . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE $url");
break;
case "publishInstance":
$url = $url . "/1.0/images?project=" . $project;
$data = escapeshellarg('{"properties":{"description": "'. $description . '"}, "public": '. $public . ', "source":{"type": "instance", "name": "'. $instance . '"}}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
}
}
echo $results;
?>

View file

@ -1,7 +0,0 @@
<?php
$results = shell_exec("cat /var/lxdware/data/lxd/client.crt");
echo htmlentities($results);
?>

View file

@ -1,77 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/networks?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$network_urls = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($network_urls as $network_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $network_url . "?project=" . $project;
$network_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$network_data = json_decode($network_data, true);
$network_data = $network_data['metadata'];
if ($network_data['name'] == "")
continue;
$network_data_managed = ($network_data['managed'])?"true":"false";
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
if ($network_data['managed'] == "true")
echo "<i class='fas fa-network-wired fa-lg' style='color:#4e73df'></i>";
else
echo "<i class='fas fa-network-wired fa-lg' style='color:#ddd'></i>";
echo '",';
echo '"' . htmlentities($network_data['name']) . '",';
echo '"' . htmlentities($network_data['description']) . '",';
echo '"' . htmlentities($network_data['type']) . '",';
echo '"' . htmlentities($network_data_managed) . '",';
echo '"';
if ($network_data['managed'] == "true"){
echo "<div class='dropdown no-arrow'>";
echo "<a class='dropdown-toggle' href='#' role='button' id='dropdownMenuLink' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>";
echo "<i class='fas fa-ellipsis-v fa-lg fa-fw text-gray-400'></i>";
echo "</a>";
echo "<div class='dropdown-menu dropdown-menu-right shadow animated--fade-in' aria-labelledby='dropdownMenuLink'>";
echo "<div class='dropdown-header'>Options:</div>";
echo "<a class='dropdown-item' href='#' onclick=loadNetworkJson('".$network_data['name']."')>Edit</a>";
echo "<a class='dropdown-item' href='#' onclick=deleteNetwork('".$network_data['name']."')>Delete</a>";
echo "</div>";
echo "</div>";
}
echo '"';
echo " ]";
}
echo " ]}";
}
?>

View file

@ -1,71 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
if (isset($_GET['network']))
$network = filter_var(urldecode($_GET['network']), FILTER_SANITIZE_STRING);
if (isset($_GET['name']))
$name = filter_var(urldecode($_GET['name']), FILTER_SANITIZE_STRING);
if (isset($_GET['description']))
$description = filter_var(urldecode($_GET['description']), FILTER_SANITIZE_STRING);
if (isset($_GET['repo']))
$repo = filter_var(urldecode($_GET['repo']), FILTER_SANITIZE_STRING);
//Instantiate the POST variable
if (isset($_POST['json']))
$json = $_POST['json'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Query DB to find remote
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Run the matching action
switch ($action) {
case "createNetworkForm":
$url = $url . "/1.0/networks?project=" . $project;
$data = escapeshellarg('{"description": "'.$description.'", "name": "'.$name.'"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "createNetworkJson":
$url = $url . "/1.0/networks?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "deleteNetwork":
$url = $url . "/1.0/networks/" . $network . "?project=" . $project;
$data = escapeshellarg('{}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE -d $data $url");
break;
case "updateNetwork":
$url = $url . "/1.0/networks/" . $network . "?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "renameNetwork":
$url = $url . "/1.0/networks/" . $network . "?project=" . $project;
$data = escapeshellarg('{"name": "' . $name . '"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "loadNetwork":
$url = $url . "/1.0/networks/" . $network . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
}
}
echo $results;
?>

View file

@ -1,88 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/operations";
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$operations_dict = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($operations_dict as $operations_url){
foreach ($operations_url as $operation_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $operation_url;
$operation_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$operation_data = json_decode($operation_data, true);
$operation_data = $operation_data['metadata'];
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<a href='#' onclick=loadOperationJson('".$operation_data['id']."')> <i class='fas fa-exchange-alt fa-lg' style='color:#4e73df'></i> </a>";
echo '",';
echo '"';
echo "<a href='#' onclick=loadOperationJson('".$operation_data['id']."')>".htmlentities($operation_data['id'])."</a>";
echo '",';
echo '"' . htmlentities($operation_data['class']) . '",';
echo '"' . htmlentities($operation_data['description']) . '",';
echo '"' . htmlentities($operation_data['status']) . '",';
echo '"' . htmlentities($operation_data['created_at']) . '",';
if($operation_data['may_cancel']){
$may_cancel = "true";
echo '"' . htmlentities($may_cancel) . '",';
echo '"';
echo "<a href='#' onclick=deleteOperation('".$operation_data['id']."')> <i class='fas fa-stop fa-2x' style='color:#ddd'></i> </a>";
echo '"';
}
else{
$may_cancel = "false";
echo '"' . htmlentities($may_cancel) . '",';
echo '" ';
echo ' "';
}
echo " ]";
}
}
echo " ]}";
}
?>

View file

@ -1,24 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['id']))
$id = filter_var(urldecode($_GET['id']), FILTER_SANITIZE_STRING);
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/operations/" . $id;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
}
echo $results;
?>

View file

@ -1,43 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['operation']))
$operation = filter_var(urldecode($_GET['operation']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
//Instantiate the POST variable
if (isset($_POST['json']))
$json = $_POST['json'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Query DB to find remote
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Run the matching action
switch ($action) {
case "deleteOperation":
$url = $url . "/1.0/operations/" . $operation;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE $url");
break;
case "loadOperation":
$url = $url . "/1.0/operations/" . $operation;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
}
}
echo $results;
?>

View file

@ -1,68 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
echo "<thead>";
echo "<tr>";
echo "<th style='width:75px'></th>";
echo "<th>Name</th>";
echo "<th>Description</th>";
echo "<th style='width:75px'></th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/profiles?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$profile_urls = $remote_data['metadata'];
foreach ($profile_urls as $profile_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $profile_url . "?project=" . $project;
$profile_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$profile_data = json_decode($profile_data, true);
$profile_data = $profile_data['metadata'];
if ($profile_data['name'] == "")
continue;
echo "<tr>";
echo "<td> <i class='fas fa-address-card fa-2x' style='color:#4e73df'></i> </td>";
echo "<td>" . htmlentities($profile_data['name']) . "</td>";
echo "<td>" . htmlentities($profile_data['description']) . "</td>";
echo "<td>";
echo '<div class="dropdown no-arrow">';
echo '<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
echo '<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>';
echo '</a>';
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">';
echo '<div class="dropdown-header">Options:</div>';
echo '<a class="dropdown-item" href="#" onclick="loadProfileJson(' . escapeshellarg($profile_data['name']) . ')">Edit</a>';
echo '<a class="dropdown-item" href="#" onclick="deleteProfile(' . escapeshellarg($profile_data['name']) . ')">Delete</a>';
echo '</div>';
echo '</div>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
?>

View file

@ -1,35 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/profiles?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$profile_urls = $remote_data['metadata'];
foreach ($profile_urls as $profile_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $profile_url . "?project=" . $project;
$profile_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$profile_data = json_decode($profile_data, true);
$profile_data = $profile_data['metadata'];
if ($profile_data['name'] == "")
continue;
echo '<option value="' . $profile_data['name'] . '">' . htmlentities($profile_data['name']) . '</option>';
}
}
?>

View file

@ -1,68 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/profiles?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$profile_urls = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($profile_urls as $profile_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $profile_url . "?project=" . $project;
$profile_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$profile_data = json_decode($profile_data, true);
$profile_data = $profile_data['metadata'];
if ($profile_data['name'] == "")
continue;
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<i class='fas fa-address-card fa-lg' style='color:#4e73df'></i>";
echo '",';
echo '"' . htmlentities($profile_data['name']) . '",';
echo '"' . htmlentities($profile_data['description']) . '",';
echo '"';
echo "<div class='dropdown no-arrow'>";
echo "<a class='dropdown-toggle' href='#' role='button' id='dropdownMenuLink' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>";
echo "<i class='fas fa-ellipsis-v fa-lg fa-fw text-gray-400'></i>";
echo "</a>";
echo "<div class='dropdown-menu dropdown-menu-right shadow animated--fade-in' aria-labelledby='dropdownMenuLink'>";
echo "<div class='dropdown-header'>Options:</div>";
echo "<a class='dropdown-item' href='#' onclick=loadProfileJson('".$profile_data['name']."')>Edit</a>";
echo "<a class='dropdown-item' href='#' onclick=deleteProfile('".$profile_data['name']."')>Delete</a>";
echo "</div>";
echo "</div>";
echo '"';
echo " ]";
}
echo " ]}";
}
?>

View file

@ -1,71 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
if (isset($_GET['profile']))
$profile = filter_var(urldecode($_GET['profile']), FILTER_SANITIZE_STRING);
if (isset($_GET['name']))
$name = filter_var(urldecode($_GET['name']), FILTER_SANITIZE_STRING);
if (isset($_GET['description']))
$description = filter_var(urldecode($_GET['description']), FILTER_SANITIZE_STRING);
if (isset($_GET['repo']))
$repo = filter_var(urldecode($_GET['repo']), FILTER_SANITIZE_STRING);
//Instantiate the POST variable
if (isset($_POST['json']))
$json = $_POST['json'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Query DB to find remote
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Run the matching action
switch ($action) {
case "createProfileForm":
$url = $url . "/1.0/profiles?project=" . $project;
$data = escapeshellarg('{"description": "'.$description.'", "name": "'.$name.'"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "createProfileJson":
$url = $url . "/1.0/profiles?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "deleteProfile":
$url = $url . "/1.0/profiles/" . $profile . "?project=" . $project;
$data = escapeshellarg('{}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE -d $data $url");
break;
case "updateProfile":
$url = $url . "/1.0/profiles/" . $profile . "?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "renameProfile":
$url = $url . "/1.0/profiles/" . $profile . "?project=" . $project;
$data = escapeshellarg('{"name": "' . $name . '"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "loadProfile":
$url = $url . "/1.0/profiles/" . $profile . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
}
}
echo $results;
?>

View file

@ -1,56 +0,0 @@
<?php
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
$return_url = strtok($_SERVER["HTTP_REFERER"], '?');
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/projects";
$project_results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$project_results = json_decode($project_results, true);
$project_urls = $project_results['metadata'];
//echo '<li class="nav-item dropdown no-arrow">';
echo '<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
echo '<span class="mr-2 d-none d-lg-inline text-gray-600 small">Project: <strong>'. htmlentities($project) . '</strong></span>';
echo '</a>';
echo '<!-- Dropdown - User Information -->';
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">';
foreach ($project_urls as $project_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $project_url;
$project_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$project_data = json_decode($project_data, true);
$project_data = $project_data['metadata'];
if ($project_data['name'] == $project)
echo '<a class="dropdown-item" href="'.$return_url.'?remote=' . $remote . '&project=' . $project_data['name'] . '"><i class="fas fa-project-diagram fa-sm fa-fw mr-2 text-gray-400"></i><strong>' . htmlentities($project_data['name']) . '</strong></a>';
else
echo '<a class="dropdown-item" href="'.$return_url.'?remote=' . $remote . '&project=' . $project_data['name'] . '"><i class="fas fa-project-diagram fa-sm fa-fw mr-2 text-gray-400"></i>' . htmlentities($project_data['name']) . '</a>';
}
echo '</div>';
//echo '</li>';
}
?>

View file

@ -1,72 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/projects";
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$project_urls = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($project_urls as $project_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $project_url;
$project_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$project_data = json_decode($project_data, true);
$project_data = $project_data['metadata'];
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<a href='host.html?remote=".$remote."&project=".$project_data['name'] ."'><i class='fas fa-project-diagram fa-lg' style='color:#4e73df'></i> </a>";
echo '",';
echo '"';
echo "<a href='host.html?remote=".$remote."&project=".$project_data['name'] ."'> ".htmlentities($project_data['name']) ."</a>";
echo '",';
echo '"' . htmlentities($project_data['description']) . '",';
echo '"' . htmlentities($project_data['config']['features.images']) . '",';
echo '"' . htmlentities($project_data['config']['features.profiles']) . '",';
echo '"' . htmlentities($project_data['config']['features.storage.volumes']) . '",';
echo '"';
echo "<div class='dropdown no-arrow'>";
echo "<a class='dropdown-toggle' href='#' role='button' id='dropdownMenuLink' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>";
echo "<i class='fas fa-ellipsis-v fa-lg fa-fw text-gray-400'></i>";
echo "</a>";
echo "<div class='dropdown-menu dropdown-menu-right shadow animated--fade-in' aria-labelledby='dropdownMenuLink'>";
echo "<div class='dropdown-header'>Options:</div>";
echo "<a class='dropdown-item' href='#' onclick=loadProjectJson('".$project_data['name']."')>Edit</a>";
echo "<a class='dropdown-item' href='#' onclick=deleteProject('".$project_data['name']."')>Delete</a>";
echo "</div>";
echo "</div>";
echo '"';
echo " ]";
}
echo " ]}";
}
?>

View file

@ -1,60 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
if (isset($_GET['name']))
$name = filter_var(urldecode($_GET['name']), FILTER_SANITIZE_STRING);
if (isset($_GET['profile']))
$profile = filter_var(urldecode($_GET['profile']), FILTER_SANITIZE_STRING);
if (isset($_GET['fingerprint']))
$fingerprint = filter_var(urldecode($_GET['fingerprint']), FILTER_SANITIZE_STRING);
//Instantiate the POST variable
if (isset($_POST['json']))
$json = $_POST['json'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Query DB to find remote
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Run the matching action
switch ($action) {
case "deleteProject":
$url = $url . "/1.0/projects/" . $name;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE $url");
break;
case "createProject":
$url = $url . "/1.0/projects";
$data = escapeshellarg('{"name":"' . $name . '"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "loadProject":
$url = $url . "/1.0/projects/" . $name;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
case "updateProject":
$url = $url . "/1.0/projects/" . $project;
$data = $json;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d '$data' $url");
break;
}
}
echo $results;
?>

View file

@ -1,18 +0,0 @@
<?php
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
if ($row['alias'] != "")
echo $row['alias'];
else
echo $row['host'];
}
?>

View file

@ -1,49 +0,0 @@
<?php
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
if ($row['alias'] != "")
$display_name = $row['alias'];
else
$display_name = $row['host'];
//echo '<li class="nav-item dropdown no-arrow">';
echo '<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
echo '<span class="mr-2 d-none d-lg-inline text-gray-600 small">Host: <strong>'. htmlentities($display_name) . '</strong></span>';
echo '</a>';
echo '<!-- Dropdown - User Information -->';
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">';
$db_results2 = $db->query('SELECT * FROM lxd_hosts');
while($row2 = $db_results2->fetchArray()){
if ($row2['alias'] != "")
$display_name2 = $row2['alias'];
else
$display_name2 = $row2['host'];
if ($row2['id'] == $remote)
echo '<a class="dropdown-item" href="host.html?remote=' . $row2['id'] . '&project=' . $project . '"><i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i><strong>' . htmlentities($display_name2) . '</strong></a>';
else
echo '<a class="dropdown-item" href="host.html?remote=' . $row2['id'] . '&project=default"><i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>' . htmlentities($display_name2) . '</a>';
}
echo '</div>';
//echo '</li>';
}
?>

View file

@ -1,73 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
echo "<thead>";
echo "<tr>";
echo "<th style='width:75px'></th>";
echo "<th>Host</th>";
echo "<th>Port</th>";
echo "<th>Alias</th>";
echo "<th>Protocol</th>";
echo "<th style='width:75px'></th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query('SELECT * FROM lxd_hosts');
if ($db_results != false){
while ($row = $db_results->fetchArray()){
echo "<tr>";
if ($action == "quickLoad"){
echo '<td> <a href="host.html?remote=' . $row['id'] . '&project=default"> <i class="fas fa-server fa-2x" style="color:#4e73df"></i> </a> </td>';
echo '<td> <a href="host.html?remote=' . $row['id'] . '&project=default">' . $row['host'] . '</a> </td>';
}
else {
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0";
$data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$data = json_decode($data, true);
if ($data['metadata']['auth'] == "trusted"){
echo '<td> <a href="host.html?remote=' . $row['id'] . '&project=default"> <i class="fas fa-server fa-2x" style="color:#4e73df"></i> </a> </td>';
echo '<td> <a href="host.html?remote=' . $row['id'] . '&project=default">' . $row['host'] . '</a> </td>';
}
else {
echo '<td> <i class="fas fa-server fa-2x" style="color:#ddd"></i> </td>';
echo '<td>' . $row['host'] . '</td>';
}
}
echo "<td>" . $row['port'] . "</td>";
echo "<td>" . $row['alias'] . "</td>";
echo "<td>" . $row['protocol'] . "</td>";
echo "<td>";
echo '<div class="dropdown no-arrow">';
echo '<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
echo '<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>';
echo '</a>';
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">';
echo '<div class="dropdown-header">Options:</div>';
echo '<a class="dropdown-item" href="#" onclick="removeRemote(' . escapeshellarg($row['id']) . ')">Remove</a>';
echo '</div>';
echo '</div>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
?>

View file

@ -1,63 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['host']))
$host = filter_var(urldecode($_GET['host']), FILTER_SANITIZE_STRING);
if (isset($_GET['port']))
$port = filter_var(urldecode($_GET['port']), FILTER_SANITIZE_STRING);
if (isset($_GET['alias']))
$alias = filter_var(urldecode($_GET['alias']), FILTER_SANITIZE_STRING);
if (isset($_GET['id']))
$id = filter_var(urldecode($_GET['id']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
//Run the matching action
switch ($action) {
case "addRemote":
if (filter_var($host, FILTER_VALIDATE_IP) || filter_var($host, FILTER_VALIDATE_DOMAIN))
$valid_domain = true;
if (filter_var($port, FILTER_VALIDATE_INT))
$valid_port = true;
if ($valid_domain && $valid_port){
$url = "https://" . $host . ":" . $port . "/1.0";
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$data = json_decode($results, true);
if ($data['metadata']['auth'] == "trusted"){
$db->exec('CREATE TABLE IF NOT EXISTS lxd_hosts (id INTEGER PRIMARY KEY AUTOINCREMENT, host TEXT NOT NULL, port INTEGER NOT NULL, alias TEXT, protocol TEXT)');
$record_added = $db->exec("INSERT INTO lxd_hosts (host, port, alias, protocol) VALUES ('$host', $port, '$alias', 'lxd')");
if ($record_added)
echo "Connection Successful, record added";
else
echo "Connection Successful, error adding record";
}
else {
echo "Connection Problem";
}
}
else {
echo "Invalid host or port";
}
break;
case "removeRemote":
$record_removed = $db->exec("DELETE FROM lxd_hosts WHERE id = $id");
if ($record_removed)
echo "Record removed";
else
echo "Error removing record";
break;
}
?>

View file

@ -1,19 +0,0 @@
<?php
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query('SELECT * FROM lxd_simplestreams');
if ($db_results != false){
while ($row = $db_results->fetchArray()){
if ($row['alias'] != "")
$host_display = $row['alias'];
else
$host_display = $row['host'];
echo '<option value="' . $row['host'] . '">' . htmlentities($host_display) . '</option>';
}
}
?>

View file

@ -1,50 +0,0 @@
<?php
//$cert = "/root/.config/lxc/client.crt";
//$key = "/root/.config/lxc/client.key";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query('SELECT * FROM lxd_simplestreams');
if($db_results != false){
$i = 0;
echo '{ "data": [';
while($row = $db_results->fetchArray()){
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<i class='fas fa-archive fa-lg' style='color:#4e73df'></i>";
echo '",';
echo '"' . htmlentities($row['host']) . '",';
echo '"' . htmlentities($row['alias']) . '",';
echo '"' . htmlentities($row['protocol']) . '",';
echo '"';
echo "<div class='dropdown no-arrow'>";
echo "<a class='dropdown-toggle' href='#' role='button' id='dropdownMenuLink' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>";
echo "<i class='fas fa-ellipsis-v fa-lg fa-fw text-gray-400'></i>";
echo "</a>";
echo "<div class='dropdown-menu dropdown-menu-right shadow animated--fade-in' aria-labelledby='dropdownMenuLink'>";
echo "<div class='dropdown-header'>Options:</div>";
echo "<a class='dropdown-item' href='#' onclick=removeSimplestreams('".$row['id']."')>Remove</a>";
echo "</div>";
echo "</div>";
echo '"';
echo " ]";
}
echo " ]}";
}
?>

View file

@ -1,46 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['host']))
$host = filter_var(urldecode($_GET['host']), FILTER_SANITIZE_STRING);
if (isset($_GET['alias']))
$alias = filter_var(urldecode($_GET['alias']), FILTER_SANITIZE_STRING);
if (isset($_GET['id']))
$id = filter_var(urldecode($_GET['id']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
//Run the matching action
switch ($action) {
case "addSimplestreams":
if (filter_var($host, FILTER_VALIDATE_URL))
$valid_url = true;
if ($valid_url){
$db->exec('CREATE TABLE IF NOT EXISTS lxd_simplestreams (id INTEGER PRIMARY KEY AUTOINCREMENT, host TEXT NOT NULL, alias TEXT, protocol TEXT)');
$record_added = $db->exec("INSERT INTO lxd_simplestreams (host, alias, protocol) VALUES ('$host', '$alias', 'simplestreams')");
if ($record_added)
echo "Connection Successful, record added";
else
echo "Connection Successful, error adding record";
}
else {
echo "Invalid host address or port number";
}
break;
case "removeSimplestreams":
$record_removed = $db->exec("DELETE FROM lxd_simplestreams WHERE id = $id");
if ($record_removed)
echo "Record removed";
else
echo "Error removing record";
break;
}
?>

View file

@ -1,74 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/storage-pools?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$storage_pool_urls = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($storage_pool_urls as $storage_pool_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $storage_pool_url . "?project=" . $project;
$storage_pool_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$storage_pool_data = json_decode($storage_pool_data, true);
$storage_pool_data = $storage_pool_data['metadata'];
if ($storage_pool_data['name'] == "")
continue;
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<a href='storage-volumes.html?pool=".$storage_pool_data['name']."&remote=".$remote."&project=".$project."'><i class='fas fa-hdd fa-lg' style='color:#4e73df'></i> </a>";
echo '",';
echo '"';
echo "<a href='storage-volumes.html?pool=".$storage_pool_data['name']."&remote=".$remote."&project=".$project."'> ".$storage_pool_data['name']."</a>";
echo '",';
echo '"' . htmlentities($storage_pool_data['description']) . '",';
echo '"' . htmlentities($storage_pool_data['driver']) . '",';
echo '"' . htmlentities($storage_pool_data['config']['source']) . '",';
echo '"' . htmlentities($storage_pool_data['config']['size']) . '",';
echo '"';
echo "<div class='dropdown no-arrow'>";
echo "<a class='dropdown-toggle' href='#' role='button' id='dropdownMenuLink' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>";
echo "<i class='fas fa-ellipsis-v fa-lg fa-fw text-gray-400'></i>";
echo "</a>";
echo "<div class='dropdown-menu dropdown-menu-right shadow animated--fade-in' aria-labelledby='dropdownMenuLink'>";
echo "<div class='dropdown-header'>Options:</div>";
echo "<a class='dropdown-item' href='#' onclick=loadStoragePoolJson('".$storage_pool_data['name']."')>Edit</a>";
echo "<a class='dropdown-item' href='#' onclick=deleteStoragePool('".$storage_pool_data['name']."')>Delete</a>";
echo "</div>";
echo "</div>";
echo '"';
echo " ]";
}
echo " ]}";
}
?>

View file

@ -1,78 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
if (isset($_GET['storage_pool']))
$storage_pool = filter_var(urldecode($_GET['storage_pool']), FILTER_SANITIZE_STRING);
if (isset($_GET['name']))
$name = filter_var(urldecode($_GET['name']), FILTER_SANITIZE_STRING);
if (isset($_GET['description']))
$description = filter_var(urldecode($_GET['description']), FILTER_SANITIZE_STRING);
if (isset($_GET['size']))
$size = filter_var(urldecode($_GET['size']), FILTER_SANITIZE_STRING);
if (isset($_GET['driver']))
$driver = filter_var(urldecode($_GET['driver']), FILTER_SANITIZE_STRING);
if (isset($_GET['repo']))
$repo = filter_var(urldecode($_GET['repo']), FILTER_SANITIZE_STRING);
//Instantiate the POST variable
if (isset($_POST['json']))
$json = $_POST['json'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Query DB to find remote
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Run the matching action
switch ($action) {
case "createStoragePoolForm":
$url = $url . "/1.0/storage-pools?project=" . $project;
if ($driver == "dir" || $driver == "ceph")
$data = escapeshellarg('{"driver": "'.$driver.'","name": "'.$name.'","description": "'.$description.'"}');
else
$data = escapeshellarg('{"config": {"size": "'.$size.'GB"},"driver": "'.$driver.'","name": "'.$name.'","description": "'.$description.'"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "createStoragePoolJson":
$url = $url . "/1.0/storage-pools?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "deleteStoragePool":
$url = $url . "/1.0/storage-pools/" . $storage_pool . "?project=" . $project;
$data = escapeshellarg('{}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE -d $data $url");
break;
case "updateStoragePool":
$url = $url . "/1.0/storage-pools/" . $storage_pool . "?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "renameStoragePool":
$url = $url . "/1.0/storage-pools/" . $storage_pool . "?project=" . $project;
$data = escapeshellarg('{"name": "' . $name . '"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "loadStoragePool":
$url = $url . "/1.0/storage-pools/" . $storage_pool . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
}
}
echo $results;
?>

View file

@ -1,79 +0,0 @@
<?php
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['pool']))
$pool = filter_var(urldecode($_GET['pool']), FILTER_SANITIZE_STRING);
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
$db_statement->bindValue(':id', $remote);
$db_results = $db_statement->execute();
while($row = $db_results->fetchArray()){
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/storage-pools/" . $pool . "/volumes?project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$storage_volume_urls = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($storage_volume_urls as $storage_volume_url){
$url = "https://" . $row['host'] . ":" . $row['port'] . $storage_volume_url . "?project=" . $project;
$storage_volume_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$storage_volume_data = json_decode($storage_volume_data, true);
$storage_volume_data = $storage_volume_data['metadata'];
if ($storage_volume_data['name'] == "")
continue;
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<i class='fas fa-hdd fa-lg' style='color:#4e73df'></i>";
echo '",';
echo '"' . htmlentities($storage_volume_data['name']) . '",';
echo '"' . htmlentities($storage_volume_data['type']) . '",';
echo '"';
$ii = 0;
foreach ($storage_volume_data['used_by'] as $item){
if ($ii >= 1)
echo ", ";
$ii++;
echo htmlentities($item);
}
echo '",';
echo '"';
echo "<div class='dropdown no-arrow'>";
echo "<a class='dropdown-toggle' href='#' role='button' id='dropdownMenuLink' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>";
echo "<i class='fas fa-ellipsis-v fa-lg fa-fw text-gray-400'></i>";
echo "</a>";
echo "<div class='dropdown-menu dropdown-menu-right shadow animated--fade-in' aria-labelledby='dropdownMenuLink'>";
echo "<div class='dropdown-header'>Options:</div>";
echo "<a class='dropdown-item' href='#' onclick=loadStorageVolumeJson('".$storage_volume_url."')>Edit</a>";
echo "<a class='dropdown-item' href='#' onclick=deleteStorageVolume('".$storage_volume_url."')>Delete</a>";
echo "</div>";
echo "</div>";
echo '"';
echo " ]";
}
echo " ]}";
}
?>

View file

@ -1,62 +0,0 @@
<?php
//Instantiate the GET variables
if (isset($_GET['remote']))
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
if (isset($_GET['project']))
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
if (isset($_GET['action']))
$action = filter_var(urldecode($_GET['action']), FILTER_SANITIZE_STRING);
if (isset($_GET['storage_pool']))
$storage_pool = filter_var(urldecode($_GET['storage_pool']), FILTER_SANITIZE_STRING);
if (isset($_GET['storage_volume_url']))
$storage_volume_url = filter_var(urldecode($_GET['storage_volume_url']), FILTER_SANITIZE_STRING);
if (isset($_GET['name']))
$image = filter_var(urldecode($_GET['name']), FILTER_SANITIZE_STRING);
if (isset($_GET['repo']))
$repo = filter_var(urldecode($_GET['repo']), FILTER_SANITIZE_STRING);
//Instantiate the POST variable
if (isset($_POST['json']))
$json = $_POST['json'];
//Set the curl variables
$cert = "/root/.config/lxc/client.crt";
$key = "/root/.config/lxc/client.key";
//Query DB to find remote
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db_results = $db->query("SELECT * FROM lxd_hosts WHERE id = $remote LIMIT 1");
while($res = $db_results->fetchArray()){
$url = "https://" . $res['host'] . ":" . $res['port'];
//Run the matching action
switch ($action) {
case "createStorageVolume":
$url = $url . "/1.0/storage-pools?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "deleteStorageVolume":
$url = $url . $storage_volume_url . "?project=" . $project;
$data = escapeshellarg('{}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE -d $data $url");
break;
case "updateStorageVolume":
$url = $url . $storage_volume_url . "?project=" . $project;
$data = escapeshellarg($json);
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X PUT -d $data $url");
break;
case "loadStorageVolume":
$url = $url . $storage_volume_url . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
}
}
echo $results;
?>

View file

@ -1,468 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="profilesBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Profile List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Profiles</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#createProfileModal">Create Profile</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="profileListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Profile List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Create Profile Modal-->
<div class="modal fade" id="createProfileModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Create Profile</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="form-tab" data-toggle="tab" href="#form" role="tab" aria-controls="form" aria-selected="true">Form</a>
</li>
<li class="nav-item">
<a class="nav-link" id="json-tab" data-toggle="tab" href="#json" role="tab" aria-controls="json" aria-selected="false">JSON</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="form" role="tabpanel" aria-labelledby="form-tab">
<br />
<div class="row">
<label class="col-3 col-form-label text-right">Name: </label>
<div class="col-7">
<div class="form-group">
<input type="text" id="profileNameCreate" class="form-control" placeholder="Profile Name" name="profile_name">
</div>
</div>
</div>
<div class="row">
<label class="col-3 col-form-label text-right">Description: </label>
<div class="col-7">
<div class="form-group">
<input type="text" id="profileDescriptionCreate" class="form-control" placeholder="Enter Description" name="profile_description">
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="createProfileForm()" data-dismiss="modal">Submit</a>
</div>
</div>
<div class="tab-pane fade" id="json" role="tabpanel" aria-labelledby="json-tab">
<br />
<div class="row">
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonCreateInput" rows="16" placeholder="Enter JSON data"></textarea>
</pre>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="createProfileJson()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Edit Profile Modal-->
<div class="modal fade" id="editProfileModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Profile</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label" id="profileNameEditInput"></label>
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonEditInput" rows="16" ></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="updateProfile()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- Rename Profile Modal-->
<div class="modal fade" id="renameProfileModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Rename Profile</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label text-right" id="newProfileName">Name:</label>
<div class="col-8">
<div class="form-group">
<input type="text" id="newInstanceName" class="form-control" placeholder="Profile name">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="renameProfile()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadProfileTable = true;
var operationNumber = "";
var profileToUpdate = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404 || operationData.status_code == 200){
operationNumber = "";
$('#spinner').hide();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadProfileTable == false){
$('#profileListTable').DataTable().ajax.reload();
}
if (loadProfileTable == true){
$('#profileListTable').DataTable( {
ajax: "./php/lxd/profile-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Name" },
{ title: "Description" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadProfileTable = false;
}
}
function createProfileForm(){
var profileNameCreate = $("#profileNameCreate").val();
var profileDescriptionCreate = $("#profileDescriptionCreate").val();
console.log("Info: creating profile");
$.get("./php/lxd/profiles.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&name=" + encodeURI(profileNameCreate) + "&description=" + encodeURI(profileDescriptionCreate) + "&action=createProfileForm", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function createProfileJson(){
var profileCreateJSON = $("#jsonCreateInput").val();
console.log("Info: creating profile");
$.post("./php/lxd/profiles.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=createProfileJson", {json: profileCreateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//Called by Edit action, loads JSON data of project
function loadProfileJson(profileToLoad){
console.log("Info: loading profile " + profileToLoad);
profileToUpdate = profileToLoad;
$.get("./php/lxd/profiles.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&profile=" + encodeURI(profileToLoad) + "&action=loadProfile", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
$("#profileNameEditInput").text("Name: " + profileToLoad);
$("#jsonEditInput").val(JSON.stringify(operationData.metadata, null, 2));
$("#editProfileModal").modal('show');
});
}
function updateProfile(){
var profileUpdateJSON = $("#jsonEditInput").val();
console.log("Info: updating profile " + profileToUpdate);
$.post("./php/lxd/profiles.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&profile=" + encodeURI(profileToUpdate) + "&action=updateProfile", {json: profileUpdateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function renameProfile(profileToRename){
console.log("Info: renaming profile " + profileToRename);
$.get("./php/lxd/profiles.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&name=" + encodeURI(profileToRename) + "&action=renameProfile", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function deleteProfile(profileToDelete){
console.log("Info: deleting profile " + profileToDelete);
$.get("./php/lxd/profiles.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&profile=" + encodeURI(profileToDelete) + "&action=deleteProfile", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#profilesBreadCrumb').text("profiles");
//Load the card contents
loadPageContent();
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,382 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="projectsBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Project List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Projects</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#createProjectModal">Create Project</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="projectListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Project List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Create Project Modal-->
<div class="modal fade" id="createProjectModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Create Project</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-2 col-form-label text-right">Name: </label>
<div class="col-9">
<div class="form-group text-right">
<input type="text" class="form-control" id="projectNameInput" required="required" placeholder="Project Name" name="name">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="createProject()" data-dismiss="modal">Ok</a>
</div>
</div>
</div>
</div>
<!-- Edit Project Modal-->
<div class="modal fade" id="editProjectModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Project</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label" id="projectNameEditInput"></label>
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonInput" rows="16" ></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="updateProject()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadProjectTable = true;
var operationNumber = "";
var projectToUpdate = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404 || operationData.status_code == 200){
operationNumber = "";
$('#spinner').hide();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadProjectTable == false){
$('#projectListTable').DataTable().ajax.reload();
}
if (loadProjectTable == true){
$('#projectListTable').DataTable( {
ajax: "./php/lxd/project-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Name" },
{ title: "Description" },
{ title: "Features Images" },
{ title: "Features Profiles" },
{ title: "Features Storage Volumes" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadProjectTable = false;
}
}
//API uses sync
function createProject(){
var projectToCreate = $("#projectNameInput").val();
console.log("Info: creating project " + projectToCreate);
$.get("./php/lxd/projects.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&name=" + encodeURI(projectToCreate) + "&action=createProject", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//Called by Edit action, loads JSON data of project
function loadProjectJson(projectToLoad){
console.log("Info: loading project " + projectToLoad);
projectToUpdate = projectToLoad;
$.get("./php/lxd/projects.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&name=" + encodeURI(projectToLoad) + "&action=loadProject", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
$("#projectNameEditInput").text("Name: " + projectToLoad);
$("#jsonInput").val(JSON.stringify(operationData.metadata, null, 2));
$("#editProjectModal").modal('show');
});
}
function updateProject(){
var projectUpdateJSON = $("#jsonInput").val();
console.log("Info: updating project " + projectToUpdate);
$.post("./php/lxd/projects.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectToUpdate) + "&action=updateProject",{json: projectUpdateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function deleteProject(projectToDelete){
console.log("Info: deleting project " + projectToDelete);
$.get("./php/lxd/projects.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&name=" + encodeURI(projectToDelete) + "&action=deleteProject", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#projectsBreadCrumb').text("projects");
//Load the card contents
loadPageContent();
//Populate the select options fields used in modals
$("#selectImageInput").load("./php/lxd/image-list-select.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#selectProfileInput").load("./php/lxd/profile-list-select.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,115 +0,0 @@
<!-- Sidebar - Brand -->
<a class="sidebar-brand d-flex align-items-center justify-content-center" href="index.html">
<div class="sidebar-brand-icon rotate-n-0">
<!--<img src="theme/images/logo-white.png" style="width: 2rem;"></img>-->
<i class="fas fa-cube" style="width: 2rem;"></i>
</div>
<div class="sidebar-brand-text mx-3"><span style="color: #e95420;">LXD</span>WARE</div>
</a>
<!-- Divider -->
<hr class="sidebar-divider">
<div id="main">
<!-- Nav Item - Instances -->
<li class="nav-item">
<a class="nav-link" id="instancesLinkSidebar" href="#">
<i class="fas fa-fw fa-cube"></i>
<span>Instances</span></a>
</li>
<!-- Nav Item - Images -->
<li class="nav-item">
<a class="nav-link" id="imagesLinkSidebar" href="#">
<i class="fas fa-fw fa-box-open"></i>
<span>Images</span></a>
</li>
<!-- Nav Item - Profiles -->
<li class="nav-item">
<a class="nav-link" id="profilesLinkSidebar" href="#">
<i class="fas fa-fw fa-address-card"></i>
<span>Profiles</span></a>
</li>
<!-- Nav Item - Networks -->
<li class="nav-item">
<a class="nav-link" id="networksLinkSidebar" href="#">
<i class="fas fa-fw fa-network-wired"></i>
<span>Networks</span></a>
</li>
<!-- Nav Item - Storage Pools-->
<li class="nav-item">
<a class="nav-link" id="storagePoolsLinkSidebar" href="#">
<i class="fas fa-fw fa-hdd"></i>
<span>Storage Pools</span></a>
</li>
</div>
<!-- Divider -->
<hr class="sidebar-divider">
<div class="secondary">
<!-- Nav Item - Cluster-->
<li class="nav-item">
<a class="nav-link" id="clusterLinkSidebar" href="#">
<i class="fas fa-fw fa-layer-group"></i>
<span>Cluster</span>
</a>
</li>
<!-- Nav Item - Projects-->
<li class="nav-item">
<a class="nav-link" id="projectsLinkSidebar" href="#">
<i class="fas fa-fw fa-project-diagram"></i>
<span>Projects</span>
</a>
</li>
<!-- Nav Item - Operations-->
<li class="nav-item">
<a class="nav-link" id="operationsLinkSidebar" href="#">
<i class="fas fa-fw fa-exchange-alt"></i>
<span>Operations</span>
</a>
</li>
<!-- Nav Item - Certificates-->
<li class="nav-item">
<a class="nav-link" id="certificatesLinkSidebar" href="#">
<i class="fas fa-fw fa-wallet"></i>
<span>Certificates</span>
</a>
</li>
</div>
<!-- Divider -->
<hr class="sidebar-divider">
<div class="secondary">
<!-- Nav Item - Image Simplestream Repositories-->
<li class="nav-item">
<a class="nav-link" id="simplestreamsLinkSidebar" href="#">
<i class="fas fa-fw fa-archive"></i>
<span>Simplestreams</span>
</a>
</li>
</div>
<script>
$("#instancesLinkSidebar").attr("href", "instances.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#imagesLinkSidebar").attr("href", "images.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#profilesLinkSidebar").attr("href", "profiles.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#networksLinkSidebar").attr("href", "networks.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#storagePoolsLinkSidebar").attr("href", "storage-pools.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#clusterLinkSidebar").attr("href", "cluster.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectsLinkSidebar").attr("href", "projects.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#operationsLinkSidebar").attr("href", "operations.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#certificatesLinkSidebar").attr("href", "certificates.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#simplestreamsLinkSidebar").attr("href", "simplestreams.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
</script>

View file

@ -1,301 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="simplestreamsBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Simplestreams List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Simplestreams</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addSimplestreamsModal">Add Simplestreams Host</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="simplestreamsListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Simplestreams List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Add Simplestreams Modal-->
<div class="modal fade" id="addSimplestreamsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Add Simplestreams Host</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label text-right">URL: </label>
<div class="col-8">
<div class="form-group">
<input type="text" class="form-control" id="hostInput" required="required" placeholder="https://images.linuxcontainers.org" name="host">
</div>
</div>
</div>
<div class="row">
<label class="col-4 col-form-label text-right">Alias: </label>
<div class="col-8">
<div class="form-group">
<input type="text" class="form-control" id="aliasInput" placeholder="Enter name of server" name="alias">
</div>
</div>
</div>
</div> <!-- End Modal Body-->
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="addSimplestreams()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadSimplestreamsTable = true;
function loadPageContent(){
if (loadSimplestreamsTable == false){
$('#simplestreamsListTable').DataTable().ajax.reload();
}
if (loadSimplestreamsTable == true){
$('#simplestreamsListTable').DataTable( {
ajax: "./php/lxd/simplestreams-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Host" },
{ title: "Alias" },
{ title: "Protocol" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadSimplestreamsTable = false;
}
}
function addSimplestreams(){
var hostName = $("#hostInput").val();
var aliasName = $("#aliasInput").val();
console.log("Info: adding simplestreams host " + hostName);
$.get("./php/lxd/simplestreams.php?host=" + encodeURI(hostName) + "&alias=" + encodeURI(aliasName) + "&action=addSimplestreams", function (data) {
console.log(data);
loadPageContent();
});
}
function removeSimplestreams(simplestreamsID){
console.log("Info: removing simplesteams host, id " + simplestreamsID);
$.get("./php/lxd/simplestreams.php?id=" + encodeURI(simplestreamsID) + "&action=removeSimplestreams", function (data) {
console.log(data);
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#simplestreamsBreadCrumb').text("simplestreams");
//Load the card contents
loadPageContent();
//Set page reload every 7 seconds
setInterval(function(){loadPageContent()}, 7000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,454 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="storagePoolsBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Storage Pool List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Storage Pools</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#createStoragePoolModal">Create Storage Pool</a>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="storagePoolListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Storage Pool List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Create Storage Pool Modal-->
<div class="modal fade" id="createStoragePoolModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Create Storage Pool</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="form-tab" data-toggle="tab" href="#form" role="tab" aria-controls="form" aria-selected="true">Form</a>
</li>
<li class="nav-item">
<a class="nav-link" id="json-tab" data-toggle="tab" href="#json" role="tab" aria-controls="json" aria-selected="false">JSON</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="form" role="tabpanel" aria-labelledby="form-tab">
<br />
<div class="row">
<label class="col-3 col-form-label text-right">Name: </label>
<div class="col-7">
<div class="form-group">
<input type="text" id="storagePoolNameCreate" class="form-control" placeholder="Storage Pool Name" name="storage_pool_name">
</div>
</div>
</div>
<div class="row">
<label class="col-3 col-form-label text-right">Description: </label>
<div class="col-7">
<div class="form-group">
<input type="text" id="storagePoolDescriptionCreate" class="form-control" placeholder="Enter Description" name="storage_pool_description">
</div>
</div>
</div>
<div class="row">
<label class="col-3 col-form-label text-right">Size (GB): </label>
<div class="col-4">
<div class="form-group">
<input type="number" id="storagePoolSizeCreate" class="form-control" name="storage_pool_size">
</div>
</div>
</div>
<div class="row">
<label class="col-3 col-form-label text-right">Driver: </label>
<div class="col-4">
<div class="form-group">
<select id="storagePoolDriverCreate" class="form-control" name="storage_pool_driver">
<option value="btrfs">btrfs</option>
<option value="ceph">ceph</option>
<option value="dir">dir</option>
<option value="lvm">lvm</option>
<option value="zfs" selected>zfs</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="createStoragePoolForm()" data-dismiss="modal">Submit</a>
</div>
</div>
<div class="tab-pane fade" id="json" role="tabpanel" aria-labelledby="json-tab">
<br />
<div class="row">
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonCreateInput" rows="16" placeholder="Enter JSON data"></textarea>
</pre>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="createStoragePoolJson()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Edit Storage Pool Modal-->
<div class="modal fade" id="editStoragePoolModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Storage Pool</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label" id="storagePoolNameEditInput"></label>
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonEditInput" rows="16" ></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="updateStoragePool()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
var loadStoragePoolTable = true;
var operationNumber = "";
var storagePoolToUpdate = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404 || operationData.status_code == 200){
operationNumber = "";
$('#spinner').hide();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadStoragePoolTable == false){
$('#storagePoolListTable').DataTable().ajax.reload();
}
if (loadStoragePoolTable == true){
$('#storagePoolListTable').DataTable( {
ajax: "./php/lxd/storage-pool-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Name" },
{ title: "Description" },
{ title: "Driver" },
{ title: "Source" },
{ title: "Size" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadStoragePoolTable = false;
}
}
//API uses sync
function createStoragePoolJson(){
var storagePoolCreateJSON = $("#jsonCreateInput").val();
console.log("Info: creating storage pool");
$.post("./php/lxd/storage-pools.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=createStoragePoolJson", {json: storagePoolCreateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
function createStoragePoolForm(){
var storagePoolNameCreate = $("#storagePoolNameCreate").val();
var storagePoolDescriptionCreate = $("#storagePoolDescriptionCreate").val();
var storagePoolSizeCreate = $("#storagePoolSizeCreate").val();
var storagePoolDriverCreate = $("#storagePoolDriverCreate").val();
console.log("Info: creating storage pool");
$.get("./php/lxd/storage-pools.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&name=" + encodeURI(storagePoolNameCreate) + "&description=" + encodeURI(storagePoolDescriptionCreate) + "&size=" + encodeURI(storagePoolSizeCreate)+ "&driver=" + encodeURI(storagePoolDriverCreate) + "&action=createStoragePoolForm", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//Called by Edit action, loads JSON data of project
function loadStoragePoolJson(storagePoolToLoad){
console.log("Info: loading storage pool " + storagePoolToLoad);
storagePoolToUpdate = storagePoolToLoad;
$.get("./php/lxd/storage-pools.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&storage_pool=" + encodeURI(storagePoolToLoad) + "&action=loadStoragePool", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
$("#storagePoolNameEditInput").text("Name: " + storagePoolToLoad);
$("#jsonEditInput").val(JSON.stringify(operationData.metadata, null, 2));
$("#editStoragePoolModal").modal('show');
});
}
function updateStoragePool(){
var storagePoolUpdateJSON = $("#jsonEditInput").val();
console.log("Info: updating storage pool " + storagePoolToUpdate);
$.post("./php/lxd/storage-pools.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&storage_pool=" + encodeURI(storagePoolToUpdate) + "&action=updateStoragePool", {json: storagePoolUpdateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function deleteStoragePool(storagePoolToDelete){
console.log("Info: deleting storage pool " + storagePoolToDelete);
$.get("./php/lxd/storage-pools.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&storage_pool=" + encodeURI(storagePoolToDelete) + "&action=deleteStoragePool", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#storagePoolsBreadCrumb').text("storage pools");
//Load the card contents
loadPageContent();
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,381 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" href="theme/images/logo-white.png">
<title>LXDWARE</title>
<!-- Custom fonts for this template-->
<link href="theme/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="theme/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom styles for this page -->
<link href="theme/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">
<div id="sidebarLinks"></div>
<!-- Divider -->
<hr class="sidebar-divider d-none d-md-block">
<!-- Sidebar Toggler (Sidebar) -->
<div class="text-center d-none d-md-inline">
<button class="rounded-circle border-0" id="sidebarToggle"></button>
</div>
</ul>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<nav class="navbar navbar-expand navbar-light bg-white topbar mb-4 static-top shadow">
<!-- Sidebar Toggle (Topbar) -->
<button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
<i class="fa fa-bars"></i>
</button>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown no-arrow" id="remoteListNav">
</li>
<li class="nav-item dropdown no-arrow" id="projectListNav">
</li>
<div class="nav-item spinner-grow text-primary m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
<div class="topbar-divider d-none d-sm-block"></div>
<!-- Nav Item - User Information -->
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="mr-2 d-none d-lg-inline text-gray-600 small">Admin</span>
</a>
<!-- Dropdown - User Information -->
<div class="dropdown-menu dropdown-menu-right shadow animated--grow-in" aria-labelledby="userDropdown">
<a class="dropdown-item" href="index.html">
<i class="fas fa-server fa-sm fa-fw mr-2 text-gray-400"></i>
Hosts
</a>
</div>
</li>
</ul>
</nav>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- BreadCrumb -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" id="remoteBreadCrumb"></a></li>
<li class="breadcrumb-item"><a href="#" id="storagePoolsBreadCrumb"></a></li>
<li class="breadcrumb-item active" aria-current="page" id="storageVolumesBreadCrumb"></li>
</ol>
</nav>
<div class="row">
<div class="col-12">
<!-- Storage Volume List -->
<div class="card shadow mb-4">
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Storage Volumes</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Options:</div>
<!--<a class="dropdown-item" href="#" data-toggle="modal" data-target="#createStorageVolumeModal">Create Storage Volume</a>-->
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
<div class="table-responsive">
<table class="table" id="storageVolumeListTable" width="100%" cellspacing="0">
</table>
</div>
</div>
</div>
<!-- End Storage Volume List -->
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright &copy; lxdware.com 2020</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<!-- Create Storage Volume Modal-->
<div class="modal fade" id="createStorageVolumeModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Create Storage Volume</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonCreateInput" rows="16" placeholder="Enter JSON data"></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="createStorageVolume()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- Edit Storage Volume Modal-->
<div class="modal fade" id="editStorageVolumeModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Edit Storage Volume</h5>
<button class="close" type="button" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<label class="col-4 col-form-label" id="storageVolumeNameEditInput"></label>
<div class="col-12">
<div class="form-group text-right">
<pre>
<textarea name="json" class="form-control" id="jsonEditInput" rows="16" ></textarea>
</pre>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>
<a class="btn btn-primary" href="#" onclick="updateStorageVolume()" data-dismiss="modal">Submit</a>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="theme/vendor/jquery/jquery.min.js"></script>
<script src="theme/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="theme/vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="theme/js/sb-admin-2.min.js"></script>
<!-- Page level plugins -->
<script src="theme/vendor/datatables/jquery.dataTables.min.js"></script>
<script src="theme/vendor/datatables/dataTables.bootstrap4.min.js"></script>
</body>
<script>
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const remoteName = urlParams.get('remote');
const projectName = urlParams.get('project');
const storagePoolName = urlParams.get('pool');
var loadStorageVolumeTable = true;
var operationNumber = "";
var storageVolumeToUpdate = "";
function operationStatusCheck(data){
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code == 404 || operationData.status_code == 200){
operationNumber = "";
$('#spinner').hide();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
}
function loadPageContent(){
//Check the status of an operation if running
if (operationNumber != ""){
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName) + "&id=" + encodeURI(operationNumber) , operationStatusCheck);
}
if (loadStorageVolumeTable == false){
$('#storageVolumeListTable').DataTable().ajax.reload();
}
if (loadStorageVolumeTable == true){
$('#storageVolumeListTable').DataTable( {
ajax: "./php/lxd/storage-volume-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&pool=" + encodeURI(storagePoolName),
columns: [
{},
{ title: "Name" },
{ title: "Type" },
{ title: "Used by" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
loadStorageVolumeTable = false;
}
}
//API uses sync, NOT YET SETUP
function createStorageVolume(){
var storageVolumeCreateJSON = $("#jsonCreateInput").val();
console.log("Info: creating storage volume");
$.post("./php/lxd/storage-volumes.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=createStorageVolume", {json: storageVolumeCreateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//Called by Edit action, loads JSON data of project
function loadStorageVolumeJson(storageVolumeToLoad){
console.log("Info: loading storage volume " + storageVolumeToLoad);
storageVolumeToUpdate = storageVolumeToLoad;
$.get("./php/lxd/storage-volumes.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&storage_volume_url=" + encodeURI(storageVolumeToLoad) + "&action=loadStorageVolume", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
$("#storageVolumeNameEditInput").text("Name: " + storageVolumeToLoad);
$("#jsonEditInput").val(JSON.stringify(operationData.metadata, null, 2));
$("#editStorageVolumeModal").modal('show');
});
}
function updateStorageVolume(){
var storageVolumeUpdateJSON = $("#jsonEditInput").val();
console.log("Info: updating storage volume " + storageVolumeToUpdate);
$.post("./php/lxd/storage-volumes.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&storage_volume_url=" + encodeURI(storageVolumeToUpdate) + "&action=updateStorageVolume", {json: storageVolumeUpdateJSON}, function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
//API uses sync
function deleteStorageVolume(storageVolumeToDelete){
console.log("Info: deleting storage volume " + storageVolumeToDelete);
$.get("./php/lxd/storage-volumes.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&storage_volume_url=" + encodeURI(storageVolumeToDelete) + "&action=deleteStorageVolume", function (data) {
var operationData = JSON.parse(data);
console.log(operationData);
if (operationData.error_code >= 400){
alert(operationData.error);
}
loadPageContent();
});
}
$(document).ready(function(){
//Load in the sidebar
$("#sidebarLinks").load("./sidebar.html");
//Setup Page Breadcrumb Links/Information
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$('#remoteBreadCrumb').attr("href", "host.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#storagePoolsBreadCrumb').text("storage pools");
$('#storagePoolsBreadCrumb').attr("href", "storage-pools.html?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$('#storageVolumesBreadCrumb').text(storagePoolName);
//Load the card contents
loadPageContent();
//Set page reload every 4 seconds
setInterval(function(){loadPageContent()}, 4000);
$("#remoteListNav").load("./php/lxd/remote-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
$("#projectListNav").load("./php/lxd/project-list-nav.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
});
</script>
</html>

View file

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2013-2019 Blackrock Digital LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,65 +0,0 @@
# [Start Bootstrap - SB Admin 2](https://startbootstrap.com/template-overviews/sb-admin-2/)
[SB Admin 2](https://startbootstrap.com/template-overviews/sb-admin-2/) is an open source admin dashboard theme for [Bootstrap](http://getbootstrap.com/) created by [Start Bootstrap](http://startbootstrap.com/).
For the legacy Bootstrap 3 version of this theme, you can view the [last stable release](https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/releases/tag/v3.3.7%2B1) of SB Admin 2 for Bootstrap 3.
## Preview
[![SB Admin 2 Preview](https://startbootstrap.com/assets/img/screenshots/themes/sb-admin-2.png)](https://blackrockdigital.github.io/startbootstrap-sb-admin-2/)
**[Launch Live Preview](https://blackrockdigital.github.io/startbootstrap-sb-admin-2/)**
## Status
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/BlackrockDigital/startbootstrap-sb-admin-2/master/LICENSE)
[![npm version](https://img.shields.io/npm/v/startbootstrap-sb-admin-2.svg)](https://www.npmjs.com/package/startbootstrap-sb-admin-2)
[![Build Status](https://travis-ci.org/BlackrockDigital/startbootstrap-sb-admin-2.svg?branch=master)](https://travis-ci.org/BlackrockDigital/startbootstrap-sb-admin-2)
[![dependencies Status](https://david-dm.org/BlackrockDigital/startbootstrap-sb-admin-2/status.svg)](https://david-dm.org/BlackrockDigital/startbootstrap-sb-admin-2)
[![devDependencies Status](https://david-dm.org/BlackrockDigital/startbootstrap-sb-admin-2/dev-status.svg)](https://david-dm.org/BlackrockDigital/startbootstrap-sb-admin-2?type=dev)
## Download and Installation
To begin using this template, choose one of the following options to get started:
- [Download the latest release on Start Bootstrap](https://startbootstrap.com/template-overviews/sb-admin-2/)
- Install via npm: `npm i startbootstrap-sb-admin-2`
- Clone the repo: `git clone https://github.com/BlackrockDigital/startbootstrap-sb-admin-2.git`
- [Fork, Clone, or Download on GitHub](https://github.com/BlackrockDigital/startbootstrap-sb-admin-2)
## Usage
After installation, run `npm install` and then run `npm start` which will open up a preview of the template in your default browser, watch for changes to core template files, and live reload the browser when changes are saved. You can view the `gulpfile.js` to see which tasks are included with the dev environment.
### Gulp Tasks
- `gulp` the default task that builds everything
- `gulp watch` browserSync opens the project in your default browser and live reloads when changes are made
- `gulp css` compiles SCSS files into CSS and minifies the compiled CSS
- `gulp js` minifies the themes JS file
- `gulp vendor` copies dependencies from node_modules to the vendor directory
You must have npm installed globally in order to use this build environment. This theme was built using node v11.6.0 and the Gulp CLI v2.0.1. If Gulp is not running properly after running `npm install`, you may need to update node and/or the Gulp CLI locally.
## Bugs and Issues
Have a bug or an issue with this template? [Open a new issue](https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/issues) here on GitHub or leave a comment on the [template overview page at Start Bootstrap](http://startbootstrap.com/template-overviews/sb-admin-2/).
## About
Start Bootstrap is an open source library of free Bootstrap templates and themes. All of the free templates and themes on Start Bootstrap are released under the MIT license, which means you can use them for any purpose, even for commercial projects.
- <https://startbootstrap.com>
- <https://twitter.com/SBootstrap>
Start Bootstrap was created by and is maintained by **[David Miller](http://davidmiller.io/)**.
- <http://davidmiller.io>
- <https://twitter.com/davidmillerskt>
- <https://github.com/davidtmiller>
Start Bootstrap is based on the [Bootstrap](http://getbootstrap.com/) framework created by [Mark Otto](https://twitter.com/mdo) and [Jacob Thorton](https://twitter.com/fat).
## Copyright and License
Copyright 2013-2019 Blackrock Digital LLC. Code released under the [MIT](https://github.com/BlackrockDigital/startbootstrap-resume/blob/gh-pages/LICENSE) license.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

View file

@ -1,49 +0,0 @@
(function($) {
"use strict"; // Start of use strict
// Toggle the side navigation
$("#sidebarToggle, #sidebarToggleTop").on('click', function(e) {
$("body").toggleClass("sidebar-toggled");
$(".sidebar").toggleClass("toggled");
if ($(".sidebar").hasClass("toggled")) {
$('.sidebar .collapse').collapse('hide');
};
});
// Close any open menu accordions when window is resized below 768px
$(window).resize(function() {
if ($(window).width() < 768) {
$('.sidebar .collapse').collapse('hide');
};
});
// Prevent the content wrapper from scrolling when the fixed side navigation hovered over
$('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function(e) {
if ($(window).width() > 768) {
var e0 = e.originalEvent,
delta = e0.wheelDelta || -e0.detail;
this.scrollTop += (delta < 0 ? 1 : -1) * 30;
e.preventDefault();
}
});
// Scroll to top button appear
$(document).on('scroll', function() {
var scrollDistance = $(this).scrollTop();
if (scrollDistance > 100) {
$('.scroll-to-top').fadeIn();
} else {
$('.scroll-to-top').fadeOut();
}
});
// Smooth scrolling using jQuery easing
$(document).on('click', 'a.scroll-to-top', function(e) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: ($($anchor.attr('href')).offset().top)
}, 1000, 'easeInOutExpo');
e.preventDefault();
});
})(jQuery); // End of use strict

View file

@ -1,7 +0,0 @@
/*!
* Start Bootstrap - SB Admin 2 v4.0.7 (https://startbootstrap.com/template-overviews/sb-admin-2)
* Copyright 2013-2019 Start Bootstrap
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/blob/master/LICENSE)
*/
!function(t){"use strict";t("#sidebarToggle, #sidebarToggleTop").on("click",function(o){t("body").toggleClass("sidebar-toggled"),t(".sidebar").toggleClass("toggled"),t(".sidebar").hasClass("toggled")&&t(".sidebar .collapse").collapse("hide")}),t(window).resize(function(){t(window).width()<768&&t(".sidebar .collapse").collapse("hide")}),t("body.fixed-nav .sidebar").on("mousewheel DOMMouseScroll wheel",function(o){if(768<t(window).width()){var e=o.originalEvent,l=e.wheelDelta||-e.detail;this.scrollTop+=30*(l<0?1:-1),o.preventDefault()}}),t(document).on("scroll",function(){100<t(this).scrollTop()?t(".scroll-to-top").fadeIn():t(".scroll-to-top").fadeOut()}),t(document).on("click","a.scroll-to-top",function(o){var e=t(this);t("html, body").stop().animate({scrollTop:t(e.attr("href")).offset().top},1e3,"easeInOutExpo"),o.preventDefault()})}(jQuery);

View file

@ -1,52 +0,0 @@
.btn-circle {
border-radius: 100%;
height: 2.5rem;
width: 2.5rem;
font-size: 1rem;
display: inline-flex;
align-items: center;
justify-content: center;
&.btn-sm {
height: 1.8rem;
width: 1.8rem;
font-size: 0.75rem;
}
&.btn-lg {
height: 3.5rem;
width: 3.5rem;
font-size: 1.35rem;
}
}
.btn-icon-split {
padding: 0;
overflow: hidden;
display: inline-flex;
align-items: stretch;
justify-content: center;
.icon {
background: fade-out($black, .85);
display: inline-block;
padding: $btn-padding-y $btn-padding-x;
}
.text {
display: inline-block;
padding: $btn-padding-y $btn-padding-x;
}
&.btn-sm {
.icon {
padding: $btn-padding-y-sm $btn-padding-x-sm;
}
.text {
padding: $btn-padding-y-sm $btn-padding-x-sm;
}
}
&.btn-lg {
.icon {
padding: $btn-padding-y-lg $btn-padding-x-lg;
}
.text {
padding: $btn-padding-y-lg $btn-padding-x-lg;
}
}
}

View file

@ -1,36 +0,0 @@
// Custom Card Styling
.card {
.card-header {
// Format Dropdowns in Card Headings
.dropdown {
line-height: 1;
.dropdown-menu {
line-height: 1.5;
}
}
}
// Collapsable Card Styling
.card-header[data-toggle="collapse"] {
text-decoration: none;
position: relative;
padding: 0.75rem 3.25rem 0.75rem 1.25rem;
&::after {
position: absolute;
right: 0;
top: 0;
padding-right: 1.725rem;
line-height: 51px;
font-weight: 900;
content: '\f107';
font-family: 'Font Awesome 5 Free';
color: $gray-400;
}
&.collapsed {
border-radius: $card-border-radius;
&::after {
content: '\f105';
}
}
}
}

View file

@ -1,29 +0,0 @@
// Area Chart
.chart-area {
position: relative;
height: 10rem;
width: 100%;
@include media-breakpoint-up(md) {
height: 20rem;
}
}
// Bar Chart
.chart-bar {
position: relative;
height: 10rem;
width: 100%;
@include media-breakpoint-up(md) {
height: 20rem;
}
}
// Pie Chart
.chart-pie {
position: relative;
height: 15rem;
width: 100%;
@include media-breakpoint-up(md) {
height: calc(20rem - 43px) !important;
}
}

View file

@ -1,21 +0,0 @@
// Custom Dropdown Styling
.dropdown {
.dropdown-menu {
font-size: $dropdown-font-size;
.dropdown-header {
@extend .text-uppercase;
font-weight: 800;
font-size: 0.65rem;
color: $gray-500;
}
}
}
// Utility class to hide arrow from dropdown
.dropdown.no-arrow {
.dropdown-toggle::after {
display: none;
}
}

View file

@ -1,52 +0,0 @@
// Lucas Bebber's Glitch Effect
// Tutorial and CSS from CSS Tricks
// https://css-tricks.com/glitch-effect-text-images-svg/
.error {
color: $gray-800;
font-size: 7rem;
position: relative;
line-height: 1;
width: 12.5rem;
}
@keyframes noise-anim {
$steps: 20;
@for $i from 0 through $steps {
#{percentage($i*(1/$steps))} {
clip: rect(random(100)+px,9999px,random(100)+px,0);
}
}
}
.error:after {
content: attr(data-text);
position: absolute;
left: 2px;
text-shadow: -1px 0 $red;
top: 0;
color: $gray-800;
background: $gray-100;
overflow: hidden;
clip: rect(0,900px,0,0);
animation: noise-anim 2s infinite linear alternate-reverse;
}
@keyframes noise-anim-2 {
$steps: 20;
@for $i from 0 through $steps {
#{percentage($i*(1/$steps))} {
clip: rect(random(100)+px,9999px,random(100)+px,0);
}
}
}
.error:before {
content: attr(data-text);
position: absolute;
left: -2px;
text-shadow: 1px 0 $blue;
top: 0;
color: $gray-800;
background: $gray-100;
overflow: hidden;
clip: rect(0,900px,0,0);
animation: noise-anim-2 3s infinite linear alternate-reverse;
}

View file

@ -1,14 +0,0 @@
footer.sticky-footer {
padding: 2rem 0;
flex-shrink: 0;
.copyright {
line-height: 1;
font-size: 0.8rem;
}
}
body.sidebar-toggled {
footer.sticky-footer {
width: 100%;
}
}

View file

@ -1,60 +0,0 @@
// Global component styles
html {
position: relative;
min-height: 100%;
}
body {
height: 100%;
}
a {
&:focus {
outline: none;
}
}
// Main page wrapper
#wrapper {
display: flex;
#content-wrapper {
background-color: $gray-100;
width: 100%;
overflow-x: hidden;
#content {
flex: 1 0 auto;
}
}
}
// Set container padding to match gutter width instead of default 15px
.container,
.container-fluid {
padding-left: $grid-gutter-width;
padding-right: $grid-gutter-width;
}
// Scroll to top button
.scroll-to-top {
position: fixed;
right: 1rem;
bottom: 1rem;
display: none;
width: 2.75rem;
height: 2.75rem;
text-align: center;
color: $white;
background: fade-out($gray-800, .5);
line-height: 46px;
&:focus,
&:hover {
color: white;
}
&:hover {
background: $gray-800;
}
i {
font-weight: 800;
}
}

View file

@ -1,50 +0,0 @@
// Pulling these images from Unsplash
// Toshi the dog from https://unsplash.com/@charlesdeluvio - what a funny dog...
.bg-login-image {
background: url('https://source.unsplash.com/K4mSJ7kc0As/600x800');
background-position: center;
background-size: cover;
}
.bg-register-image {
background: url('https://source.unsplash.com/Mv9hjnEUHR4/600x800');
background-position: center;
background-size: cover;
}
.bg-password-image {
background: url('https://source.unsplash.com/oWTW-jNGl9I/600x800');
background-position: center;
background-size: cover;
}
form.user {
.custom-checkbox.small {
label {
line-height: 1.5rem;
}
}
.form-control-user {
font-size: 0.8rem;
border-radius: 10rem;
padding: 1.5rem 1rem;
}
.btn-user {
font-size: 0.8rem;
border-radius: 10rem;
padding: 0.75rem 1rem;
}
}
.btn-google {
@include button-variant($brand-google, $white);
}
.btn-facebook {
@include button-variant($brand-facebook, $white);
}

View file

@ -1 +0,0 @@

View file

@ -1,3 +0,0 @@
@import "navs/global.scss";
@import "navs/topbar.scss";
@import "navs/sidebar.scss";

View file

@ -1,7 +0,0 @@
@import "utilities/animation.scss";
@import "utilities/background.scss";
@import "utilities/display.scss";
@import "utilities/text.scss";
@import "utilities/border.scss";
@import "utilities/progress.scss";
@import "utilities/rotate.scss";

View file

@ -1,76 +0,0 @@
// Override Bootstrap default variables here
// Do not edit any of the files in /vendor/bootstrap/scss/!
// Color Variables
// Bootstrap Color Overrides
$white: #fff !default;
$gray-100: #f8f9fc !default;
$gray-200: #eaecf4 !default;
$gray-300: #dddfeb !default;
$gray-400: #d1d3e2 !default;
$gray-500: #b7b9cc !default;
$gray-600: #858796 !default;
$gray-700: #6e707e !default;
$gray-800: #5a5c69 !default;
$gray-900: #3a3b45 !default;
$black: #000 !default;
$blue: #4e73df !default;
$indigo: #6610f2 !default;
$purple: #6f42c1 !default;
$pink: #e83e8c !default;
$red: #e74a3b !default;
$orange: #fd7e14 !default;
$yellow: #f6c23e !default;
$green: #1cc88a !default;
$teal: #20c9a6 !default;
$cyan: #36b9cc !default;
// Custom Colors
$brand-google: #ea4335;
$brand-facebook: #3b5998;
// Set Contrast Threshold
$yiq-contrasted-threshold: 195 !default;
// Typography
$body-color: $gray-600 !default;
$font-family-sans-serif: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", 'Noto Color Emoji' !default;
$font-weight-light: 300 !default;
// $font-weight-base: 400;
$headings-font-weight: 400 !default;
// Shadows
$box-shadow-sm: 0 0.125rem 0.25rem 0 rgba($gray-900, .2) !default;
$box-shadow: 0 0.15rem 1.75rem 0 rgba($gray-900, .15) !default;
// $box-shadow-lg: 0 1rem 3rem rgba($black, .175) !default;
// Borders Radius
$border-radius: 0.35rem !default;
$border-color: darken($gray-200, 2%);
// Spacing Variables
// Change below variable if the height of the navbar changes
$topbar-base-height: 4.375rem;
// Change below variable to change the width of the sidenav
$sidebar-base-width: 14rem;
// Change below variable to change the width of the sidenav when collapsed
$sidebar-collapsed-width: 6.5rem;
// Card
$card-cap-bg: $gray-100;
$card-border-color: $border-color;
// Adjust column spacing for symmetry
$spacer: 1rem;
$grid-gutter-width: $spacer * 1.5;
// Transitions
$transition-collapse: height .15s ease !default;
// Dropdowns
$dropdown-font-size: 0.85rem;
$dropdown-border-color: $border-color;

View file

@ -1,42 +0,0 @@
// Global styles for both custom sidebar and topbar compoments
.sidebar,
.topbar {
.nav-item {
// Customize Dropdown Arrows for Navbar
&.dropdown {
.dropdown-toggle {
&::after {
width: 1rem;
text-align: center;
float: right;
vertical-align: 0;
border: 0;
font-weight: 900;
content: '\f105';
font-family: 'Font Awesome 5 Free';
}
}
&.show {
.dropdown-toggle::after {
content: '\f107';
}
}
}
// Counter for nav links and nav link image sizing
.nav-link {
position: relative;
.badge-counter {
position: absolute;
transform: scale(0.7);
transform-origin: top right;
right: .25rem;
margin-top: -.25rem;
}
.img-profile {
height: 2rem;
width: 2rem;
}
}
}
}

View file

@ -1,372 +0,0 @@
// Sidebar
.sidebar {
width: $sidebar-collapsed-width;
min-height: 100vh;
.nav-item {
position: relative;
&:last-child {
margin-bottom: 1rem;
}
.nav-link {
text-align: center;
padding: 0.75rem 1rem;
width: $sidebar-collapsed-width;
span {
font-size: 0.65rem;
display: block;
}
}
&.active {
.nav-link {
font-weight: 700;
}
}
// Accordion
.collapse {
position: absolute;
left: calc(#{$sidebar-collapsed-width} + #{$grid-gutter-width} / 2);
z-index: 1;
top: 2px;
// Grow In Animation
@extend .animated--grow-in;
.collapse-inner {
border-radius: $border-radius;
box-shadow: $box-shadow;
}
}
.collapsing {
display: none;
transition: none;
}
.collapse,
.collapsing {
.collapse-inner {
padding: .5rem 0;
min-width: 10rem;
font-size: $dropdown-font-size;
margin: 0 0 1rem 0;
.collapse-header {
margin: 0;
white-space: nowrap;
padding: .5rem 1.5rem;
text-transform: uppercase;
font-weight: 800;
font-size: 0.65rem;
color: $gray-500;
}
.collapse-item {
padding: 0.5rem 1rem;
margin: 0 0.5rem;
display: block;
color: $gray-900;
text-decoration: none;
border-radius: $border-radius;
white-space: nowrap;
&:hover {
background-color: $gray-200;
}
&:active {
background-color: $gray-300;
}
&.active {
color: $primary;
font-weight: 700;
}
}
}
}
}
#sidebarToggle {
width: 2.5rem;
height: 2.5rem;
text-align: center;
margin-bottom: 1rem;
cursor: pointer;
&::after {
font-weight: 900;
content: '\f104';
font-family: 'Font Awesome 5 Free';
margin-right: 0.1rem;
}
&:hover {
text-decoration: none;
}
&:focus {
outline: none;
}
}
&.toggled {
width: 0 !important;
overflow: hidden;
#sidebarToggle::after {
content: '\f105';
font-family: 'Font Awesome 5 Free';
margin-left: 0.25rem;
}
}
.sidebar-brand {
height: $topbar-base-height;
text-decoration: none;
font-size: 1rem;
font-weight: 800;
padding: 1.5rem 1rem;
text-align: center;
text-transform: uppercase;
letter-spacing: 0.05rem;
z-index: 1;
.sidebar-brand-icon i {
font-size: 2rem;
}
.sidebar-brand-text {
display: none;
}
}
hr.sidebar-divider {
margin: 0 1rem 1rem;
}
.sidebar-heading {
text-align: center;
padding: 0 1rem;
font-weight: 800;
font-size: 0.65rem;
@extend .text-uppercase;
}
}
@include media-breakpoint-up(md) {
.sidebar {
width: $sidebar-base-width !important;
.nav-item {
// Accordion
.collapse {
position: relative;
left: 0;
z-index: 1;
top: 0;
animation: none;
.collapse-inner {
border-radius: 0;
box-shadow: none;
}
}
.collapsing {
display: block;
transition: $transition-collapse;
}
.collapse,
.collapsing {
margin: 0 1rem;
}
.nav-link {
display: block;
width: 100%;
text-align: left;
padding: 1rem;
width: $sidebar-base-width;
i {
font-size: 0.85rem;
margin-right: 0.25rem;
}
span {
font-size: 0.85rem;
display: inline;
}
// Accordion Arrow Icon
&[data-toggle="collapse"] {
&::after {
width: 1rem;
text-align: center;
float: right;
vertical-align: 0;
border: 0;
font-weight: 900;
content: '\f107';
font-family: 'Font Awesome 5 Free';
}
&.collapsed::after {
content: '\f105';
}
}
}
}
.sidebar-brand {
.sidebar-brand-icon i {
font-size: 2rem;
}
.sidebar-brand-text {
display: inline;
}
}
.sidebar-heading {
text-align: left;
}
&.toggled {
overflow: visible;
width: $sidebar-collapsed-width !important;
.nav-item {
// Accordion
.collapse {
position: absolute;
left: calc(#{$sidebar-collapsed-width} + #{$grid-gutter-width} / 2);
z-index: 1;
top: 2px;
// Grow In Animation for Toggled State
animation-name: growIn;
animation-duration: 200ms;
animation-timing-function: transform cubic-bezier(.18,1.25,.4,1), opacity cubic-bezier(0,1,.4,1);
.collapse-inner {
box-shadow: $box-shadow;
border-radius: $border-radius;
}
}
.collapsing {
display: none;
transition: none;
}
.collapse,
.collapsing {
margin: 0;
}
&:last-child {
margin-bottom: 1rem;
}
.nav-link {
text-align: center;
padding: 0.75rem 1rem;
width: $sidebar-collapsed-width;
span {
font-size: 0.65rem;
display: block;
}
i {
margin-right: 0;
}
&[data-toggle="collapse"]::after {
display: none;
}
}
}
.sidebar-brand {
.sidebar-brand-icon i {
font-size: 2rem;
}
.sidebar-brand-text {
display: none;
}
}
.sidebar-heading {
text-align: center;
}
}
}
}
// Sidebar Color Variants
// Sidebar Light
.sidebar-light {
.sidebar-brand {
color: $gray-700;
}
hr.sidebar-divider {
border-top: 1px solid $gray-200;
}
.sidebar-heading {
color: $gray-500;
}
.nav-item {
.nav-link {
color: $gray-600;
i {
color: $gray-400;
}
&:active,
&:focus,
&:hover {
color: $gray-700;
i {
color: $gray-700;
}
}
// Accordion
&[data-toggle="collapse"]::after {
color: $gray-500;
}
}
&.active {
.nav-link {
color: $gray-700;
i {
color: $gray-700;
}
}
}
}
// Color the sidebar toggler
#sidebarToggle {
background-color: $gray-200;
&::after {
color: $gray-500;
}
&:hover {
background-color: $gray-300;
}
}
}
// Sidebar Dark
.sidebar-dark {
.sidebar-brand {
color: $white;
}
hr.sidebar-divider {
border-top: 1px solid fade-out($white, 0.85);
}
.sidebar-heading {
color: fade-out($white, 0.6);
}
.nav-item {
.nav-link {
color: fade-out($white, 0.2);
i {
color: fade-out($white, 0.7);
}
&:active,
&:focus,
&:hover {
color: $white;
i {
color: $white;
}
}
// Accordion
&[data-toggle="collapse"]::after {
color: fade-out($white, 0.5);
}
}
&.active {
.nav-link {
color: $white;
i {
color: $white;
}
}
}
}
// Color the sidebar toggler
#sidebarToggle {
background-color: fade-out($white, 0.8);
&::after {
color: fade-out($white, 0.5);
}
&:hover {
background-color: fade-out($white, 0.75);
}
}
&.toggled {
#sidebarToggle::after {
color: fade-out($white, 0.5);
}
}
}

View file

@ -1,130 +0,0 @@
// Topbar
.topbar {
height: $topbar-base-height;
#sidebarToggleTop {
height: 2.5rem;
width: 2.5rem;
&:hover {
background-color: $gray-200;
}
&:active {
background-color: $gray-300;
}
}
.navbar-search {
width: 25rem;
input {
font-size: 0.85rem;
height: auto;
}
}
.topbar-divider {
width: 0;
border-right: 1px solid $border-color;
height: calc(#{$topbar-base-height} - 2rem);
margin: auto 1rem;
}
.nav-item {
.nav-link {
height: $topbar-base-height;
display: flex;
align-items: center;
padding: 0 0.75rem;
&:focus {
outline: none;
}
}
&:focus {
outline: none;
}
}
.dropdown {
position: static;
.dropdown-menu {
width: calc(100% - #{$grid-gutter-width});
right: $grid-gutter-width / 2;
}
}
.dropdown-list {
padding: 0;
border: none;
overflow: hidden;
.dropdown-header {
background-color: $primary;
border: 1px solid $primary;
padding-top: 0.75rem;
padding-bottom: 0.75rem;
color: $white;
}
.dropdown-item {
white-space: normal;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
border-left: 1px solid $border-color;
border-right: 1px solid $border-color;
border-bottom: 1px solid $border-color;
line-height: 1.3rem;
.dropdown-list-image {
position: relative;
height: 2.5rem;
width: 2.5rem;
img {
height: 2.5rem;
width: 2.5rem;
}
.status-indicator {
background-color: $gray-200;
height: 0.75rem;
width: 0.75rem;
border-radius: 100%;
position: absolute;
bottom: 0;
right: 0;
border: .125rem solid $white;
}
}
.text-truncate {
max-width: 10rem;
}
&:active {
background-color: $gray-200;
color: $gray-900;
}
}
}
@include media-breakpoint-up(sm) {
.dropdown {
position: relative;
.dropdown-menu {
width: auto;
right: 0;
}
}
.dropdown-list {
width: 20rem !important;
.dropdown-item {
.text-truncate {
max-width: 13.375rem;
}
}
}
}
}
.topbar.navbar-dark {}
.topbar.navbar-light {
.navbar-nav {
.nav-item {
.nav-link {
color: $gray-400;
&:hover {
color: $gray-500;
}
&:active {
color: $gray-600;
}
}
}
}
}

View file

@ -1,20 +0,0 @@
// Import Custom SB Admin 2 Variables (Overrides Default Bootstrap Variables)
@import "variables.scss";
// Import Bootstrap
@import "../vendor/bootstrap/scss/bootstrap.scss";
// Import Custom SB Admin 2 Mixins and Components
@import "mixins.scss";
@import "global.scss";
@import "utilities.scss";
// Custom Components
@import "dropdowns.scss";
@import "navs.scss";
@import "buttons.scss";
@import "cards.scss";
@import "charts.scss";
@import "login.scss";
@import "error.scss";
@import "footer.scss";

View file

@ -1,37 +0,0 @@
// Animation Utilities
// Grow In Animation
@keyframes growIn {
0% {
transform: scale(0.9);
opacity: 0;
}
100% {
transform: scale(1);
opacity: 1;
}
}
.animated--grow-in {
animation-name: growIn;
animation-duration: 200ms;
animation-timing-function: transform cubic-bezier(.18,1.25,.4,1), opacity cubic-bezier(0,1,.4,1);
}
// Fade In Animation
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.animated--fade-in {
animation-name: fadeIn;
animation-duration: 200ms;
animation-timing-function: opacity cubic-bezier(0,1,.4,1);
}

View file

@ -1,17 +0,0 @@
// Background Gradient Utilities
@each $color, $value in $theme-colors {
.bg-gradient-#{$color} {
background-color: $value;
background-image: linear-gradient(180deg, $value 10%, darken($value, 15%) 100%);
background-size: cover;
}
}
// Grayscale Background Utilities
@each $level, $value in $grays {
.bg-gray-#{$level} {
background-color: $value !important;
}
}

View file

@ -1,7 +0,0 @@
@each $color, $value in $theme-colors {
@each $position in ['left', 'bottom'] {
.border-#{$position}-#{$color} {
border-#{$position}: .25rem solid $value !important;
}
}
}

View file

@ -1,4 +0,0 @@
// Overflow Hidden
.o-hidden {
overflow: hidden !important;
}

View file

@ -1,3 +0,0 @@
.progress-sm {
height: .5rem;
}

View file

@ -1,7 +0,0 @@
.rotate-15 {
transform: rotate(15deg);
}
.rotate-n-15 {
transform: rotate(-15deg);
}

View file

@ -1,54 +0,0 @@
// Grayscale Text Utilities
.text-xs {
font-size: .7rem;
}
.text-lg {
font-size: 1.2rem;
}
.text-gray-100 {
color: $gray-100 !important;
}
.text-gray-200 {
color: $gray-200 !important;
}
.text-gray-300 {
color: $gray-300 !important;
}
.text-gray-400 {
color: $gray-400 !important;
}
.text-gray-500 {
color: $gray-500 !important;
}
.text-gray-600 {
color: $gray-600 !important;
}
.text-gray-700 {
color: $gray-700 !important;
}
.text-gray-800 {
color: $gray-800 !important;
}
.text-gray-900 {
color: $gray-900 !important;
}
.icon-circle {
height: 2.5rem;
width: 2.5rem;
border-radius: 100%;
display: flex;
align-items: center;
justify-content: center;
}

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,51 +0,0 @@
//
// Base styles
//
.alert {
position: relative;
padding: $alert-padding-y $alert-padding-x;
margin-bottom: $alert-margin-bottom;
border: $alert-border-width solid transparent;
@include border-radius($alert-border-radius);
}
// Headings for larger alerts
.alert-heading {
// Specified to prevent conflicts of changing $headings-color
color: inherit;
}
// Provide class for links that match alerts
.alert-link {
font-weight: $alert-link-font-weight;
}
// Dismissible alerts
//
// Expand the right padding and account for the close button's positioning.
.alert-dismissible {
padding-right: $close-font-size + $alert-padding-x * 2;
// Adjust close link position
.close {
position: absolute;
top: 0;
right: 0;
padding: $alert-padding-y $alert-padding-x;
color: inherit;
}
}
// Alternate styles
//
// Generate contextual modifier classes for colorizing the alert.
@each $color, $value in $theme-colors {
.alert-#{$color} {
@include alert-variant(theme-color-level($color, $alert-bg-level), theme-color-level($color, $alert-border-level), theme-color-level($color, $alert-color-level));
}
}

View file

@ -1,54 +0,0 @@
// Base class
//
// Requires one of the contextual, color modifier classes for `color` and
// `background-color`.
.badge {
display: inline-block;
padding: $badge-padding-y $badge-padding-x;
@include font-size($badge-font-size);
font-weight: $badge-font-weight;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
@include border-radius($badge-border-radius);
@include transition($badge-transition);
@at-root a#{&} {
@include hover-focus {
text-decoration: none;
}
}
// Empty badges collapse automatically
&:empty {
display: none;
}
}
// Quick fix for badges in buttons
.btn .badge {
position: relative;
top: -1px;
}
// Pill badges
//
// Make them extra rounded with a modifier to replace v3's badges.
.badge-pill {
padding-right: $badge-pill-padding-x;
padding-left: $badge-pill-padding-x;
@include border-radius($badge-pill-border-radius);
}
// Colors
//
// Contextual variations (linked badges get darker on :hover).
@each $color, $value in $theme-colors {
.badge-#{$color} {
@include badge-variant($value);
}
}

View file

@ -1,41 +0,0 @@
.breadcrumb {
display: flex;
flex-wrap: wrap;
padding: $breadcrumb-padding-y $breadcrumb-padding-x;
margin-bottom: $breadcrumb-margin-bottom;
list-style: none;
background-color: $breadcrumb-bg;
@include border-radius($breadcrumb-border-radius);
}
.breadcrumb-item {
// The separator between breadcrumbs (by default, a forward-slash: "/")
+ .breadcrumb-item {
padding-left: $breadcrumb-item-padding;
&::before {
display: inline-block; // Suppress underlining of the separator in modern browsers
padding-right: $breadcrumb-item-padding;
color: $breadcrumb-divider-color;
content: $breadcrumb-divider;
}
}
// IE9-11 hack to properly handle hyperlink underlines for breadcrumbs built
// without `<ul>`s. The `::before` pseudo-element generates an element
// *within* the .breadcrumb-item and thereby inherits the `text-decoration`.
//
// To trick IE into suppressing the underline, we give the pseudo-element an
// underline and then immediately remove it.
+ .breadcrumb-item:hover::before {
text-decoration: underline;
}
// stylelint-disable-next-line no-duplicate-selectors
+ .breadcrumb-item:hover::before {
text-decoration: none;
}
&.active {
color: $breadcrumb-active-color;
}
}

View file

@ -1,163 +0,0 @@
// stylelint-disable selector-no-qualifying-type
// Make the div behave like a button
.btn-group,
.btn-group-vertical {
position: relative;
display: inline-flex;
vertical-align: middle; // match .btn alignment given font-size hack above
> .btn {
position: relative;
flex: 1 1 auto;
// Bring the hover, focused, and "active" buttons to the front to overlay
// the borders properly
@include hover {
z-index: 1;
}
&:focus,
&:active,
&.active {
z-index: 1;
}
}
}
// Optional: Group multiple button groups together for a toolbar
.btn-toolbar {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
.input-group {
width: auto;
}
}
.btn-group {
// Prevent double borders when buttons are next to each other
> .btn:not(:first-child),
> .btn-group:not(:first-child) {
margin-left: -$btn-border-width;
}
// Reset rounded corners
> .btn:not(:last-child):not(.dropdown-toggle),
> .btn-group:not(:last-child) > .btn {
@include border-right-radius(0);
}
> .btn:not(:first-child),
> .btn-group:not(:first-child) > .btn {
@include border-left-radius(0);
}
}
// Sizing
//
// Remix the default button sizing classes into new ones for easier manipulation.
.btn-group-sm > .btn { @extend .btn-sm; }
.btn-group-lg > .btn { @extend .btn-lg; }
//
// Split button dropdowns
//
.dropdown-toggle-split {
padding-right: $btn-padding-x * .75;
padding-left: $btn-padding-x * .75;
&::after,
.dropup &::after,
.dropright &::after {
margin-left: 0;
}
.dropleft &::before {
margin-right: 0;
}
}
.btn-sm + .dropdown-toggle-split {
padding-right: $btn-padding-x-sm * .75;
padding-left: $btn-padding-x-sm * .75;
}
.btn-lg + .dropdown-toggle-split {
padding-right: $btn-padding-x-lg * .75;
padding-left: $btn-padding-x-lg * .75;
}
// The clickable button for toggling the menu
// Set the same inset shadow as the :active state
.btn-group.show .dropdown-toggle {
@include box-shadow($btn-active-box-shadow);
// Show no shadow for `.btn-link` since it has no other button styles.
&.btn-link {
@include box-shadow(none);
}
}
//
// Vertical button groups
//
.btn-group-vertical {
flex-direction: column;
align-items: flex-start;
justify-content: center;
> .btn,
> .btn-group {
width: 100%;
}
> .btn:not(:first-child),
> .btn-group:not(:first-child) {
margin-top: -$btn-border-width;
}
// Reset rounded corners
> .btn:not(:last-child):not(.dropdown-toggle),
> .btn-group:not(:last-child) > .btn {
@include border-bottom-radius(0);
}
> .btn:not(:first-child),
> .btn-group:not(:first-child) > .btn {
@include border-top-radius(0);
}
}
// Checkbox and radio options
//
// In order to support the browser's form validation feedback, powered by the
// `required` attribute, we have to "hide" the inputs via `clip`. We cannot use
// `display: none;` or `visibility: hidden;` as that also hides the popover.
// Simply visually hiding the inputs via `opacity` would leave them clickable in
// certain cases which is prevented by using `clip` and `pointer-events`.
// This way, we ensure a DOM element is visible to position the popover from.
//
// See https://github.com/twbs/bootstrap/pull/12794 and
// https://github.com/twbs/bootstrap/pull/14559 for more information.
.btn-group-toggle {
> .btn,
> .btn-group > .btn {
margin-bottom: 0; // Override default `<label>` value
input[type="radio"],
input[type="checkbox"] {
position: absolute;
clip: rect(0, 0, 0, 0);
pointer-events: none;
}
}
}

View file

@ -1,137 +0,0 @@
// stylelint-disable selector-no-qualifying-type
//
// Base styles
//
.btn {
display: inline-block;
font-family: $btn-font-family;
font-weight: $btn-font-weight;
color: $body-color;
text-align: center;
vertical-align: middle;
user-select: none;
background-color: transparent;
border: $btn-border-width solid transparent;
@include button-size($btn-padding-y, $btn-padding-x, $btn-font-size, $btn-line-height, $btn-border-radius);
@include transition($btn-transition);
@include hover {
color: $body-color;
text-decoration: none;
}
&:focus,
&.focus {
outline: 0;
box-shadow: $btn-focus-box-shadow;
}
// Disabled comes first so active can properly restyle
&.disabled,
&:disabled {
opacity: $btn-disabled-opacity;
@include box-shadow(none);
}
&:not(:disabled):not(.disabled):active,
&:not(:disabled):not(.disabled).active {
@include box-shadow($btn-active-box-shadow);
&:focus {
@include box-shadow($btn-focus-box-shadow, $btn-active-box-shadow);
}
}
}
// Future-proof disabling of clicks on `<a>` elements
a.btn.disabled,
fieldset:disabled a.btn {
pointer-events: none;
}
//
// Alternate buttons
//
@each $color, $value in $theme-colors {
.btn-#{$color} {
@include button-variant($value, $value);
}
}
@each $color, $value in $theme-colors {
.btn-outline-#{$color} {
@include button-outline-variant($value);
}
}
//
// Link buttons
//
// Make a button look and behave like a link
.btn-link {
font-weight: $font-weight-normal;
color: $link-color;
text-decoration: $link-decoration;
@include hover {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
}
&:focus,
&.focus {
text-decoration: $link-hover-decoration;
box-shadow: none;
}
&:disabled,
&.disabled {
color: $btn-link-disabled-color;
pointer-events: none;
}
// No need for an active state here
}
//
// Button Sizes
//
.btn-lg {
@include button-size($btn-padding-y-lg, $btn-padding-x-lg, $btn-font-size-lg, $btn-line-height-lg, $btn-border-radius-lg);
}
.btn-sm {
@include button-size($btn-padding-y-sm, $btn-padding-x-sm, $btn-font-size-sm, $btn-line-height-sm, $btn-border-radius-sm);
}
//
// Block button
//
.btn-block {
display: block;
width: 100%;
// Vertically space out multiple block buttons
+ .btn-block {
margin-top: $btn-block-spacing-y;
}
}
// Specificity overrides
input[type="submit"],
input[type="reset"],
input[type="button"] {
&.btn-block {
width: 100%;
}
}

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