| 1 |
/** @odoo-module */ |
| 2 |
|
| 3 |
import { Component, xml } from "@odoo/owl"; |
| 4 |
import { Job } from "../core/job"; |
| 5 |
import { Test } from "../core/test"; |
| 6 |
import { HootLink } from "./hoot_link"; |
| 7 |
|
| 8 |
/** |
| 9 |
* @typedef {{ |
| 10 |
* hidden?: boolean; |
| 11 |
* job: Job; |
| 12 |
* }} HootJobButtonsProps |
| 13 |
*/ |
| 14 |
|
| 15 |
/** @extends {Component<HootJobButtonsProps, import("../hoot").Environment>} */ |
| 16 |
export class HootJobButtons extends Component { |
| 17 |
static components = { HootLink }; |
| 18 |
|
| 19 |
static props = { |
| 20 |
hidden: { type: Boolean, optional: true }, |
| 21 |
job: Job, |
| 22 |
}; |
| 23 |
|
| 24 |
static template = xml` |
| 25 |
<t t-set="type" t-value="getType()" /> |
| 26 |
<div class="${HootJobButtons.name} items-center gap-1" t-att-class="props.hidden ? 'hidden' : 'flex'"> |
| 27 |
<HootLink |
| 28 |
ids="{ id: props.job.id }" |
| 29 |
class="'hoot-btn-link border border-primary text-emerald rounded transition-colors'" |
| 30 |
title="'Run this ' + type + ' only'" |
| 31 |
> |
| 32 |
<i class="fa fa-play w-5 h-5" /> |
| 33 |
</HootLink> |
| 34 |
<t t-if="type === 'test'"> |
| 35 |
<HootLink |
| 36 |
ids="{ id: props.job.id }" |
| 37 |
options="{ debug: true }" |
| 38 |
class="'hoot-btn-link border border-primary text-emerald rounded transition-colors'" |
| 39 |
title="'Run this ' + type + ' only in debug mode'" |
| 40 |
> |
| 41 |
<i class="fa fa-bug w-5 h-5" /> |
| 42 |
</HootLink> |
| 43 |
</t> |
| 44 |
<HootLink |
| 45 |
ids="{ id: props.job.id }" |
| 46 |
options="{ ignore: true }" |
| 47 |
class="'hoot-btn-link border border-primary text-rose rounded transition-colors'" |
| 48 |
title="'Ignore ' + type" |
| 49 |
> |
| 50 |
<i class="fa fa-ban w-5 h-5" /> |
| 51 |
</HootLink> |
| 52 |
</div> |
| 53 |
`; |
| 54 |
|
| 55 |
getType() { |
| 56 |
return this.props.job instanceof Test ? "test" : "suite"; |
| 57 |
} |
| 58 |
} |