Skip to content

Commit

Permalink
Fixes #87
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Apr 4, 2020
1 parent ac00ff3 commit 60b6d62
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions src/components/buttons/HacsButtonMainAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@ export class HacsButtonMainAction extends HacsRepositoryButton {

protected firstUpdated() {
let path: string = this.repository.local_path;
if (this.repository.category === "theme") {
path = `${path}/${this.repository.file_name}`;
}
this.hass.connection
.sendMessagePromise({
type: "hacs/check_path",
path: path
path: path,
})
.then(
resp => {
(resp) => {
this.pathExists = resp["exist"];
},
err => {
(err) => {
this.logger.error("(hacs/check_path) Message failed!");
this.logger.error(err);
}
Expand All @@ -50,12 +47,8 @@ export class HacsButtonMainAction extends HacsRepositoryButton {
return html`
<mwc-button @click=${this.RepositoryInstall}>
${this.repository.state == "installing"
? html`
<paper-spinner active></paper-spinner>
`
: html`
${label}
`}
? html` <paper-spinner active></paper-spinner> `
: html` ${label} `}
</mwc-button>
`;
}
Expand All @@ -73,10 +66,7 @@ export class HacsButtonMainAction extends HacsRepositoryButton {
);
if (this.pathExists && !this.repository.installed) {
let path: string = this.repository.local_path;
if (
this.repository.category === "theme" ||
this.repository.category === "python_script"
) {
if (this.repository.category === "python_script") {
path = `${path}/${this.repository.file_name}`;
}
swal(
Expand All @@ -86,9 +76,9 @@ export class HacsButtonMainAction extends HacsRepositoryButton {
"\n" +
localize("confirm.continue"),
{
buttons: [localize("confirm.no"), localize("confirm.yes")]
buttons: [localize("confirm.no"), localize("confirm.yes")],
}
).then(value => {
).then((value) => {
if (value !== null) {
this.ExecuteAction();
} else {
Expand All @@ -106,12 +96,7 @@ export class HacsButtonMainAction extends HacsRepositoryButton {
.replace("{haversion}", this.hass.config.version)
.replace("{minversion}", this.repository.homeassistant)
);
RepositoryWebSocketAction(
this.hass,
this.repository.id,
"set_state",
""
);
RepositoryWebSocketAction(this.hass, this.repository.id, "set_state", "");
} else this.ExecuteAction();
}
ExecuteAction() {
Expand Down

0 comments on commit 60b6d62

Please sign in to comment.