Skip to content

Commit

Permalink
remove useless properties
Browse files Browse the repository at this point in the history
remove useless field property in FieldListItem and JoinListItem and
access it from the props directly instead.
  • Loading branch information
huguesdk committed Oct 13, 2023
1 parent 8f439a0 commit f981bef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
import {Component, onMounted, useRef, useState} from "@odoo/owl";

class FieldListItem extends Component {
// This is only to simplify the template (using field instead of
// props.field).
get field() {
return this.props.field;
}
delete() {
this.props.delete(this.props.field);
}
Expand All @@ -26,13 +21,7 @@ FieldListItem.props = {
readonly: Boolean,
};

class JoinListItem extends Component {
// This is only to simplify the template (using field instead of
// props.field).
get field() {
return this.props.field;
}
}
class JoinListItem extends Component {}
JoinListItem.template = "bi_view_editor.JoinListItem";
JoinListItem.props = {
field: Object,
Expand Down
32 changes: 16 additions & 16 deletions bi_view_editor/static/src/components/bi_view_editor/field_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,29 +127,29 @@
<tr class="field-node" t-att-class="{readonly: props.readonly}">
<td>
<input
t-attf-title="#{field.model_name} (#{field.model})"
t-attf-title="#{props.field.model_name} (#{props.field.model})"
class="form-control input-sm"
type="text"
name="description"
t-att-value="field.description"
t-att-value="props.field.description"
t-att-disabled="props.readonly"
t-on-input="descriptionChanged"
/>
</td>
<td>
<t t-out="field.model_name" />
<t t-out="props.field.model_name" />
</td>
<td>
<!-- a space is needed to separate the icons -->
<span t-if="field.column" class="fa fa-columns" title="Column" /> <span
t-if="field.row"
class="fa fa-bars"
title="Row"
/> <span
t-if="field.measure"
<span
t-if="props.field.column"
class="fa fa-columns"
title="Column"
/> <span t-if="props.field.row" class="fa fa-bars" title="Row" /> <span
t-if="props.field.measure"
class="fa fa-bar-chart-o"
title="Measure"
/> <span t-if="field.list" class="fa fa-list" title="List" />
/> <span t-if="props.field.list" class="fa fa-list" title="List" />
</td>
<td>
<button
Expand All @@ -164,23 +164,23 @@
<t t-name="bi_view_editor.JoinListItem" owl="1">
<tr class="join-node">
<td colspan="4">
<t t-if="field.join_node > field.table_alias">
<t t-if="props.field.join_node > props.field.table_alias">
<b>
<t t-out="field.model_name" />
<t t-out="props.field.model_name" />
<!-- spaces around the icon are needed -->
</b> <i class="fa fa-caret-right" /> <small>
<t t-out="field.description" />
<t t-out="props.field.description" />
</small>
</t>
<t t-else="">
<small>
<t t-out="field.description" />
<t t-out="props.field.description" />
<!-- spaces around the icon are needed -->
</small> <i class="fa fa-caret-left" /> <b>
<t t-out="field.model_name" />
<t t-out="props.field.model_name" />
</b>
</t>
<span t-if="field.join_left">
<span t-if="props.field.join_left">
<i>(join left)</i>
</span>
</td>
Expand Down

0 comments on commit f981bef

Please sign in to comment.