From 80040bcd1a029e70e930c746abf3dfaa90f2247f Mon Sep 17 00:00:00 2001 From: Dmitry Baev Date: Sun, 6 Aug 2017 14:27:56 +0300 Subject: [PATCH 01/11] remove unused model --- .../src/main/javascript/data/report/ReportModel.js | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 allure-generator/src/main/javascript/data/report/ReportModel.js diff --git a/allure-generator/src/main/javascript/data/report/ReportModel.js b/allure-generator/src/main/javascript/data/report/ReportModel.js deleted file mode 100644 index 44167b4f2..000000000 --- a/allure-generator/src/main/javascript/data/report/ReportModel.js +++ /dev/null @@ -1,12 +0,0 @@ -import {Model} from 'backbone'; - -export default class ReportModel extends Model { - url = 'data/report.json'; - - fetch(...args) { - if(!this.fetchPromise) { - this.fetchPromise = super.fetch(...args); - } - return new Promise((res, rej) => this.fetchPromise.then(res, rej)); - } -} From f9f5b89fbbc596893e3bb864c8f1df4f3f8b3b89 Mon Sep 17 00:00:00 2001 From: Dmitry Baev Date: Sun, 6 Aug 2017 17:30:44 +0300 Subject: [PATCH 02/11] rft local storage --- .../language-select/LanguageSelectView.js | 4 +- .../components/node-sorter/NodeSorterView.js | 12 +- .../components/side-nav/SideNavView.js | 10 +- .../status-toggle/StatusToggleView.js | 14 +- .../javascript/components/tree/TreeView.js | 37 ++--- .../javascript/components/tree/tree-group.hbs | 2 +- .../widgets-grid/WidgetsGridView.js | 12 +- .../data/localstorage/LocalStorageModel.js | 25 ++++ .../data/settings/createSettingsModel.js | 41 ------ .../main/javascript/helpers/statistic-bar.js | 7 +- .../src/main/javascript/pluginApi.js | 9 +- .../main/javascript/plugins/default/index.js | 4 +- .../src/main/javascript/util/settings.js | 24 +--- .../main/javascript/util/settingsFactory.js | 131 ++++++++++++++++++ .../components/status-toggle.spec.js | 12 +- .../test/javascript/components/tree.spec.js | 22 ++- .../components/widgets-grid.spec.js | 10 +- 17 files changed, 232 insertions(+), 144 deletions(-) create mode 100644 allure-generator/src/main/javascript/data/localstorage/LocalStorageModel.js delete mode 100644 allure-generator/src/main/javascript/data/settings/createSettingsModel.js create mode 100644 allure-generator/src/main/javascript/util/settingsFactory.js diff --git a/allure-generator/src/main/javascript/components/language-select/LanguageSelectView.js b/allure-generator/src/main/javascript/components/language-select/LanguageSelectView.js index e13c854e7..52097b78b 100644 --- a/allure-generator/src/main/javascript/components/language-select/LanguageSelectView.js +++ b/allure-generator/src/main/javascript/components/language-select/LanguageSelectView.js @@ -16,7 +16,7 @@ class LanguageSelectView extends PopoverView { setContent() { this.$el.html(template({ languages: LANGUAGES, - currentLang: settings.get('language') + currentLang: settings.getLanguage() })); } @@ -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); } diff --git a/allure-generator/src/main/javascript/components/node-sorter/NodeSorterView.js b/allure-generator/src/main/javascript/components/node-sorter/NodeSorterView.js index fa6fe43df..6757eaf2c 100644 --- a/allure-generator/src/main/javascript/components/node-sorter/NodeSorterView.js +++ b/allure-generator/src/main/javascript/components/node-sorter/NodeSorterView.js @@ -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'; @@ -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') }); @@ -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, diff --git a/allure-generator/src/main/javascript/components/side-nav/SideNavView.js b/allure-generator/src/main/javascript/components/side-nav/SideNavView.js index 5cdaf6897..1f03593c2 100644 --- a/allure-generator/src/main/javascript/components/side-nav/SideNavView.js +++ b/allure-generator/src/main/javascript/components/side-nav/SideNavView.js @@ -6,10 +6,10 @@ 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 template from './SideNavView.hbs'; import {escapeExpression as escape} from 'handlebars/runtime'; import router from '../../router'; +import settings from '../../util/settings'; @className('side-nav') class SideNavView extends View { @@ -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() { @@ -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; } @@ -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(); } diff --git a/allure-generator/src/main/javascript/components/status-toggle/StatusToggleView.js b/allure-generator/src/main/javascript/components/status-toggle/StatusToggleView.js index 15dd01760..bd69a46e4 100644 --- a/allure-generator/src/main/javascript/components/status-toggle/StatusToggleView.js +++ b/allure-generator/src/main/javascript/components/status-toggle/StatusToggleView.js @@ -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 {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, @@ -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})); } } diff --git a/allure-generator/src/main/javascript/components/tree/TreeView.js b/allure-generator/src/main/javascript/components/tree/TreeView.js index 1ca2387d1..6f2c25ae6 100644 --- a/allure-generator/src/main/javascript/components/tree/TreeView.js +++ b/allure-generator/src/main/javascript/components/tree/TreeView.js @@ -1,6 +1,5 @@ import './styles.scss'; import {View} from 'backbone.marionette'; -import settings from '../../util/settings'; import hotkeys from '../../util/hotkeys'; import template from './TreeView.hbs'; import {behavior, className, on, regions} from '../../decorators'; @@ -10,6 +9,7 @@ import NodeSorterView from '../node-sorter/NodeSorterView'; import StatusToggleView from '../status-toggle/StatusToggleView'; import router from '../../router'; import {Model} from 'backbone'; +import {getSettingsForTreePlugin} from '../../util/settingsFactory'; @className('tree') @behavior('TooltipBehavior', {position: 'bottom'}) @@ -20,19 +20,18 @@ import {Model} from 'backbone'; class TreeView extends View { template = template; - initialize({routeState, tabName, baseUrl}) { + initialize({routeState, tabName, baseUrl, settings = getSettingsForTreePlugin(baseUrl)}) { this.state = new Model(); this.routeState = routeState; this.baseUrl = baseUrl; this.tabName = tabName; - this.statusesKey = tabName + '.visibleStatuses'; - this.sorterSettingsKey = tabName + '.treeSorting'; this.setState(); this.listenTo(this.routeState, 'change:treeNode', this.selectNode); this.listenTo(this.routeState, 'change:testResultTab', this.render); - this.listenTo(settings, 'change:' + this.statusesKey, this.render); - this.listenTo(settings, 'change:' + this.sorterSettingsKey, this.render); - this.listenTo(settings, 'change:showGroupInfo', this.render); + + this.settings = settings; + this.listenTo(this.settings, 'change', this.render); + this.listenTo(hotkeys, 'key:up', this.onKeyUp, this); this.listenTo(hotkeys, 'key:down', this.onKeyDown, this); this.listenTo(hotkeys, 'key:esc', this.onKeyBack, this); @@ -52,20 +51,22 @@ class TreeView extends View { } onBeforeRender() { - const visibleStatuses = settings.getVisibleStatuses(this.statusesKey); + const visibleStatuses = this.settings.getVisibleStatuses(); const filter = byStatuses(visibleStatuses); - const sortSettings = settings.getTreeSorting(this.sorterSettingsKey); + + const sortSettings = this.settings.getTreeSorting(); const sorter = getComparator(sortSettings); + this.collection.applyFilterAndSorting(filter, sorter); } onRender() { this.selectNode(); this.showChildView('sorter', new NodeSorterView({ - sorterSettingsKey: this.sorterSettingsKey + settings: this.settings })); this.showChildView('filter', new StatusToggleView({ - statusesKey: this.statusesKey, + settings: this.settings, statistic: this.collection.statistic })); } @@ -90,7 +91,7 @@ class TreeView extends View { changeState(uid, active = true) { if (active) { this.state.set(uid, true); - } else { + } else { this.state.unset(uid); } } @@ -122,14 +123,14 @@ class TreeView extends View { @on('click .tree__info') onInfoClick() { - const show = settings.get('showGroupInfo'); - settings.save('showGroupInfo', !show); + const show = this.settings.isShowGroupInfo(); + this.settings.setShowGroupInfo(!show); } onKeyUp(event) { event.preventDefault(); const current = this.routeState.get('treeNode'); - if(current && current.testResult) { + if (current && current.testResult) { this.selectTestResult(this.collection.getPreviousTestResult(current.testResult)); } else { this.selectTestResult(this.collection.getLastTestResult()); @@ -139,7 +140,7 @@ class TreeView extends View { onKeyDown(event) { event.preventDefault(); const current = this.routeState.get('treeNode'); - if(current && current.testResult) { + if (current && current.testResult) { this.selectTestResult(this.collection.getNextTestResult(current.testResult)); } else { this.selectTestResult(this.collection.getFirstTestResult()); @@ -160,7 +161,7 @@ class TreeView extends View { } selectTestResult(testResult) { - if(testResult) { + if (testResult) { const tab = this.routeState.get('testResultTab') || ''; router.toUrl(`${this.baseUrl}/${testResult.parentUid}/${testResult.uid}/${tab}`, {replace: true}); } @@ -170,7 +171,7 @@ class TreeView extends View { return { cls: this.className, baseUrl: this.baseUrl, - showGroupInfo: settings.get('showGroupInfo'), + showGroupInfo: this.settings.isShowGroupInfo(), time: this.collection.time, statistic: this.collection.statistic, uid: this.collection.uid, diff --git a/allure-generator/src/main/javascript/components/tree/tree-group.hbs b/allure-generator/src/main/javascript/components/tree/tree-group.hbs index 99bbad826..bdce7cbca 100644 --- a/allure-generator/src/main/javascript/components/tree/tree-group.hbs +++ b/allure-generator/src/main/javascript/components/tree/tree-group.hbs @@ -11,7 +11,7 @@ {{/if}}
 
- {{statistic-bar statistic tabName}} + {{statistic-bar statistic}}
diff --git a/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js b/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js index 1635a059b..445be563b 100644 --- a/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js +++ b/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js @@ -2,10 +2,9 @@ import './styles.scss'; import {View} from 'backbone.marionette'; import $ from 'jquery'; import Sortable from 'sortablejs'; -import settings from '../../util/settings'; import {className} from '../../decorators'; import pluginsRegistry from '../../util/pluginsRegistry'; -//import {fetchAndShow} from '../../util/loading'; +import {getSettingsForWidgetGridPlugin} from '../../util/settingsFactory'; const widgetTpl = (id) => `
@@ -20,8 +19,9 @@ const colTpl = '
'; class WidgetsGridView extends View { template = () => ''; - initialize() { + initialize({settings = getSettingsForWidgetGridPlugin('overview')}) { this.widgets = pluginsRegistry.widgets[this.options.tabName]; + this.settings = settings; } onRender() { @@ -43,7 +43,7 @@ class WidgetsGridView extends View { } getWidgetsArrangement() { - const savedData = settings.get('widgets') || [[], []]; + const savedData = this.settings.getWidgetsArrangement(); const storedWidgets = savedData.map(col => { return col.filter(widgetName => this.widgets[widgetName]); @@ -60,7 +60,7 @@ class WidgetsGridView extends View { } saveWidgetsArrangement() { - settings.save('widgets', this.$('.widgets-grid__col').toArray().map(colEl => { + this.settings.setWidgetsArrangement(this.$('.widgets-grid__col').toArray().map(colEl => { return $(colEl).find('.widget').toArray().map(el => $(el).data('id')); })); } @@ -70,7 +70,7 @@ class WidgetsGridView extends View { col.append(el); this.addRegion(name, {el: el.find('.widget__body')}); - /// fetchAndShow(this, name, this.model, new Widget({model: this.model})) + /// fetchAndShow(this, name, this.model, new Widget({model: this.model})) const model = this.model; this.getRegion(name).show(new Widget({model, name})); } diff --git a/allure-generator/src/main/javascript/data/localstorage/LocalStorageModel.js b/allure-generator/src/main/javascript/data/localstorage/LocalStorageModel.js new file mode 100644 index 000000000..1e5f2bb06 --- /dev/null +++ b/allure-generator/src/main/javascript/data/localstorage/LocalStorageModel.js @@ -0,0 +1,25 @@ +import {Model} from 'backbone'; + +export default class LocalStorageModel extends Model { + + storageKey() { + return 'ALLURE_REPORT_SETTINGS'; + } + + fetch() { + return new Promise(resolve => { + const settings = window.localStorage.getItem(this.storageKey()); + if (settings) { + this.set(JSON.parse(settings)); + } + resolve(); + }); + } + + save(key, val) { + this.set(key, val); + const json = this.toJSON(); + window.localStorage.setItem(this.storageKey(), JSON.stringify(json)); + } + +} \ No newline at end of file diff --git a/allure-generator/src/main/javascript/data/settings/createSettingsModel.js b/allure-generator/src/main/javascript/data/settings/createSettingsModel.js deleted file mode 100644 index 7cd53cb0f..000000000 --- a/allure-generator/src/main/javascript/data/settings/createSettingsModel.js +++ /dev/null @@ -1,41 +0,0 @@ -import {Model} from 'backbone'; - - -export default function createSettingsModel(pluginName, defaults) { - let storageKey = 'allure2Settings'; - if(pluginName) { - storageKey += `-${pluginName}`; - } - - return class SettingsModel extends Model { - - defaults() { - return defaults; - } - - fetch() { - return new Promise(resolve => { - const settings = window.localStorage.getItem(storageKey); - if(settings) { - this.set(JSON.parse(settings)); - } - resolve(); - }); - } - - save(key, val) { - this.set(key, val); - const json = this.toJSON(); - window.localStorage.setItem(storageKey, JSON.stringify(json)); - } - - getVisibleStatuses(key) { - return this.get(key) || this.get('visibleStatuses'); - } - - getTreeSorting(key) { - return this.get(key) || {ascending: true, sorter: 'sorter.name'}; - } - }; -} - diff --git a/allure-generator/src/main/javascript/helpers/statistic-bar.js b/allure-generator/src/main/javascript/helpers/statistic-bar.js index a08a59507..da34aec3d 100644 --- a/allure-generator/src/main/javascript/helpers/statistic-bar.js +++ b/allure-generator/src/main/javascript/helpers/statistic-bar.js @@ -1,13 +1,10 @@ import {SafeString} from 'handlebars/runtime'; -import settings from '../util/settings'; import {values} from '../util/statuses'; -export default function (statistic, tabName){ - const statusesKey = tabName + '.visibleStatuses'; - const statuses = settings.getVisibleStatuses(statusesKey); +export default function (statistic){ const fill = values.map(status => { const count = !statistic || typeof statistic[status] === 'undefined' ? 0 : statistic[status]; - return count === 0 || !statuses[status] + return count === 0 ? '' : `${count} `; } diff --git a/allure-generator/src/main/javascript/pluginApi.js b/allure-generator/src/main/javascript/pluginApi.js index f6d54d00d..756c317a6 100644 --- a/allure-generator/src/main/javascript/pluginApi.js +++ b/allure-generator/src/main/javascript/pluginApi.js @@ -2,16 +2,15 @@ import pluginsRegistry from './util/pluginsRegistry'; import TreeLayout from './layouts/tree/TreeLayout'; import AppLayout from './layouts/application/AppLayout'; import WidgetStatusView from './components/widget-status/WidgetStatusView'; -import createSettingsModel from './data/settings/createSettingsModel'; +import {getSettingsForPlugin} from './util/settingsFactory'; +import settings from './util/settings'; window.allure = { api: pluginsRegistry, getPluginSettings(name, defaults) { - const SettingsModel = createSettingsModel(name, defaults); - const settings = new SettingsModel(); - settings.fetch(); - return settings; + return getSettingsForPlugin(name, defaults); }, + settings: settings, components: { AppLayout: AppLayout, TreeLayout: TreeLayout, diff --git a/allure-generator/src/main/javascript/plugins/default/index.js b/allure-generator/src/main/javascript/plugins/default/index.js index 3931ea453..09542c9ff 100644 --- a/allure-generator/src/main/javascript/plugins/default/index.js +++ b/allure-generator/src/main/javascript/plugins/default/index.js @@ -3,5 +3,7 @@ import OverviewLayout from '../../layouts/overview/OverviewLayout'; allure.api.addTab('', { title: 'tab.overview.name', icon: 'fa fa-home', route: '', - onEnter: () => new OverviewLayout() + onEnter: () => new OverviewLayout({ + tabName: 'tab.overview.name' + }) }); diff --git a/allure-generator/src/main/javascript/util/settings.js b/allure-generator/src/main/javascript/util/settings.js index 3529963d4..0a34d3bc6 100644 --- a/allure-generator/src/main/javascript/util/settings.js +++ b/allure-generator/src/main/javascript/util/settings.js @@ -1,22 +1,4 @@ -import createSettingsModel from '../data/settings/createSettingsModel'; +import {getGlobalSettings} from './settingsFactory'; -const GlobalSettingsModel = createSettingsModel(null, { - language: 'en', - testResultSorting: { - field: 'index', - order: 'asc' - }, - sidebarCollapsed: false, - visibleStatuses: { - failed: true, - broken: true, - skipped: true, - unknown: true, - passed: true - }, - showGroupInfo: false -}); -const settings = new GlobalSettingsModel(); -settings.fetch(); - -export default settings; +const globalSettings = getGlobalSettings(); +export default globalSettings; diff --git a/allure-generator/src/main/javascript/util/settingsFactory.js b/allure-generator/src/main/javascript/util/settingsFactory.js new file mode 100644 index 000000000..31511bf54 --- /dev/null +++ b/allure-generator/src/main/javascript/util/settingsFactory.js @@ -0,0 +1,131 @@ +import LocalStorageModel from '../data/localstorage/LocalStorageModel'; + +const globalSettingsDefaults = { + language: 'en', + sidebarCollapsed: false +}; + +const treePluginDefaults = { + visibleStatuses: { + failed: true, + broken: true, + skipped: true, + unknown: true, + passed: true + }, + showGroupInfo: false, + treeSorting: { + ascending: true, + sorter: 'sorter.name' + } +}; + +const widgetGridPluginDefaults = { + widgets: [[], []] +}; + +function getGlobalSettings() { + const SettingsModel = LocalStorageModel.extend({ + defaults() { + return globalSettingsDefaults; + }, + + getLanguage() { + return this.get('language'); + }, + + setLanguage(value) { + return this.save('language', value); + }, + + isSidebarCollapsed() { + return this.get('sidebarCollapsed'); + }, + + setSidebarCollapsed(value) { + return this.save('sidebarCollapsed', value); + } + }); + const settings = new SettingsModel(); + settings.fetch(); + return settings; +} + +function getSettingsForPlugin(pluginName, defaults = {}) { + const SettingsModel = LocalStorageModel.extend({ + storageKey() { + return `ALLURE_REPORT_SETTINGS_${pluginName.toUpperCase()}`; + }, + defaults() { + return defaults; + }, + }); + const settings = new SettingsModel(); + settings.fetch(); + return settings; +} + +function getSettingsForWidgetGridPlugin(pluginName, defaults = widgetGridPluginDefaults) { + const SettingsModel = LocalStorageModel.extend({ + storageKey() { + return `ALLURE_REPORT_SETTINGS_${pluginName.toUpperCase()}`; + }, + defaults() { + return defaults; + }, + getWidgetsArrangement() { + return this.get('widgets'); + }, + setWidgetsArrangement(value) { + this.save('widgets', value); + } + }); + const settings = new SettingsModel(); + settings.fetch(); + return settings; +} + +function getSettingsForTreePlugin(pluginName, defaults = treePluginDefaults) { + const SettingsModel = LocalStorageModel.extend({ + storageKey() { + return `ALLURE_REPORT_SETTINGS_${pluginName.toUpperCase()}`; + }, + defaults() { + return defaults; + }, + + getVisibleStatuses() { + return this.get('visibleStatuses'); + }, + + setVisibleStatuses(value) { + return this.save('visibleStatuses', value); + }, + + getTreeSorting() { + return this.get('treeSorting'); + }, + + setTreeSorting(value) { + this.save('treeSorting', value); + }, + + isShowGroupInfo() { + return this.get('showGroupInfo'); + }, + + setShowGroupInfo(value) { + this.save('showGroupInfo', value); + } + }); + const settings = new SettingsModel(); + settings.fetch(); + return settings; +} + +export { + getGlobalSettings, + getSettingsForPlugin, + getSettingsForTreePlugin, + getSettingsForWidgetGridPlugin +}; \ No newline at end of file diff --git a/allure-generator/src/test/javascript/components/status-toggle.spec.js b/allure-generator/src/test/javascript/components/status-toggle.spec.js index b35c35ae5..db130fc14 100644 --- a/allure-generator/src/test/javascript/components/status-toggle.spec.js +++ b/allure-generator/src/test/javascript/components/status-toggle.spec.js @@ -1,9 +1,9 @@ -import settings from 'util/settings'; import StatusToggleView from 'components/status-toggle/StatusToggleView'; +import {getSettingsForTreePlugin} from 'util/settingsFactory'; describe('StatusToggle', function () { - const statusesKey = 'testStatusKey'; const statistic = {failed: '4', broken: '3', passed: '2', skipped: '1', unknown: '0'}; + const settings = getSettingsForTreePlugin('ALLURE_TEST'); function StatusElement(el) { this.activeItems = () => el.find('.status-toggle__item').find('.y-label').toArray().map(item => item.textContent.trim()); @@ -12,8 +12,8 @@ describe('StatusToggle', function () { } beforeEach(() => { - settings.set(statusesKey, {failed: true, broken: true, passed: false, skipped: false, unknown: false}); - this.view = new StatusToggleView({statusesKey, statistic}); + settings.setVisibleStatuses({failed: true, broken: true, passed: false, skipped: false, unknown: false}); + this.view = new StatusToggleView({settings, statistic}); this.view.render(); this.el = new StatusElement(this.view.$el); }); @@ -25,9 +25,9 @@ describe('StatusToggle', function () { it('should update model on click', () => { this.el.passed().click(); - expect(settings.get(statusesKey)).toEqual({failed: true, broken: true, passed: true, skipped:false, unknown: false}); + expect(settings.getVisibleStatuses()).toEqual({failed: true, broken: true, passed: true, skipped:false, unknown: false}); this.el.passed().click(); - expect(settings.get(statusesKey)).toEqual({failed: true, broken: true, passed: false, skipped:false, unknown: false}); + expect(settings.getVisibleStatuses()).toEqual({failed: true, broken: true, passed: false, skipped:false, unknown: false}); }); }); diff --git a/allure-generator/src/test/javascript/components/tree.spec.js b/allure-generator/src/test/javascript/components/tree.spec.js index a85c58d58..8149ea073 100644 --- a/allure-generator/src/test/javascript/components/tree.spec.js +++ b/allure-generator/src/test/javascript/components/tree.spec.js @@ -1,14 +1,11 @@ import {Model} from 'backbone'; import TreeView from 'components/tree/TreeView'; import TreeCollection from 'data/tree/TreeCollection'; -import settings from 'util/settings'; - +import {getSettingsForTreePlugin} from 'util/settingsFactory'; describe('Tree', function () { const tabName = 'Tab Name'; - const sorterSettingsKey = tabName + '.treeSorting'; - const filterSettingsKey = tabName + '.visibleStatuses'; - const infoSettingsKey = 'showGroupInfo'; + let settings = getSettingsForTreePlugin('TREE_TEST'); let view; let page; @@ -45,11 +42,11 @@ describe('Tree', function () { } function sortTree({sorter = 'sorter.name', ascending = true}) { - settings.save(sorterSettingsKey, {sorter, ascending}); + settings.setTreeSorting({sorter, ascending}); } function filterTree({failed = true, broken = true, passed = true, skipped = true, unknown = true}) { - settings.save(filterSettingsKey, { + settings.setVisibleStatuses({ failed: failed, broken: broken, passed: passed, @@ -68,6 +65,7 @@ describe('Tree', function () { routeState: new Model(), tabName: tabName, baseUrl: 'XUnit', + settings: settings }).render(); view.onRender(); const page = new PageObject(view.$el); @@ -96,9 +94,7 @@ describe('Tree', function () { }); beforeEach(() => { - settings.unset(sorterSettingsKey); - settings.unset(filterSettingsKey); - settings.unset(infoSettingsKey); + settings = getSettingsForTreePlugin('TREE_TEST'); ({view, page} = renderView(data)); }); @@ -113,7 +109,7 @@ describe('Tree', function () { expect(page.nodes().length).toBe(0); sortTree({ascending: false}); filterTree({failed: true, broken: false, passed: false, skipped: false, unknown: false}); - settings.save(infoSettingsKey, true); + settings.setShowGroupInfo(true); expect(page.nodes().length).toBe(0); view.destroy(); }); @@ -184,9 +180,9 @@ describe('Tree', function () { describe('groupInfo', () => { it('should showing and hiding the group node info', () => { - settings.save(infoSettingsKey, true); + settings.setShowGroupInfo(true); expect(page.infos().length).toBe(2); - settings.save(infoSettingsKey, false); + settings.setShowGroupInfo(false); expect(page.infos().length).toBe(0); }); }); diff --git a/allure-generator/src/test/javascript/components/widgets-grid.spec.js b/allure-generator/src/test/javascript/components/widgets-grid.spec.js index c93cd4628..1b5b63fbb 100644 --- a/allure-generator/src/test/javascript/components/widgets-grid.spec.js +++ b/allure-generator/src/test/javascript/components/widgets-grid.spec.js @@ -1,18 +1,18 @@ import {View} from 'backbone'; -import settings from 'util/settings'; import pluginsRegistry from 'util/pluginsRegistry'; import WidgetsGridView from 'components/widgets-grid/WidgetsGridView'; import WidgetsModel from 'data/widgets/WidgetsModel'; +import {getSettingsForWidgetGridPlugin} from 'util/settingsFactory'; describe('WidgetsGridView', function() { + let settings = getSettingsForWidgetGridPlugin('ALLURE_TEST'); function PageObject(el) { this.column = (i) => el.find('.widgets-grid__col').eq(i); this.widgetsAtCol = (i) => this.column(i).find('.widget'); - this.widgetById = (id) => el.find(`[data-id=${id}]`); } beforeEach(() => { - settings.clear(); + settings = getSettingsForWidgetGridPlugin('ALLURE_TEST'); pluginsRegistry.widgets = { group: { a: View, @@ -29,7 +29,7 @@ describe('WidgetsGridView', function() { c: {} } }); - this.view = new WidgetsGridView({model: this.model, tabName: 'group'}).render(); + this.view = new WidgetsGridView({model: this.model, tabName: 'group', settings: settings}).render(); this.view.onRender(); this.el = new PageObject(this.view.$el); }); @@ -55,7 +55,7 @@ describe('WidgetsGridView', function() { }); it('should add remaining widgets and ignore missing', () => { - settings.set('widgets', [['a', 'x', 'c'], ['d', 'e']]); + settings.setWidgetsArrangement([['a', 'x', 'c'], ['d', 'e']]); expect(this.view.getWidgetsArrangement()).toEqual([ ['a', 'c', 'b'], ['d', 'e'] From 63eb08a2b514bcbd0fcb2a0d20e3efe1af0b2ed2 Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Wed, 9 Aug 2017 17:33:49 +0300 Subject: [PATCH 03/11] rename util to utils --- allure-generator/src/main/javascript/app.js | 2 +- .../src/main/javascript/behaviors/ClipboardBehavior.js | 2 +- .../main/javascript/components/attachment/AttachmentView.js | 4 ++-- .../components/graph-duration-chart/DurationChartView.js | 2 +- .../javascript/components/graph-pie-chart/PieChartView.js | 4 ++-- .../components/graph-severity-chart/SeverityChartView.js | 4 ++-- .../components/graph-trend-chart/TrendChartView.js | 2 +- .../components/language-select/LanguageSelectView.js | 4 ++-- .../src/main/javascript/components/side-nav/SideNavView.js | 6 +++--- .../javascript/components/status-toggle/StatusToggleView.js | 2 +- .../testresult-execution/TestResultExecutionView.js | 2 +- .../testresult-overview/TestResultOverviewView.js | 2 +- .../main/javascript/components/testresult/TestResultView.js | 2 +- .../src/main/javascript/components/tree/TreeView.js | 4 ++-- .../javascript/components/widgets-grid/WidgetsGridView.js | 4 ++-- .../src/main/javascript/data/testresult/TestResultModel.js | 2 +- .../src/main/javascript/data/tree/TreeCollection.js | 2 +- .../src/main/javascript/data/tree/comparator.js | 2 +- allure-generator/src/main/javascript/helpers/fileicon.js | 2 +- .../src/main/javascript/helpers/statistic-bar.js | 2 +- allure-generator/src/main/javascript/helpers/status-bar.js | 2 +- allure-generator/src/main/javascript/helpers/t.js | 2 +- allure-generator/src/main/javascript/pluginApi.js | 6 +++--- .../main/javascript/plugins/tab-timeline/TimelineView.js | 2 +- .../src/main/javascript/{util => utils}/arrays.js | 0 .../src/main/javascript/{util => utils}/attachmentType.js | 0 .../src/main/javascript/{util => utils}/clipboard.js | 0 .../src/main/javascript/{util => utils}/escape.js | 0 .../src/main/javascript/{util => utils}/highlight.js | 0 .../src/main/javascript/{util => utils}/hotkeys.js | 0 .../src/main/javascript/{util => utils}/loading.js | 0 .../src/main/javascript/{util => utils}/pluginsRegistry.js | 0 .../src/main/javascript/{util => utils}/settings.js | 0 .../src/main/javascript/{util => utils}/settingsFactory.js | 0 .../src/main/javascript/{util => utils}/sorting.js | 0 .../src/main/javascript/{util => utils}/statuses.js | 0 .../src/main/javascript/{util => utils}/translation.js | 0 .../src/test/javascript/components/status-toggle.spec.js | 2 +- .../src/test/javascript/components/tree.spec.js | 2 +- .../src/test/javascript/components/widgets-grid.spec.js | 4 ++-- 40 files changed, 38 insertions(+), 38 deletions(-) rename allure-generator/src/main/javascript/{util => utils}/arrays.js (100%) rename allure-generator/src/main/javascript/{util => utils}/attachmentType.js (100%) rename allure-generator/src/main/javascript/{util => utils}/clipboard.js (100%) rename allure-generator/src/main/javascript/{util => utils}/escape.js (100%) rename allure-generator/src/main/javascript/{util => utils}/highlight.js (100%) rename allure-generator/src/main/javascript/{util => utils}/hotkeys.js (100%) rename allure-generator/src/main/javascript/{util => utils}/loading.js (100%) rename allure-generator/src/main/javascript/{util => utils}/pluginsRegistry.js (100%) rename allure-generator/src/main/javascript/{util => utils}/settings.js (100%) rename allure-generator/src/main/javascript/{util => utils}/settingsFactory.js (100%) rename allure-generator/src/main/javascript/{util => utils}/sorting.js (100%) rename allure-generator/src/main/javascript/{util => utils}/statuses.js (100%) rename allure-generator/src/main/javascript/{util => utils}/translation.js (100%) diff --git a/allure-generator/src/main/javascript/app.js b/allure-generator/src/main/javascript/app.js index 09d2533ff..e6eec6606 100644 --- a/allure-generator/src/main/javascript/app.js +++ b/allure-generator/src/main/javascript/app.js @@ -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 diff --git a/allure-generator/src/main/javascript/behaviors/ClipboardBehavior.js b/allure-generator/src/main/javascript/behaviors/ClipboardBehavior.js index 559e4bbf0..b779fd330 100644 --- a/allure-generator/src/main/javascript/behaviors/ClipboardBehavior.js +++ b/allure-generator/src/main/javascript/behaviors/ClipboardBehavior.js @@ -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'; diff --git a/allure-generator/src/main/javascript/components/attachment/AttachmentView.js b/allure-generator/src/main/javascript/components/attachment/AttachmentView.js index f54c239a4..8d6ac90fe 100644 --- a/allure-generator/src/main/javascript/components/attachment/AttachmentView.js +++ b/allure-generator/src/main/javascript/components/attachment/AttachmentView.js @@ -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'; diff --git a/allure-generator/src/main/javascript/components/graph-duration-chart/DurationChartView.js b/allure-generator/src/main/javascript/components/graph-duration-chart/DurationChartView.js index db6770d43..f8a750e0f 100644 --- a/allure-generator/src/main/javascript/components/graph-duration-chart/DurationChartView.js +++ b/allure-generator/src/main/javascript/components/graph-duration-chart/DurationChartView.js @@ -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'; diff --git a/allure-generator/src/main/javascript/components/graph-pie-chart/PieChartView.js b/allure-generator/src/main/javascript/components/graph-pie-chart/PieChartView.js index da5d3fac8..502a6b77c 100644 --- a/allure-generator/src/main/javascript/components/graph-pie-chart/PieChartView.js +++ b/allure-generator/src/main/javascript/components/graph-pie-chart/PieChartView.js @@ -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'; diff --git a/allure-generator/src/main/javascript/components/graph-severity-chart/SeverityChartView.js b/allure-generator/src/main/javascript/components/graph-severity-chart/SeverityChartView.js index 3c8bb61f1..079f05318 100644 --- a/allure-generator/src/main/javascript/components/graph-severity-chart/SeverityChartView.js +++ b/allure-generator/src/main/javascript/components/graph-severity-chart/SeverityChartView.js @@ -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'; diff --git a/allure-generator/src/main/javascript/components/graph-trend-chart/TrendChartView.js b/allure-generator/src/main/javascript/components/graph-trend-chart/TrendChartView.js index 990fb38b6..ca4de97aa 100644 --- a/allure-generator/src/main/javascript/components/graph-trend-chart/TrendChartView.js +++ b/allure-generator/src/main/javascript/components/graph-trend-chart/TrendChartView.js @@ -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'; diff --git a/allure-generator/src/main/javascript/components/language-select/LanguageSelectView.js b/allure-generator/src/main/javascript/components/language-select/LanguageSelectView.js index 52097b78b..d6c49f9ee 100644 --- a/allure-generator/src/main/javascript/components/language-select/LanguageSelectView.js +++ b/allure-generator/src/main/javascript/components/language-select/LanguageSelectView.js @@ -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') diff --git a/allure-generator/src/main/javascript/components/side-nav/SideNavView.js b/allure-generator/src/main/javascript/components/side-nav/SideNavView.js index 1f03593c2..897b97688 100644 --- a/allure-generator/src/main/javascript/components/side-nav/SideNavView.js +++ b/allure-generator/src/main/javascript/components/side-nav/SideNavView.js @@ -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 { 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 '../../util/settings'; +import settings from '../../utils/settings'; @className('side-nav') class SideNavView extends View { diff --git a/allure-generator/src/main/javascript/components/status-toggle/StatusToggleView.js b/allure-generator/src/main/javascript/components/status-toggle/StatusToggleView.js index bd69a46e4..064966781 100644 --- a/allure-generator/src/main/javascript/components/status-toggle/StatusToggleView.js +++ b/allure-generator/src/main/javascript/components/status-toggle/StatusToggleView.js @@ -1,7 +1,7 @@ import './styles.scss'; import {on, className} from '../../decorators'; 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'; diff --git a/allure-generator/src/main/javascript/components/testresult-execution/TestResultExecutionView.js b/allure-generator/src/main/javascript/components/testresult-execution/TestResultExecutionView.js index afee6bdc8..891aefe17 100644 --- a/allure-generator/src/main/javascript/components/testresult-execution/TestResultExecutionView.js +++ b/allure-generator/src/main/javascript/components/testresult-execution/TestResultExecutionView.js @@ -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'; diff --git a/allure-generator/src/main/javascript/components/testresult-overview/TestResultOverviewView.js b/allure-generator/src/main/javascript/components/testresult-overview/TestResultOverviewView.js index 1c9fe1bb4..a234d88ff 100644 --- a/allure-generator/src/main/javascript/components/testresult-overview/TestResultOverviewView.js +++ b/allure-generator/src/main/javascript/components/testresult-overview/TestResultOverviewView.js @@ -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') diff --git a/allure-generator/src/main/javascript/components/testresult/TestResultView.js b/allure-generator/src/main/javascript/components/testresult/TestResultView.js index 241263516..7d6df1ba0 100644 --- a/allure-generator/src/main/javascript/components/testresult/TestResultView.js +++ b/allure-generator/src/main/javascript/components/testresult/TestResultView.js @@ -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'; diff --git a/allure-generator/src/main/javascript/components/tree/TreeView.js b/allure-generator/src/main/javascript/components/tree/TreeView.js index 6f2c25ae6..ad9521cf7 100644 --- a/allure-generator/src/main/javascript/components/tree/TreeView.js +++ b/allure-generator/src/main/javascript/components/tree/TreeView.js @@ -1,6 +1,6 @@ import './styles.scss'; import {View} from 'backbone.marionette'; -import hotkeys from '../../util/hotkeys'; +import hotkeys from '../../utils/hotkeys'; import template from './TreeView.hbs'; import {behavior, className, on, regions} from '../../decorators'; import getComparator from '../../data/tree/comparator'; @@ -9,7 +9,7 @@ import NodeSorterView from '../node-sorter/NodeSorterView'; import StatusToggleView from '../status-toggle/StatusToggleView'; import router from '../../router'; import {Model} from 'backbone'; -import {getSettingsForTreePlugin} from '../../util/settingsFactory'; +import {getSettingsForTreePlugin} from '../../utils/settingsFactory'; @className('tree') @behavior('TooltipBehavior', {position: 'bottom'}) diff --git a/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js b/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js index 445be563b..562b032fc 100644 --- a/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js +++ b/allure-generator/src/main/javascript/components/widgets-grid/WidgetsGridView.js @@ -3,8 +3,8 @@ import {View} from 'backbone.marionette'; import $ from 'jquery'; import Sortable from 'sortablejs'; import {className} from '../../decorators'; -import pluginsRegistry from '../../util/pluginsRegistry'; -import {getSettingsForWidgetGridPlugin} from '../../util/settingsFactory'; +import pluginsRegistry from '../../utils/pluginsRegistry'; +import {getSettingsForWidgetGridPlugin} from '../../utils/settingsFactory'; const widgetTpl = (id) => `
diff --git a/allure-generator/src/main/javascript/data/testresult/TestResultModel.js b/allure-generator/src/main/javascript/data/testresult/TestResultModel.js index c2b6da5fe..8af94424d 100644 --- a/allure-generator/src/main/javascript/data/testresult/TestResultModel.js +++ b/allure-generator/src/main/javascript/data/testresult/TestResultModel.js @@ -1,6 +1,6 @@ import {findWhere} from 'underscore'; import {Model} from 'backbone'; -import {makeArray} from '../../util/arrays'; +import {makeArray} from '../../utils/arrays'; function collectAttachments({steps, attachments}) { diff --git a/allure-generator/src/main/javascript/data/tree/TreeCollection.js b/allure-generator/src/main/javascript/data/tree/TreeCollection.js index 0d9f24481..57bd6fbbb 100644 --- a/allure-generator/src/main/javascript/data/tree/TreeCollection.js +++ b/allure-generator/src/main/javascript/data/tree/TreeCollection.js @@ -1,6 +1,6 @@ import {Collection} from 'backbone'; import {flatten, findWhere} from 'underscore'; -import {values} from '../../util/statuses'; +import {values} from '../../utils/statuses'; function updateTime(timeA, timeB, field, operation) { if (timeB && timeB[field]) { diff --git a/allure-generator/src/main/javascript/data/tree/comparator.js b/allure-generator/src/main/javascript/data/tree/comparator.js index 0cb48700e..623e80b55 100644 --- a/allure-generator/src/main/javascript/data/tree/comparator.js +++ b/allure-generator/src/main/javascript/data/tree/comparator.js @@ -1,4 +1,4 @@ -import {values} from '../../util/statuses'; +import {values} from '../../utils/statuses'; function byName(a, b) { return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; diff --git a/allure-generator/src/main/javascript/helpers/fileicon.js b/allure-generator/src/main/javascript/helpers/fileicon.js index 91ed0a2fa..085e5a45a 100644 --- a/allure-generator/src/main/javascript/helpers/fileicon.js +++ b/allure-generator/src/main/javascript/helpers/fileicon.js @@ -1,4 +1,4 @@ -import typeByMime from '../util/attachmentType'; +import typeByMime from '../utils/attachmentType'; export default function(type) { return typeByMime(type).icon; diff --git a/allure-generator/src/main/javascript/helpers/statistic-bar.js b/allure-generator/src/main/javascript/helpers/statistic-bar.js index da34aec3d..65576d09d 100644 --- a/allure-generator/src/main/javascript/helpers/statistic-bar.js +++ b/allure-generator/src/main/javascript/helpers/statistic-bar.js @@ -1,5 +1,5 @@ import {SafeString} from 'handlebars/runtime'; -import {values} from '../util/statuses'; +import {values} from '../utils/statuses'; export default function (statistic){ const fill = values.map(status => { diff --git a/allure-generator/src/main/javascript/helpers/status-bar.js b/allure-generator/src/main/javascript/helpers/status-bar.js index 3c84af003..74c698061 100644 --- a/allure-generator/src/main/javascript/helpers/status-bar.js +++ b/allure-generator/src/main/javascript/helpers/status-bar.js @@ -1,5 +1,5 @@ import {SafeString} from 'handlebars/runtime'; -import {values} from '../util/statuses'; +import {values} from '../utils/statuses'; export default function statusBar(statistic) { const fill = values.map(status => { diff --git a/allure-generator/src/main/javascript/helpers/t.js b/allure-generator/src/main/javascript/helpers/t.js index 5efebcc53..79b9998fa 100644 --- a/allure-generator/src/main/javascript/helpers/t.js +++ b/allure-generator/src/main/javascript/helpers/t.js @@ -1,4 +1,4 @@ -import i18next from '../util/translation'; +import i18next from '../utils/translation'; export default function translate(key, options) { return i18next.t(key, options ? options.hash : {}); diff --git a/allure-generator/src/main/javascript/pluginApi.js b/allure-generator/src/main/javascript/pluginApi.js index 756c317a6..d448d96ea 100644 --- a/allure-generator/src/main/javascript/pluginApi.js +++ b/allure-generator/src/main/javascript/pluginApi.js @@ -1,9 +1,9 @@ -import pluginsRegistry from './util/pluginsRegistry'; +import pluginsRegistry from './utils/pluginsRegistry'; import TreeLayout from './layouts/tree/TreeLayout'; import AppLayout from './layouts/application/AppLayout'; import WidgetStatusView from './components/widget-status/WidgetStatusView'; -import {getSettingsForPlugin} from './util/settingsFactory'; -import settings from './util/settings'; +import {getSettingsForPlugin} from './utils/settingsFactory'; +import settings from './utils/settings'; window.allure = { api: pluginsRegistry, diff --git a/allure-generator/src/main/javascript/plugins/tab-timeline/TimelineView.js b/allure-generator/src/main/javascript/plugins/tab-timeline/TimelineView.js index 62196f14a..af2242a0d 100644 --- a/allure-generator/src/main/javascript/plugins/tab-timeline/TimelineView.js +++ b/allure-generator/src/main/javascript/plugins/tab-timeline/TimelineView.js @@ -10,7 +10,7 @@ import {select, event as currentEvent} from 'd3-selection'; import {brushX} from 'd3-brush'; import {drag} from 'd3-drag'; import 'd3-selection-multi'; -import escape from '../../util/escape'; +import escape from '../../utils/escape'; import TooltipView from '../../components/tooltip/TooltipView'; import template from './TimelineView.hbs'; import {axisBottom} from 'd3-axis'; diff --git a/allure-generator/src/main/javascript/util/arrays.js b/allure-generator/src/main/javascript/utils/arrays.js similarity index 100% rename from allure-generator/src/main/javascript/util/arrays.js rename to allure-generator/src/main/javascript/utils/arrays.js diff --git a/allure-generator/src/main/javascript/util/attachmentType.js b/allure-generator/src/main/javascript/utils/attachmentType.js similarity index 100% rename from allure-generator/src/main/javascript/util/attachmentType.js rename to allure-generator/src/main/javascript/utils/attachmentType.js diff --git a/allure-generator/src/main/javascript/util/clipboard.js b/allure-generator/src/main/javascript/utils/clipboard.js similarity index 100% rename from allure-generator/src/main/javascript/util/clipboard.js rename to allure-generator/src/main/javascript/utils/clipboard.js diff --git a/allure-generator/src/main/javascript/util/escape.js b/allure-generator/src/main/javascript/utils/escape.js similarity index 100% rename from allure-generator/src/main/javascript/util/escape.js rename to allure-generator/src/main/javascript/utils/escape.js diff --git a/allure-generator/src/main/javascript/util/highlight.js b/allure-generator/src/main/javascript/utils/highlight.js similarity index 100% rename from allure-generator/src/main/javascript/util/highlight.js rename to allure-generator/src/main/javascript/utils/highlight.js diff --git a/allure-generator/src/main/javascript/util/hotkeys.js b/allure-generator/src/main/javascript/utils/hotkeys.js similarity index 100% rename from allure-generator/src/main/javascript/util/hotkeys.js rename to allure-generator/src/main/javascript/utils/hotkeys.js diff --git a/allure-generator/src/main/javascript/util/loading.js b/allure-generator/src/main/javascript/utils/loading.js similarity index 100% rename from allure-generator/src/main/javascript/util/loading.js rename to allure-generator/src/main/javascript/utils/loading.js diff --git a/allure-generator/src/main/javascript/util/pluginsRegistry.js b/allure-generator/src/main/javascript/utils/pluginsRegistry.js similarity index 100% rename from allure-generator/src/main/javascript/util/pluginsRegistry.js rename to allure-generator/src/main/javascript/utils/pluginsRegistry.js diff --git a/allure-generator/src/main/javascript/util/settings.js b/allure-generator/src/main/javascript/utils/settings.js similarity index 100% rename from allure-generator/src/main/javascript/util/settings.js rename to allure-generator/src/main/javascript/utils/settings.js diff --git a/allure-generator/src/main/javascript/util/settingsFactory.js b/allure-generator/src/main/javascript/utils/settingsFactory.js similarity index 100% rename from allure-generator/src/main/javascript/util/settingsFactory.js rename to allure-generator/src/main/javascript/utils/settingsFactory.js diff --git a/allure-generator/src/main/javascript/util/sorting.js b/allure-generator/src/main/javascript/utils/sorting.js similarity index 100% rename from allure-generator/src/main/javascript/util/sorting.js rename to allure-generator/src/main/javascript/utils/sorting.js diff --git a/allure-generator/src/main/javascript/util/statuses.js b/allure-generator/src/main/javascript/utils/statuses.js similarity index 100% rename from allure-generator/src/main/javascript/util/statuses.js rename to allure-generator/src/main/javascript/utils/statuses.js diff --git a/allure-generator/src/main/javascript/util/translation.js b/allure-generator/src/main/javascript/utils/translation.js similarity index 100% rename from allure-generator/src/main/javascript/util/translation.js rename to allure-generator/src/main/javascript/utils/translation.js diff --git a/allure-generator/src/test/javascript/components/status-toggle.spec.js b/allure-generator/src/test/javascript/components/status-toggle.spec.js index db130fc14..cc05d684d 100644 --- a/allure-generator/src/test/javascript/components/status-toggle.spec.js +++ b/allure-generator/src/test/javascript/components/status-toggle.spec.js @@ -1,5 +1,5 @@ import StatusToggleView from 'components/status-toggle/StatusToggleView'; -import {getSettingsForTreePlugin} from 'util/settingsFactory'; +import {getSettingsForTreePlugin} from 'utils/settingsFactory'; describe('StatusToggle', function () { const statistic = {failed: '4', broken: '3', passed: '2', skipped: '1', unknown: '0'}; diff --git a/allure-generator/src/test/javascript/components/tree.spec.js b/allure-generator/src/test/javascript/components/tree.spec.js index 8149ea073..08330eb0a 100644 --- a/allure-generator/src/test/javascript/components/tree.spec.js +++ b/allure-generator/src/test/javascript/components/tree.spec.js @@ -1,7 +1,7 @@ import {Model} from 'backbone'; import TreeView from 'components/tree/TreeView'; import TreeCollection from 'data/tree/TreeCollection'; -import {getSettingsForTreePlugin} from 'util/settingsFactory'; +import {getSettingsForTreePlugin} from 'utils/settingsFactory'; describe('Tree', function () { const tabName = 'Tab Name'; diff --git a/allure-generator/src/test/javascript/components/widgets-grid.spec.js b/allure-generator/src/test/javascript/components/widgets-grid.spec.js index 1b5b63fbb..0ee8119e3 100644 --- a/allure-generator/src/test/javascript/components/widgets-grid.spec.js +++ b/allure-generator/src/test/javascript/components/widgets-grid.spec.js @@ -1,8 +1,8 @@ import {View} from 'backbone'; -import pluginsRegistry from 'util/pluginsRegistry'; +import pluginsRegistry from 'utils/pluginsRegistry'; import WidgetsGridView from 'components/widgets-grid/WidgetsGridView'; import WidgetsModel from 'data/widgets/WidgetsModel'; -import {getSettingsForWidgetGridPlugin} from 'util/settingsFactory'; +import {getSettingsForWidgetGridPlugin} from 'utils/settingsFactory'; describe('WidgetsGridView', function() { let settings = getSettingsForWidgetGridPlugin('ALLURE_TEST'); From 47c5116206e411f39c9900d913ac8071f37abdc0 Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Wed, 9 Aug 2017 17:55:38 +0300 Subject: [PATCH 04/11] 0px to 0 in css --- .../src/main/javascript/components/status-toggle/styles.scss | 2 +- .../src/main/javascript/components/tree/styles.scss | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/allure-generator/src/main/javascript/components/status-toggle/styles.scss b/allure-generator/src/main/javascript/components/status-toggle/styles.scss index 38097e6b0..789b505e4 100644 --- a/allure-generator/src/main/javascript/components/status-toggle/styles.scss +++ b/allure-generator/src/main/javascript/components/status-toggle/styles.scss @@ -8,7 +8,7 @@ } &__item { cursor: pointer; - padding: 5px 0px 5px 0px; + padding: 5px 0 5px 0; display: inline-block; white-space: nowrap; } diff --git a/allure-generator/src/main/javascript/components/tree/styles.scss b/allure-generator/src/main/javascript/components/tree/styles.scss index 8c7881dfb..a1f152f2f 100644 --- a/allure-generator/src/main/javascript/components/tree/styles.scss +++ b/allure-generator/src/main/javascript/components/tree/styles.scss @@ -87,7 +87,7 @@ background: $pane-overlay-bg-hover; } &__filter, &__sorter { - padding: 0px $gap-size 0px $gap-size; + padding: 0 $gap-size 0 $gap-size; position: relative; white-space: nowrap; } @@ -96,6 +96,6 @@ } &__empty { border-top: 1px solid #ECEFF1; - padding: 8px 0px 0px 15px; + padding: 8px 0 0 15px; } } From a5bbb0f5569de496161e8ca03fcff0b9b63067e2 Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Wed, 9 Aug 2017 18:04:55 +0300 Subject: [PATCH 05/11] delete BackPanelView --- .../components/back-panel/BackPanelView.hbs | 2 -- .../components/back-panel/BackPanelView.js | 19 ------------------- .../components/back-panel/styles.scss | 11 ----------- 3 files changed, 32 deletions(-) delete mode 100644 allure-generator/src/main/javascript/components/back-panel/BackPanelView.hbs delete mode 100644 allure-generator/src/main/javascript/components/back-panel/BackPanelView.js delete mode 100644 allure-generator/src/main/javascript/components/back-panel/styles.scss diff --git a/allure-generator/src/main/javascript/components/back-panel/BackPanelView.hbs b/allure-generator/src/main/javascript/components/back-panel/BackPanelView.hbs deleted file mode 100644 index 6e8a12068..000000000 --- a/allure-generator/src/main/javascript/components/back-panel/BackPanelView.hbs +++ /dev/null @@ -1,2 +0,0 @@ - -
{{t 'controls.backto'}} {{text}}
diff --git a/allure-generator/src/main/javascript/components/back-panel/BackPanelView.js b/allure-generator/src/main/javascript/components/back-panel/BackPanelView.js deleted file mode 100644 index 5ef2bc6a2..000000000 --- a/allure-generator/src/main/javascript/components/back-panel/BackPanelView.js +++ /dev/null @@ -1,19 +0,0 @@ -import './styles.scss'; -import {View} from 'backbone.marionette'; -import {className} from '../../decorators'; -import template from './BackPanelView.hbs'; - -@className('back-panel') -class TestResultBackPanelView extends View { - template = template; - - templateContext() { - const {url} = this.options; - return { - text: url.split('/')[0], - url - }; - } -} - -export default TestResultBackPanelView; diff --git a/allure-generator/src/main/javascript/components/back-panel/styles.scss b/allure-generator/src/main/javascript/components/back-panel/styles.scss deleted file mode 100644 index a058e97a3..000000000 --- a/allure-generator/src/main/javascript/components/back-panel/styles.scss +++ /dev/null @@ -1,11 +0,0 @@ -.back-panel { - &__text { - position: absolute; - top: 50%; - transform: rotate(-90deg); - margin-left: 5%; - width: 100%; - text-align: center; - left: -50%; - } -} From 564a1d2bd84c1d49e4ee628c226ad6ca90fd6bed Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Wed, 9 Aug 2017 18:14:28 +0300 Subject: [PATCH 06/11] delete empty component --- .../src/main/javascript/components/execution/styles.scss | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 allure-generator/src/main/javascript/components/execution/styles.scss diff --git a/allure-generator/src/main/javascript/components/execution/styles.scss b/allure-generator/src/main/javascript/components/execution/styles.scss deleted file mode 100644 index e69de29bb..000000000 From 8ce15d4d794039c8853b62c83c08b2b0173bcd93 Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Wed, 9 Aug 2017 18:28:46 +0300 Subject: [PATCH 07/11] colors to variables --- .../src/main/javascript/components/tooltip/styles.scss | 3 +-- allure-generator/src/main/javascript/variables.scss | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/allure-generator/src/main/javascript/components/tooltip/styles.scss b/allure-generator/src/main/javascript/components/tooltip/styles.scss index b68a0fefc..2d63445e1 100644 --- a/allure-generator/src/main/javascript/components/tooltip/styles.scss +++ b/allure-generator/src/main/javascript/components/tooltip/styles.scss @@ -1,5 +1,4 @@ -$tooltip-bg: rgba(50, 50, 50, 0.8); -$tooltip-color: #fff; +@import "../../variables.scss"; .tooltip { position: absolute; diff --git a/allure-generator/src/main/javascript/variables.scss b/allure-generator/src/main/javascript/variables.scss index 61c03bf71..6f1dac076 100644 --- a/allure-generator/src/main/javascript/variables.scss +++ b/allure-generator/src/main/javascript/variables.scss @@ -59,9 +59,14 @@ $sidebar-text-shadow-color: #000; $link-color: #000; $link-color-hover: #f00; + /* Pane set */ $pane-bg-color: #fff; $pane-shadow-color: #999; $pane-overlay-bg: rgba(240, 240, 240, 0.4); -$pane-overlay-bg-hover: rgba(240, 240, 240, 0.2); +$pane-overlay-bg-hover: rgba(240, 240, 240, 0.2); + +/* Tooltip */ +$tooltip-bg: rgba(50, 50, 50, 0.8); +$tooltip-color: #fff; From d004a5c7cd6d735223aba478ebe11b540f5ea984 Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Wed, 9 Aug 2017 18:32:52 +0300 Subject: [PATCH 08/11] color from variavles.scss --- .../src/main/javascript/components/popover/styles.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/allure-generator/src/main/javascript/components/popover/styles.scss b/allure-generator/src/main/javascript/components/popover/styles.scss index 557402152..e142996a5 100644 --- a/allure-generator/src/main/javascript/components/popover/styles.scss +++ b/allure-generator/src/main/javascript/components/popover/styles.scss @@ -2,7 +2,7 @@ .popover { position: absolute; - background: #fff; + background: $pane-bg-color; color: $text-color; border: 1px solid $border-accent-color; padding: 8px; @@ -21,7 +21,7 @@ } &::after { left: -15px; - border-right-color: #fff; + border-right-color: $pane-bg-color; } } &__list { From fbb2df3ec1dd85ce2b95ebf9ea44a160d8e6263a Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Wed, 9 Aug 2017 18:34:54 +0300 Subject: [PATCH 09/11] padding --- .../src/main/javascript/components/node-sorter/styles.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allure-generator/src/main/javascript/components/node-sorter/styles.scss b/allure-generator/src/main/javascript/components/node-sorter/styles.scss index ea72192eb..b4afd60da 100644 --- a/allure-generator/src/main/javascript/components/node-sorter/styles.scss +++ b/allure-generator/src/main/javascript/components/node-sorter/styles.scss @@ -10,6 +10,6 @@ &__item { cursor: pointer; display: inline-block; - padding-right: 15px; + padding-right: $gap-size; } } \ No newline at end of file From fb3fd6fddd6eb7a1d34ef4535a2c78d0e4fa16d8 Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Wed, 9 Aug 2017 18:42:07 +0300 Subject: [PATCH 10/11] unnecessary css styles --- .../src/main/javascript/components/modal/styles.scss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/allure-generator/src/main/javascript/components/modal/styles.scss b/allure-generator/src/main/javascript/components/modal/styles.scss index 40e81e007..6d94f7d78 100644 --- a/allure-generator/src/main/javascript/components/modal/styles.scss +++ b/allure-generator/src/main/javascript/components/modal/styles.scss @@ -21,9 +21,5 @@ } .blur { - -webkit-filter: blur(3px); - -moz-filter: blur(3px); - -o-filter: blur(3px); - -ms-filter: blur(3px); filter: blur(3px); } \ No newline at end of file From 4490fd416f916878961450fe8f05f0947d112b6a Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Wed, 9 Aug 2017 18:47:57 +0300 Subject: [PATCH 11/11] fix empty tags --- .../main/javascript/components/node-sorter/NodeSorterView.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/allure-generator/src/main/javascript/components/node-sorter/NodeSorterView.hbs b/allure-generator/src/main/javascript/components/node-sorter/NodeSorterView.hbs index eb996d10e..2313dfc8b 100644 --- a/allure-generator/src/main/javascript/components/node-sorter/NodeSorterView.hbs +++ b/allure-generator/src/main/javascript/components/node-sorter/NodeSorterView.hbs @@ -3,8 +3,8 @@
{{t name}} - - + +
{{/each}}