[REM] web: remove legacy views benchmark page

Those views are no longer used and about to be removed. This
commit also removes the benchmark lib as it is no longer used.

Part of task 3168640

Part-of: odoo/odoo#111809
This commit is contained in:
Aaron Bohy
2023-02-08 13:27:57 +01:00
parent 7ea2e6ce15
commit b2e267872f
10 changed files with 0 additions and 20307 deletions
-1
View File
@@ -659,7 +659,6 @@ This module provides the core of the Odoo Web Client.
('remove', 'web/static/tests/webclient/**/helpers.js'),
'web/static/tests/legacy/**/*.js',
('remove', 'web/static/tests/legacy/**/*_mobile_tests.js'),
('remove', 'web/static/tests/legacy/**/*_benchmarks.js'),
('remove', 'web/static/tests/legacy/helpers/**/*.js'),
('remove', 'web/static/tests/legacy/legacy_setup.js'),
-4
View File
@@ -124,10 +124,6 @@ class WebClient(http.Controller):
def test_mobile_suite(self, mod=None, **kwargs):
return request.render('web.qunit_mobile_suite')
@http.route('/web/benchmarks', type='http', auth="none")
def benchmarks(self, mod=None, **kwargs):
return request.render('web.benchmark_suite')
@http.route('/web/bundle/<string:bundle_name>', auth="public", methods=["GET"])
def bundle(self, bundle_name, **bundle_params):
"""
-22
View File
@@ -1,22 +0,0 @@
Copyright 2010-2016 Mathias Bynens <https://mathiasbynens.be/>
Based on JSLitmus.js, copyright Robert Kieffer <http://broofa.com/>
Modified by John-David Dalton <http://allyoucanleet.com/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,109 +0,0 @@
/* global Benchmark */
odoo.define('web.form_benchmarks', function (require) {
"use strict";
const FormView = require('web.FormView');
const testUtils = require('web.test_utils');
const { createView } = testUtils;
QUnit.module('Form View', {
beforeEach: function () {
this.data = {
foo: {
fields: {
foo: {string: "Foo", type: "char"},
many2many: { string: "bar", type: "many2many", relation: 'bar'},
},
records: [
{ id: 1, foo: "bar", many2many: []},
],
onchanges: {}
},
bar: {
fields: {
char: {string: "char", type: "char"},
many2many: { string: "pokemon", type: "many2many", relation: 'pokemon'},
},
records: [],
onchanges: {}
},
pokemon: {
fields: {
name: {string: "Name", type: "char"},
},
records: [],
onchanges: {}
},
};
this.arch = null;
this.run = function (assert, viewParams, cb) {
const data = this.data;
const arch = this.arch;
return new Promise(resolve => {
new Benchmark.Suite({})
.add('form', {
defer: true,
fn: async (deferred) => {
const form = await createView(Object.assign({
View: FormView,
model: 'foo',
data,
arch,
}, viewParams));
if (cb) {
await cb(form);
}
form.destroy();
deferred.resolve();
},
})
.on('cycle', event => {
assert.ok(true, String(event.target));
})
.on('complete', resolve)
.run({ async: true });
});
};
}
}, function () {
QUnit.test('x2many with 250 rows, 2 fields (with many2many_tags, and modifiers), onchanges, and edition', function (assert) {
assert.expect(1);
this.data.foo.onchanges.many2many = function (obj) {
obj.many2many = [5].concat(obj.many2many);
};
for (let i = 2; i < 500; i++) {
this.data.bar.records.push({
id: i,
char: "automated data",
});
this.data.foo.records[0].many2many.push(i);
}
this.arch = `
<form>
<field name="many2many">
<tree editable="top" limit="250">
<field name="char"/>
<field name="many2many" widget="many2many_tags" attrs="{'readonly': [('char', '==', 'toto')]}"/>
</tree>
</field>
</form>`;
return this.run(assert, { res_id: 1 }, async form => {
await testUtils.form.clickEdit(form);
await testUtils.dom.click(form.$('.o_data_cell:first'));
await testUtils.fields.editInput(form.$('input:first'), "tralala");
});
});
QUnit.test('form view with 100 fields, half of them being invisible', function (assert) {
assert.expect(1);
this.arch = `
<form>
${[...Array(100)].map((_, i) => '<field name="foo"' + (i % 2 ? ' invisible="1"' : '') + '/>').join('')}
</form>`;
return this.run(assert);
});
});
});
@@ -1,93 +0,0 @@
/* global Benchmark */
odoo.define('web.kanban_benchmarks', function (require) {
"use strict";
const KanbanView = require('web.KanbanView');
const { createView } = require('web.test_utils');
QUnit.module('Kanban View', {
beforeEach: function () {
this.data = {
foo: {
fields: {
foo: {string: "Foo", type: "char"},
bar: {string: "Bar", type: "boolean"},
int_field: {string: "int_field", type: "integer", sortable: true},
qux: {string: "my float", type: "float"},
},
records: [
{ id: 1, bar: true, foo: "yop", int_field: 10, qux: 0.4},
{id: 2, bar: true, foo: "blip", int_field: 9, qux: 13},
]
},
};
this.arch = null;
this.run = function (assert) {
const data = this.data;
const arch = this.arch;
return new Promise(resolve => {
new Benchmark.Suite({})
.add('kanban', {
defer: true,
fn: async (deferred) => {
const kanban = await createView({
View: KanbanView,
model: 'foo',
data,
arch,
});
kanban.destroy();
deferred.resolve();
},
})
.on('cycle', event => {
assert.ok(true, String(event.target));
})
.on('complete', resolve)
.run({ async: true });
});
};
}
}, function () {
QUnit.test('simple kanban view with 2 records', function (assert) {
assert.expect(1);
this.arch = `
<kanban>
<templates>
<t t-name="kanban-box">
<div>
<t t-esc="record.foo.value"/>
<field name="foo"/>
</div>
</t>
</templates>
</kanban>`;
return this.run(assert);
});
QUnit.test('simple kanban view with 200 records', function (assert) {
assert.expect(1);
for (let i = 2; i < 200; i++) {
this.data.foo.records.push({
id: i,
foo: `automated data ${i}`,
});
}
this.arch = `
<kanban>
<templates>
<t t-name="kanban-box">
<div>
<t t-esc="record.foo.value"/>
<field name="foo"/>
</div>
</t>
</templates>
</kanban>`;
return this.run(assert);
});
});
});
@@ -1,114 +0,0 @@
/* global Benchmark */
odoo.define('web.list_benchmarks', function (require) {
"use strict";
const ListView = require('web.ListView');
const { createView } = require('web.test_utils');
QUnit.module('List View', {
beforeEach: function () {
this.data = {
foo: {
fields: {
foo: {string: "Foo", type: "char"},
bar: {string: "Bar", type: "boolean"},
int_field: {string: "int_field", type: "integer", sortable: true},
qux: {string: "my float", type: "float"},
},
records: [
{id: 1, bar: true, foo: "yop", int_field: 10, qux: 0.4},
{id: 2, bar: true, foo: "blip", int_field: 9, qux: 13},
]
},
};
this.arch = null;
this.run = function (assert, cb) {
const data = this.data;
const arch = this.arch;
return new Promise(resolve => {
new Benchmark.Suite({})
.add('list', {
defer: true,
fn: async (deferred) => {
const list = await createView({
View: ListView,
model: 'foo',
data,
arch,
});
if (cb) {
cb(list);
}
list.destroy();
deferred.resolve();
},
})
.on('cycle', event => {
assert.ok(true, String(event.target));
})
.on('complete', resolve)
.run({ async: true });
});
};
}
}, function () {
QUnit.test('simple readonly list with 2 rows and 2 fields', function (assert) {
assert.expect(1);
this.arch = '<tree><field name="foo"/><field name="int_field"/></tree>';
return this.run(assert);
});
QUnit.test('simple readonly list with 200 rows and 2 fields', function (assert) {
assert.expect(1);
for (let i = 2; i < 200; i++) {
this.data.foo.records.push({
id: i,
foo: "automated data",
int_field: 10 * i,
});
}
this.arch = '<tree><field name="foo"/><field name="int_field"/></tree>';
return this.run(assert);
});
QUnit.test('simple readonly list with 200 rows and 2 fields (with widgets)', function (assert) {
assert.expect(1);
for (let i = 2; i < 200; i++) {
this.data.foo.records.push({
id: i,
foo: "automated data",
int_field: 10 * i,
});
}
this.arch = '<tree><field name="foo" widget="char"/><field name="int_field" widget="integer"/></tree>';
return this.run(assert);
});
QUnit.test('editable list with 200 rows 4 fields', function (assert) {
assert.expect(1);
for (let i = 2; i < 200; i++) {
this.data.foo.records.push({
id: i,
foo: "automated data",
int_field: 10 * i,
bar: i % 2 === 0,
});
}
this.arch = `
<tree editable="bottom">
<field name="foo" attrs="{'readonly': [['bar', '=', True]]}"/>
<field name="int_field"/>
<field name="bar"/>
<field name="qux"/>
</tree>`;
return this.run(assert, list => {
list.$('.o_list_button_add').click();
list.$('.o_list_button_discard').click();
});
});
});
});
-44
View File
@@ -247,50 +247,6 @@
</t>
</template>
<template id="web.benchmark_suite">
<t t-call="web.layout">
<t t-set="html_data" t-value="{'style': 'height: 100%;'}"/>
<t t-set="title">Web Benchmarks</t>
<t t-set="head">
<script type="text/javascript" src="/web/static/lib/benchmarkjs/lodash.js"></script>
<script type="text/javascript" src="/web/static/lib/benchmarkjs/benchmark.js"></script>
<t t-call-assets="web.assets_common" t-js="false"/>
<t t-call-assets="web.assets_backend" t-js="false"/>
<t t-call-assets="web.assets_common" t-css="false"/>
<t t-call-assets="web.assets_backend" t-css="false"/>
<t t-call="web.test_helpers"/>
<script type="text/javascript">
QUnit.config.hidepassed = false;
</script>
<style>
body:not(.debug) .modal-backdrop, body:not(.debug) .modal, body:not(.debug) .ui-autocomplete {
opacity: 0 !important;
}
#qunit-testrunner-toolbar label {
font-weight: inherit;
margin-bottom: inherit;
}
#qunit-testrunner-toolbar input[type=text] {
width: inherit;
display: inherit;
}
</style>
<script type="text/javascript" src="/web/static/tests/views/list_benchmarks.js"></script>
<script type="text/javascript" src="/web/static/tests/views/kanban_benchmarks.js"></script>
<script type="text/javascript" src="/web/static/tests/views/form_benchmarks.js"></script>
</t>
<div id="qunit"/>
<div id="qunit-fixture"/>
</t>
</template>
<template id="web.webclient_bootstrap">
<t t-call="web.layout">
<t t-set="head_web">
-12
View File
@@ -221,18 +221,6 @@ Files: addons/web/static/lib/ace/ace.js
Copyright: 2010, Ajax.org B.V
License: BSD-3
Files: addons/web/static/lib/benchmarkjs/*
Copyright: 2010-2016 Mathias Bynens
License: MIT
Files: addons/web/static/lib/benchmarkjs/benchmark.js
Copyright: 2010-2016 Mathias Bynens; Robert Kieffer
License: MIT
Files: addons/web/static/lib/benchmarkjs/lodash.js
Copyright: JS Foundation and other contributors; Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
License: MIT
Files: addons/web/static/lib/bootstrap/* doc/_extensions/odoo_ext/static/style.css doc/_extensions/odoo_ext/static/bootstrap.js
Copyright: 2011-2019 The Bootstrap Authors; 2011-2019 Twitter, Inc
License: MIT