Remove Hassbian panel (#1132)

This commit is contained in:
c727 2018-04-29 18:08:03 +02:00 committed by GitHub
parent ac38fdb9df
commit 30555eda88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 198 deletions

View File

@ -8,7 +8,6 @@
<link rel='import' href='../../../src/util/hass-mixins.html'> <link rel='import' href='../../../src/util/hass-mixins.html'>
<link rel="import" href="./ha-config-section-core.html"> <link rel="import" href="./ha-config-section-core.html">
<link rel="import" href="./ha-config-section-hassbian.html">
<link rel="import" href="./ha-config-section-push-notifications.html"> <link rel="import" href="./ha-config-section-push-notifications.html">
<link rel="import" href="./ha-config-section-translation.html"> <link rel="import" href="./ha-config-section-translation.html">
<link rel="import" href="./ha-config-section-themes.html"> <link rel="import" href="./ha-config-section-themes.html">
@ -72,13 +71,6 @@
></ha-config-section-themes> ></ha-config-section-themes>
</template> </template>
<template is='dom-if' if='[[computeIsHassbianLoaded(hass)]]'>
<div class='border'></div>
<ha-config-section-hassbian
is-wide='[[isWide]]'
hass='[[hass]]'
></ha-config-section-hassbian>
</template>
</div> </div>
</ha-app-layout> </ha-app-layout>
</template> </template>
@ -106,10 +98,6 @@ class HaConfigCore extends window.hassMixins.LocalizeMixin(Polymer.Element) {
return isWide ? 'content' : 'content narrow'; return isWide ? 'content' : 'content narrow';
} }
computeIsHassbianLoaded(hass) {
return window.hassUtil.isComponentLoaded(hass, 'config.hassbian');
}
computeIsZwaveLoaded(hass) { computeIsZwaveLoaded(hass) {
return window.hassUtil.isComponentLoaded(hass, 'config.zwave'); return window.hassUtil.isComponentLoaded(hass, 'config.zwave');
} }

View File

@ -1,180 +0,0 @@
<link rel="import" href="../../../bower_components/polymer/polymer-element.html">
<link rel='import' href='../../../bower_components/iron-media-query/iron-media-query.html'>
<link rel="import" href="../../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../../bower_components/paper-input/paper-input.html">
<link rel="import" href="../../../bower_components/paper-button/paper-button.html">
<link rel="import" href="../../../bower_components/paper-card/paper-card.html">
<link rel="import" href="../../../bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="../../../bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="../../../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../../../src/components/ha-menu-button.html">
<link rel="import" href="../../../src/resources/ha-style.html">
<link rel='import' href='../../../src/util/hass-mixins.html'>
<link rel="import" href="../ha-config-section.html">
<dom-module id="ha-config-section-hassbian">
<template>
<style include="iron-flex ha-style">
.header {
font-size: 16px;
margin-bottom: 1em;
}
.header .status {
font-size: 14px;
float: right;
}
.card-actions paper-button {
color: var(--default-primary-color);
font-weight: 500;
}
</style>
<ha-config-section is-wide='[[isWide]]'>
<span slot='header'>[[localize('ui.panel.config.core.section.hassbian.header')]]</span>
<span slot='introduction'>
[[localize('ui.panel.config.core.section.hassbian.introduction')]]
</span>
<template is='dom-if' if='[[suiteStatus]]'>
<template is='dom-repeat' items='[[computeSuiteKeys(suiteStatus)]]' as='suiteKey'>
<paper-card>
<div class='card-content'>
<div class='header'>
[[computeTitle(suiteKey)]]
<span class='status'>
[[computeSuiteStatus(suiteStatus, suiteKey)]]
</span>
</div>
[[computeSuiteDescription(suiteStatus, suiteKey)]]
</div>
<div class='card-actions'>
<paper-button on-click='suiteMoreInfoTapped'>
[[localize('ui.panel.config.core.section.hassbian.learn_more')]]
</paper-button>
<template is='dom-if' if='[[computeShowInstall(suiteStatus, suiteKey)]]'>
<paper-button on-click='suiteActionTapped'>
[[localize('ui.panel.config.core.section.hassbian.install')]]
</paper-button>
</template>
</div>
</paper-card>
</template>
</template>
</ha-config-section>
</template>
</dom-module>
<script>
/*
* @appliesMixin window.hassMixins.LocalizeMixin
*/
class HaConfigSectionHassbian extends window.hassMixins.LocalizeMixin(Polymer.Element) {
static get is() { return 'ha-config-section-hassbian'; }
static get properties() {
return {
hass: {
type: Object,
},
isWide: {
type: Boolean,
},
suiteStatus: {
type: Object,
value: null,
},
};
}
updateStatus() {
// TODO tapping install while something is installing triggers a second
// update loop to start.
this.hass.callApi('GET', 'config/hassbian/suites').then(function (suites) {
this.suiteStatus = suites;
var isInstalling = false;
var keys = Object.keys(suites);
for (var i = 0; i < keys.length; i++) {
if (suites[keys[i]].state === 'installing') {
isInstalling = true;
break;
}
}
if (isInstalling) {
setTimeout(() => this.updateStatus(), 5000);
}
}.bind(this));
}
connectedCallback() {
super.connectedCallback();
this.updateStatus = this.updateStatus.bind(this);
this.updateStatus();
}
computeSuiteKeys(suiteStatus) {
// Prioritize installing packages
return Object.keys(suiteStatus).sort(function (keyA, keyB) {
var installingA = suiteStatus[keyA].state === 'installing';
var installingB = suiteStatus[keyB].state === 'installing';
if (installingA && installingB) {
// do nothing
} else if (installingA) {
return -1;
} else if (installingB) {
return 1;
}
if (keyA < keyB) {
return -1;
}
if (keyA > keyB) {
return 1;
}
return 0;
});
}
computeSuiteDescription(suiteStatus, suiteKey) {
return suiteStatus[suiteKey].description;
}
computeTitle(suiteKey) {
return suiteKey.substr(0, 1).toUpperCase() + suiteKey.substr(1);
}
computeSuiteStatus(suiteStatus, suiteKey) {
var state = suiteStatus[suiteKey].state.replace(/_/, ' ');
return state.substr(0, 1).toUpperCase() + state.substr(1);
}
computeShowStatus(suiteStatus, suiteKey) {
var state = suiteStatus[suiteKey].state;
return state !== 'installing' && state !== 'not_installed';
}
computeShowInstall(suiteStatus, suiteKey) {
return suiteStatus[suiteKey].state === 'not_installed';
}
suiteMoreInfoTapped() {
// console.log('learn more', ev.model.item);
}
suiteActionTapped() {
// TODO install tapped suite
this.hass.callApi('POST', 'config/hassbian/suites/openzwave/install').then(this.updateStatus);
}
}
customElements.define(HaConfigSectionHassbian.is, HaConfigSectionHassbian);
</script>

View File

@ -431,12 +431,6 @@
"header": "Set a theme", "header": "Set a theme",
"introduction": "Choose 'Backend-selected' to use whatever theme the backend chooses or pick a theme for this device", "introduction": "Choose 'Backend-selected' to use whatever theme the backend chooses or pick a theme for this device",
"theme": "Theme" "theme": "Theme"
},
"hassbian": {
"header": "Bring Hassbian to the next level",
"introduction": "Discover exciting add-ons to enhance your Home Assistant installation. Add an MQTT server or control a connected TV via HDMI-CEC.",
"learn_more": "Learn more",
"install": "Install"
} }
} }
}, },