server exceptions are formatted much nicer in the ui.

This commit is contained in:
kay.one 2013-02-14 22:46:42 -08:00
parent 258977f262
commit 951e083756
6 changed files with 32 additions and 20 deletions

1
.gitignore vendored
View File

@ -130,3 +130,4 @@ UpdateLogs/
NzbDrone.Web/cassette-cache/* NzbDrone.Web/cassette-cache/*
*.eq *.eq
NzbDrone.Web/_backboneApp/.idea/workspace.xml NzbDrone.Web/_backboneApp/.idea/workspace.xml
*/.idea/workspace.xml

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Api.Extentions
{ {
DateTimeZoneHandling = DateTimeZoneHandling.Utc, DateTimeZoneHandling = DateTimeZoneHandling.Utc,
NullValueHandling = NullValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore,
Formatting = Formatting.None, Formatting = Formatting.Indented,
DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate
}; };
@ -20,7 +20,7 @@ namespace NzbDrone.Api.Extentions
{ {
DateTimeZoneHandling = Settings.DateTimeZoneHandling, DateTimeZoneHandling = Settings.DateTimeZoneHandling,
NullValueHandling = NullValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore,
Formatting = Formatting.None, Formatting = Formatting.Indented,
DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate,
ContractResolver = new CamelCasePropertyNamesContractResolver() ContractResolver = new CamelCasePropertyNamesContractResolver()
}; };

View File

@ -1,14 +1,7 @@
'use strict'; 'use strict';
define([ define([
'app', 'app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection', 'Shared/NotificationCollection', 'AddSeries/Existing/UnmappedFolderModel', 'AddSeries/SearchResultCollection', 'Series/SeriesModel'], function (app, rootFolders, qualityProfileCollection, notificationCollection) {
'AddSeries/RootFolders/RootFolderCollection',
'Quality/QualityProfileCollection',
'Shared/NotificationCollection',
'AddSeries/Existing/UnmappedFolderModel',
'AddSeries/SearchResultCollection',
'Series/SeriesModel'],
function (app, rootFolders, qualityProfileCollection, notificationCollection) {
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({ NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
@ -34,6 +27,21 @@ define([
var self = this; var self = this;
var seriesCollection = new NzbDrone.Series.SeriesCollection();
seriesCollection.add(model, {success:function () {
var notificationModel = new NzbDrone.Shared.NotificationModel({
title:'Added',
message:title,
level:'success'
});
notificationCollection.push(notificationModel);
self.close();
}
});
return;
model.save(undefined, { model.save(undefined, {
success:function () { success:function () {
var notificationModel = new NzbDrone.Shared.NotificationModel({ var notificationModel = new NzbDrone.Shared.NotificationModel({

View File

@ -73,6 +73,10 @@ body {
padding-right: 10px; padding-right: 10px;
} }
#notification-region pre{
font-size: 12px;
}
.line { .line {
height: 4em; height: 4em;

View File

@ -2,16 +2,15 @@
NzbDrone.Shared.NotificationModel = Backbone.Model.extend({ NzbDrone.Shared.NotificationModel = Backbone.Model.extend({
mutators:{ mutators:{
pre:function () {
try {
if (this.get('message')) {
return this.get('message').lines().lenght > 1;
}
} catch (error) {
return false;
}
preFormattedMessage:function () {
return this.get('message').replace(/\\r\\n/g, '<br>');
}, },
isPreFormatted:function () {
return this.get('message').indexOf('\\r\\n') !== -1;
},
iconClass:function () { iconClass:function () {
if (this.has('icon')) { if (this.has('icon')) {

View File

@ -1,8 +1,8 @@
<div class="alert alert-{{level}}"> <div class="alert alert-{{level}}">
<button type="button" class="close x-close">×</button> <button type="button" class="close x-close">×</button>
<i class="{{iconClass}}" /><strong>{{title}}</strong> <i class="{{iconClass}}" /><strong>{{title}}</strong>
{{#if preFormatted}} {{#if isPreFormatted}}
<pre> {{message}}</pre> <pre>{{{preFormattedMessage}}}</pre>
{{else}} {{else}}
{{message}} {{message}}
{{/if}} {{/if}}