Skip to content

Commit

Permalink
Popup msg will now displayed when the user installs a new plugin (If …
Browse files Browse the repository at this point in the history
…the popupmsg exists in the bundle)
  • Loading branch information
creoludifico committed Jan 21, 2017
1 parent e6a7c4b commit 14b1bd7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Contents/Code/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
WT_AUTH = True # validate password
VERSION = 'ERROR' # version of WebTools
UAS_URL = 'https://github.com/ukdtom/UAS2Res' # USA2 Repo branch
UAS_BRANCH = 'master' # UAS2 branch to check
UAS_BRANCH = 'test' # UAS2 branch to check
PREFIX = '/applications/webtools'
NAME = 'WebTools'
ICON = 'WebTools.png'
Expand Down
21 changes: 13 additions & 8 deletions http/modules/install/jscript/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ install.search_apps = function () {

if (Object.size(install.backupAllBundles) > Object.size(install.allBundles)) install.allBundles = install.backupAllBundles;
var allBundles = install.allBundles;

install.backupAllBundles = install.allBundles;

//Temp array.. TODO: Get list from backend instead
Expand Down Expand Up @@ -174,8 +173,9 @@ install.show_options = function() {
$('#OptionsModalAlert').hide();
}

install.installfromgit = function(github) {
var branch = null;
install.installfromgit = function(github, popupmsg) {
var branch = null;
popupmsg = (popupmsg ? "<br /><br />" + popupmsg : "");

// Retrieve channel element
var $channel = $('#channellist .panel[data-url="' + github + '"]');
Expand Down Expand Up @@ -207,7 +207,12 @@ install.installfromgit = function(github) {
type: 'GET',
dataType: 'text',
success: function (data) {
$('#myModalBody').html('Done. Your channel has been successfully installed. Data will be refreshed from the server.');
$('#myModalBody').html('Done. Your channel has been successfully installed. Data will be refreshed from the server.' + (popupmsg ? "<br /><br />" : ""));
//Popupmsg displaying html tags as text.
//Security reasons because we are getting this from the semi-public json in UAS repo
var popupmsgEle = document.createElement("DIV");
popupmsgEle.innerHTML = popupmsg;
$('#myModalBody').append(popupmsgEle.textContent || popupmsgEle.innerText || "");
$('#myModalFoot').html('<button type="button" class="btn btn-default" onclick="$(\'#gitlink\').val(\'\');install.loadChannels();" data-dismiss="modal">Close</button>');
},
error: function(data) {
Expand Down Expand Up @@ -290,7 +295,6 @@ install.loadChannels = function (InitalRun) {
install.allBundles[tempkey] = object;
console.log(object);
})

callback();
},
error: function(data) {
Expand Down Expand Up @@ -446,6 +450,8 @@ install.showChannels = function (button, type, page, highlight) {
var key = install.channelstoshow[i];
var bundleInfo = install.allBundles[key];
console.log(bundleInfo);
var popupmsg = (bundleInfo.popupmsg ? bundleInfo.popupmsg : "");

var dropdown_branch = '';

var link_install = '';
Expand All @@ -456,7 +462,6 @@ install.showChannels = function (button, type, page, highlight) {
var installDate = '';
var rowspan = 3;
var repolink = '';

if((typeof(bundleInfo.branches) != 'undefined') && Array.isArray(bundleInfo.branches)) {
// Retrieve selected branch
var selectedBranch = null;
Expand Down Expand Up @@ -486,15 +491,15 @@ install.showChannels = function (button, type, page, highlight) {
isInstalled = true;
rowspan = 3;
if ((key.indexOf('http') != -1) && (key.indexOf('https') != -1)) {
link_install = '<button class="btn btn-default btn-xs" onclick="install.installfromgit(\'' + key + '\')">Re-Install with latest available</button>';
link_install = '<button class="btn btn-default btn-xs" onclick="install.installfromgit(\'' + key + '\', \'' + popupmsg + '\')">Re-Install with latest available</button>';
}
}


if ((key.indexOf('http') != -1) && (key.indexOf('https') != -1)) {
if (isInstalled === false) {
//link_install = '<div class="panel-footer"><button class="btn btn-default btn-xs" onclick="install.installfromgit(\'' + key + '\')">Install</button>';
link_install = '<button class="btn btn-default btn-xs" onclick="install.installfromgit(\'' + key + '\')">Install</button>';
link_install = '<button class="btn btn-default btn-xs" onclick="install.installfromgit(\'' + key + '\', \'' + popupmsg + '\')">Install</button>';
}
repolink = '<a href="' + key + '" target="_NEW">' + key + '</a>';
//link_update += ' <button class="btn btn-default btn-xs" onclick="install.checkForUpdates(\'' + install.allBundles[key].bundle + '\',\'' + key + '\')">Check for Updates</button>';
Expand Down

0 comments on commit 14b1bd7

Please sign in to comment.