mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Set/read plugin-installed flag
This commit is contained in:
parent
92ba7df9c6
commit
ad36695224
@ -471,6 +471,7 @@ $('#js-sys-reboot, #js-sys-shutdown').on('click', function (e) {
|
|||||||
$('#install-user-plugin').on('shown.bs.modal', function (e) {
|
$('#install-user-plugin').on('shown.bs.modal', function (e) {
|
||||||
var button = $(e.relatedTarget);
|
var button = $(e.relatedTarget);
|
||||||
var manifestData = button.data('plugin-manifest');
|
var manifestData = button.data('plugin-manifest');
|
||||||
|
var installed = button.data('plugin-installed');
|
||||||
|
|
||||||
if (manifestData) {
|
if (manifestData) {
|
||||||
$('#plugin-uri').html(manifestData.plugin_uri
|
$('#plugin-uri').html(manifestData.plugin_uri
|
||||||
@ -492,33 +493,43 @@ $('#install-user-plugin').on('shown.bs.modal', function (e) {
|
|||||||
$('#plugin-sudoers').html(formatProperty(manifestData.sudoers || []));
|
$('#plugin-sudoers').html(formatProperty(manifestData.sudoers || []));
|
||||||
$('#plugin-user-name').html(manifestData.user_nonprivileged.name || 'None');
|
$('#plugin-user-name').html(manifestData.user_nonprivileged.name || 'None');
|
||||||
}
|
}
|
||||||
|
if (installed) {
|
||||||
|
$('#js-install-plugin-confirm').html('OK');
|
||||||
|
} else {
|
||||||
|
$('#js-install-plugin-confirm').html('Install now');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#js-install-plugin-confirm').on('click', function (e) {
|
$('#js-install-plugin-confirm').on('click', function (e) {
|
||||||
var progressText = $('#js-install-plugin-confirm').attr('data-message');
|
var progressText = $('#js-install-plugin-confirm').attr('data-message');
|
||||||
var successHtml = $('#plugin-install-message').attr('data-message');
|
var successHtml = $('#plugin-install-message').attr('data-message');
|
||||||
var closeHtml = $('#js-system-reset-cancel').attr('data-message');
|
|
||||||
var pluginUri = $('#plugin-uri a').attr('href');
|
var pluginUri = $('#plugin-uri a').attr('href');
|
||||||
var pluginVersion = $('#plugin-version').text();
|
var pluginVersion = $('#plugin-version').text();
|
||||||
var csrfToken = $('meta[name=csrf_token]').attr('content');
|
var csrfToken = $('meta[name=csrf_token]').attr('content');
|
||||||
|
|
||||||
$("#install-user-plugin").modal('hide');
|
$("#install-user-plugin").modal('hide');
|
||||||
|
|
||||||
|
if ($('#js-install-plugin-confirm').text() === 'Install now') {
|
||||||
$("#install-plugin-progress").modal('show');
|
$("#install-plugin-progress").modal('show');
|
||||||
|
|
||||||
$.post('ajax/plugins/do_plugin_install.php?',{'plugin_uri': pluginUri, 'plugin_version': pluginVersion, 'csrf_token': csrfToken},function(data){
|
$.post('ajax/plugins/do_plugin_install.php?',{'plugin_uri': pluginUri,
|
||||||
|
'plugin_version': pluginVersion, 'csrf_token': csrfToken},function(data){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
response = JSON.parse(data);
|
response = JSON.parse(data);
|
||||||
if(response === true) {
|
if (response === true) {
|
||||||
$('#plugin-install-message').text(successHtml);
|
$('#plugin-install-message').contents().first().replaceWith(successHtml);
|
||||||
$('#plugin-install-message').find('i').removeClass('fas fa-cog fa-spin link-secondary').addClass('fas fa-check');
|
$('#plugin-install-message').find('i')
|
||||||
|
.removeClass('fas fa-cog fa-spin link-secondary')
|
||||||
|
.addClass('fas fa-check');
|
||||||
$('#js-install-plugin-ok').removeAttr("disabled");
|
$('#js-install-plugin-ok').removeAttr("disabled");
|
||||||
} else {
|
} else {
|
||||||
$('#plugin-install-message').text('An error occurred installing the plugin.');
|
$('#plugin-install-message').contents().first().replaceWith('An error occurred installing the plugin.');
|
||||||
$('#plugin-install-message').find('i').removeClass('fas fa-cog fa-spin link-secondary');
|
$('#plugin-install-message').find('i').removeClass('fas fa-cog fa-spin link-secondary');
|
||||||
$('#js-install-plugin-ok').removeAttr("disabled");
|
$('#js-install-plugin-ok').removeAttr("disabled");
|
||||||
}
|
}
|
||||||
},300);
|
},200);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#js-install-plugin-ok').on('click', function (e) {
|
$('#js-install-plugin-ok').on('click', function (e) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# PluginInstaller helper for RaspAP
|
# PluginInstaller helper for RaspAP
|
||||||
# # @author billz
|
# @author billz
|
||||||
# license: GNU General Public License v3.0
|
# license: GNU General Public License v3.0
|
||||||
|
|
||||||
# Exit on error
|
# Exit on error
|
||||||
|
@ -428,7 +428,7 @@ class PluginInstaller
|
|||||||
if ($installed === true ) {
|
if ($installed === true ) {
|
||||||
$button = '<button type="button" class="btn btn-outline btn-primary btn-sm text-nowrap"
|
$button = '<button type="button" class="btn btn-outline btn-primary btn-sm text-nowrap"
|
||||||
name="plugin-details" data-bs-toggle="modal" data-bs-target="#install-user-plugin"
|
name="plugin-details" data-bs-toggle="modal" data-bs-target="#install-user-plugin"
|
||||||
data-plugin-manifest="' .$manifest. '"> ' . _("Installed") .'</button>';
|
data-plugin-manifest="' .$manifest. '" data-plugin-installed="' .$installed. '"> ' . _("Installed") .'</button>';
|
||||||
} else {
|
} else {
|
||||||
$button = '<button type="button" class="btn btn-outline btn-primary btn-sm text-nowrap"
|
$button = '<button type="button" class="btn btn-outline btn-primary btn-sm text-nowrap"
|
||||||
name="install-plugin" data-bs-toggle="modal" data-bs-target="#install-user-plugin"
|
name="install-plugin" data-bs-toggle="modal" data-bs-target="#install-user-plugin"
|
||||||
|
@ -164,7 +164,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal"><?php echo _("Cancel"); ?></button>
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal"><?php echo _("Cancel"); ?></button>
|
||||||
<button type="button" id="js-install-plugin-confirm" data-message="<?php echo _("Plugin installation in progress..."); ?>" class="btn btn-outline-success btn-activate"><?php echo _("Install now"); ?></button>
|
<button type="button" id="js-install-plugin-confirm" data-message="<?php echo _("Plugin installation in progress..."); ?>" class="btn btn-outline-success btn-activate"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user