Skip to content

Commit

Permalink
chore: merge dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
akloeckner authored Mar 20, 2024
2 parents af01df1 + 8237747 commit 8f71010
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 19 deletions.
8 changes: 7 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ updates:
schedule:
interval: "weekly"
open-pull-requests-limit: 0
target-branch: "develop"
target-branch: "dev"
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "dev"
schedule:
interval: "weekly"
groups:
patch-and-minor:
update-types:
- "minor"
- "patch"
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js 12.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 12.x
- name: Cache Node.js modules
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-12.x-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -37,13 +37,13 @@ jobs:
node-version: [10.x, 12.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node.js modules
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -54,3 +54,9 @@ jobs:
run: npm ci
- name: Build the project
run: npm run build --if-present
- name: Archive distribution bundle
uses: actions/upload-artifact@v4
with:
name: dist-node${{ matrix.node-version }}
path: |
dist
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
new_release_version: ${{ steps.semantic.outputs.new_release_version }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js 12.x
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 12.x
- name: Cache Node.js modules
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-12.x-${{ hashFiles('**/package-lock.json') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5.2.0
- uses: amannn/action-semantic-pull-request@v5.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 15 additions & 8 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,27 +527,34 @@ class MiniGraphCard extends LitElement {

setTooltip(entity, index, value, label = null) {
const {
group_by,
points_per_hour,
hours_to_show,
format,
} = this.config;
const offset = hours_to_show < 1 && points_per_hour < 1
? points_per_hour * hours_to_show
: 1 / points_per_hour;

const id = Math.abs(index + 1 - Math.ceil(hours_to_show * points_per_hour));
// time units in milliseconds in this function
const interval = getMilli(1 / points_per_hour);
const n_points = Math.ceil(hours_to_show * points_per_hour);

// index is 0 (oldest) to n_points-1 (most recent ~= now)
// count of intervals from now to end of bin
// count is 0 (now) to n_points-1 (oldest)
const count = (n_points - 1) - index;

// offset end by a minute, if grouped by, e.g., date or hour
const oneMinute = group_by !== 'interval' ? 60000 : 0;

const now = this.getEndDate();

const oneMinInHours = 1 / 60;
now.setMilliseconds(now.getMilliseconds() - getMilli(offset * id + oneMinInHours));
now.setMilliseconds(now.getMilliseconds() - oneMinute - interval * count);
const end = getTime(now, format, this._hass.language);
now.setMilliseconds(now.getMilliseconds() - getMilli(offset - oneMinInHours));
now.setMilliseconds(now.getMilliseconds() + oneMinute - interval);
const start = getTime(now, format, this._hass.language);

this.tooltip = {
value,
id,
count,
entity,
time: [start, end],
index,
Expand Down

0 comments on commit 8f71010

Please sign in to comment.