Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web refactoring #529

Merged
merged 12 commits into from
Aug 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion allure-generator/src/main/javascript/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import router from './router';
import * as behaviors from './behaviors';
import ErrorLayout from './layouts/error/ErrorLayout';
import TestResultLayout from './layouts/testresult/TestResultLayout';
import i18next, { initTranslations } from './util/translation';
import i18next, { initTranslations } from './utils/translation';
import translate from './helpers/t';

//https://github.com/d3/d3-timer/pull/21
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Behavior} from 'backbone.marionette';
import {on} from '../decorators';
import copy from '../util/clipboard';
import copy from '../utils/clipboard';
import TooltipView from '../components/tooltip/TooltipView';
import translate from '../helpers/t';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import './styles.scss';
import highlight from '../../util/highlight';
import highlight from '../../utils/highlight';
import {View} from 'backbone.marionette';
import $ from 'jquery';
import router from '../../router';
import {className, on, behavior} from '../../decorators';
import attachmentType from '../../util/attachmentType';
import attachmentType from '../../utils/attachmentType';
import template from './AttachmentView.hbs';


Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import BaseChartView from '../../components/graph-base/BaseChartView';
import {scaleLinear, scaleSqrt} from 'd3-scale';
import {histogram, max} from 'd3-array';
import PopoverView from '../../components/popover/PopoverView';
import escape from '../../util/escape';
import escape from '../../utils/escape';
import duration from '../../helpers/duration';
import translate from '../../helpers/t';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {omit} from 'underscore';
import {arc, pie} from 'd3-shape';
import {interpolate} from 'd3-interpolate';
import {select} from 'd3-selection';
import escape from '../../util/escape';
import {values} from '../../util/statuses';
import escape from '../../utils/escape';
import {values} from '../../utils/statuses';
import translate from '../../helpers/t';


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BaseChartView from '../../components/graph-base/BaseChartView';
import PopoverView from '../../components/popover/PopoverView';
import escape from '../../util/escape';
import {values} from '../../util/statuses';
import escape from '../../utils/escape';
import {values} from '../../utils/statuses';
import {scaleBand, scaleSqrt} from 'd3-scale';
import {max} from 'd3-array';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './styles.scss';
import {scaleLinear, scalePoint} from 'd3-scale';
import {max} from 'd3-array';
import {area, stack} from 'd3-shape';
import {values} from '../../util/statuses';
import {values} from '../../utils/statuses';
import translate from '../../helpers/t';
import BaseChartView from '../../components/graph-base/BaseChartView';
import TooltipView from '../../components/tooltip/TooltipView';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import './styles.scss';
import PopoverView from '../popover/PopoverView';
import {className, on} from '../../decorators';
import template from './LanguageSelectView.hbs';
import i18next, { LANGUAGES } from '../../util/translation';
import settings from '../../util/settings';
import i18next, { LANGUAGES } from '../../utils/translation';
import settings from '../../utils/settings';
import $ from 'jquery';

@className('language-select popover')
Expand All @@ -16,7 +16,7 @@ class LanguageSelectView extends PopoverView {
setContent() {
this.$el.html(template({
languages: LANGUAGES,
currentLang: settings.get('language')
currentLang: settings.getLanguage()
}));
}

Expand All @@ -31,7 +31,7 @@ class LanguageSelectView extends PopoverView {
@on('click .language-select__item')
onLanguageClick(e) {
const langId = this.$(e.currentTarget).data('id');
settings.save('language', langId);
settings.setLanguage(langId);
i18next.changeLanguage(langId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,5 @@
}

.blur {
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-o-filter: blur(3px);
-ms-filter: blur(3px);
filter: blur(3px);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<div class="{{b 'sorter' 'item'}}" data-name="{{name}}" data-asc={{asc}}>
<span class="{{b 'sorter' enabled=(or asc desc)}} {{b 'sorter' 'name'}}">{{t name}}</span>
<span class="fa-stack {{b 'sorter' 'icon'}}">
<i class="fa fa-sort-asc fa-stack-1x {{b 'sorter' enabled=asc}}"/>
<i class="fa fa-sort-desc fa-stack-1x {{b 'sorter' enabled=desc}}"/>
<i class="fa fa-sort-asc fa-stack-1x {{b 'sorter' enabled=asc}}"></i>
<i class="fa fa-sort-desc fa-stack-1x {{b 'sorter' enabled=desc}}"></i>
</span>
</div>
{{/each}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import './styles.scss';
import {on, className} from '../../decorators';
import settings from '../../util/settings';
import {className, on} from '../../decorators';
import template from './NodeSorterView.hbs';
import {View} from 'backbone.marionette';

Expand All @@ -10,15 +9,14 @@ const AVAILABLE_SORTERS = ['sorter.name', 'sorter.duration', 'sorter.status'];
class NodeSorterView extends View {
template = template;

initialize({sorterSettingsKey}) {
this.sorterSettingsKey = sorterSettingsKey;
initialize({settings}) {
this.settings = settings;
}

@on('click .sorter__item')
onChangeSorting(e) {
const el = this.$(e.currentTarget);

settings.save(this.sorterSettingsKey, {
this.settings.setTreeSorting({
sorter: el.data('name'),
ascending: !el.data('asc')
});
Expand All @@ -31,7 +29,7 @@ class NodeSorterView extends View {
}

serializeData() {
const sortSettings = settings.getTreeSorting(this.sorterSettingsKey);
const sortSettings = this.settings.getTreeSorting();
return {
sorters: AVAILABLE_SORTERS.map(sorter => ({
name: sorter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
&__item {
cursor: pointer;
display: inline-block;
padding-right: 15px;
padding-right: $gap-size;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.popover {
position: absolute;
background: #fff;
background: $pane-bg-color;
color: $text-color;
border: 1px solid $border-accent-color;
padding: 8px;
Expand All @@ -21,7 +21,7 @@
}
&::after {
left: -15px;
border-right-color: #fff;
border-right-color: $pane-bg-color;
}
}
&__list {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {findWhere} from 'underscore';
import {View} from 'backbone.marionette';
import TooltipView from '../tooltip/TooltipView';
import LanguageSelectView from '../language-select/LanguageSelectView';
import { LANGUAGES } from '../../util/translation';
import pluginsRegistry from '../../util/pluginsRegistry';
import settings from '../../util/settings';
import { LANGUAGES } from '../../utils/translation';
import pluginsRegistry from '../../utils/pluginsRegistry';
import template from './SideNavView.hbs';
import {escapeExpression as escape} from 'handlebars/runtime';
import router from '../../router';
import settings from '../../utils/settings';

@className('side-nav')
class SideNavView extends View {
Expand All @@ -25,7 +25,7 @@ class SideNavView extends View {
}

onRender() {
this.$el.toggleClass('side-nav_collapsed', settings.get('sidebarCollapsed'));
this.$el.toggleClass('side-nav_collapsed', settings.isSidebarCollapsed());
}

onDestroy() {
Expand All @@ -34,13 +34,13 @@ class SideNavView extends View {

serializeData() {
return {
language: findWhere(LANGUAGES, {id: settings.get('language')}),
language: findWhere(LANGUAGES, {id: settings.getLanguage()}),
tabs: this.tabs
};
}

isTabActive(name) {
var currentUrl = router.getCurrentUrl();
const currentUrl = router.getCurrentUrl();
return name ? currentUrl.indexOf(name) === 0 : currentUrl === name;
}

Expand All @@ -60,7 +60,7 @@ class SideNavView extends View {
@on('click .side-nav__collapse')
onCollapseClick() {
this.$el.toggleClass('side-nav_collapsed');
settings.save('sidebarCollapsed', this.$el.hasClass('side-nav_collapsed'));
settings.setSidebarCollapsed( this.$el.hasClass('side-nav_collapsed'));
this.tooltip.hide();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import './styles.scss';
import {on, className} from '../../decorators';
import settings from '../../util/settings';
import template from './StatusToggleView.hbs';
import {values} from '../../util/statuses';
import {values} from '../../utils/statuses';
import {View} from 'backbone.marionette';
import translate from '../../helpers/t';


@className('status-toggle')
class StatusToggleView extends View {
template = template;

initialize({statusesKey, statistic}) {
this.statusesKey = statusesKey;
initialize({settings, statistic}) {
this.settings = settings;
this.statistic = statistic;
this.listenTo(settings, 'change:' + this.statusesKey, this.render);
this.listenTo(settings, 'change', this.render);
}

serializeData() {
const statuses = settings.getVisibleStatuses(this.statusesKey);
const statuses = this.settings.getVisibleStatuses();
return {
statuses: values.map(status => ({
status,
Expand All @@ -34,8 +32,8 @@ class StatusToggleView extends View {
const el = this.$(e.currentTarget);
const name = el.data('status');
const checked = el.hasClass('n-label');
const statuses = settings.getVisibleStatuses(this.statusesKey);
settings.save(this.statusesKey, Object.assign({}, statuses, {[name]: checked}));
const statuses = this.settings.getVisibleStatuses();
this.settings.setVisibleStatuses(Object.assign({}, statuses, {[name]: checked}));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
&__item {
cursor: pointer;
padding: 5px 0px 5px 0px;
padding: 5px 0 5px 0;
display: inline-block;
white-space: nowrap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AttachmentView from '../attachment/AttachmentView';
import template from './TestResultExecutionView.hbs';
import router from '../../router';
import {className, on} from '../../decorators';
import {makeArray} from '../../util/arrays';
import {makeArray} from '../../utils/arrays';
import {Model} from 'backbone';
import {View} from 'backbone.marionette';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './styles.scss';
import {View} from 'backbone.marionette';
import {className, regions} from '../../decorators';
import template from './TestResultOverviewView.hbs';
import pluginsRegistry from '../../util/pluginsRegistry';
import pluginsRegistry from '../../utils/pluginsRegistry';
import TestResultExecutionView from '../testresult-execution/TestResultExecutionView';

@className('test-result-overview')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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 pluginsRegistry from '../../utils/pluginsRegistry';
import ModalView from '../modal/ModalView';
import AttachmentView from '../attachment/AttachmentView';
import translate from '../../helpers/t';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
$tooltip-bg: rgba(50, 50, 50, 0.8);
$tooltip-color: #fff;
@import "../../variables.scss";

.tooltip {
position: absolute;
Expand Down
Loading