mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-24 22:55:21 -04:00
7af782d353
New: Test button for indexers in UI Fixed: Testing download clients shows error messages in UI Fixed: Testing notifications shows error messages in UI
37 lines
1002 B
JavaScript
37 lines
1002 B
JavaScript
'use strict';
|
|
|
|
define([
|
|
'jquery',
|
|
'backbone.deepmodel',
|
|
'Shared/Messenger'
|
|
], function ($, DeepModel, Messenger) {
|
|
return DeepModel.DeepModel.extend({
|
|
|
|
test: function () {
|
|
var self = this;
|
|
|
|
this.trigger('validation:sync');
|
|
|
|
var params = {};
|
|
|
|
params.url = this.collection.url + '/test';
|
|
params.contentType = 'application/json';
|
|
params.data = JSON.stringify(this.toJSON());
|
|
params.type = 'POST';
|
|
params.isValidatedCall = true;
|
|
|
|
var promise = $.ajax(params);
|
|
|
|
Messenger.monitor({
|
|
promise : promise,
|
|
successMessage : 'Testing \'{0}\' completed'.format(this.get('name')),
|
|
errorMessage : 'Testing \'{0}\' failed'.format(this.get('name'))
|
|
});
|
|
|
|
promise.fail(function (response) {
|
|
self.trigger('validation:failed', response);
|
|
});
|
|
}
|
|
});
|
|
});
|