Skip to content

Commit

Permalink
Fixes #89
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Apr 4, 2020
1 parent 067d09f commit 561213e
Show file tree
Hide file tree
Showing 4 changed files with 3,069 additions and 29 deletions.
8 changes: 0 additions & 8 deletions .devcontainer/DockerFile

This file was deleted.

6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "HACS Frontend",
"dockerFile": "DockerFile",
"image": "ludeeus/container:frontend",
"context": "..",
"appPort": ["5000:5000"],
"postCreateCommand": "npm install; npm run postinstall",
"postCreateCommand": "yarn; yarn postinstall",
"runArgs": [
"-v",
"${env:HOME}${env:USERPROFILE}/.ssh:/tmp/.ssh" // This is added so you can push from inside the container
"${env:HOME}${env:USERPROFILE}/.ssh:/tmp/.ssh"
],
"extensions": [
"github.vscode-pull-request-github",
Expand Down
34 changes: 16 additions & 18 deletions src/components/buttons/HacsButtonUninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
CSSResultArray,
css,
TemplateResult,
html
html,
} from "lit-element";
import { HacsStyle } from "../../style/hacs-style";
import { HacsRepositoryButton } from "./HacsRepositoryButton";
Expand Down Expand Up @@ -34,12 +34,8 @@ export class HacsButtonUninstall extends HacsRepositoryButton {
<mwc-button @click=${this.RepositoryUnInstall}">
${
this.repository.state == "uninstalling"
? html`
<paper-spinner active></paper-spinner>
`
: html`
${label}
`
? html` <paper-spinner active></paper-spinner> `
: html` ${label} `
}
</mwc-button>
`;
Expand All @@ -51,7 +47,7 @@ export class HacsButtonUninstall extends HacsRepositoryButton {
mwc-button {
--mdc-theme-primary: var(--google-red-500);
}
`
`,
];
}

Expand All @@ -63,7 +59,7 @@ export class HacsButtonUninstall extends HacsRepositoryButton {
const value = await swal(
localize("confirm.uninstall", "{item}", this.repository.name),
{
buttons: [localize("confirm.no"), localize("confirm.yes")]
buttons: [localize("confirm.no"), localize("confirm.yes")],
}
);

Expand Down Expand Up @@ -98,9 +94,9 @@ export class HacsButtonUninstall extends HacsRepositoryButton {
this.hass.connection
.sendMessagePromise({
type: "lovelace/config",
force: false
force: false,
})
.then(resp => {
.then((resp) => {
const currentConfig = resp as LovelaceConfig;

if (currentConfig.resources) {
Expand All @@ -114,23 +110,25 @@ export class HacsButtonUninstall extends HacsRepositoryButton {
currentConfig.resources = resources;
this.hass.callWS({
type: "lovelace/config/save",
config: currentConfig
config: currentConfig,
});
}
});
} else {
const resources = await this.hass.callWS<LovelaceResourceConfig[]>({
type: "lovelace/resources"
type: "lovelace/resources",
});
const resource: LovelaceResourceConfig = resources.find(function(
const resource: LovelaceResourceConfig = resources.find(function (
element
) {
return element.url === url1 || element.url === url2;
});
this.hass.callWS({
type: "lovelace/resources/delete",
resource_id: resource.id
});
if (resource) {
this.hass.callWS({
type: "lovelace/resources/delete",
resource_id: resource.id,
});
}
}
}
}
Loading

0 comments on commit 561213e

Please sign in to comment.