mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-18 16:36:15 +00:00
add remote wipe option when admin unlink device
This commit is contained in:
@@ -12,6 +12,9 @@ define([
|
||||
'device_id': this.get('device_id'),
|
||||
'user': this.get('user')
|
||||
};
|
||||
if (options.wipe_device) {
|
||||
data['wipe_device'] = 'true';
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: Common.getUrl({name: 'admin-devices'}),
|
||||
@@ -28,6 +31,11 @@ define([
|
||||
if (options.error) {
|
||||
options.error(xhr);
|
||||
}
|
||||
},
|
||||
complete: function(xhr) {
|
||||
if (options.complete) {
|
||||
options.complete(xhr);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@@ -14,7 +14,7 @@ define([
|
||||
template: _.template($('#device-item-tmpl').html()),
|
||||
|
||||
events: {
|
||||
'click .unlink-device': 'unlinkDevice'
|
||||
'click .unlink-device': 'unlinkDeviceWithConfirm'
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
@@ -33,26 +33,54 @@ define([
|
||||
return this;
|
||||
},
|
||||
|
||||
unlinkDevice: function() {
|
||||
unlinkDeviceWithConfirm: function() {
|
||||
var _this = this,
|
||||
is_desktop_client = this.model.get('is_desktop_client'),
|
||||
device_name = this.model.get('device_name');
|
||||
|
||||
this.model.unlink({
|
||||
success: function() {
|
||||
_this.remove();
|
||||
if (is_desktop_client) {
|
||||
var title = gettext('Unlink device');
|
||||
var content = gettext('Are you sure you want to unlink this device?');
|
||||
var extraOption = gettext('Delete files from this device the next time it comes online.');
|
||||
|
||||
var msg = gettext("Successfully unlink %(name)s.")
|
||||
.replace('%(name)s', device_name);
|
||||
Common.feedback(msg, 'success');
|
||||
},
|
||||
error: function(xhr) {
|
||||
Common.ajaxErrorHandler(xhr);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
var yesCallback = function (wipe_device) {
|
||||
_this.model.unlink({
|
||||
wipe_device: wipe_device,
|
||||
|
||||
success: function() {
|
||||
_this.remove();
|
||||
|
||||
var msg = gettext("Successfully unlink %(name)s.")
|
||||
.replace('%(name)s', device_name);
|
||||
Common.feedback(msg, 'success');
|
||||
},
|
||||
error: function(xhr) {
|
||||
Common.ajaxErrorHandler(xhr);
|
||||
},
|
||||
complete: function() {
|
||||
$.modal.close();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
Common.showConfirmWithExtraOption(title, content, extraOption, yesCallback);
|
||||
} else {
|
||||
_this.model.unlink({
|
||||
wipe_device: true,
|
||||
success: function() {
|
||||
_this.remove();
|
||||
|
||||
var msg = gettext("Successfully unlink %(name)s.")
|
||||
.replace('%(name)s', device_name);
|
||||
Common.feedback(msg, 'success');
|
||||
},
|
||||
error: function(xhr) {
|
||||
Common.ajaxErrorHandler(xhr);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return DeviceView;
|
||||
});
|
||||
|
Reference in New Issue
Block a user