Skip to content

Commit

Permalink
remove unsupported find (fixes #493, via #510)
Browse files Browse the repository at this point in the history
  • Loading branch information
baev authored Jul 27, 2017
1 parent 1b059bb commit 7861d5c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import './styles.scss';
import {View} from 'backbone.marionette';
import {regions, behavior, className, on} from '../../decorators';
import {behavior, className, on, regions} from '../../decorators';
import template from './TestResultView.hbs';
import TestResultOverviewView from '../testresult-overview/TestResultOverviewView';
import ErrorSplashView from '../error-splash/ErrorSplashView';
import pluginsRegistry from '../../util/pluginsRegistry';
import ModalView from '../modal/ModalView';
import AttachmentView from '../attachment/AttachmentView';
import translate from '../../helpers/t';
import {findWhere} from 'underscore';

const subViews = [
{id: '', name: 'testResult.overview.name', View: TestResultOverviewView}
Expand All @@ -25,13 +26,13 @@ class TestResultView extends View {
initialize({routeState}) {
this.routeState = routeState;
this.tabs = subViews.concat(pluginsRegistry.testResultTabs);
this.tabName = this.routeState.get('testResultTab') || '';
this.tabName = this.routeState.get('testResultTab') || '';
this.listenTo(this.routeState, 'change:testResultTab', (_, tabName) => this.onTabChange(tabName));
this.listenTo(this.routeState, 'change:attachment', (_, uid) => this.onShowAttachment(uid));
}

onRender() {
const subView = this.tabs.find(view => view.id === this.tabName);
const subView = findWhere(this.tabs, {id: this.tabName});
this.showChildView('content', !subView
? new ErrorSplashView({code: 404, message: `Tab "${this.tabName}" not found`})
: new subView.View(this.options)
Expand All @@ -53,7 +54,7 @@ class TestResultView extends View {
this.modalView.destroy();
}

if(uid) {
if (uid) {
const attachment = this.model.getAttachment(uid);
this.modalView = new ModalView({
childView: attachment
Expand Down

0 comments on commit 7861d5c

Please sign in to comment.