Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paranoid GUI #378

Merged
merged 22 commits into from
Apr 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ _testmain.go

# TLS cert/key files
*.pem

node_modules/

**/bootstrap.min.css
**/site.css
**/jquery-2.2.2.min.js
22 changes: 22 additions & 0 deletions paranoid-gui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Paranoid GUI #

## Preconditions ##
You must have [Node Webkit](http://nwjs.io/) installed.

You also must have [Nodejs](https://nodejs.org/en/) including npm installed

paranoid-cli must be installed and within your $PATH


## Build Instructions ##
Navigate into this directory inside a terminal and run the following commands.
```
npm install
sh init.sh
```

## Running the GUI ##
After following the build instructions make sure you are still in the directory and run the following command:
```
nw .
```
135 changes: 135 additions & 0 deletions paranoid-gui/css/master.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
@import url("http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fonts will not work when there is no internet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neither will any of the filesystems. But what solution do you propose? should i download the actual font file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would work locally.

Yes. Download the font and add it to gitignore, check #387


* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: 'Open Sans';
}

a {
text-decoration: none;
}

div#header {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDs should not be used for styling. Applies to all cases further on in the file as well

width: 100%;
height: 50px;
background-color: #2c3e50;
margin: 0 auto;
}

.logo {
float: left;
margin-top: 8px;
}

.logo a{
font-size: 1.6em;
color: #fff;
margin-left: 10px;
}

.logo a span {
font-weight: 300;
}

div#container {
width: 100%;
margin: 0 auto;
}

.sidebar {
width: 250px;
height: -webkit-calc(100% - 50px); /* Chrome, Safari */
background-color: #171717;
float: left;
}

.content {
width: auto;
height: -webkit-calc(100% - 50px); /* Chrome, Safari */
background-color: #95a5a6;
margin-left: 250px;
padding: 15px;
overflow-y: scroll;
}

.devs {
width: 100%;
display: flex;
flex-direction: column;
}

.content p {
color: #424242;
font-size: 0.7em;
}

#badge {
float: right;
}

#refreshButton {
float: right;
}

ul#nav li{
list-style: none;
}

ul#nav li a{
color: #ccc;
display: block;
padding: 10px;
font-size: 0.8em;
border-bottom: 1px solid #0A0A0A;
-webkit-transition: 0.2s;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just declaring it as transition would also work

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know but i specifically want 0.2s

}

ul#nav li a:hover {
background-color: #030303;
color: #fff;
padding-left: 20px;
}

ul#nav li a.selected {
padding-left: 30px;
font-weight: bold;
}

div#box {
margin-top: 15px;
}

div#box .box-top {
color: #fff;
text-shadow: 0px 0px 1px #000;
background-color: #2980b9;
padding: 5px;
padding-left: 15px;
font-weight: 500;

}

div#box .box-panel {
padding: 15px;
background-color: #fff;
}

div#buttons {
padding-top: 15px;
display: flex;
flex-direction: row;
width: 100%;
}

div#buttons.btn {
width: 33%;
}

#refresh_bt {
padding: 100px;
}
72 changes: 72 additions & 0 deletions paranoid-gui/html/filesystem.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<div id="fsHeader">
<h1 id="fsName">FileSystem</h1>
<hr>
</div>

<div id="fsStatus">
<h3>Status <span class="label label-success" id="fsMountedLabel">Mounted</span>
<button class="btn btn-normal" id="refreshButton" onClick="refreshButtonClicked()">refresh</button></h3>

<div class="onlyForMountedSection">
<div class="mountpointSection">
<h5>Mountpoint</h5>
<ul class="list-group">
<li class="list-group-item"><div id="mountpoint">Must be mounted to get mountpoint</div></li>
</ul>
<button class="btn btn-normal" id="openButton" onclick="openButtonPressed()">Open</button>
</div>

<div class="detailedStatus">
<h5>Detailed status</h5>
<ul class="list-group">
<li class="list-group-item"><div id="clistatus">Must be mounted to get detailed status</div></li>
</ul>
</div>

<div class="nodesDiv">
<h5>Nodes</h5>
<ul class="list-group">
<li class="list-group-item"><div id="nodes">Must be mounted to get node list</div></li>
</ul>
</div>
</div>

<button class="btn btn-warning" id="mountUnmountButton" onClick="mountUnmountButtonClicked()">Mount</button>
<button class="btn btn-normal" id="autoMountButton" onClick="automountButtonClicked()">Automount</button>
<hr>
</div>

<div id="fsMountSection">
<h3>Mount your FileSystem</h3>
<form id="fsMountForm">
<label for="location">Location</label>
<input type="file" id="location" class='form-control' placeholder="Directory in which to mount your filesystem" required webkitdirectory directory multiple>
<label for="interface">Interface</label>
<input type="text" id="interface" class='form-control' placeholder="A network interface over which to make connections">
<label for="discovery">Discovery Server</label>
<input type="text" id="discovery" class='form-control' placeholder="The address of the discovery server - ip:port">
<label for="password">Pool Password</label>
<input type="text" id="password" class='form-control' placeholder="The pool password">
<button type="submit" class="btn btn-success">Mount</button>
</form>
<hr>
</div>

<div id="fsAttributes">
<h3>Attributes</h3>
<ul class="list-group" id="fsAttributesList">
<li class="list-group-item" id="fsAttributeEncrypted">Encrypted<span class="label label-success" id="badge">YES</span></li>
<li class="list-group-item" id="fsAttributeNetwork">Network<span class="label label-success" id="badge">YES</span></li>
<li class="list-group-item" id="fsAttributeKeygen">Key Generated<span class="label label-success" id="badge">YES</span></li>
<li class="list-group-item" id="fsAttributePool">Pool<span class="label label-primary" id="badge">strange_fox</span></li>
<li class="list-group-item" id="fsAttributeUuid">UUID<span class="label label-primary" id="badge">e256a4ed-43c2-4011-a1c8-545bc73cc021</span></li>
</ul>
<hr>
</div>

<div id="fsDeleteSection">
<h3>Delete FileSystem</h3>
<label for="nameCheck">Confirm Deletion</label>
<input type="text" name="nameCheck" class='form-control' placeholder="Enter the filesystem name" id="nameCheckText">
<button type="submit" class="btn btn-danger" id="deleteButton">Delete</button>
</div>
19 changes: 19 additions & 0 deletions paranoid-gui/html/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<h1>PFSD Status</h1>
<h3><span class="label label-success" id="runningLabel">running</span></h3>
<hr>
<button class="btn btn-primary" onclick="rowClicked(fileSystems.length)">Create New Filesystem</button>
<hr>
<h1>Credits</h1>
<h2>Co-Ordinator</h2>
<a style="text-decoration:none; color:inherit;" href="#" onclick='require("open")("https://github.com/smblott-github")'><img src="images/Stephen_Blott.jpg"/> Stehpen Blott</a>
<br>
<h2>Developers</h2>
<div class="devs">
<a style="text-decoration:none; color:inherit;" href="#" onclick='require("open")("https://github.com/CanOpener")'><img src="images/Mladen_Kajic.jpg"/> Mladen Kajic</a> <br>
<a style="text-decoration:none; color:inherit;" href="#" onclick='require("open")("https://github.com/GoldenBadger")'><img src="images/Terry_Bolt.jpg"/> Terry Bolt</a> <br>
<a style="text-decoration:none; color:inherit;" href="#" onclick='require("open")("https://github.com/ConorGriffin37")'><img src="images/Conor_Griffin.jpg"/> Conor Griffin</a> <br>
<a style="text-decoration:none; color:inherit;" href="#" onclick='require("open")("https://github.com/VoyTechnology")'><img src="images/Wojtek_Bednarzak.jpg"/> Wojtek Bednarzak</a> <br>
<a style="text-decoration:none; color:inherit;" href="#" onclick='require("open")("https://github.com/SeanHealy33")'><img src="images/Sean_Healy.jpg"/> Sean Healy</a>
</div>
<br>
<div>Icons made by <a href="http://www.freepik.com" title="Freepik">Freepik</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
30 changes: 30 additions & 0 deletions paranoid-gui/html/newFs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<h1>Create a new filesystem</h1>

<form id="newfsForm" action="#" type="submit" onsubmit="newfs(this);">
<label for="name">Name</label>
<input type="text" name="name" class='form-control' placeholder="Name for your filesystem" required>
<label for="cert">Cert</label>
<input type="file" name="cert" class='form-control' placeholder="Path to existing cert file">
<label for="key">Key</label>
<input type="file" name="key" class='form-control' placeholder="Path to existing key file">
<label for="pool">Pool</label>
<input type="text" name="pool" class='form-control' placeholder="Pool name (opt)"><br>
<label for="secure">Secure</label>
<input type="checkbox" name="secure" checked><br>
<label for="network">Use Network</label>
<input type="checkbox" name="network" checked><br>
<label for="encrypted">Encrypted</label>
<input type="checkbox" name="encrypted" checked><br>

<h3>Cert Generation (ignore if unsecured)</h3>
<label for="numDays">Number of days cert is valid</label>
<input type="number" name="numDays" class='form-control' placeholder="365"><br>

<label for="organisation">Organisation name</label>
<input type="text" name="organisation" class='form-control' placeholder="The name of your organisation (optional)"><br>

<label for="hostnames">Hostnames or ips this cert validates (ignore if unsecured)</label>
<input type="text" name="hostnames" class='form-control' placeholder="comma-separated list of hostnames and/or IP addresses this cert will validate (optional)"><br>

<button type="submit" class="btn btn-success">Submit</button>
</form>
Binary file added paranoid-gui/images/Conor_Griffin.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paranoid-gui/images/Mladen_Kajic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paranoid-gui/images/Sean_Healy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paranoid-gui/images/Stephen_Blott.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paranoid-gui/images/Terry_Bolt.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paranoid-gui/images/Wojtek_Bednarzak.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paranoid-gui/images/buildings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paranoid-gui/images/circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paranoid-gui/images/interface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added paranoid-gui/images/interface_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions paranoid-gui/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<html>
<head>
<title>Paranoid Filesystems</title>
<script src="scripts/jquery-2.2.2.min.js"></script>
<script src="scripts/filesystems.js"></script>
<script src="scripts/home.js"></script>
<script type="text/javascript">
var fileSystems = getFilesystems();
$(document).ready(function () {
loadSideBar();
setupHome();
});
$('a[target=_blank]').on('click', function(){
require('open')(this.href);
return false;
});
</script>
<script src="scripts/nav.js"></script>
<link rel="stylesheet" type="text/css" href="css/master.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/site.css">
</head>

<body>
<div id="header">
<div class="logo">
<a onclick="rowClicked(-1)">Paranoid<span>Filesystems</span></a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does -1 mean in this instance?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1 is the index of the home section

</div>
</div>

<div id="container">
<div class="sidebar">
<ul id="nav">
</ul>
</div>

<div class="content">
</div>
</div>
</body>

</html>
10 changes: 10 additions & 0 deletions paranoid-gui/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
echo "downloading bootstrap"
wget --quiet -O ./css/bootstrap.min.css http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably package a make file with the project

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really necessary? the shell script does the job


echo "downloading bootflat"
wget --quiet -O ./css/site.css http://bootflat.github.io/css/site.css

echo "downloading jquery"
wget --quiet -O ./scripts/jquery-2.2.2.min.js https://code.jquery.com/jquery-2.2.2.min.js

echo "done."
14 changes: 14 additions & 0 deletions paranoid-gui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "paranoid-gui",
"description": "Paranoid GUI",
"version": "1.0.0",
"main": "index.html",
"window": {
"toolbar": false,
"width": 1000,
"height": 700
},
"dependencies": {
"open": "0.0.5"
}
}
Loading