DEV: Tagless components

This commit is contained in:
Jarek Radosz 2023-01-16 10:02:09 +01:00
parent ba418ede2f
commit 7d7b067b98
8 changed files with 95 additions and 87 deletions

View File

@ -1,5 +1,7 @@
<div <div class="progress progress-striped {{if this.active 'active'}}">
class="progress-bar progress-bar-striped <div
{{if active 'progress-bar-animated'}}" class="progress-bar progress-bar-striped
style={{barStyle}} {{if this.active 'progress-bar-animated'}}"
></div> style={{barStyle}}
></div>
</div>

View File

@ -3,7 +3,7 @@ import { computed } from "@ember/object";
import { htmlSafe } from "@ember/template"; import { htmlSafe } from "@ember/template";
export default Component.extend({ export default Component.extend({
classNameBindings: [":progress", ":progress-striped", "active"], tagName: "",
active: computed("percent", function () { active: computed("percent", function () {
return parseInt(this.get("percent"), 10) !== 100; return parseInt(this.get("percent"), 10) !== 100;

View File

@ -1,69 +1,71 @@
<td> <tr>
{{#if this.officialRepoBadge}} <td>
{{d-icon {{#if this.officialRepoBadge}}
this.officialRepoBadge {{d-icon
class="check-circle" this.officialRepoBadge
alt=this.officialRepoBadgeTitle class="check-circle"
title=this.officialRepoBadgeTitle alt=this.officialRepoBadgeTitle
}} title=this.officialRepoBadgeTitle
{{/if}} }}
</td> {{/if}}
</td>
<td> <td>
<a href="{{repo.url}}">{{repo.name}}</a> <a href="{{repo.url}}">{{repo.name}}</a>
<span class="current commit-hash" title={{repo.version}}> <span class="current commit-hash" title={{repo.version}}>
{{repo.prettyVersion}} {{repo.prettyVersion}}
</span> </span>
</td> </td>
<td> <td>
{{#if repo.checkingStatus}} {{#if repo.checkingStatus}}
Checking for new version... Checking for new version...
{{else if repo.upToDate}} {{else if repo.upToDate}}
Up to date Up to date
{{else}} {{else}}
<div class="new-version"> <div class="new-version">
<h4>New Version Available!</h4> <h4>New Version Available!</h4>
<ul> <ul>
<li> <li>
Remote Version: Remote Version:
<span class="new commit-hash" title={{repo.latestVersion}}> <span class="new commit-hash" title={{repo.latestVersion}}>
{{repo.prettyLatestVersion}} {{repo.prettyLatestVersion}}
</span> </span>
</li> </li>
<li> <li>
Last Updated: Last Updated:
{{#if repo.latest.date}} {{#if repo.latest.date}}
{{format-date repo.latest.date}} {{format-date repo.latest.date}}
{{else}} {{else}}
&mdash; &mdash;
{{/if}} {{/if}}
</li> </li>
<li class="new-commits"> <li class="new-commits">
{{new-commits {{new-commits
repo.latest.commits_behind repo.latest.commits_behind
repo.version repo.version
repo.latest.version repo.latest.version
repo.url repo.url
}} }}
</li> </li>
</ul> </ul>
{{#if repo.upgrading}} {{#if repo.upgrading}}
<button class="btn" {{action "upgrade"}}> <button class="btn" {{action "upgrade"}}>
Currently Upgrading... Currently Upgrading...
</button> </button>
{{else}} {{else}}
<LinkTo <LinkTo
@route="upgrade.show" @route="upgrade.show"
@model={{this.repo}} @model={{this.repo}}
disabled={{this.upgradeDisabled}} disabled={{this.upgradeDisabled}}
class="upgrade-button btn" class="upgrade-button btn"
> >
Upgrade Upgrade
</LinkTo> </LinkTo>
{{/if}} {{/if}}
</div> </div>
{{/if}} {{/if}}
</td> </td>
</tr>

View File

@ -4,7 +4,7 @@ import { inject as service } from "@ember/service";
export default Component.extend({ export default Component.extend({
router: service(), router: service(),
tagName: "tr", tagName: "",
upgradeDisabled: computed( upgradeDisabled: computed(
"upgradingRepo", "upgradingRepo",

View File

@ -1,14 +1,16 @@
{{#if currentUser.admin}} {{#if currentUser.admin}}
<th colspan="5"> <tr>
{{#if versionCheck.upToDate}} <th colspan="5">
<a href="{{href}}" data-auto-route="true"> {{#if versionCheck.upToDate}}
{{i18n "docker.link_to_upgrade"}} <a href="{{href}}" data-auto-route="true">
</a> {{i18n "docker.link_to_upgrade"}}
{{else}} </a>
{{i18n "docker.upgrade"}} {{else}}
<a href="{{href}}" data-auto-route="true"> {{i18n "docker.upgrade"}}
{{i18n "docker.perform_upgrade"}} <a href="{{href}}" data-auto-route="true">
</a> {{i18n "docker.perform_upgrade"}}
{{/if}} </a>
</th> {{/if}}
</th>
</tr>
{{/if}} {{/if}}

View File

@ -2,7 +2,7 @@ import getURL from "discourse-common/lib/get-url";
import Component from "@ember/component"; import Component from "@ember/component";
export default class extends Component { export default class extends Component {
tagName = "tr"; tagName = "";
get href() { get href() {
return getURL("/admin/upgrade"); return getURL("/admin/upgrade");

View File

@ -1 +1,3 @@
{{output}} <div class="logs">
{{output}}
</div>

View File

@ -3,7 +3,7 @@ import { observer } from "@ember/object";
import { scheduleOnce } from "@ember/runloop"; import { scheduleOnce } from "@ember/runloop";
export default Component.extend({ export default Component.extend({
classNameBindings: [":logs"], tagName: "",
_outputChanged: observer("output", function () { _outputChanged: observer("output", function () {
scheduleOnce("afterRender", this, "_scrollBottom"); scheduleOnce("afterRender", this, "_scrollBottom");