1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

[system repo admin] fix, improvement, supplement, clean

This commit is contained in:
llj
2016-06-07 17:32:01 +08:00
committed by lian
parent a767aeb3d8
commit 8c2e16ca36
29 changed files with 615 additions and 1153 deletions

View File

@@ -9,14 +9,15 @@ define([
'sysadmin-app/views/mobile-devices',
'sysadmin-app/views/device-errors',
'sysadmin-app/views/repos',
'sysadmin-app/views/dir',
'sysadmin-app/views/search-repos',
'sysadmin-app/views/system-repo',
'sysadmin-app/views/trash-repos',
'sysadmin-app/views/dir',
'app/views/account'
], function($, Backbone, Common, SideNavView, DashboardView,
DesktopDevicesView, MobileDevicesView, DeviceErrorsView,
ReposView, DirView, SystemReposView,
TrashReposView, AccountView) {
ReposView, SearchReposView, SystemReposView, TrashReposView, DirView,
AccountView) {
"use strict";
@@ -27,10 +28,11 @@ define([
'desktop-devices/': 'showDesktopDevices',
'mobile-devices/': 'showMobileDevices',
'device-errors/': 'showDeviceErrors',
'libraries/': 'showLibraries',
'libraries/:repo_id/dirents(/*path)': 'showLibraryDir',
'libraries/system/': 'showSystemLibrary',
'libraries/trash/': 'showTrashLibraries',
'all-libs/': 'showLibraries',
'search-libs/': 'showSearchLibraries',
'system-lib/': 'showSystemLibrary',
'trash-libs/': 'showTrashLibraries',
'libs/:repo_id(/*path)': 'showLibraryDir',
// Default
'*actions': 'showDashboard'
},
@@ -50,7 +52,9 @@ define([
this.desktopDevicesView = new DesktopDevicesView();
this.mobileDevicesView = new MobileDevicesView();
this.deviceErrorsView = new DeviceErrorsView();
this.reposView = new ReposView();
this.searchReposView = new SearchReposView();
this.systemReposView = new SystemReposView();
this.trashReposView = new TrashReposView();
this.dirView = new DirView();
@@ -108,16 +112,27 @@ define([
},
showLibraries: function() {
var url = window.location.href;
var page = url.match(/.*?page=(\d+)/);
if (page) {
var current_page = page[1];
} else {
var current_page = null;
}
// url_match: null or an array like ["http://127.0.0.1:8000/sysadmin/#libraries/?page=2", "2"]
var url_match = location.href.match(/.*?page=(\d+)/);
var page = url_match ? url_match[1] : 1; // 1: default
this.switchCurrentView(this.reposView);
this.sideNavView.setCurTab('libraries');
this.reposView.show({'current_page': current_page});
this.sideNavView.setCurTab('libraries', {'option': 'all'});
this.reposView.show({'page': page});
},
showSearchLibraries: function() {
// url_match: null or an array
var url_match = location.href.match(/.*?name=(.*)&owner=(.*)/); // search by repo_name/owner
var repo_name = url_match ? url_match[1] : '';
var owner = url_match ? url_match[2] : '';
this.switchCurrentView(this.searchReposView);
this.sideNavView.setCurTab('libraries', {'option': 'all'});
this.searchReposView.show({
'name': decodeURIComponent(repo_name),
'owner': decodeURIComponent(owner)
});
},
showLibraryDir: function(repo_id, path) {
@@ -128,19 +143,23 @@ define([
}
this.switchCurrentView(this.dirView);
this.dirView.show(repo_id, path);
this.sideNavView.setCurTab('libraries');
this.sideNavView.setCurTab('libraries', {'option': ''});
},
showSystemLibrary: function() {
this.switchCurrentView(this.systemReposView);
this.sideNavView.setCurTab('libraries');
this.sideNavView.setCurTab('libraries', {'option': 'system'});
this.systemReposView.show();
},
showTrashLibraries: function() {
// url_match: null or an array
var url_match = location.href.match(/.*?name=(.*)/); // search by owner
var owner = url_match ? url_match[1] : '';
this.switchCurrentView(this.trashReposView);
this.sideNavView.setCurTab('libraries');
this.trashReposView.show();
this.sideNavView.setCurTab('libraries', {'option': 'trash'});
this.trashReposView.show({'owner': decodeURIComponent(owner)});
}
});