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

[IMP] cetmix_tower_server: implement UI updates #185

Open
wants to merge 12 commits into
base: 14.0-dev
Choose a base branch
from
1 change: 1 addition & 0 deletions cetmix_tower_server/models/cx_tower_file_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def _compute_file_count(self):
for template in self:
template.file_count = len(template.file_ids)

active = fields.Boolean(default=True)
file_name = fields.Char(
help="Default full file name with file type for example: test.txt",
)
Expand Down
4 changes: 3 additions & 1 deletion cetmix_tower_server/models/cx_tower_plan_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class CxTowerPlanLine(models.Model):
help="Actions trigger based on command result."
" If empty next command will be executed",
)
command_code = fields.Text(related="command_id.code", readonly=True)
command_code = fields.Text(
ivs-cetmix marked this conversation as resolved.
Show resolved Hide resolved
comodel_name="cx.tower.command", string="Code", readonly=True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason behind removing the "related" key?

)
action = fields.Selection(related="command_id.action", readonly=True)
tag_ids = fields.Many2many(related="command_id.tag_ids", readonly=True)
access_level = fields.Selection(
Expand Down
8 changes: 7 additions & 1 deletion cetmix_tower_server/views/cx_tower_command_log_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
<field name="duration_current" />
</group>
</group>
<group>
<field
name="plan_log_id"
attrs="{'invisible': [('plan_log_id', '=', False)]}"
/>
</group>
<notebook attrs="{'invisible': [('command_action', '=', 'plan')]}">
<page name="result" string="Result">
<field
Expand All @@ -99,7 +105,7 @@
<field name="model">cx.tower.command.log</field>
<field name="arch" type="xml">
<tree
default_order="id"
default_order="start_date desc, id desc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same order is already defined at the model level.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the assignment stated:

  • "Sort Flight Plan Log and Command Log by "Started" newest top."

It turns out that sorting worked as it was and still works without these changes.
Maybe you mean: do it for specific lists (tree views) where default_order may be important?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but you should check everything before doing any modifications. And give your feedback in case those modification are not required, or requested changes may lead to any kind of misbehaviour.

decoration-danger="command_status not in [0, -20]"
decoration-info="is_running == True"
decoration-muted="command_status == -20"
Expand Down
5 changes: 5 additions & 0 deletions cetmix_tower_server/views/cx_tower_command_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@
name="file_from_template"
domain="[('action', '=', 'file_using_template')]"
/>
<filter
string="Run Flight Plan"
name="filter_flight_plan"
domain="[('action', '=', 'plan')]"
/>
<separator />
<filter
string="Tagged"
Expand Down
21 changes: 21 additions & 0 deletions cetmix_tower_server/views/cx_tower_file_template_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
<field name="model">cx.tower.file.template</field>
<field name="arch" type="xml">
<form>
<header>
<button
name="toggle_active"
ivs-cetmix marked this conversation as resolved.
Show resolved Hide resolved
type="object"
class="oe_highlight"
string="Archive"
attrs="{'invisible': [('active', '=', False)]}"
/>
<button
name="toggle_active"
type="object"
string="Unarchive"
attrs="{'invisible': [('active', '=', True)]}"
/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button
Expand All @@ -28,6 +43,7 @@
placeholder="Reference. Can contain English letters, digits and '_'. Leave blank to autogenerate"
/>
</h3>
<field name="active" invisible="1" />
</div>
<group>
<group>
Expand Down Expand Up @@ -113,6 +129,11 @@
string="Text"
domain="[('file_type', '=', 'text')]"
/>
<filter
string="Archived"
name="archived"
domain="[('active', '=', False)]"
/>
<group expand="0" string="Group By">
<filter
name="group_by_file_type"
Expand Down
6 changes: 5 additions & 1 deletion cetmix_tower_server/views/cx_tower_plan_line_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@
<notebook>
<page name="preview" string="Command Preview">
<group>
<field name="command_code" />
<field name="action" />
<field
name="command_code"
attrs="{'invisible': [('action', 'not in', ['ssh_command', 'python_code'])]}"
/>
</group>
</page>
<page name="actions" string="Post Run Actions">
Expand Down
1 change: 1 addition & 0 deletions cetmix_tower_server/views/cx_tower_plan_log_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<field name="model">cx.tower.plan.log</field>
<field name="arch" type="xml">
<tree
default_order="start_date desc, id desc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same sorting order is already defined at the model level.

decoration-danger="plan_status != 0"
decoration-info="is_running == True"
>
Expand Down
6 changes: 5 additions & 1 deletion cetmix_tower_server/views/cx_tower_server_template_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<field name="tag_ids" />
<field name="os_id" />
<field name="color" />
<field name="server_count" />
<templates>
<t t-name="kanban-box">
<div
Expand Down Expand Up @@ -56,7 +57,10 @@
<div class="oe_kanban_global_click">
<div class="col-12 pt8 o_kanban_primary_right">
<div>
<field name="reference" />
<strong>Servers:</strong>
<span class="badge badge-primary">
tendil marked this conversation as resolved.
Show resolved Hide resolved
<t t-esc="record.server_count.value" />
</span>
</div>
<div attrs="{'invisible': [('os_id', '=', False)]}">
<strong>Operating System:</strong>
Expand Down
Loading