Skip to content

Commit

Permalink
Merge next into master for 0.11.0 (hacs#208)
Browse files Browse the repository at this point in the history
* New loader

* view

* file update

* restore changes

* abc

* Move more info

* Fix missing description

* store more data

* cleanup

* fix loading

* logs

* abc

* fix 3->4 migration

* component -> integration

* Fixed typo in error message (hacs#206)

* Limit API calls

* fix sensor

* Fix beta issues

* select version

* limit saves

* Fix issue for release asset

* 0.11.0
  • Loading branch information
ludeeus authored Jul 1, 2019
1 parent c8a4783 commit 292439e
Show file tree
Hide file tree
Showing 45 changed files with 1,154 additions and 642 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ HACS is an abbreviation of "Home Assistant Community Store".

_Although "Store" is not "technically" correct since nothing is sold, it’s more like a marketplace? but "HACM" didn’t have the same ring to it._

HACS is a component that gives the user a powerful UI to handle downloads of custom integrations and plugins.
HACS is a integration that gives the user a powerful UI to handle downloads of custom integrations and plugins.

**Highlights of what HACS can do:**

Expand Down
7 changes: 5 additions & 2 deletions custom_components/hacs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Custom element manager for community created elements.
For more details about this component, please refer to the documentation at
For more details about this integration, please refer to the documentation at
https://custom-components.github.io/hacs/
"""
import logging
Expand All @@ -19,6 +19,7 @@
from homeassistant.helpers import discovery

from .hacsbase import HacsBase as hacs
from .hacsdatastore import HacsDataStore
from .const import (
CUSTOM_UPDATER_LOCATIONS,
STARTUP,
Expand Down Expand Up @@ -66,7 +67,7 @@


async def async_setup(hass, config): # pylint: disable=unused-argument
"""Set up this component."""
"""Set up this integration."""
_LOGGER.info(STARTUP)
config_dir = hass.config.path()
github_token = config[DOMAIN]["token"]
Expand Down Expand Up @@ -159,3 +160,5 @@ async def configure_hacs(hass, github_token, hass_config_dir):

hacs.hass = hass
hacs.config_dir = hass_config_dir
hacs.store = HacsDataStore(hass_config_dir)
hacs.store.restore_values()
14 changes: 7 additions & 7 deletions custom_components/hacs/aiogithub.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,12 @@ async def get_contents(self, path, ref=None):
@backoff.on_exception(
backoff.expo, (ClientError, CancelledError, TimeoutError, KeyError), max_tries=5
)
async def get_releases(self, latest=False):
async def get_releases(self, prerelease=False):
"""Retrun a list of repository release objects."""
if self._ratelimit_remaining == "0":
raise AIOGitHubRatelimit("GitHub Ratelimit error")
endpoint = "/repos/{}/releases/latest".format(self.full_name)
endpoint = "/repos/{}/releases".format(self.full_name)
url = self.baseapi + endpoint
if not latest:
url = url.replace("/latest", "")

async with async_timeout.timeout(20, loop=self.loop):
response = await self.session.get(url, headers=self.headers)
Expand All @@ -237,12 +235,14 @@ async def get_releases(self, latest=False):
if response.get("message"):
return False

if latest:
return AIOGithubRepositoryRelease(response)

contents = []

for content in response:
if len(contents) == 5:
break
if not prerelease:
if content.get("prerelease", False):
continue
contents.append(AIOGithubRepositoryRelease(content))

return contents
Expand Down
6 changes: 3 additions & 3 deletions custom_components/hacs/const.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Constants for HACS"""
VERSION = "DEV"
VERSION = "0.11.0"
NAME_LONG = "HACS (Home Assistant Community Store)"
NAME_SHORT = "HACS"
STORAGE_VERSION = "3"
STORAGE_VERSION = "4"
STORENAME = "hacs"
PROJECT_URL = "https://github.com/custom-components/hacs/"
CUSTOM_UPDATER_LOCATIONS = [
Expand Down Expand Up @@ -35,7 +35,7 @@
-------------------------------------------------------------------
{}
Version: {}
This is a custom component
This is a custom integration
If you have any issues with this you need to open an issue here:
{}
-------------------------------------------------------------------
Expand Down
13 changes: 13 additions & 0 deletions custom_components/hacs/frontend/elements/custom_message.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class='container'>
<div class="row">
<div class="col s12">
<div class="card-panel orange darken-4">
<div class="card-content white-text">
<span>
{MESSAGE}
</span>
</div>
</div>
</div>
</div>
</div>
171 changes: 171 additions & 0 deletions custom_components/hacs/frontend/elements/hacs.css
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,175 @@ tr.hacs-table-row:hover {
overflow: scroll !important;
-webkit-overflow-scrolling: touch;
}
}


/* laoder */

*.hidden {
display: none !important;
}

div.loading{
position: fixed;
z-index: 999;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(16, 16, 16, 0.5);
}

@-webkit-keyframes uil-ring-anim {
0% {
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-webkit-keyframes uil-ring-anim {
0% {
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-moz-keyframes uil-ring-anim {
0% {
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-ms-keyframes uil-ring-anim {
0% {
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-moz-keyframes uil-ring-anim {
0% {
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-webkit-keyframes uil-ring-anim {
0% {
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-o-keyframes uil-ring-anim {
0% {
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes uil-ring-anim {
0% {
-ms-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-ms-transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-o-transform: rotate(360deg);
transform: rotate(360deg);
}
}
.uil-ring-css {
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 200px;
height: 200px;
}
.uil-ring-css > div {
position: absolute;
display: block;
width: 160px;
height: 160px;
top: 20px;
left: 20px;
border-radius: 80px;
box-shadow: 0 6px 0 0 var(--primary-color);
-ms-animation: uil-ring-anim 1s linear infinite;
-moz-animation: uil-ring-anim 1s linear infinite;
-webkit-animation: uil-ring-anim 1s linear infinite;
-o-animation: uil-ring-anim 1s linear infinite;
animation: uil-ring-anim 1s linear infinite;
}
8 changes: 8 additions & 0 deletions custom_components/hacs/frontend/elements/hacs.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,11 @@ document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.modal');
var instances = M.Modal.init(elems, {});
});


// Loader
function toggleLoading(){
var loadingOverlay = document.querySelector('.loading');
loadingOverlay.classList.remove('hidden')
document.activeElement.blur();
}
5 changes: 5 additions & 0 deletions custom_components/hacs/frontend/elements/overview/grid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class='hacs-overview-container'>
<h5>{TYPE}</h5>
<div class='hacs-card-container'>
{CARDS}
</div></div></br></br>
19 changes: 19 additions & 0 deletions custom_components/hacs/frontend/elements/overview/table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class='hacs-overview-container'>
<div class="row">
<h5>{TYPE}</h5>
<table class="hacs-table">
<thead>
<tr>
<th>Status</th>
<th>Name</th>
<th class="smal-hide">Description</th>
<th class="smal-hide">Installed</th>
<th class="smal-hide">Available</th>
</tr>
</thead>
<tbody>
{ROWS}
</tbody>
</table>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<a href="{API}/{ID}" class="hacs-card" onclick="toggleLoading()">
<div class="hacs-card overview">
<span class="hacs-card-title">{ICON} {NAME}</span>
<span class="hacs-card-content">
<p>{DESCRIPTION}</p>
</span>
</div>
</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<a href="{API}/{ID}" class="hacs-card" onclick="toggleLoading()">
<div class="hacs-card overview">
<!--{TOPICS}-->
<!--{AUTHORES}-->
<!--{REPOSITORY_NAME}-->
<span class="hacs-card-title">{ICON} {NAME} {BADGE}</span>
<span class="hacs-card-content">
<p>{DESCRIPTION}</p>
</span>
</div>
</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class='container''>
<div class="row">
<div class="col s12">
<div class="card-panel orange darken-4">
<div class="card-content white-text">
<span>
You need to restart (and potentially reconfigure) Home Assistant, for your last operation to be loaded.
</span>
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<tr class="hacs-table-row" onclick="toggleLoading();window.location='{API}/{ID}';">
<td>{ICON}</td>
<td>{NAME}</td>
<td class="hacs-card-content smal-hide">{DESCRIPTION}</td>
<td class="smal-hide">{INSTALLED}</td>
<td class="smal-hide">{AVAILABLE}</td>
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<tr class="hacs-table-row" onclick="toggleLoading();window.location='{API}/{ID}';">
<td>{ICON}</td>
<td>{NAME} {BADGE}</td>
<td class="hacs-card-content smal-hide">{DESCRIPTION}</td>
</tr>
12 changes: 12 additions & 0 deletions custom_components/hacs/frontend/elements/repository/view_info.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class='hacs-overview-container'>
<div class="row">
<div class="col s12">
<div class="card hacscolor">
<div class="card-content">
{CONTENT}
{NOTE}
</div>
</div>
</div>
</div>
</div>
Loading

0 comments on commit 292439e

Please sign in to comment.