Compare commits

..

43 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
3754 changed files with 172085 additions and 144852 deletions

View file

@ -1,22 +1,50 @@
#v1.1.5
-added CHANGELOG.md file
-modifed notifications to include any error message when downloading a new image
-added accessibility attributes to semantic icons, providing a popup text when hovering over icon
-changed notification spinner to bootstrap border spinner from grow spinner, making it less obtrusive
-relocated notification area to the left side of top nav bar to help with various notification lengths
-added support for creating storage pools on hosts that belong to a cluster
-added Status to the table on the storage pools page
# v3.8.0
- Added a check for a null config in storage pools
- Added image token cleanup with downloading images while in a cluster
#v1.1.4
-added dropdown arrows to host and project dropdowns in the top nav bar
#v1.1.3
-added recursion to the API calls for remainder of the table lists, improving page load time
-redesigned the hosts page
-added copying of instances on clustered hosts
-added instance migration of instance from one host to another on a cluster
-added Hosts link to sidebar navigation
-modified actions to use icons
-improved reloading of page data to give updated information on pages
-improved running operation notifications of tasks to be persistent between pages of the application
-added instance location to instances page
# 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,20 +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
- Migrating instances between hosts on a cluster
- 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,409 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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="#" data-toggle="modal" data-target="#addCertificateModal">
<i class="fas fa-plus fa-sm fa-fw"></i>
New Certificate
</a>
</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 certificateToUpdate = "";
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent(){
$('#certificateListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#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" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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');
});
}
//API uses sync
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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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,302 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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>
<!-- 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');
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent() {
$('#clusterMemberListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#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" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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,413 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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">
<!-- 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">Host Details</h6>
</div>
<div class="row">
<div class="col-xl-2 col-lg-4 col-md-6 col-sm-12">
<!-- Instance Details -->
<div class="card mb-4 border-0">
<!-- Card Body -->
<div class="card-body text-center">
<div id="instanceCard">
<!-- Instance Card -->
<i class="mb-2 fas fa-cube fa-5x fa-fw" style="color:#cccccc"></i>
<div class="media-body">
<h5 class="mt-0 mb-1"><strong>Instances:</strong></h5>
0 out of 0 running
</div>
</div>
</div>
</div>
<!-- End Instance Details -->
</div>
<div class="col-xl-2 col-lg-4 col-md-6 col-sm-12">
<!-- Image Details -->
<div class="card mb-4 border-0">
<!-- Card Body -->
<div class="card-body text-center">
<div id="imageCard">
<!-- Image Card -->
<i class="mb-2 fas fa-box-open fa-5x fa-fw" style="color:#cccccc"></i>
<div class="media-body">
<h5 class="mt-0 mb-1"><strong>Images:</strong></h5>
0 images available
</div>
</div>
</div>
</div>
<!-- End Image Details -->
</div>
<div class="col-xl-2 col-lg-4 col-md-6 col-sm-12">
<!-- Cluster Details -->
<div class="card mb-4 border-0">
<!-- Card Body -->
<div class="card-body text-center">
<div id="clusterCard">
<!-- Cluster Card -->
<i class="mb-2 fas fa-project-diagram fa-5x fa-fw" style="color:#cccccc"></i>
<div class="media-body">
<h5 class="mt-0 mb-1"><strong>Cluster:</strong></h5>
0 out of 0 online
</div>
</div>
</div>
</div>
<!-- End Cluster Details -->
</div>
<div class="col-xl-2 col-lg-4 col-md-6 col-sm-12">
<!-- Project Details -->
<div class="card mb-4 border-0">
<!-- Card Body -->
<div class="card-body text-center">
<div id="projectCard">
<!-- Project Card -->
<i class="mb-2 fas fa-chart-bar fa-5x fa-fw" style="color:#cccccc"></i>
<div class="media-body">
<h5 class="mt-0 mb-1"><strong>Projects:</strong></h5>
0 project environments
</div>
</div>
</div>
</div>
<!-- End Project Details -->
</div>
<div class="col-xl-2 col-lg-4 col-md-6 col-sm-12">
<!-- Network Details -->
<div class="card mb-4 border-0">
<!-- Card Body -->
<div class="card-body text-center">
<div id="networkCard">
<!-- Network Card -->
<i class="mb-2 fas fa-network-wired fa-5x fa-fw" style="color:#cccccc"></i>
<div class="media-body">
<h5 class="mt-0 mb-1"><strong>Networks:</strong></h5>
0 network interfaces
</div>
</div>
</div>
</div>
<!-- End Network Details -->
</div>
<div class="col-xl-2 col-lg-4 col-md-6 col-sm-12">
<!-- Storage Details -->
<div class="card mb-4 border-0">
<!-- Card Body -->
<div class="card-body text-center">
<div id="storageCard">
<!-- Storage Card -->
<i class="mb-2 fas fa-hdd fa-5x fa-fw" style="color:#cccccc"></i>
<div class="media-body">
<h5 class="mt-0 mb-1"><strong>Storage Pools:</strong></h5>
0 dedicated storage pools
</div>
</div>
</div>
</div>
<!-- End Storage Details -->
</div>
<div class="col-sm-12 col-md-6">
<!-- LXD Information -->
<div class="card mb-4 border-0">
<!-- 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 Information</h6>
</div>
<!-- Card Body -->
<div class="card-body">
<div id="lxdCard">
</div>
</div>
</div>
<!-- End LXD Information -->
</div>
<div class="col-sm-12 col-md-6">
<!-- Resource Information -->
<div class="card mb-4 border-0">
<!-- 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">Resource Information</h6>
</div>
<!-- Card Body -->
<div class="card-body">
<div id="sysCard">
</div>
</div>
</div>
<!-- End Resource Information -->
</div>
</div>
</div>
<!-- End 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');
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent() {
$("#instanceCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=instanceInfo");
$("#imageCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=imageInfo");
$("#networkCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=networkInfo");
$("#storageCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=storageInfo");
$("#sysCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=sysInfo");
$("#projectCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=projectInfo");
$("#clusterCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=clusterInfo");
$("#lxdCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=lxdInfo");
//Set the page content to reload again in 5 more seconds
setTimeout(() => { reloadPageContent(); }, 5000);
}
function loadPageContent(){
$("#sidebarLinks").load("./sidebar.html");
$('#remoteBreadCrumb').load("./php/lxd/remote-breadcrumb.php?remote=" + encodeURI(remoteName));
$("#instanceCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=instanceInfo");
$("#imageCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=imageInfo");
$("#networkCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=networkInfo");
$("#storageCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=storageInfo");
$("#sysCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=sysInfo");
$("#projectCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=projectInfo");
$("#clusterCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=clusterInfo");
$("#lxdCard").load("./php/lxd/hosts.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName) + "&action=lxdInfo");
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 5 seconds
setTimeout(() => { reloadPageContent(); }, 5000);
}
$(document).ready(function(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
//Load Page Content
loadPageContent();
$("#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,471 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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="#" data-toggle="modal" data-target="#downloadImageModal">
<i class="fas fa-plus fa-sm fa-fw"></i>
Download Image
</a>
</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 selectList = "";
var imageToUpdate = "";
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent() {
$('#imageListTable').DataTable().ajax.reload();
//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;
}
});
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#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" }
]
});
//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;
}
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
//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){
operationStatusCheck();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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){
operationStatusCheck();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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){
operationStatusCheck();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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,402 +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="">
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
<link rel="icon" type="image/png" href="theme/images/logo_light.png">
<title>lxdware - dashboard</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">
<!-- 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_dark.png" style="width: 2rem;"></img>
<!-- <i class="fas fa-cube" style="width: 2rem;"></i> -->
</div>
<div class="sidebar-brand-text mx-3">Dashboard</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 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 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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>
<!-- 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>
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin/index.html", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function reloadPageContent() {
$('#lxdListTable').DataTable().ajax.reload();
//Set the page content to reload again in 5 more seconds
setTimeout(() => { reloadPageContent(); }, 5000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if (data != "true") {
window.location.replace("../index.html");
}
});
$('#lxdListTable').DataTable( {
ajax: "./php/lxd/remote-list.php",
columns: [
{},
{ title: "Host" },
{ title: "Port" },
{ title: "Alias" },
{ title: "Protocol" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
//Load the basic info for the certificate
$.get("./php/lxd/lxc-cert.php", function (data) {
$("#clientCert").html(data);
});
//Set the page content to reload once in 5 seconds
setTimeout(() => { reloadPageContent(); }, 5000);
}
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);
if (data.substring(0, 5) == "Error"){
alert(data);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
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);
if (data.substring(0, 5) == "Error"){
alert(data);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(document).ready(function(){
//Load the card contents
loadPageContent();
});
</script>
</html>

File diff suppressed because it is too large Load diff

View file

@ -1,424 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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="#" data-toggle="modal" data-target="#launchInstanceModal">
<i class="fas fa-plus fa-sm fa-fw"></i>
New Instance
</a>
</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');
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent(){
$('#instanceListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#instanceListTable').DataTable( {
ajax: "./php/lxd/instance-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Name" },
{ title: "Image" },
{ title: "Location" },
{ title: "Type" },
{ title: "Memory Usage" },
{ title: "Root Disk Usage" },
{ title: "Status" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
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){
operationStatusCheck();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
if (operationData.error_code >= 400){
alert(operationData.error);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
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){
operationStatusCheck();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
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){
operationStatusCheck();
}
if (operationData.metadata.status_code >= 400){
alert(operationData.metadata.err);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//If use creates a new instance load the images based on container or virtual-machine selection
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();
$("#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));
//Populate the select options fields used in modals
$("#selectProfileInput").load("./php/lxd/profile-list-select.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName));
//Populate initial list of images available for container
changeImageInput();
});
</script>
</html>

View file

@ -1,505 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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="#" data-toggle="modal" data-target="#createNetworkModal">
<i class="fas fa-plus fa-sm fa-fw"></i>
New Network
</a>
</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 networkToUpdate = "";
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent() {
$('#networkListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#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" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
//API uses sync
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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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');
});
}
//API uses sync
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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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,348 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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>
<!-- 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');
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent(){
$('#operationListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#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" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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,14 +0,0 @@
<?php
$auth = "false";
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//header('WWW-Authenticate: Basic realm="My Realm"');
//header('HTTP/1.0 401 Unauthorized');
//exit;
$auth = "true";
}
echo $auth;
?>

View file

@ -1,64 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1&project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$certificates = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($certificates as $certificate){
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<a href='#' onclick=loadCertificateJson('".$certificate['fingerprint']."')> <i class='fas fa-wallet fa-lg' style='color:#4e73df'></i> </a>";
echo '",';
echo '"';
echo "<a href='#' onclick=loadCertificateJson('".$certificate['fingerprint']."')>".htmlentities($certificate['name'])."</a>";
echo '",';
echo '"' . htmlentities($certificate['type']) . '",';
echo '"' . htmlentities($certificate['fingerprint']) . '",';
echo '"';
echo "<a href='#' onclick=deleteCertificate('".$certificate['fingerprint']."')><i class='fas fa-trash-alt fa-lg' style='color:#ddd' title='Delete' aria-hidden='true'></i></a>";
echo '"';
echo " ]";
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,57 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,32 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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/members?recursion=1";
$cluster_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$cluster_api_data = json_decode($cluster_api_data, true);
$cluster_hosts = $cluster_api_data['metadata'];
foreach ($cluster_hosts as $cluster_host){
if ($cluster_host['message'] != "fully operational")
continue;
echo '<option value="' . $cluster_host['server_name'] . '">' . htmlentities($cluster_host['server_name']) . '</option>';
}
}
}
?>

View file

@ -1,72 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1";
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$members = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($members as $member){
$database_status = ($member['database'])?"true":"false";
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<i class='fas fa-project-diagram fa-lg' style='color:#4e73df'></i>";
echo '",';
echo '"' . htmlentities($member['server_name']) . '",';
echo '"' . htmlentities($member['url']) . '",';
echo '"' . htmlentities($database_status) . '",';
echo '"' . htmlentities($member['status']) . '",';
echo '"' . htmlentities($member['message']) . '",';
echo '"';
echo '"';
echo " ]";
}
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,67 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,284 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/client.key";
//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);
//Determine host info from database
$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'];
//Run the matching action
switch ($action) {
case "sysInfo":
//Retrieve host resource data
$url = $url . "/1.0/resources?project=" . $project;
$resource_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
if ($resource_api_data == NULL) {
$results = "<strong>Error</strong>: Unable to connect to host <br /> <br />";
break;
}
$resource_api_data = json_decode($resource_api_data, true);
$resource_data = $resource_api_data['metadata'];
#Extract json data into variables
$system_vendor = $resource_data['system']['vendor']?: "N/A"; //example: DigitalOcean, Dell, Etc
$system_product = $resource_data['system']['product']?: "N/A"; //example: Droplet, R810, Etc
$architecture = $resource_data['cpu']['architecture']?: "N/A"; //example: x86_64
$cpus = $resource_data['cpu']['total']?: "N/A"; //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
#Determine Memory Information
if ($resource_data['memory']['total'] < 1073741824) {
$memory_total = number_format($resource_data['memory']['total']/1024/1024,2); //total amount of memory used in MB
$memory_used = number_format($resource_data['memory']['used']/1024/1024,2); //current amount of memory used in MB
$memory_unit = "MB";
}
else {
$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_unit = "GB";
}
$memory_percentage = number_format($memory_used / $memory_total, 2) * 100;
$results = '';
$results .= "<strong>System Vendor</strong>: " . htmlentities($system_vendor) . "<br />";
$results .= "<strong>System Product</strong>: " . htmlentities($system_product) . "<br />";
$results .= "<br />";
$results .= "<strong>CPU Information</strong>: <br />";
$results .= "<ul>";
$results .= "<li><strong>Architecture</strong>: " . htmlentities($architecture) . "</li>";
$results .= "<li><strong>CPU Count</strong>: " . htmlentities($cpus) . "</li>";
foreach($sockets as $socket){
$results .= "<li><strong>Socket " . htmlentities($socket['socket']) . "</strong>: " . htmlentities($socket['name']?: "N/A") . "</li>";
}
$results .= "</ul>";
$results .= "<strong>Total Memory</strong>: " . htmlentities($memory_total) . " " . $memory_unit . "<br />";
$results .= "<strong>Percentage Used</strong>: " . htmlentities($memory_percentage) . "% <br />";
$results .= "<br />";
$results .= "<strong>Disk Storage Information</strong>: <br />";
foreach($storage_disks as $disk){
if ($disk['type'] == "cdrom")
continue;
$results .= "<ul>";
$results .= "<li><strong>Disk ID</strong>: " . htmlentities($disk['id']?: "N/A") . "</li>";
$results .= "<li><strong>Disk model</strong>: " . htmlentities($disk['model']?: "N/A") . "</li>";
$results .= "<li><strong>Disk type</strong>: " . htmlentities($disk['type']?: "N/A") . "</li>";
if ($disk['size'] < 1099511627776) {
$disk_total = number_format($disk['size']/1024/1024/1024,2); //disk size in GB
$disk_unit = "GB";
}
else {
$disk_total = number_format($disk['size']/1024/1024/1024/1024,2); //disk size in TB
$disk_unit = "TB";
}
$results .= "<li><strong>Disk size</strong>: " . $disk_total . " " . $disk_unit . "</li>";
$results .= "</ul>";
}
break;
case "lxdInfo":
//Retrieve host data
$url = $url . "/1.0?project=" . $project;
$api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
if ($api_data == NULL) {
$results = "<strong>Error</strong>: Unable to connect to host <br /> <br />";
break;
}
$api_data = json_decode($api_data, true);
$data = $api_data['metadata'];
#Extract json data into variables
$addresses = $data['environment']['addresses']?: "N/A"; //array of ip addresses
$driver = $data['environment']['driver']?: "N/A"; //example: qemu | lxc
$driver_version = $data['environment']['driver_version']?: "N/A"; //example: 5.2.0 | 4.0.5
$firewall = $data['environment']['firewall']?: "N/A"; //example: xtables
$kernel = $data['environment']['kernel']?: "N/A"; //example: Linux
$kernel_architecture = $data['environment']['kernel_architecture']?: "N/A"; //example: x86_64
$kernel_version = $data['environment']['kernel_version']?: "N/A"; //example: 5.8.0-36-generic
$os_name = $data['environment']['os_name']?: "N/A"; //example: Ubuntu
$os_version = $data['environment']['os_version']?: "N/A"; //example: 20.04
$server = $data['environment']['server']?: "N/A"; //example: lxd
$server_version = $data['environment']['server_version']?: "N/A"; //example: 4.10
$server_clustered = $data['environment']['server_clustered']?: "N/A"; //example: true
$server_name = $data['environment']['server_name']?: "N/A"; //hostname
$storage = $data['environment']['storage']?: "N/A"; //example: zfs
$storage_version = $data['environment']['storage_version']?: "N/A"; //example: 0.8.4-1ubuntu11
$results = '';
$results .= "<strong>Operating System</strong>: " . htmlentities($os_name) . " " . htmlentities($os_version) ."<br />";
$results .= "<strong>Hostname</strong>: " . htmlentities($server_name) . "<br />";
$results .= "<strong>Kernel</strong>: " . htmlentities($kernel) . " " . htmlentities($kernel_version) ."<br />";
$results .= "<br />";
$results .= "<strong>Driver</strong>: " . htmlentities($driver) . "<br />";
$results .= "<strong>Driver Version</strong>: " . htmlentities($driver_version) . "<br />";
$results .= "<br />";
$results .= "<strong>Storage Type</strong>: " . htmlentities($storage) . "<br />";
$results .= "<strong>Storage Version</strong>: " . htmlentities($storage_version) . "<br />";
$results .= "<br />";
$results .= "<strong>Firewall</strong>: " . htmlentities($firewall) . "<br />";
$results .= "<strong>Addresses</strong>: <br />";
$results .= "<ul>";
foreach($addresses as $address){
$results .= "<li>" . htmlentities($address) . "</li>";
}
$results .= "</ul>";
$results .= "<br />";
break;
case "instanceInfo":
//Determine the number of running / total instances
$running_instances = 0;
$total_instances = 0;
$url = $url. "/1.0/instances?recursion=2&project=" . $project;
$instance_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$instance_api_data = json_decode($instance_api_data, true);
foreach ($instance_api_data['metadata'] as $instance_data){
if ($instance_data['state']['status'] == "Running"){
$running_instances++;
}
$total_instances++;
}
$results = '';
$results .= '<!-- Instance Card -->';
$results .= '<i class="mb-2 fas fa-cube fa-5x fa-fw" style="color:#cccccc"></i>';
$results .= '<div class="media-body">';
$results .= '<h5 class="mt-0 mb-1"><strong>Instances:</strong></h5>';
$results .= $running_instances . " out of " . $total_instances . " running";
$results .= '<a href="instances.html?remote='.$remote.'&project='.$project.'" class="stretched-link"></a>';
$results .= '</div>';
break;
case "imageInfo":
//Retrieve list of images
$url = $url . "/1.0/images?project=" . $project;
$image_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$image_api_data = json_decode($image_api_data, true);
$image_urls = $image_api_data['metadata'];
$results = '';
$results .= '<!-- Image Card -->';
$results .= '<i class="mb-2 fas fa-box-open fa-5x fa-fw" style="color:#cccccc"></i>';
$results .= '<div class="media-body">';
$results .= '<h5 class="mt-0 mb-1"><strong>Images:</strong></h5>';
if (count($image_urls) != 1)
$results .= count($image_urls) . " images available";
else
$results .= count($image_urls) . " image available";
$results .= '<a href="images.html?remote='.$remote.'&project='.$project.'" class="stretched-link"></a>';
$results .= '</div>';
break;
case "clusterInfo":
#First determine if part of a cluster
$url_enabled = $url . "/1.0/cluster";
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url_enabled");
$remote_data = json_decode($remote_data, true);
$cluster_status = $remote_data['metadata'];
if ($cluster_status['enabled'] == false){
//Host is not part of a cluster
$results = '';
$results .= '<!-- Cluster Card -->';
$results .= '<i class="mb-2 fas fa-project-diagram fa-5x fa-fw" style="color:#cccccc"></i>';
$results .= '<div class="media-body">';
$results .= '<h5 class="mt-0 mb-1"><strong>Cluster:</strong></h5>';
$results .= "0 out of 0 online";
$results .= '<a href="cluster.html?remote='.$remote.'&project='.$project.'" class="stretched-link"></a>';
$results .= '</div>';
}
else {
//Retrieve cluster member status
$online_members = 0;
$total_members = 0;
$url = $url . "/1.0/cluster/members?recursion=1";
$cluster_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$cluster_api_data = json_decode($cluster_api_data, true);
$cluster_api_data = $cluster_api_data['metadata'];
foreach ($cluster_api_data as $cluster_data){
if ($cluster_data['status'] == "Online"){
$online_members++;
}
$total_members++;
}
$results = '';
$results .= '<!-- Cluster Card -->';
$results .= '<i class="mb-2 fas fa-project-diagram fa-5x fa-fw" style="color:#cccccc"></i>';
$results .= '<div class="media-body">';
$results .= '<h5 class="mt-0 mb-1"><strong>Cluster:</strong></h5>';
$results .= $online_members . " out of " . $total_members . " online";
$results .= '<a href="cluster.html?remote='.$remote.'&project='.$project.'" class="stretched-link"></a>';
$results .= '</div>';
}
break;
case "projectInfo":
//Retrieve list of projects
$url = $url . "/1.0/projects?project=" . $project;
$project_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$project_api_data = json_decode($project_api_data, true);
$project_urls = $project_api_data['metadata'];
$results = '';
$results .= '<!-- Project Card -->';
$results .= '<i class="mb-2 fas fa-chart-bar fa-5x fa-fw" style="color:#cccccc"></i>';
$results .= '<div class="media-body">';
$results .= '<h5 class="mt-0 mb-1"><strong>Projects:</strong></h5>';
if (count($project_urls) != 1)
$results .= count($project_urls) . " project environments";
else
$results .= count($project_urls) . " project environment";
$results .= '<a href="projects.html?remote='.$remote.'&project='.$project.'" class="stretched-link"></a>';
$results .= '</div>';
break;
case "networkInfo":
//Retrieve list of networks
$url = $url . "/1.0/networks?project=" . $project;
$network_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$network_api_data = json_decode($network_api_data, true);
$network_urls = $network_api_data['metadata'];
$results = '';
$results .= '<!-- Network Card -->';
$results .= '<i class="mb-2 fas fa-network-wired fa-5x fa-fw" style="color:#cccccc"></i>';
$results .= '<div class="media-body">';
$results .= '<h5 class="mt-0 mb-1"><strong>Networks:</strong></h5>';
if (count($network_urls) != 1)
$results .= count($network_urls) . " network interfaces";
else
$results .= count($network_urls) . " network interface";
$results .= '<a href="networks.html?remote='.$remote.'&project='.$project.'" class="stretched-link"></a>';
$results .= '</div>';
break;
case "storageInfo":
//Retrieve list of storage pools
$url = $url . "/1.0/storage-pools?project=" . $project;
$storage_pool_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$storage_pool_api_data = json_decode($storage_pool_api_data, true);
$storage_pool_urls = $storage_pool_api_data['metadata'];
$results = '';
$results .= '<!-- Storage Card -->';
$results .= '<i class="mb-2 fas fa-hdd fa-5x fa-fw" style="color:#cccccc"></i>';
$results .= '<div class="media-body">';
$results .= '<h5 class="mt-0 mb-1"><strong>Storage Pools:</strong></h5>';
if (count($storage_pool_urls) != 1)
$results .= count($storage_pool_urls) . " dedicated storage pools";
else
$results .= count($storage_pool_urls) . " dedicated storage pool";
$results .= '<a href="storage-pools.html?remote='.$remote.'&project='.$project.'" class="stretched-link"></a>';
$results .= '</div>';
break;
}
echo $results;
}
}
?>

View file

@ -1,36 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1&project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$images = $remote_data['metadata'];
foreach ($images as $image){
if ($image['fingerprint'] == "" || $image['type'] != $image_type)
continue;
echo '<option value="' . $image['fingerprint'] . '">' . htmlentities($image['properties']['description']) . '</option>';
}
}
}
?>

View file

@ -1,67 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1&project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$images = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($images as $image){
if ($image['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['properties']['description']) . '",';
echo '"' . htmlentities($image['fingerprint']) . '",';
echo '"' . htmlentities($image['type']) . '",';
echo '"' . htmlentities(number_format($image['size'] / 1048576, 2)) . ' MB",';
echo '"';
echo "<a href='#' onclick=refreshImage('".$image['fingerprint']."')><i class='fas fa-sync-alt fa-lg' style='color:#ddd' title='Refresh' aria-hidden='true'></i></a>";
echo " &nbsp ";
echo "<a href='#' onclick=loadImageJson('".$image['fingerprint']."')><i class='fas fa-edit fa-lg' style='color:#ddd' title='Edit' aria-hidden='true'></i></a>";
echo " &nbsp ";
echo "<a href='#' onclick=deleteImage('".$image['fingerprint']."')><i class='fas fa-trash-alt fa-lg' style='color:#ddd' title='Delete' aria-hidden='true'></i></a>";
echo '"';
echo " ]";
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,72 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,114 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=2&project=" . $project;
$instance_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$instance_api_data = json_decode($instance_api_data, true);
$instance_api_data = $instance_api_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($instance_api_data as $instance_data){
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['location'] . '",';
echo '"' . $instance_data['type'] . '",';
//Convert the memory usage to an appropriate unit
if ($instance_data['state']['memory']['usage'] < 1073741824){
$memory = number_format($instance_data['state']['memory']['usage']/1024/1024, 2);
$memory_unit = "MB";
}
else {
$memory = number_format($instance_data['state']['memory']['usage']/1024/1024/1024, 2);
$memory_unit = "GB";
}
echo '"' . $memory . " " . $memory_unit . '",';
//Convert the storage usage to an approprate unit
if ($instance_data['state']['disk']['root']['usage'] < 1073741824){
$disk_total = number_format($instance_data['state']['disk']['root']['usage']/1024/1024,2);
$disk_unit = "MB";
}
if ($instance_data['state']['disk']['root']['usage'] >= 1073741824 && $instance_data['state']['disk']['root']['usage'] < 1099511627776) {
$disk_total = number_format($instance_data['state']['disk']['root']['usage']/1024/1024/1024,2);
$disk_unit = "GB";
}
if ($instance_data['state']['disk']['root']['usage'] >= 1099511627776){
$disk_total = number_format($instance_data['state']['disk']['root']['usage']/1024/1024/1024/1024,2);
$disk_unit = "TB";
}
echo '"' . $disk_total . " " . $disk_unit . '",';
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' title='Stop' aria-hidden='true'></i> </a>";
echo '"';
}
else{
echo '"';
echo "<a href='#' onclick=startInstance('".$instance_data['name']."')> <i class='fas fa-play fa-lg' style='color:#ddd' title='Start' aria-hidden='true'></i> </a>";
echo '"';
}
echo " ]";
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,74 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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:150px'></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 '<a href="#" onclick="detachProfile('.escapeshellarg($network_name).')"><i class="fas fa-trash-alt fa-lg" style="color:#ddd"></i></a>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
}
?>

View file

@ -1,92 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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:150px'></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?recursion=1&project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$networks = $remote_data['metadata']['network'];
foreach ($networks as $network => $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) . "</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 '<a href="#" onclick="detachProfile('.escapeshellarg($network).')"><i class="fas fa-trash-alt fa-lg" style="color:#ddd"></i></a>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
}
?>

View file

@ -1,66 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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:150px'></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 '<a href="#" onclick="detachProfile('.escapeshellarg($profile_data['name']).')"><i class="fas fa-trash-alt fa-lg" style="color:#ddd" title="Detach" aria-hidden="true"></i></a>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
}
?>

View file

@ -1,69 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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:150px'></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 '<a href="#" onclick="detachProfile('.escapeshellarg($device_name).')"><i class="fas fa-trash-alt fa-lg" style="color:#ddd"></i></a>';
echo "</td>";
echo "</tr>";
}
else {
continue;
}
}
}
echo "</tbody>";
}
?>

View file

@ -1,73 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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:150px'></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?recursion=1&project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$snapshots = $remote_data['metadata'];
foreach ($snapshots as $snapshot){
if ($snapshot['name'] == "")
continue;
if ($snapshot['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['name']) . "</td>";
echo "<td>" . htmlentities($state) . "</td>";
echo "<td>" . htmlentities(number_format($snapshot['size']/1024/1024,2)) . "MB</td>";
echo "<td>" . htmlentities($snapshot['created_at']) . "</td>";
echo "<td>";
echo '<a href="#" onclick="restoreSnapshot('.escapeshellarg($snapshot['name']).')"><i class="fas fa-window-restore fa-lg" style="color:#ddd" title="Restore" aria-hidden="true"></i></a>';
echo ' &nbsp ';
echo '<a href="#" onclick="deleteSnapshot('.escapeshellarg($snapshot['name']).')"><i class="fas fa-trash-alt fa-lg" style="color:#ddd" title="Delete" aria-hidden="true"></i></a>';
echo "</td>";
echo "</tr>";
}
}
echo "</tbody>";
}
?>

View file

@ -1,177 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/client.key";
//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['instance']))
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
//Determine host info from database
$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 and State using Recursion
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances?recursion=2&project=" . $project;
$instance_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$instance_api_data = json_decode($instance_api_data, true);
foreach ($instance_api_data['metadata'] as $instance_data){
if ($instance_data['name'] == $instance){
$name = $instance_data['name']?: "N/A";
$created = $instance_data['created_at']?: "N/A";
$description = $instance_data['description']?: "N/A";
$type = $instance_data['type']?: "N/A"; //ex container, virtual-machine
$location = $instance_data['location']?: "N/A"; //used with clusters,none for non-clustered host
$image = $instance_data['config']['image.description']?: "N/A"; //ex Ubuntu focal amd64 (20200821_07:42)
$status = $instance_data['status']?: "N/A"; //ex Running
$pid = $instance_data['state']['pid']?: "N/A"; //process ID on the host
$processes = $instance_data['state']['processes']?: "N/A"; //number of process running in container
//$cpu = $instance_data['state']['cpu']['usage']; //cpu usage in nanoseconds
if ($instance_data['state']['memory']['usage'] < 1073741824){
$memory = number_format($instance_data['state']['memory']['usage']/1024/1024, 2);//total amount of memory used in MB
$memory_unit = "MB";
}
else {
$memory = number_format($instance_data['state']['memory']['usage']/1024/1024/1024, 2);//total amount of memory used in GB
$memory_unit = "GB";
}
$network_interfaces = $instance_data['state']['network']; //array of networks
//Instance Logs
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "/logs?project=" . $project;
$instance_api_logs = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$instance_api_logs = json_decode($instance_api_logs, true);
$instance_logs = $instance_api_logs['metadata'];
//Instance Backups
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "/backups?project=" . $project;
$instance_api_backups = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$instance_api_backups = json_decode($instance_api_backups, true);
$instance_backups = $instance_api_backups['metadata'];
echo '<div class="row">';
echo '<div class="col-xl-4 col-lg-4">';
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>Location</strong>: " . htmlentities($location) . "<br />";
echo "<strong>Memory</strong>: " . htmlentities($memory) . " " . $memory_unit . "<br />";
echo "<strong>PID</strong>: " . htmlentities($pid) . "<br />";
echo "<strong>Processes</strong>: " . htmlentities($processes) . "<br />";
echo "<strong>IPv4 Addresses</strong>: ";
$i = 0;
if (!$network_interfaces)
echo "N/A";
foreach ($network_interfaces as $network_interface){
if (count($network_interface['addresses']) == 0)
echo "N/A";
foreach ($network_interface['addresses'] as $address){
if ($address['family'] == "inet" && $address['scope'] == "global"){
if ($i > 0)
echo ", ";
echo htmlentities($address['address']) . "/" . htmlentities($address['netmask']);
$i++;
}
}
}
echo "<br />";
echo "<strong>IPv6 Addresses</strong>: ";
$i = 0;
if (!$network_interfaces)
echo "N/A";
foreach ($network_interfaces as $network_interface){
if (count($network_interface['addresses']) == 0)
echo "N/A";
foreach ($network_interface['addresses'] as $address){
if ($address['family'] == "inet6" && $address['scope'] == "global"){
if ($i > 0)
echo ", ";
echo htmlentities($address['address']);
$i++;
}
}
}
echo "<br />";
echo "<br />";
echo '</div>';
echo '<!-- Second Column -->';
echo '<div class="col-xl-3 col-lg-3">';
echo '<ul class="list-unstyled">';
echo '<li class="media">';
echo '<i class="mr-3 mb-5 fas fa-clipboard fa-2x fa-fw" style="color:#ddd"></i>';
echo '<div class="media-body">';
echo '<h6 class="mt-0 mb-1"><strong>Logs:</strong></h6>';
$i = 0;
if (count($instance_logs) == 0)
echo "N/A";
foreach ($instance_logs as $log){
if ($i > 0)
echo ", ";
echo "<a href='#' onclick=loadLog('".$log."')>".htmlentities(basename($log))."</a>";
$i++;
}
echo '</div>';
echo '</li>';
echo '<li class="media">';
echo '<i class="mr-3 mb-5 fas fa-file-archive fa-2x fa-fw" style="color:#ddd"></i>';
echo '<div class="media-body">';
echo '<h6 class="mt-0 mb-1"><strong>Backups:</strong></h6>';
$i = 0;
if (count($instance_backups) == 0)
echo "N/A";
foreach ($instance_backups as $backup){
if ($i > 0)
echo ", ";
echo "<a href='#' onclick=loadBackup('".$backup."')>".htmlentities(basename($backup))."</a>";
$i++;
}
echo '</div>';
echo '</li>';
echo '</ul>';
echo '</div>';
echo '<!-- Third Column -->';
echo '<div class="col-xl-5 col-lg-5">';
echo '</div>';
echo '</div>';
}
}
}
}
?>

View file

@ -1,188 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/client.key";
//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);
if (isset($_GET['path']))
$path = filter_var(urldecode($_GET['path']), FILTER_SANITIZE_STRING);
if (isset($_GET['destination']))
$destination = filter_var(urldecode($_GET['destination']), FILTER_SANITIZE_STRING);
//Determine host info from database
$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'];
//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 "forceStopInstance":
$url = $url . "/1.0/instances/" . $instance . "/state?project=" . $project;
$data = escapeshellarg('{"action": "stop","force":true}');
$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 "freezeInstance":
$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 "unfreezeInstance":
$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":
//Copying on clustered hosts requires target location. Determine location of instance being copied.
$instance_url = $url . "/1.0/instances/$instance?project=" . $project;
$instance_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $instance_url");
$instance_api_data = json_decode($instance_api_data, true);
$instance_data = $instance_api_data['metadata'];
$location = $instance_data['location']; //Returns "none" for instances on non-clusted hosts
//Copy instance on host to same host
$url = $url . "/1.0/instances?target=".$location."&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 "migrateInstance":
$url = $url . "/1.0/instances/" . $instance . "?target=" . $destination . "&project=";
$data = escapeshellarg('{"name": "'. $instance . '", "migration": true, "live": false}');
$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;
case "loadLog":
$url = $url . $path . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
case "downloadBackup":
mkdir('../../downloads');
$url = $url . $path . "/export?project=" . $project;
$results = shell_exec("sudo curl -k -L --output ../../downloads/".basename($path).".tar.gz --cert $cert --key $key -X GET $url");
$results = "downloads/".basename($path).".tar.gz";
break;
case "deleteBackup":
$url = $url . $path . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X DELETE $url");
break;
case "createBackup":
$url = $url . "/1.0/instances/" . $instance . "/backups?project=" . $project;
$data = escapeshellarg('{"name": "'. $name . '"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
break;
case "loadBackup":
$url = $url . $path . "?project=" . $project;
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
break;
}
}
echo $results;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,8 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$results = shell_exec("cat /var/lxdware/data/lxd/client.crt");
echo htmlentities($results);
}
?>

View file

@ -1,72 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1&project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$networks = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($networks as $network){
if ($network['name'] == "")
continue;
$network_data_managed = ($network['managed'])?"true":"false";
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
if ($network['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['name']) . '",';
echo '"' . htmlentities($network['description']) . '",';
echo '"' . htmlentities($network['type']) . '",';
echo '"' . htmlentities($network_data_managed) . '",';
echo '"';
if ($network['managed'] == "true"){
echo "<a href='#' onclick=loadNetworkJson('".$network['name']."')><i class='fas fa-edit fa-lg' style='color:#ddd' title='Edit' aria-hidden='true'></i></a>";
echo " &nbsp ";
echo "<a href='#' onclick=deleteNetwork('".$network['name']."')><i class='fas fa-trash-alt fa-lg' style='color:#ddd' title='Delete' aria-hidden='true'></i></a>";
}
echo '"';
echo " ]";
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,78 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,83 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1";
$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){
foreach ($operations as $operation){
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<a href='#' onclick=loadOperationJson('".$operation['id']."')> <i class='fas fa-exchange-alt fa-lg' style='color:#4e73df'></i> </a>";
echo '",';
echo '"';
echo "<a href='#' onclick=loadOperationJson('".$operation['id']."')>".htmlentities($operation['id'])."</a>";
echo '",';
echo '"' . htmlentities($operation['class']) . '",';
echo '"' . htmlentities($operation['description']) . '",';
echo '"' . htmlentities($operation['status']) . '",';
echo '"' . htmlentities($operation['created_at']) . '",';
if($operation['may_cancel']){
$may_cancel = "true";
echo '"' . htmlentities($may_cancel) . '",';
echo '"';
echo "<a href='#' onclick=deleteOperation('".$operation['id']."')> <i class='fas fa-trash-alt fa-lg' style='color:#ddd' title='Delete' aria-hidden='true'></i> </a>";
echo '"';
}
else{
$may_cancel = "false";
echo '"' . htmlentities($may_cancel) . '",';
echo '" ';
echo ' "';
}
echo " ]";
}
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,50 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1";
$operations_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$operations_api_data= json_decode($operations_api_data, true);
$operations_data = $operations_api_data['metadata'];
$results = "";
if (!empty($operations_data)){
if (!empty($operations_data['running'])){
foreach ($operations_data['running'] as $running_task){
$results .= $running_task['description'];
if ($running_task['description'] == "Downloading image"){
$results .= " " . $running_task['metadata']['download_progress'];
}
}
}
if (!empty($operations_data['failure'])){
foreach ($operations_data['failure'] as $failed_task){
$results .= $failed_task['description'] . " Error: " . $failed_task['err'];
}
}
}
}
echo $results;
}
?>

View file

@ -1,50 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,34 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1&project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$profiles = $remote_data['metadata'];
foreach ($profiles as $profile){
if ($profile['name'] == "")
continue;
echo '<option value="' . $profile['name'] . '">' . htmlentities($profile['name']) . '</option>';
}
}
}
?>

View file

@ -1,72 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1&project=" . $project;
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$profiles = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($profiles as $profile){
if ($profile['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['name']) . '",';
echo '"' . htmlentities($profile['description']) . '",';
echo '"';
$ii = 0;
foreach($profile['devices'] as $device=>$value){
if ($ii > 0)
echo ", ";
echo $device;
$ii++;
}
echo '",';
echo '"';
echo "<a href='#' onclick=loadProfileJson('".$profile['name']."')><i class='fas fa-edit fa-lg' style='color:#ddd' title='Edit' aria-hidden='true'></i></a>";
echo " &nbsp ";
echo "<a href='#' onclick=deleteProfile('".$profile['name']."')><i class='fas fa-trash-alt fa-lg' style='color:#ddd' title='Delete' aria-hidden='true'></i></a>";
echo '"';
echo " ]";
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,79 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,56 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1";
$project_results = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$project_results = json_decode($project_results, true);
$projects = $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">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 ($projects as $project_data){
if ($project_data['name'] == $project)
echo '<a class="dropdown-item" href="'.$return_url.'?remote=' . $remote . '&project=' . $project_data['name'] . '"><i class="fas fa-chart-bar fa-sm fa-fw mr-2 text-gray-400"></i><strong>' . htmlentities($project_data['name']) . '</strong></a>';
else {
if (basename($return_url) == "instance.html")
echo '<a class="dropdown-item" href="instances.html?remote=' . $remote . '&project=' . $project_data['name'] . '"><i class="fas fa-chart-bar fa-sm fa-fw mr-2 text-gray-400"></i>' . htmlentities($project_data['name']) . '</a>';
else
echo '<a class="dropdown-item" href="'.$return_url.'?remote=' . $remote . '&project=' . $project_data['name'] . '"><i class="fas fa-chart-bar fa-sm fa-fw mr-2 text-gray-400"></i>' . htmlentities($project_data['name']) . '</a>';
}
}
echo '</div>';
//echo '</li>';
}
}
?>

View file

@ -1,67 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1";
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
$remote_data = json_decode($remote_data, true);
$projects = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($projects as $project_data){
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<a href='host.html?remote=".$remote."&project=".$project_data['name'] ."'><i class='fas fa-chart-bar 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 "<a href='#' onclick=loadProjectJson('".$project_data['name']."')><i class='fas fa-edit fa-lg' style='color:#ddd' title='Edit' aria-hidden='true'></i></a>";
echo " &nbsp ";
echo "<a href='#' onclick=deleteProject('".$project_data['name']."')><i class='fas fa-trash-alt fa-lg' style='color:#ddd' title='Delete' aria-hidden='true'></i></a>";
echo '"';
echo " ]";
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,67 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,22 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
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,55 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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()){
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">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,56 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/client.key";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db->busyTimeout(5000);
$db_results = $db->query('SELECT * FROM lxd_hosts');
if ($db_results != false){
$i = 0;
echo '{ "data": [';
while ($row = $db_results->fetchArray()){
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<a href='host.html?remote=" . $row['id'] . "&project=default'> <i class='fas fa-server fa-lg' style='color:#4e73df'></i> </a>";
echo '",';
echo '"';
echo "<a href='host.html?remote=" . $row['id'] . "&project=default'>".htmlentities($row['host'])."</a>";
echo '",';
echo '"' . htmlentities($row['port']) . '",';
echo '"' . htmlentities($row['alias']) . '",';
echo '"' . htmlentities($row['protocol']) . '",';
echo '"';
echo "<a href='#' onclick=removeRemote('".$row['id']."')><i class='fas fa-trash-alt fa-lg' style='color:#ddd' title='Delete' aria-hidden='true'></i></a>";
echo '"';
echo " ]";
}
echo " ]}";
}
$db->close();
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,72 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/client.key";
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
$db->busyTimeout(5000);
//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 "Error: Connection was successful, error adding record to database";
}
else {
echo "Error: Unable to connect to host";
}
}
else {
echo "Error: 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: Unable to remove record from database";
break;
}
$db->close();
}
else {
echo "Error: Not Authenticated";
}
?>

View file

@ -1,21 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$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,45 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$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 "<a href='#' onclick=removeSimplestreams('".$row['id']."')><i class='fas fa-trash-alt fa-lg' style='color:#ddd' title='Delete' aria-hidden='true'></i></a>";
echo '"';
echo " ]";
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,52 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 "Error: Connection was successful, error adding record to database";
}
else {
echo "Error: Invalid host or port";
}
break;
case "removeSimplestreams":
$record_removed = $db->exec("DELETE FROM lxd_simplestreams WHERE id = $id");
if ($record_removed)
echo "Record removed";
else
echo "Error: Unable to remove record from database";
break;
}
}
else {
echo "Error: Not Authenticated";
}
?>

View file

@ -1,71 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1&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_pools = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($storage_pools as $storage_pool){
if ($storage_pool['name'] == "")
continue;
if ($i > 0){
echo ",";
}
$i++;
echo "[ ";
echo '"';
echo "<a href='storage-volumes.html?pool=".$storage_pool['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['name']."&remote=".$remote."&project=".$project."'> ".$storage_pool['name']."</a>";
echo '",';
echo '"' . htmlentities($storage_pool['description']) . '",';
echo '"' . htmlentities($storage_pool['driver']) . '",';
echo '"' . htmlentities($storage_pool['status']) . '",';
echo '"' . htmlentities($storage_pool['config']['source']) . '",';
echo '"' . htmlentities($storage_pool['config']['size']) . '",';
echo '"';
echo "<a href='#' onclick=loadStoragePoolJson('".$storage_pool['name']."')><i class='fas fa-edit fa-lg' style='color:#ddd' title='Edit' aria-hidden='true'></i></a>";
echo " &nbsp ";
echo "<a href='#' onclick=deleteStoragePool('".$storage_pool['name']."')><i class='fas fa-trash-alt fa-lg' style='color:#ddd' title='Delete' aria-hidden='true'></i></a>";
echo '"';
echo " ]";
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,117 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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":
//Check to see if host is part of a cluster. Clusted hosts need storage pool created first on each of the hosts
$enabled_url = $url . "/1.0/cluster";
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $enabled_url");
$remote_data = json_decode($remote_data, true);
$cluster_status = $remote_data['metadata'];
if ($cluster_status['enabled'] = true){
//Now setup storage pool on each cluster member, putting them in pending status
$cluster_url = $url . "/1.0/cluster/members?recursion=1";
$cluster_api_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $cluster_url");
$cluster_api_data = json_decode($cluster_api_data, true);
$cluster_api_data = $cluster_api_data['metadata'];
foreach ($cluster_api_data as $cluster_data){
if ($cluster_data['status'] == "Online"){
$member_url = $url . "/1.0/storage-pools?target=".$cluster_data['server_name']."&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 $member_url");
}
}
//Now lets create the storage pool without config, moving the pending status to created
$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": {},"driver": "'.$driver.'","name": "'.$name.'","description": "'.$description.'"}');
$results = shell_exec("sudo curl -k -L --cert $cert --key $key -X POST -d $data $url");
}
else {
//This is process of creating storage pool on a non-clustered host
$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;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,75 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
$cert = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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?recursion=1&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_volumes = $remote_data['metadata'];
$i = 0;
echo '{ "data": [';
foreach ($storage_volumes as $storage_volume){
if ($storage_volume['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['name']) . '",';
echo '"' . htmlentities($storage_volume['type']) . '",';
echo '"';
$ii = 0;
foreach ($storage_volume['used_by'] as $item){
if ($ii >= 1)
echo ", ";
$ii++;
echo htmlentities($item);
}
echo '",';
echo '"';
//echo "<a href='#' onclick=loadStorageVolumeJson('".$storage_volume."')><i class='fas fa-edit fa-lg' style='color:#ddd'></i></a>";
//echo " &nbsp ";
//echo "<a href='#' onclick=deleteStorageVolume('".$storage_volume."')><i class='fas fa-trash-alt fa-lg' style='color:#ddd'></i></a>";
echo '"';
echo " ]";
}
echo " ]}";
}
}
else {
echo '{ "data": [] }';
}
?>

View file

@ -1,69 +0,0 @@
<?php
if (!empty($_SERVER['PHP_AUTH_USER'])) {
//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 = "/var/lxdware/data/lxd/client.crt";
$key = "/var/lxdware/data/lxd/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;
}
else {
echo '{"error": "not authenticated", "error_code": "401", "metadata": {"err": "not authenticated", "status_code": "401"}}';
}
?>

View file

@ -1,504 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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="#" data-toggle="modal" data-target="#createProfileModal">
<i class="fas fa-plus fa-sm fa-fw"></i>
New Profile
</a>
</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 profileToUpdate = "";
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent(){
$('#profileListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#profileListTable').DataTable( {
ajax: "./php/lxd/profile-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Name" },
{ title: "Description" },
{ title: "Devices" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
//API uses sync
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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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');
});
}
//API uses sync
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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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,413 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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="#" data-toggle="modal" data-target="#createProjectModal">
<i class="fas fa-plus fa-sm fa-fw"></i>
New Project
</a>
</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 projectToUpdate = "";
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent(){
$('#projectListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#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" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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,178 +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_dark.png" style="width: 2rem;"></img>
<!-- <i class="fas fa-cube" style="width: 2rem;"></i> -->
</div>
<div class="sidebar-brand-text mx-3">Dashboard</div>
</a>
<!-- Divider -->
<hr class="sidebar-divider">
<div id="hosts">
<!-- Nav Item - Hosts -->
<li class="nav-item">
<a class="nav-link" href="index.html">
<i class="fas fa-fw fa-server"></i>
<span>Hosts</span></a>
</li>
</div>
<!-- Divider -->
<hr class="sidebar-divider">
<div id="main">
<!-- Nav Item - Instances -->
<li class="nav-item">
<a class="nav-link" id="instancesLinkSidebar" href="#">
<i id="instancesIcon" class="fas fa-fw fa-cube"></i>
<span id="instancesSpan">Instances</span></a>
</li>
<!-- Nav Item - Images -->
<li class="nav-item">
<a class="nav-link" id="imagesLinkSidebar" href="#">
<i id="imagesIcon" class="fas fa-fw fa-box-open"></i>
<span id="imagesSpan">Images</span></a>
</li>
<!-- Nav Item - Profiles -->
<li class="nav-item">
<a class="nav-link" id="profilesLinkSidebar" href="#">
<i id="profilesIcon" class="fas fa-fw fa-address-card"></i>
<span id="profilesSpan">Profiles</span></a>
</li>
<!-- Nav Item - Networks -->
<li class="nav-item">
<a class="nav-link" id="networksLinkSidebar" href="#">
<i id="networksIcon" class="fas fa-fw fa-network-wired"></i>
<span id="networksSpan">Networks</span></a>
</li>
<!-- Nav Item - Storage Pools-->
<li class="nav-item">
<a class="nav-link" id="storagePoolsLinkSidebar" href="#">
<i id="storagePoolsIcon" class="fas fa-fw fa-hdd"></i>
<span id="storagePoolsSpan">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 id="clusterIcon" class="fas fa-fw fa-project-diagram "></i>
<span id="cluterSpan">Cluster</span>
</a>
</li>
<!-- Nav Item - Projects-->
<li class="nav-item">
<a class="nav-link" id="projectsLinkSidebar" href="#">
<i id="projectsIcon" class="fas fa-fw fa-chart-bar"></i>
<span id="projectsSpan">Projects</span>
</a>
</li>
<!-- Nav Item - Operations-->
<li class="nav-item">
<a class="nav-link" id="operationsLinkSidebar" href="#">
<i id="operationsIcon" class="fas fa-fw fa-exchange-alt"></i>
<span id="operationsSpan">Operations</span>
</a>
</li>
<!-- Nav Item - Certificates-->
<li class="nav-item">
<a class="nav-link" id="certificatesLinkSidebar" href="#">
<i id="certificatesIcon" class="fas fa-fw fa-wallet"></i>
<span id="certificatesSpan">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 id="simplestreamsIcon" class="fas fa-fw fa-archive"></i>
<span id="simplestreamsSpan">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));
if (location.pathname == "/admin/instances.html" || location.pathname == "/admin/instance.html"){
$('#instancesSpan').css('color','#fff');
$('#instancesIcon').css('color','#fff');
}
if (location.pathname == "/admin/images.html"){
$('#imagesSpan').css('color','#fff');
$('#imagesIcon').css('color','#fff');
}
if (location.pathname == "/admin/profiles.html"){
$('#profilesSpan').css('color','#fff');
$('#profilesIcon').css('color','#fff');
}
if (location.pathname == "/admin/networks.html"){
$('#networksSpan').css('color','#fff');
$('#networksIcon').css('color','#fff');
}
if (location.pathname == "/admin/storage-pools.html" || location.pathname == "/admin/storage-volumes.html"){
$('#storagePoolsSpan').css('color','#fff');
$('#storagePoolsIcon').css('color','#fff');
}
if (location.pathname == "/admin/cluster.html"){
$('#cluterSpan').css('color','#fff');
$('#clusterIcon').css('color','#fff');
}
if (location.pathname == "/admin/projects.html"){
$('#projectsSpan').css('color','#fff');
$('#projectsIcon').css('color','#fff');
}
if (location.pathname == "/admin/operations.html"){
$('#operationsSpan').css('color','#fff');
$('#operationsIcon').css('color','#fff');
}
if (location.pathname == "/admin/certificates.html"){
$('#certificatesSpan').css('color','#fff');
$('#certificatesIcon').css('color','#fff');
}
if (location.pathname == "/admin/simplestreams.html"){
$('#simplestreamsSpan').css('color','#fff');
$('#simplestreamsIcon').css('color','#fff');
}
</script>

View file

@ -1,358 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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="#" data-toggle="modal" data-target="#addSimplestreamsModal">
<i class="fas fa-plus fa-sm fa-fw"></i>
New Simplestreams Host
</a>
</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" 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-2 col-form-label text-right">URL: </label>
<div class="col-9">
<div class="form-group">
<input type="text" class="form-control" id="hostInput" required="required" placeholder="URL" name="host">
</div>
</div>
</div>
<div class="row">
<label class="col-2 col-form-label text-right">Alias: </label>
<div class="col-9">
<div class="form-group">
<input type="text" class="form-control" id="aliasInput" placeholder="Alias" 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');
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent() {
$('#simplestreamsListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#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" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
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);
if (data.substring(0, 5) == "Error"){
alert(data);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
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);
if (data.substring(0, 5) == "Error"){
alert(data);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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,490 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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="#" data-toggle="modal" data-target="#createStoragePoolModal">
<i class="fas fa-plus fa-sm fa-fw"></i>
New Storage Pool
</a>
</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 storagePoolToUpdate = "";
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent() {
$('#storagePoolListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#storagePoolListTable').DataTable( {
ajax: "./php/lxd/storage-pool-list.php?remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName),
columns: [
{},
{ title: "Name" },
{ title: "Description" },
{ title: "Driver" },
{ title: "Status" },
{ title: "Source" },
{ title: "Size" },
{ title: "Action" }
],
order: [],
columnDefs: [
{ targets: 0, orderable: false, width: "25px" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//API uses sync
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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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');
});
}
//API uses sync
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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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,411 +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_light.png">
<title>lxdware - dashboard</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 Notification -->
<div class="d-none d-sm-inline-block form-inline mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<ul class="navbar-nav ml-auto">
<li>
<div class="nav-item spinner-border m-3" role="status" style="display:none;" id="spinner">
<span class="nav-item sr-only">Loading...</span>
</div>
</li>
<li class="nav-item dropdown no-arrow" id="notificationArea" style="display: none;">
<div class="nav-link dropdown-toggle">
<span id="notification" class="mr-2 d-none d-lg-inline text-gray-600">Notification</span>
</div>
</li>
</ul>
</div>
<!-- Topbar Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item dropdown" id="remoteListNav">
</li>
<li class="nav-item dropdown" 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">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>
<a class="dropdown-item" href="#" onclick="logout()">
<i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i>
Logout
</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>
<!-- 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 storageVolumeToUpdate = "";
function logout(){
var http = new XMLHttpRequest();
http.open("get", "../admin", false, "null", "null");
http.send("");
window.location.replace("../index.html");
}
function operationStatusCheck(){
//check to see if there are any running operations
$.get("./php/lxd/operation-status.php?remote=" + encodeURI(remoteName), function (data) {
//Check to see if we have running operations
if (data){
//Display spinner and notification area if there are running tasks
$('#spinner').show();
$('#notificationArea').show();
$('#notification').text(data);
//Set the page to check operations again in 1 second
setTimeout(() => { operationStatusCheck(); }, 1000);
}
else {
//Hide spinner and notification area if no running tasks
$('#spinner').hide();
$('#notificationArea').hide();
$('#notification').text("");
//Set the page to check operations again in 3 seconds
setTimeout(() => { operationStatusCheck(); }, 3000);
}
});
}
function reloadPageContent(){
$('#storageVolumeListTable').DataTable().ajax.reload();
//Set the page content to reload again in 3 more seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
function loadPageContent(){
//Check Authorization
$.get("./php/auth/auth-check.php", function (data) {
if(data != "true"){
window.location.replace("../index.html");
}
});
$('#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" }
]
});
//Check for any running operations
operationStatusCheck();
//Set the page content to reload once in 3 seconds
setTimeout(() => { reloadPageContent(); }, 3000);
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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');
});
}
//API uses sync
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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
//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);
}
setTimeout(() => { reloadPageContent(); }, 1000);
});
}
$(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();
$("#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: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 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);
}
}

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