diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js index 4a4e2117..7c0001dc 100644 --- a/src/js/yunohost/controllers/backup.js +++ b/src/js/yunohost/controllers/backup.js @@ -32,17 +32,25 @@ c.view('backup/backup', {'storages':storages}); }); - // Storage list - app.get('#/storages/create', function (c) { - c.view('backup/storage_create', {}); + // Archive list + app.get('#/backup/:storage', function (c) { + c.api('GET', '/backup/archives?with_info', {}, function(data) { + data.storage = { + id: 'local', + name: y18n.t('local_archives') + }; + data.archives2 = []; + $.each(data['archives'], function(name, info) { + info.name = name; + data.archives2.unshift(info) + }); + data.archives = data.archives2; + data.locale = y18n.locale + c.view('backup/backup_list', data); + }); }); - // Create a storage - app.post('#/storages', function (c) { - c.redirect_to('#/storages'); - }); - - // Create a backup + // View to create a backup app.get('#/backup/:storage/create', function (c) { var data = []; data['storage'] = { @@ -59,7 +67,7 @@ }); }); - + // Actually creating the backup app.post('#/backup/:storage', function (c) { var params = ungroupHooks(c.params['system_parts'],c.params['apps']); c.api('POST', '/backup', params, function() { @@ -67,6 +75,21 @@ }); }); + // Get archive info + app.get('#/backup/:storage/:archive', function (c) { + c.api('GET', '/backup/archives/'+c.params['archive']+'?with_details', {}, function(data) { + data.storage = { + id: c.params['storage'], + name: y18n.t('local_archives') + }; + data.name = c.params['archive']; + data.system_parts = groupHooks(Object.keys(data['system']),data['system']); + data.items = (data['system']!={} || data['apps']!=[]); + data.locale = y18n.locale; + c.view('backup/backup_info', data, c.selectAllOrNone); + }); + }); + // Restore a backup app.post('#/backup/:storage/:archive/restore', function (c) { c.confirm( @@ -95,57 +118,6 @@ ); }); - // Download a backup - app.get('#/backup/:storage/:archive/download', function (c) { - c.api('GET', '/backup/'+c.params['archive']+'/download', {}, function(data) { - c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false}); - }); - }); - - // Copy a backup - app.get('#/backup/:storage/:archive/copy', function (c) { - c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false}); - }); - - // Upload a backup - app.get('#/backup/:storage/:archive/upload', function (c) { - c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false}); - }); - - // Get archive info - app.get('#/backup/:storage/:archive', function (c) { - c.api('GET', '/backup/archives/'+c.params['archive']+'?with_details', {}, function(data) { - data.storage = { - id: c.params['storage'], - name: y18n.t('local_archives') - }; - data.other_storages = []; - data.name = c.params['archive']; - data.system_parts = groupHooks(Object.keys(data['system']),data['system']); - data.items = (data['system']!={} || data['apps']!=[]); - data.locale = y18n.locale - c.view('backup/backup_info', data, c.selectAllOrNone); - }); - }); - - // Archive list - app.get('#/backup/:storage', function (c) { - c.api('GET', '/backup/archives?with_info', {}, function(data) { - data.storage = { - id: 'local', - name: y18n.t('local_archives') - }; - data.archives2 = []; - $.each(data['archives'], function(name, info) { - info.name = name; - data.archives2.unshift(info) - }); - data.archives = data.archives2; - data.locale = y18n.locale - c.view('backup/backup_list', data); - }); - }); - function groupHooks(hooks, raw_infos) { var data = {}; var rules = [ diff --git a/src/views/backup/backup.ms b/src/views/backup/backup.ms index 4da53a75..e4bd4b0c 100644 --- a/src/views/backup/backup.ms +++ b/src/views/backup/backup.ms @@ -3,12 +3,6 @@ {{t 'backup'}} -
- -
-
diff --git a/src/views/backup/backup_info.ms b/src/views/backup/backup_info.ms index ae42c67a..6cf5fb44 100644 --- a/src/views/backup/backup_info.ms +++ b/src/views/backup/backup_info.ms @@ -83,41 +83,11 @@
-

{{t 'backup_archive_delete'}}

{{t 'delete'}}
- {{#if other_storages}} -
-
-

{{t 'backup_archive_copy'}}

-
-
- -
- -
-
-
-
- -
-
-
-
- {{/if}}
diff --git a/src/views/backup/storage_create.ms b/src/views/backup/storage_create.ms deleted file mode 100644 index bc07a003..00000000 --- a/src/views/backup/storage_create.ms +++ /dev/null @@ -1,52 +0,0 @@ - -
- {{t 'home'}} - {{t 'backup'}} - {{t 'storage_create'}} -
- -
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
-
- -
-