1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-25 22:37:27 -04:00
Files
Radarr/src/UI/Settings/NetImport/Add/NetImportSchemaModal.js
T
Tim Turner 1fd909cff6 Net Import UI Updates
- Change name to "StevenLu" to fix
- Hide header on New List modal
- Show "Import Selected" only after a list has been fetched
2017-01-28 13:27:54 -05:00

41 lines
1.2 KiB
JavaScript

var _ = require('underscore');
var AppLayout = require('../../../AppLayout');
var Backbone = require('backbone');
var SchemaCollection = require('../NetImportCollection');
var AddCollectionView = require('./NetImportAddCollectionView');
module.exports = {
open : function(collection) {
var schemaCollection = new SchemaCollection();
var originalUrl = schemaCollection.url;
schemaCollection.url = schemaCollection.url + '/schema';
schemaCollection.fetch();
schemaCollection.url = originalUrl;
var groupedSchemaCollection = new Backbone.Collection();
schemaCollection.on('sync', function() {
var groups = schemaCollection.groupBy(function(model, iterator) {
return model.get('protocol');
});
//key is "undefined", which is being placed in the header
var modelCollection = _.map(groups, function(values, key, list) {
return {
//"header" : key,
collection : values
};
});
groupedSchemaCollection.reset(modelCollection);
});
var view = new AddCollectionView({
collection : groupedSchemaCollection,
targetCollection : collection
});
AppLayout.modalRegion.show(view);
}
};