Commit ab33c1c7 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: remove /inspectSoftware page and related views

parent 2cd3bc33
/*jslint undef: true */
/*global $, document, window, $SCRIPT_ROOT, ace */
/* vim: set et sts=4: */
$(document).ready(function () {
"use strict";
var editor,
send = false,
runnerDir = $("input#runnerdir").val();
function fillContent() {
$('#fileNavigator').gsFileManager({script: $SCRIPT_ROOT + "/fileBrowser", root: runnerDir});
}
$("#reloadfiles").click(function () {
fillContent();
});
fillContent();
$("#open").click(function () {
var elt = $("option:selected", $("#softwarelist"));
if (elt.val() === "No Software Release found") {
$("#error").Popup("Please select your Software Release", {type: 'alert', duration: 5000});
return false;
}
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/supplySoftwareRelease',
data: "path=" + elt.attr('rel'),
success: function (data) {
if (data.code === 1) {
window.location.href = $SCRIPT_ROOT + '/editSoftwareProfile';
} else {
$("#error").Popup(data.result, {type: 'error', duration: 5000});
}
}
});
return false;
});
$("#delete").click(function () {
if ($("#softwarelist").val() === "No Software Release found") {
$("#error").Popup("Please select your Software Release", {type: 'alert', duration: 5000});
return false;
}
if (send) {
return;
}
if (!window.confirm("Do you really want to delete this software release?")) {
return;
}
send = false;
var elt = $("option:selected", $("#softwarelist"));
$.ajax({
type: "POST",
url: $SCRIPT_ROOT + '/removeSoftwareDir',
data: {
md5: $("#softwarelist").val(),
title: elt.attr('title')
},
success: function (data) {
var i;
if (data.code === 1) {
$("#softwarelist").empty();
for (i = 0; i < data.result.length; i += 1) {
$("#softwarelist").append('<option value="' + data.result[i].md5 +
'" title="' + data.result[i].title + '" rel="' +
data.result[i].path + '">' + data.result[i].title + '</option>');
}
if (data.result.length < 1) {
$("#softwarelist").append('<option>No Software Release found</option>');
$('#fileTree').empty();
}
fillContent();
$("#error").Popup("Operation complete, Selected Software Release has been delete!",
{type: 'confirm', duration: 5000});
} else {
$("#error").Popup(data.result, {type: 'error'});
}
send = false;
}
});
return false;
});
function setupEditor() {
editor = ace.edit("editor");
editor.setTheme("ace/theme/crimson_editor");
var CurentMode = require("ace/mode/text").Mode;
editor.getSession().setMode(new CurentMode());
editor.getSession().setTabSize(2);
editor.getSession().setUseSoftTabs(true);
editor.renderer.setHScrollBarAlwaysVisible(false);
editor.setReadOnly(true);
}
});
......@@ -98,7 +98,6 @@
<li><a href="{{ url_for('runInstanceProfile') }}" id="instrun">Redeploy Services</a></li>
<li class='sep'></li>
<li><a href="{{ url_for('browseWorkspace') }}">Browse Workspace</a></li>
<li><a href="{{ url_for('inspectSoftware') }}">My Software Releases</a></li>
</ul>
</li>
<li class='right_menu slapos_run' id="softrun"><a href="{{ url_for('runSoftwareProfile') }}"></a>
......
{% extends "layout.html" %}
{% block title %}Webrunner software Inspection{% endblock %}
{% block head %}
{{ super() }}
<script src="{{ url_for('static', filename='js/scripts/inspectSoftware.js') }}" type="application/javascript" charset="utf-8"></script>
<link href="{{ url_for('static', filename='css/colorbox.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
<script src="{{ url_for('static', filename='js/jquery/jquery.colorbox-min.js') }}" type="application/javascript" charset="utf-8"></script>
<link href="{{ url_for('static', filename='css/gsFileManager.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
<script src="{{ url_for('static', filename='js/jquery/gsFileManager.js') }}" type="application/javascript" charset="utf-8"></script>
{% endblock %}
{% block body %}
<input type="hidden" name="runnerdir" id="runnerdir" value="{{softwareRoot}}" />
<label for='softwarelist' class='header'>Inspect software release </label>
<select name="softwarelist" id="softwarelist">
{%if not softwares %}<option >No Software Release found</option>{% endif %}
{%for soft in softwares %}
<option value="{{soft['md5']}}" title="{{soft['title']}}" rel="{{soft['path']}}">{{soft['title']}}</option>
{%endfor%}
</select>
&nbsp;&nbsp;<button id ="delete" class="button" title="Remove this software">Remove</button>
&nbsp;&nbsp;<button id ="open" class="button" title="Set this software as current software release">Open</button>
<br/><br/>
<div id="fileNavigator"></div>
<br/>
<a href="#" id="reloadfiles" class="lshare simple">Reload Files</a>
<br/>
{% endblock %}
......@@ -29,7 +29,7 @@ from slapos.runner.utils import (checkSoftwareFolder, checkUserCredential,
loadSoftwareRList, md5sum, newSoftware,
readFileFrom, readParameters, realpath,
removeCurrentInstance,
removeSoftwareByName, runSlapgridUntilSuccess,
runSlapgridUntilSuccess,
saveBuildAndRunParams,
setMiniShellHistory,
stopProxy,
......@@ -143,24 +143,6 @@ def editSoftwareProfile():
profile=profile, projectList=listFolder(app.config, 'workspace'))
def inspectSoftware():
return render_template('runResult.html', softwareRoot='software_link/',
softwares=loadSoftwareRList(app.config))
#remove content of compiled software release
def removeSoftware():
if isSoftwareRunning(app.config) or isInstanceRunning(app.config):
flash('Software installation or instantiation in progress, cannot remove')
elif os.path.exists(app.config['software_root']):
svcStopAll(app.config)
shutil.rmtree(app.config['software_root'])
for link in os.listdir(app.config['software_link']):
os.remove(os.path.join(app.config['software_link'], link))
flash('Software removed')
return redirect(url_for('inspectSoftware'))
def runSoftwareProfile():
_thread.start_new_thread(runSlapgridUntilSuccess,
(app.config, "software", True))
......@@ -402,12 +384,6 @@ def removeFile():
return jsonify(code=0, result=str(e))
def removeSoftwareDir():
status, message = removeSoftwareByName(app.config, request.form['md5'],
request.form['title'])
return jsonify(code=status, result=message)
#read file and return content to ajax
def getFileContent():
file_path = realpath(app.config, request.form['file'])
......@@ -846,8 +822,6 @@ app.add_url_rule('/', 'home', home)
app.add_url_rule('/browseWorkspace', 'browseWorkspace', browseWorkspace)
app.add_url_rule('/editSoftwareProfile', 'editSoftwareProfile',
editSoftwareProfile)
app.add_url_rule('/inspectSoftware', 'inspectSoftware', inspectSoftware)
app.add_url_rule('/removeSoftware', 'removeSoftware', removeSoftware)
app.add_url_rule('/runSoftwareProfile', 'runSoftwareProfile',
runSoftwareProfile, methods=['GET', 'POST'])
app.add_url_rule('/editInstanceProfile', 'editInstanceProfile',
......@@ -893,8 +867,6 @@ app.add_url_rule("/newBranch", 'newBranch', newBranch, methods=['POST'])
app.add_url_rule("/changeBranch", 'changeBranch', changeBranch, methods=['POST'])
app.add_url_rule("/saveFileContent", 'saveFileContent', saveFileContent,
methods=['POST'])
app.add_url_rule("/removeSoftwareDir", 'removeSoftwareDir', removeSoftwareDir,
methods=['POST'])
app.add_url_rule("/getFileContent", 'getFileContent', getFileContent,
methods=['POST'])
app.add_url_rule("/removeFile", 'removeFile', removeFile, methods=['POST'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment