Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Commit

Permalink
#31 #38 adding the ability to edit and upload custom yml and hitting …
Browse files Browse the repository at this point in the history
…the remote api endpoint for stack information
  • Loading branch information
thelamer committed Dec 10, 2017
1 parent c04859a commit 9c31f61
Show file tree
Hide file tree
Showing 73 changed files with 122 additions and 67,960 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
node_modules
.c9
version
public/stackstemp/*.yml
25 changes: 20 additions & 5 deletions app.js
Expand Up @@ -22,6 +22,7 @@ var dockerops = dockops.createDocker();
var images = new dockops.Images(dockerops);
var xparse = require('xrandr-parse');
var fs = require('fs');
var path = require('path');
let dockerHubAPI = require('docker-hub-api');
dockerHubAPI.setCacheOptions({enabled: false});
// Sleep Helper
Expand Down Expand Up @@ -219,8 +220,7 @@ io.on('connection', function(socket){
});
// Get Taisun.io stacks running locally
socket.on('getstacks', function(){
// Just send an empty response for now
io.sockets.in(socket.id).emit('localstacks','no');
containerinfo('localstacks');
});
// Get remote list of stack definition files from stacks.taisun.io
socket.on('browsestacks', function(page){
Expand All @@ -244,17 +244,32 @@ io.on('connection', function(socket){
io.sockets.in(socket.id).emit('stackurlresults', [name,description,form,url]);
});
});
// Parse Taisun Stacks Yaml and send form to client
// Parse Yaml for single container and send to user
socket.on('sendimagename', function(imagename){
request.get({url:'http://localhost/public/stackstemp/basetemplate.yml'},function(error, response, body){
request.get({url:'http://localhost/public/taisuntemplates/basetemplate.yml'},function(error, response, body){
var yml = yaml.safeLoad(body);
var name = yml.name;
var description = yml.description;
var form = yml.form;
form.push({type:'input',format:'text',label:'image',FormName:'Image',placeholder:'',value:imagename});
io.sockets.in(socket.id).emit('stackurlresults', [name,description,form,'http://localhost/public/stackstemp/basetemplate.yml']);
io.sockets.in(socket.id).emit('stackurlresults', [name,description,form,'http://localhost/public/taisuntemplates/basetemplate.yml']);
});
});
// Get custom Yaml from user and create a temp file for using the standard workflow
socket.on('sendyaml', function(code){
var guid = uuidv4().substring(0,12);
var file = path.join(__dirname, 'public/stackstemp/', guid + '.yml');
fs.writeFile(file, code, function(err) {
if(err) {
return console.log(err);
}
var yml = yaml.safeLoad(code);
var name = yml.name;
var description = yml.description;
var form = yml.form;
io.sockets.in(socket.id).emit('stackurlresults', [name,description,form,'http://localhost/public/stackstemp/' + guid + '.yml']);
});
});
// When user submits stack data launch the stack
socket.on('launchstack', function(userinput){
var url = userinput.stackurl;
Expand Down
11 changes: 4 additions & 7 deletions public/LICENSE
Expand Up @@ -12,10 +12,7 @@ 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.
Taisun.io license below:

Do whatever the hell you want with this code. The hive mind will never be stopped
by the copyright system.
264 changes: 0 additions & 264 deletions public/css/sb-admin.css

This file was deleted.

0 comments on commit 9c31f61

Please sign in to comment.