Commit e54fc488 authored by Jonathon Duerig's avatar Jonathon Duerig

Make parameterizable topology view a viewer rather than an editor.

parent 30c826e5
......@@ -236,6 +236,7 @@ function SPITFORM($formfields, $newuser, $errors)
SPITHEADER(1);
echo "<div id='ppviewmodal_div'></div>\n";
echo "<div class='row'>
<div class='col-lg-6 col-lg-offset-3
col-md-6 col-md-offset-3
......
......@@ -56,13 +56,18 @@ function (_, editModalString)
alert('Failed to fetch Jacks context from ' + contextUrl);
}
function JacksEditor (root)
function JacksEditor (root, isViewer)
{
this.root = root;
this.instance = null;
this.input = null;
this.output = null;
this.xml = null;
this.mode = 'editor';
if (isViewer)
{
this.mode = 'viewer';
}
this.render();
}
......@@ -71,12 +76,16 @@ function (_, editModalString)
render: function ()
{
this.root.html(editModalString);
if (this.mode !== 'editor')
{
this.root.find('.modal-header h3').html('Topology Viewer');
}
this.root.find('#quickvm_editmodal').on('shown.bs.modal', _.bind(this.handleShown, this));
this.root.find('#edit-save').click(_.bind(this.fetchXml, this));
this.root.find('#edit-cancel, #edit-dismiss')
.click(_.bind(this.cancelEdit, this));
this.instance = new window.Jacks({
mode: 'editor',
mode: this.mode,
source: 'rspec',
root: '#edit_nopicker',
nodeSelect: true,
......
......@@ -370,7 +370,7 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart,
registered : true,
amlist : amlist,
amdefault : window.AMDEFAULT,
editor : editor});
});
return;
}
sup.ShowModal('#instantiate_modal');
......
......@@ -254,13 +254,7 @@ function(_, sup, JacksEditor, ppmodalString, ppbodyString, chooserString)
return;
}
// Caller might already have an editor instance.
if (_.has(args, "editor")) {
editor = args.editor;
}
else {
editor = new JacksEditor($('#editmodal_div'));
}
editor = new JacksEditor($('#ppviewmodal_div'), true);
// Callback; instead of instantiate, send rspec to callback.
if (_.has(args, "callback")) {
callback_done = args.callback;
......
......@@ -95,6 +95,7 @@ function SPITFORM($formfields, $errors)
SPITHEADER(1);
echo "<div id='ppviewmodal_div'></div>\n";
# Place to hang the toplevel template.
echo "<div id='manage-body'></div>\n";
......
......@@ -63,7 +63,7 @@ function SPITFORM($formfrag, $formfields, $errors)
# Place to hang the toplevel template.
echo "<div id='main-body'></div>\n";
# For the editor.
echo "<div id='editmodal_div'></div>\n";
echo "<div id='ppviewmodal_div'></div>\n";
# I think this will take care of XSS prevention?
echo "<script type='text/plain' id='form-json'>\n";
......
......@@ -45,6 +45,7 @@ $reqargs = RequiredPageArguments("uuid", PAGEARG_STRING);
SPITHEADER(1);
echo "<div id='ppviewmodal_div'></div>\n";
if (!isset($uuid)) {
SPITUSERERROR("Must provide uuid!");
}
......
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