DEV: Prettier
This commit is contained in:
parent
59c20d9ddb
commit
0659613fb4
|
|
@ -1,5 +1,3 @@
|
|||
/* eslint-disable */
|
||||
|
||||
import Component from "@ember/component";
|
||||
import { observer } from "@ember/object";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
|
|
@ -22,5 +20,3 @@ export default Component.extend({
|
|||
this._scrollBottom();
|
||||
},
|
||||
});
|
||||
|
||||
/* eslint-enable */
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@ export default Controller.extend({
|
|||
upgradeAllButtonDisabled: computed(
|
||||
"managerRepo.upToDate",
|
||||
"allUpToDate",
|
||||
function() {
|
||||
function () {
|
||||
return !this.get("managerRepo.upToDate") || this.get("allUpToDate");
|
||||
}
|
||||
),
|
||||
|
||||
allUpToDate: computed("model.@each.upToDate", function() {
|
||||
return this.get("model").every(repo => repo.get("upToDate"));
|
||||
allUpToDate: computed("model.@each.upToDate", function () {
|
||||
return this.get("model").every((repo) => repo.get("upToDate"));
|
||||
}),
|
||||
|
||||
actions: {
|
||||
upgradeAllButton() {
|
||||
this.replaceRoute("upgrade", "all");
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ export default Controller.extend({
|
|||
if (this.get("autoRefresh")) {
|
||||
this.get("model").refresh();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
/* eslint-disable */
|
||||
|
||||
/* global MessageBus, bootbox */
|
||||
import Repo from "discourse/plugins/docker_manager/discourse/models/repo";
|
||||
import Controller from "@ember/controller";
|
||||
|
|
@ -137,5 +135,3 @@ export default Controller.extend({
|
|||
},
|
||||
},
|
||||
});
|
||||
|
||||
/* eslint-enable */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { computed } from "@ember/object";
|
|||
import getURL from "discourse-common/lib/get-url";
|
||||
|
||||
export default Controller.extend({
|
||||
showBanner: computed("banner", "bannerDismissed", "banner.[]", function() {
|
||||
showBanner: computed("banner", "bannerDismissed", "banner.[]", function () {
|
||||
if (this.get("bannerDismissed")) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -20,13 +20,13 @@ export default Controller.extend({
|
|||
this.set("banner", banner);
|
||||
},
|
||||
|
||||
backupsUrl: computed(function() {
|
||||
backupsUrl: computed(function () {
|
||||
return getURL("/admin/backups");
|
||||
}),
|
||||
|
||||
actions: {
|
||||
dismiss() {
|
||||
this.set("bannerDismissed", true);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ import { helper as buildHelper } from "@ember/component/helper";
|
|||
import { isNone } from "@ember/utils";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
|
||||
export default buildHelper(function(params) {
|
||||
export default buildHelper(function (params) {
|
||||
const [commitsBehind, oldSha, newSha, url] = params;
|
||||
|
||||
if (parseInt(commitsBehind) === 0) {
|
||||
if (parseInt(commitsBehind, 10) === 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,12 +6,11 @@ const ProcessList = EmberObject.extend({
|
|||
|
||||
refresh() {
|
||||
return ajax("/admin/docker/ps", {
|
||||
dataType: "text",
|
||||
})
|
||||
.then((result) => {
|
||||
this.set("output", result);
|
||||
return this;
|
||||
});
|
||||
dataType: "text",
|
||||
}).then((result) => {
|
||||
this.set("output", result);
|
||||
return this;
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -65,17 +65,15 @@ const Repo = EmberObject.extend({
|
|||
}
|
||||
|
||||
this.set("checking", true);
|
||||
this.repoAjax("/admin/docker/latest").then(
|
||||
(result) => {
|
||||
this.setProperties({
|
||||
unloaded: false,
|
||||
checking: false,
|
||||
lastCheckedAt: new Date().getTime(),
|
||||
latest: EmberObject.create(result.latest),
|
||||
});
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
this.repoAjax("/admin/docker/latest").then((result) => {
|
||||
this.setProperties({
|
||||
unloaded: false,
|
||||
checking: false,
|
||||
lastCheckedAt: new Date().getTime(),
|
||||
latest: EmberObject.create(result.latest),
|
||||
});
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default Route.extend({
|
|||
const applicationController = this.controllerFor("application");
|
||||
controller.setProperties({ model, upgrading: null });
|
||||
|
||||
model.forEach(repo => {
|
||||
model.forEach((repo) => {
|
||||
if (repo.get("upgrading")) {
|
||||
controller.set("upgrading", repo);
|
||||
}
|
||||
|
|
@ -43,5 +43,5 @@ export default Route.extend({
|
|||
});
|
||||
|
||||
this.loadRepos(model.slice(0));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ import { find } from "discourse/plugins/docker_manager/discourse/models/process-
|
|||
import Route from "@ember/routing/route";
|
||||
|
||||
export default Route.extend({
|
||||
model: find
|
||||
model: find,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1 +1,5 @@
|
|||
<div class="progress-bar progress-bar-striped {{if active 'progress-bar-animated'}}" style={{barStyle}}></div>
|
||||
<div
|
||||
class="progress-bar progress-bar-striped
|
||||
{{if active 'progress-bar-animated'}}"
|
||||
style={{barStyle}}
|
||||
></div>
|
||||
|
|
|
|||
|
|
@ -1,35 +1,67 @@
|
|||
<td>
|
||||
{{#if officialRepoImageSrc}}
|
||||
<img class="check-circle" src={{officialRepoImageSrc}} alt={{officialRepoImageTitle}} title={{officialRepoImageTitle}}>
|
||||
<img
|
||||
class="check-circle"
|
||||
src={{officialRepoImageSrc}}
|
||||
alt={{officialRepoImageTitle}}
|
||||
title={{officialRepoImageTitle}}
|
||||
/>
|
||||
{{/if}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a href="{{repo.url}}">{{repo.name}}</a>
|
||||
<span class="current commit-hash" title={{repo.version}}>{{repo.prettyVersion}}</span>
|
||||
<span class="current commit-hash" title={{repo.version}}>
|
||||
{{repo.prettyVersion}}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{{#if repo.checkingStatus}}
|
||||
Checking for new version...
|
||||
{{else if repo.upToDate}}
|
||||
Up to date
|
||||
{{else}}
|
||||
<div class='new-version'>
|
||||
<div class="new-version">
|
||||
<h4>New Version Available!</h4>
|
||||
|
||||
<ul>
|
||||
<li>Remote Version: <span class="new commit-hash" title={{repo.latestVersion}}>{{repo.prettyLatestVersion}}</span></li>
|
||||
<li>Last Updated:
|
||||
<li>
|
||||
Remote Version:
|
||||
<span class="new commit-hash" title={{repo.latestVersion}}>
|
||||
{{repo.prettyLatestVersion}}
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
Last Updated:
|
||||
{{#if repo.latest.date}}
|
||||
{{moment-from-now repo.latest.date interval=1000}}
|
||||
{{else}}
|
||||
—
|
||||
{{/if}}
|
||||
</li>
|
||||
<li class='new-commits'>{{new-commits repo.latest.commits_behind repo.version repo.latest.version repo.url}}</li>
|
||||
<li class="new-commits">
|
||||
{{new-commits
|
||||
repo.latest.commits_behind
|
||||
repo.version
|
||||
repo.latest.version
|
||||
repo.url
|
||||
}}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{#if repo.upgrading}}
|
||||
<button class="btn" {{action "upgrade"}}>Currently Upgrading...</button>
|
||||
<button class="btn" {{action "upgrade"}}>
|
||||
Currently Upgrading...
|
||||
</button>
|
||||
{{else}}
|
||||
<button class="upgrade-button btn" {{action "upgrade"}} disabled={{upgradeDisabled}}>Upgrade</button>
|
||||
<button
|
||||
class="upgrade-button btn"
|
||||
{{action "upgrade"}}
|
||||
disabled={{upgradeDisabled}}
|
||||
>
|
||||
Upgrade
|
||||
</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
{{#if currentUser.admin}}
|
||||
<th colspan="5">
|
||||
{{#if versionCheck.upToDate}}
|
||||
<a href="{{href}}" data-auto-route="true">{{i18n "docker.link_to_upgrade"}}</a>
|
||||
<a href="{{href}}" data-auto-route="true">
|
||||
{{i18n "docker.link_to_upgrade"}}
|
||||
</a>
|
||||
{{else}}
|
||||
{{i18n "docker.upgrade"}} <a href="{{href}}" data-auto-route="true">{{i18n "docker.perform_upgrade"}}</a>
|
||||
{{i18n "docker.upgrade"}}
|
||||
<a href="{{href}}" data-auto-route="true">
|
||||
{{i18n "docker.perform_upgrade"}}
|
||||
</a>
|
||||
{{/if}}
|
||||
</th>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
<button disabled={{upgradeAllButtonDisabled}} id="upgrade-all" class="btn" {{action "upgradeAllButton"}}>
|
||||
<button
|
||||
disabled={{upgradeAllButtonDisabled}}
|
||||
id="upgrade-all"
|
||||
class="btn"
|
||||
{{action "upgradeAllButton"}}
|
||||
>
|
||||
{{#if allUpToDate}}
|
||||
All Up-to-date
|
||||
{{else}}
|
||||
|
|
@ -6,10 +11,10 @@
|
|||
{{/if}}
|
||||
</button>
|
||||
|
||||
<table class='table' id='repos'>
|
||||
<table class="table" id="repos">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th style='width: 50%'>Repository</th>
|
||||
<th style="width: 50%">Repository</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
<tbody>
|
||||
|
|
|
|||
|
|
@ -17,10 +17,15 @@
|
|||
<p>Everything is up-to-date.</p>
|
||||
{{/unless}}
|
||||
{{else}}
|
||||
<div style='clear: both'>
|
||||
<button {{action "start"}} disabled={{upgrading}} class='btn'>{{upgradeButtonText}}</button>
|
||||
<div style="clear: both">
|
||||
<button {{action "start"}} disabled={{upgrading}} class="btn">
|
||||
{{upgradeButtonText}}
|
||||
</button>
|
||||
|
||||
{{#if upgrading}}
|
||||
<button {{action "resetUpgrade"}} class="btn unlock">Reset Upgrade</button>
|
||||
<button {{action "resetUpgrade"}} class="btn unlock">
|
||||
Reset Upgrade
|
||||
</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
<div class="container">
|
||||
<header class="container">
|
||||
{{#link-to 'upgrade.index'}}<img src={{logoUrl}} class="logo">{{/link-to}}
|
||||
<h1>{{#link-to 'upgrade.index'}}Upgrade{{/link-to}}</h1>
|
||||
{{#link-to "upgrade.index"}}
|
||||
<img src={{logoUrl}} class="logo" />
|
||||
{{/link-to}}
|
||||
|
||||
<h1>
|
||||
{{#link-to "upgrade.index"}}Upgrade{{/link-to}}
|
||||
</h1>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
|
|
@ -9,7 +14,10 @@
|
|||
{{#if showBanner}}
|
||||
<div id="banner">
|
||||
<div id="banner-content">
|
||||
<div class="close" {{action "dismiss"}}><i class="fa fa-times" title="Dismiss this banner."></i></div>
|
||||
<div class="close" {{action "dismiss"}}>
|
||||
<i class="fa fa-times" title="Dismiss this banner."></i>
|
||||
</div>
|
||||
|
||||
{{#each banner as |row|}}
|
||||
<p>{{{row}}}</p>
|
||||
{{/each}}
|
||||
|
|
@ -21,11 +29,16 @@
|
|||
{{#link-to "upgrade.index" tagName="li" class="nav-item"}}
|
||||
{{#link-to "upgrade.index" class="nav-link"}}Versions{{/link-to}}
|
||||
{{/link-to}}
|
||||
|
||||
{{#link-to "upgrade.processes" tagName="li" class="nav-item"}}
|
||||
{{#link-to "upgrade.processes" class="nav-link"}}Processes{{/link-to}}
|
||||
{{/link-to}}
|
||||
|
||||
<li class="nav-item"><a class="nav-link" href={{backupsUrl}}>Backups</a></li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href={{backupsUrl}}>
|
||||
Backups
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{outlet}}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ const repoObject = Repo.create({
|
|||
date: "2018-12-26T20:52:07.000+03:00",
|
||||
path: "/c/discourse",
|
||||
pretty_version: "v2.2.0.beta6 +101",
|
||||
version: "2b006c0"
|
||||
}
|
||||
version: "2b006c0",
|
||||
},
|
||||
});
|
||||
|
||||
const managerRepo = Repo.create({
|
||||
|
|
@ -38,14 +38,14 @@ const managerRepo = Repo.create({
|
|||
date: "2018-12-26T20:52:07.000+03:00",
|
||||
path: "/c/discourse/plugins/docker_manager",
|
||||
pretty_version: null,
|
||||
version: "0b1fb4b"
|
||||
}
|
||||
version: "0b1fb4b",
|
||||
},
|
||||
});
|
||||
|
||||
module("Integration | Component | repo-status", function(hooks) {
|
||||
module("Integration | Component | repo-status", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
test("it renders correctly", async function(assert) {
|
||||
test("it renders correctly", async function (assert) {
|
||||
this.set("repo", repoObject);
|
||||
this.set("managerRepo", managerRepo);
|
||||
await render(hbs`{{repo-status repo=repo managerRepo=managerRepo}}`);
|
||||
|
|
|
|||
Loading…
Reference in New Issue