Commit e195a28c authored by Leigh B Stoller's avatar Leigh B Stoller

Do not show the copy/clone buttons on repo based profiles, this makes no

sense really and will just confuse users. We still allow multiple
profiles to point to the same external repo, but users have to do that
explicitly by creating a new profile.
parent be8e8905
......@@ -75,6 +75,7 @@ function Do_GetProfile()
'created' => $profile->created(),
'ispprofile' => $ispp,
'isscript' => ($profile->script() ? 1 : 0),
'fromrepo' => ($profile->repourl() ? 1 : 0),
'amdefault' => $amdefault));
}
......
......@@ -144,6 +144,7 @@ $(function ()
profilevers: window.PROFILEVERS,
showpicker: showpicker,
cancopy: window.CANCOPY,
fromrepo: fromrepo,
clustername: window.PORTAL_NAME,
admin: isadmin,
maxduration: window.MAXDURATION,
......@@ -1354,6 +1355,14 @@ $(function ()
selected_version = profile_blob.version;
amdefault = profile_blob.amdefault;
// Not allowed to copy a repo based profile.
if (profile_blob.fromrepo) {
$('#profile_copy_button').addClass("hidden");
}
else {
$('#profile_copy_button').removeClass("hidden");
}
/*
* Change the project; if the user's project list includes
* the project the profile belongs to, that becomes the default.
......
......@@ -116,6 +116,11 @@ $(function ()
$('#approval_div').html(approvalString);
$('#linktest_div').html(linktestString);
// Not allowed to clone/copy repobased profiles.
if (window.APT_OPTIONS.repourl !== undefined) {
$('#copy_button').addClass("hidden");
}
// Format dates with moment before display.
$('.format-date').each(function() {
var date = $.trim($(this).html());
......@@ -1828,7 +1833,8 @@ $(function ()
* created from in order to do a snapshot.
*/
if (nodecount == 1) {
if (window.APT_OPTIONS.canclone) {
if (window.APT_OPTIONS.canclone &&
window.APT_OPTIONS.repourl === undefined) {
$("#clone_button").removeClass("hidden");
}
if (window.APT_OPTIONS.cansnap) {
......
......@@ -75,6 +75,7 @@ function SPITFORM($formfields, $errors)
$canrepo = (ISADMIN() || STUDLY() ? 1 : 0);
$multisite = 1;
$cloning = 0;
$copying = 0;
$disabled = 0;
$version_uuid = "null";
$profile_uuid = "null";
......@@ -112,6 +113,9 @@ function SPITFORM($formfields, $errors)
if ($action == "clone") {
$cloning = 1;
}
else {
$copying = 1;
}
$action = "create";
}
$button_label = "Create";
......@@ -198,6 +202,7 @@ function SPITFORM($formfields, $errors)
echo " window.MULTISITE = $multisite;\n";
echo " window.HISTORY = $history;\n";
echo " window.CLONING = $cloning;\n";
echo " window.COPYING = $copying;\n";
echo " window.ACTIVITY = $activity;\n";
echo " window.TITLE = '$title';\n";
echo " window.BUTTONLABEL = '$button_label';\n";
......
......@@ -157,7 +157,7 @@
<div id='selected_profile_description'></div>
</div>
<div class='panel-footer'>
<% if (cancopy) { %>
<% if (cancopy && !fromrepo) { %>
<button class='btn btn-default btn-sm pull-left'
type='button' id='profile_copy_button'
style='margin-right: 10px;'
......
......@@ -365,19 +365,21 @@
</span>
<% } %>
<% if (! (viewing || window.CLONING)) { %>
or
<span data-toggle='popover'
<span id="git-repo-button-div">
or
<span data-toggle='popover'
data-delay='{"hide":500, "show":500}'
data-html='true'
data-content="Supply your profile source from a
Git repository.
Click for more info.">
<button class='btn btn-primary btn-xs'
data-toggle='modal'
data-target='#git-repo-modal'
type='button'
style='margin-left: 10px;'
id='git-repo-button'>Git Repo</button>
<button class='btn btn-primary btn-xs'
data-toggle='modal'
data-target='#git-repo-modal'
type='button'
style='margin-left: 10px;'
id='git-repo-button'>Git Repo</button>
</span>
</span>
<% } %>
</div>
......@@ -724,6 +726,7 @@
</button>
</span>
<% } %>
<% if (!fromrepo) { %>
<a class='btn btn-primary btn-xs pull-left'
id='profile_copy_button'
style='margin-right: 10px;'
......@@ -740,6 +743,7 @@
whatever images the original profile uses.">
Copy
</a>
<% } %>
<span class='pull-left'
data-toggle='popover'
data-delay='{"hide":1500, "show":250}'
......
......@@ -212,12 +212,14 @@
style='margin-right: 10px;'
name='create'>Instantiate
</button>
<% if (!fromrepo) { %>
<a class='btn btn-primary btn-xs pull-right'
style='margin-right: 10px;'
type='button'
href='manage_profile.php?action=copy&uuid=<%= version_uuid %>'>
Copy
</a>
<% } %>
<% } %>
<% if (canedit) { %>
<a class='btn btn-primary btn-xs pull-right'
......
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