restore from backup wizard proof of concept
This commit is contained in:
1 parent
5596daf346
commit
b63eec3e91
3 files changed
+51
No files matched your search
@@ -313,6 +313,30 @@ $(function() {
|
||||
};
|
||||
}
|
||||
|
||||
function CoreWizardBackupRestoreViewModel(parameters) {
|
||||
var self = this;
|
||||
|
||||
self.required = false;
|
||||
|
||||
self.onWizardDetails = function(response) {
|
||||
if (!self.required) return;
|
||||
};
|
||||
|
||||
self.onWizardFinish = function() {
|
||||
if (!self.required) return;
|
||||
};
|
||||
|
||||
self.showRestoreFromBackup = function() {
|
||||
$showRestorePluginDialogCallback = function () {
|
||||
OctoPrint.coreui.viewmodels.wizardViewModel.closeDialog();
|
||||
$("#settings_dialog_menu").hide()
|
||||
OctoPrint.coreui.viewmodels.settingsViewModel.show("settings_plugin_backup");
|
||||
}
|
||||
|
||||
OctoPrint.coreui.viewmodels.coreWizardAclViewModel._sendData({"ac": false}, $showRestorePluginDialogCallback);
|
||||
};
|
||||
}
|
||||
|
||||
OCTOPRINT_VIEWMODELS.push({
|
||||
construct: CoreWizardAclViewModel,
|
||||
dependencies: ["loginStateViewModel"],
|
||||
@@ -337,5 +361,9 @@ $(function() {
|
||||
construct: CoreWizardPrinterProfileViewModel,
|
||||
dependencies: ["printerProfilesViewModel"],
|
||||
elements: ["#wizard_plugin_corewizard_printerprofile"]
|
||||
}, {
|
||||
construct: CoreWizardBackupRestoreViewModel,
|
||||
dependencies: ["settingsViewModel"],
|
||||
elements: ["#wizard_plugin_corewizard_backuprestore"]
|
||||
});
|
||||
});
|
||||
@@ -146,6 +146,20 @@ class PrinterProfileSubwizard(object):
|
||||
return gettext("Default Printer Profile")
|
||||
|
||||
|
||||
# noinspection PyUnresolvedReferences,PyMethodMayBeStatic
|
||||
class BackupRestoreSubwizard(object):
|
||||
def _is_backuprestore_wizard_firstrunonly(self):
|
||||
return True
|
||||
|
||||
def _is_backuprestore_wizard_required(self):
|
||||
return True
|
||||
|
||||
def _get_backuprestore_wizard_details(self):
|
||||
return dict(required=self._is_backuprestore_wizard_required())
|
||||
|
||||
def _get_backuprestore_wizard_name(self):
|
||||
return gettext("Restore Backup")
|
||||
|
||||
Subwizards = type(to_native_str("Subwizards"),
|
||||
tuple(cls for clsname, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass)
|
||||
if clsname.endswith("Subwizard")),
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<h3>{{ _('Restore from a backup') }}</h3>
|
||||
|
||||
{% trans %}<p>
|
||||
If you would like to restore OctoPrint configuration from a backup now is the time.
|
||||
</p>{% endtrans %}
|
||||
|
||||
<div class="row-fluid">
|
||||
<a href="#" class="btn btn-primary span6" data-bind="click: function() { showRestoreFromBackup() }">{{ _('Restore From Backup') }}</a>
|
||||
</div>
|
||||
Reference in new issue
Block a user