1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 10:50:24 +00:00

[misc] fixup

This commit is contained in:
llj
2018-08-18 11:05:08 +08:00
parent 0105e8e8ef
commit 5b8dc61e6f
7 changed files with 19 additions and 15 deletions

View File

@@ -56,7 +56,7 @@ def get_repo_info(repo):
result['file_count'] = repo.file_count result['file_count'] = repo.file_count
if '@seafile_group' in owner: if '@seafile_group' in owner:
group_id = get_group_id_by_repo_owner(repo_owner) group_id = get_group_id_by_repo_owner(owner)
result['group_name'] = group_id_to_name(group_id) result['group_name'] = group_id_to_name(group_id)
return result return result

View File

@@ -477,6 +477,7 @@
</script> </script>
<script type="text/template" id="system-library-tmpl"> <script type="text/template" id="system-library-tmpl">
<span class="loading-icon loading-tip"></span>
<table class="hide"> <table class="hide">
<thead> <thead>
<tr> <tr>
@@ -488,13 +489,15 @@
<tbody> <tbody>
</tbody> </tbody>
</table> </table>
<span class="loading-icon loading-tip"></span> <p class="error hide"></p>
</script> </script>
<script type="text/template" id="system-library-item-tmpl"> <script type="text/template" id="system-library-item-tmpl">
<tr>
<td><a href="#libs/<%= id %>/"><%- name %></a></td> <td><a href="#libs/<%= id %>/"><%- name %></a></td>
<td style="font-size:11px;"><%= id %></td> <td style="font-size:11px;"><%= id %></td>
<td><%= description %></td> <td><%= description %></td>
</tr>
</script> </script>
<script type="text/template" id="trash-libraries-tmpl"> <script type="text/template" id="trash-libraries-tmpl">

View File

@@ -81,9 +81,9 @@ define([
repos.reset(repos.models); repos.reset(repos.models);
} }
}, },
error: function(xhr, textStatus, errorThrown) { error: function(collection, response, options) {
// TODO: handle error gracefully var error_msg = Common.prepareAjaxErrorMsg(response);
Common.feedback('Error', 'error', Common.ERROR_TIMEOUT); Common.feedback(error_msg, 'error', Common.ERROR_TIMEOUT);
}, },
complete: function() { complete: function() {
Common.closeModal(); Common.closeModal();

View File

@@ -217,8 +217,8 @@ define([
} }
}, },
error: function(collection, response, options) { error: function(collection, response, options) {
var err_msg = Common.prepareCollectionFetchErrorMsg(collection, response, opts); var error_msg = Common.prepareAjaxErrorMsg(response);
_this.$error.html(err_msg).show(); _this.$error.html(error_msg).show();
} }
}); });

View File

@@ -55,8 +55,8 @@ define([
Common.closeModal(); Common.closeModal();
}, },
error: function(collection, response, options) { error: function(collection, response, options) {
var err_msg = Common.prepareCollectionFetchErrorMsg(collection, response, opts); var error_msg = Common.prepareAjaxErrorMsg(response);
$error.html(err_msg).show(); $error.html(error_msg).show();
Common.enableButton($submitBtn); Common.enableButton($submitBtn);
} }
}); });

View File

@@ -93,8 +93,8 @@ define([
Common.closeModal(); Common.closeModal();
}, },
error: function(collection, response, options) { error: function(collection, response, options) {
var err_msg = Common.prepareCollectionFetchErrorMsg(collection, response, opts); var error_msg = Common.prepareAjaxErrorMsg(response);
$error.html(err_msg).show(); $error.html(error_msg).show();
Common.enableButton($submitBtn); Common.enableButton($submitBtn);
} }
}); });

View File

@@ -28,11 +28,13 @@ define([
this.$table = this.$('table'); this.$table = this.$('table');
this.$tableBody = $('tbody', this.$table); this.$tableBody = $('tbody', this.$table);
this.$loadingTip = this.$('.loading-tip'); this.$loadingTip = this.$('.loading-tip');
this.$error = this.$('.error');
}, },
initPage: function() { initPage: function() {
this.$table.hide(); this.$table.hide();
this.$tableBody.empty(); this.$tableBody.empty();
this.$error.hide();
this.$loadingTip.show(); this.$loadingTip.show();
}, },
@@ -42,14 +44,12 @@ define([
this.systemRepo.fetch({ this.systemRepo.fetch({
url: Common.getUrl({name: 'admin-system-library'}), url: Common.getUrl({name: 'admin-system-library'}),
cache: false, // for IE cache: false,
reset: true,
success: function(model, response, options) { success: function(model, response, options) {
_this.reset(); _this.reset();
}, },
error: function(model, response, options) { error: function(model, response, options) {
var err_msg = Common.prepareCollectionFetchErrorMsg(collection, response, opts); _this.$error.html(gettext("Error")).show();
Common.feedback(err_msg, 'error');
} }
}); });
}, },
@@ -65,6 +65,7 @@ define([
reset: function() { reset: function() {
this.$loadingTip.hide(); this.$loadingTip.hide();
this.$error.hide();
this.$tableBody.html(this.itemTemplate(this.systemRepo.toJSON())); this.$tableBody.html(this.itemTemplate(this.systemRepo.toJSON()));
this.$table.show(); this.$table.show();
} }