Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add downloaded, available and status columns #635

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/localize/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"name": "Repository Name",
"downloads": "Downloads",
"stars": "Stars",
"installed_version": "Installed version",
"available_version": "Available version",
"status": "Status",
"category": "Category",
"last_updated": "Updated"
},
Expand Down Expand Up @@ -107,6 +110,10 @@
"report": "Request for removal",
"update_information": "Update information"
},
"repository_status": {
"pending-restart": "Pending restart",
"pending-upgrade": "Pending update"
},
"menu": {
"about": "About HACS",
"custom_repositories": "Custom repositories",
Expand Down
37 changes: 37 additions & 0 deletions src/panels/hacs-experimental-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ const tableColumnDefaults = {
downloads: true,
stars: true,
last_updated: true,
installed_version: false,
available_version: false,
status: false,
category: true,
};

Expand Down Expand Up @@ -405,6 +408,40 @@ export class HacsExperimentalPanel extends LitElement {
template: (last_updated: string, repository: RepositoryBase) =>
repository.new ? "-" : relativeTime(new Date(last_updated), this.hass.locale),
},
installed_version: {
...defaultKeyData,
title: this.hacs.localize("column.installed_version"),
hidden: narrow || !tableColumnsOptions.installed_version,
sortable: true,
direction:
this.activeSort?.column === "installed_version" ? this.activeSort.direction : null,
width: "10%",
template: (installed_version: string, repository: RepositoryBase) =>
repository.installed ? installed_version : "-",
},
available_version: {
...defaultKeyData,
title: this.hacs.localize("column.available_version"),
hidden: narrow || !tableColumnsOptions.available_version,
sortable: true,
direction:
this.activeSort?.column === "available_version" ? this.activeSort.direction : null,
width: "10%",
template: (available_version: string, repository: RepositoryBase) =>
repository.installed ? available_version : "-",
},
status: {
...defaultKeyData,
title: this.hacs.localize("column.status"),
hidden: narrow || !tableColumnsOptions.status,
sortable: true,
direction: this.activeSort?.column === "status" ? this.activeSort.direction : null,
width: "10%",
template: (status: string) =>
["pending-restart", "pending-upgrade"].includes(status)
? this.hacs.localize(`repository_status.${status}`)
: "-",
},
category: {
...defaultKeyData,
title: this.hacs.localize("column.category"),
Expand Down