A platform for community discussion. Free, open, simple.
DEV: Convert VersionChecks to glimmer (#37390)
Jarek Radosz7613bc63167e
diff --git a/frontend/discourse/admin/components/version-checks.gjs b/frontend/discourse/admin/components/version-checks.gjsindex e8dbf56cdf1..bbe0db84f1e 100644--- a/frontend/discourse/admin/components/version-checks.gjs+++ b/frontend/discourse/admin/components/version-checks.gjs@@ -1,5 +1,3 @@-/* eslint-disable ember/no-classic-components */-import Component from "@ember/component";import CustomHtml from "discourse/components/custom-html";import PluginOutlet from "discourse/components/plugin-outlet";import icon from "discourse/helpers/d-icon";@@ -7,152 +5,152 @@ import dashIfEmpty from "discourse/helpers/dash-if-empty";import lazyHash from "discourse/helpers/lazy-hash";import { i18n } from "discourse-i18n";-export default class VersionChecks extends Component {- <template>- <div class="section-title">- <h2>- {{i18n "admin.dashboard.version"}}- </h2>- </div>+const VersionChecks = <template>+ <div class="section-title">+ <h2>+ {{i18n "admin.dashboard.version"}}+ </h2>+ </div>- <div- class="dashboard-stats version-check- {{if this.versionCheck.critical_updates 'critical' 'normal'}}"- >+ <div+ class="dashboard-stats version-check+ {{if @versionCheck.critical_updates 'critical' 'normal'}}"+ >+ <div class="version-number">+ <h4>+ {{i18n "admin.dashboard.installed_version"}}+ </h4>+ <h3>+ {{dashIfEmpty @versionCheck.installed_version}}+ </h3>+ {{#if @versionCheck.gitLink}}+ <div class="sha-link">+ (+ <a+ href={{@versionCheck.gitLink}}+ rel="noopener noreferrer"+ target="_blank"+ >+ {{@versionCheck.shortSha}}+ </a>+ )+ </div>+ {{/if}}+ </div>+ {{#if @versionCheck.noCheckPerformed}}<div class="version-number"><h4>- {{i18n "admin.dashboard.installed_version"}}+ {{i18n "admin.dashboard.latest_version"}}</h4><h3>- {{dashIfEmpty this.versionCheck.installed_version}}+ —</h3>- {{#if this.versionCheck.gitLink}}- <div class="sha-link">- (- <a- href={{this.versionCheck.gitLink}}- rel="noopener noreferrer"- target="_blank"- >- {{this.versionCheck.shortSha}}- </a>- )- </div>- {{/if}}</div>- {{#if this.versionCheck.noCheckPerformed}}- <div class="version-number">- <h4>- {{i18n "admin.dashboard.latest_version"}}- </h4>- <h3>- —- </h3>+ <div class="version-status">+ <div class="face">+ <span class="icon critical-updates-available">+ {{icon "far-face-frown"}}+ </span>+ </div>+ <div class="version-notes">+ <span class="normal-note">+ {{i18n "admin.dashboard.no_check_performed"}}+ </span></div>- <div class="version-status">- <div class="face">+ </div>+ {{else if @versionCheck.stale_data}}+ <div class="version-number">+ <h4>+ {{i18n "admin.dashboard.latest_version"}}+ </h4>+ <h3>+ {{#if @versionCheck.version_check_pending}}+ {{dashIfEmpty @versionCheck.installed_version}}+ {{/if}}+ </h3>+ </div>+ <div class="version-status">+ <div class="face">+ {{#if @versionCheck.version_check_pending}}+ <span class="icon up-to-date">+ {{icon "far-face-smile"}}+ </span>+ {{else}}<span class="icon critical-updates-available">{{icon "far-face-frown"}}</span>- </div>- <div class="version-notes">- <span class="normal-note">- {{i18n "admin.dashboard.no_check_performed"}}- </span>- </div>+ {{/if}}</div>- {{else if this.versionCheck.stale_data}}- <div class="version-number">- <h4>- {{i18n "admin.dashboard.latest_version"}}- </h4>- <h3>- {{#if this.versionCheck.version_check_pending}}- {{dashIfEmpty this.versionCheck.installed_version}}- {{/if}}- </h3>- </div>- <div class="version-status">- <div class="face">- {{#if this.versionCheck.version_check_pending}}- <span class="icon up-to-date">- {{icon "far-face-smile"}}- </span>+ <div class="version-notes">+ <span class="normal-note">+ {{#if @versionCheck.version_check_pending}}+ {{i18n "admin.dashboard.version_check_pending"}}{{else}}- <span class="icon critical-updates-available">- {{icon "far-face-frown"}}- </span>+ {{i18n "admin.dashboard.stale_data"}}{{/if}}- </div>- <div class="version-notes">- <span class="normal-note">- {{#if this.versionCheck.version_check_pending}}- {{i18n "admin.dashboard.version_check_pending"}}+ </span>+ </div>+ </div>+ {{else}}+ <div class="version-number">+ <h4>+ {{i18n "admin.dashboard.latest_version"}}+ </h4>+ <h3>+ {{dashIfEmpty @versionCheck.latest_version}}+ </h3>+ </div>+ <div class="version-status">+ <div class="face">+ {{#if @versionCheck.upToDate}}+ <span class="icon up-to-date">+ {{icon "far-face-smile"}}+ </span>+ {{else}}+ <span+ class="icon+ {{if+ @versionCheck.critical_updates+ 'critical-updates-available'+ 'updates-available'+ }}"+ >+ {{#if @versionCheck.behindByOneVersion}}+ {{icon "far-face-meh"}}{{else}}- {{i18n "admin.dashboard.stale_data"}}+ {{icon "far-face-frown"}}{{/if}}</span>- </div>+ {{/if}}</div>- {{else}}- <div class="version-number">- <h4>- {{i18n "admin.dashboard.latest_version"}}- </h4>- <h3>- {{dashIfEmpty this.versionCheck.latest_version}}- </h3>- </div>- <div class="version-status">- <div class="face">- {{#if this.versionCheck.upToDate}}- <span class="icon up-to-date">- {{icon "far-face-smile"}}- </span>- {{else}}- <span- class="icon- {{if- this.versionCheck.critical_updates- 'critical-updates-available'- 'updates-available'- }}"- >- {{#if this.versionCheck.behindByOneVersion}}- {{icon "far-face-meh"}}- {{else}}- {{icon "far-face-frown"}}- {{/if}}- </span>- {{/if}}- </div>- <div class="version-notes">- {{#if this.versionCheck.upToDate}}- {{i18n "admin.dashboard.up_to_date"}}- {{else}}- <span class="critical-note">- {{i18n "admin.dashboard.critical_available"}}- </span>- <span class="normal-note">- {{i18n "admin.dashboard.updates_available"}}- </span>- {{i18n "admin.dashboard.please_update"}}- {{/if}}- </div>+ <div class="version-notes">+ {{#if @versionCheck.upToDate}}+ {{i18n "admin.dashboard.up_to_date"}}+ {{else}}+ <span class="critical-note">+ {{i18n "admin.dashboard.critical_available"}}+ </span>+ <span class="normal-note">+ {{i18n "admin.dashboard.updates_available"}}+ </span>+ {{i18n "admin.dashboard.please_update"}}+ {{/if}}</div>- {{/if}}+ </div>+ {{/if}}- <CustomHtml- @name="update-header"- @versionCheck={{this.versionCheck}}- @tagName="div"- @classNames="update-header"- />+ <CustomHtml+ @name="update-header"+ @versionCheck={{@versionCheck}}+ @tagName="div"+ @classNames="update-header"+ />- <PluginOutlet- @name="admin-upgrade-header"- @outletArgs={{lazyHash versionCheck=this.versionCheck}}- />- </div>- </template>-}+ <PluginOutlet+ @name="admin-upgrade-header"+ @outletArgs={{lazyHash versionCheck=@versionCheck}}+ />+ </div>+</template>;++export default VersionChecks;diff --git a/frontend/discourse/admin/templates/admin/dashboard.gjs b/frontend/discourse/admin/templates/admin/dashboard.gjsindex 80908315e19..499b568080e 100644--- a/frontend/discourse/admin/templates/admin/dashboard.gjs+++ b/frontend/discourse/admin/templates/admin/dashboard.gjs@@ -28,7 +28,7 @@ export default <template>{{#if @controller.showVersionChecks}}<div class="section-top"><div class="version-checks">- <VersionChecks @versionCheck={{@controller.versionCheck}} @tagName="" />+ <VersionChecks @versionCheck={{@controller.versionCheck}} /></div></div>{{/if}}