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

[QUESTION] How does "sortBy": "most-used" work ? #1033

Closed
4 tasks done
Zixim opened this issue Jan 3, 2023 · 7 comments
Closed
4 tasks done

[QUESTION] How does "sortBy": "most-used" work ? #1033

Zixim opened this issue Jan 3, 2023 · 7 comments
Labels
🤷‍♂️ Question [ISSUE] Further information is requested

Comments

@Zixim
Copy link

Zixim commented Jan 3, 2023

Question

I've set "sortBy": "most-used", for all of the sections on the dash, but none of the items inside of the sections are changing positions.
Does something else need to be set for sorting by most-used ?

Category

Configuration

Please tick the boxes

@Zixim Zixim added the 🤷‍♂️ Question [ISSUE] Further information is requested label Jan 3, 2023
@liss-bot
Copy link
Collaborator

liss-bot commented Jan 3, 2023

If you're enjoying Dashy, consider dropping us a ⭐
🤖 I'm a bot, and this message was automated

@hypatia1
Copy link

I also have this problem.

@liss-bot liss-bot added the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Jan 25, 2023
@liss-bot
Copy link
Collaborator

This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.

@liss-bot liss-bot added ⚰️ Stale [ISSUE] [PR] No activity for over 1 month and removed 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending labels Feb 25, 2023
@Zixim
Copy link
Author

Zixim commented Feb 25, 2023

This is still relevant.

@liss-bot liss-bot added 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending and removed ⚰️ Stale [ISSUE] [PR] No activity for over 1 month labels Feb 25, 2023
@Lissy93
Copy link
Owner

Lissy93 commented Feb 25, 2023

Heya @Zixim
Sorry for the delay...

So when section[n].displayData.sortBy: most-used is enabled for a given section, each time you click an item, a click count will be stored in local storage (using key MOST_USED). Then items are sorted based on this value.

Here's the code for the sorting:

/* Sorts items by most used to least used, based on click-count */
sortByMostUsed(items) {
const usageCount = JSON.parse(localStorage.getItem(localStorageKeys.MOST_USED) || '{}');
const gmu = (item) => usageCount[item.id] || 0;
items.reverse().sort((a, b) => (gmu(a) < gmu(b) ? 1 : -1));
return items;
},

And here's the code for the setting:

/* Used for smart-sort when sorting items by most used apps */
incrementMostUsedCount(itemId) {
const mostUsed = JSON.parse(localStorage.getItem(localStorageKeys.MOST_USED) || '{}');
let counter = mostUsed[itemId] || 0;
counter += 1;
mostUsed[itemId] = counter;
localStorage.setItem(localStorageKeys.MOST_USED, JSON.stringify(mostUsed));
},

Since data is only stored client-side, so if you open Dashy on a new device or browser, then usage counters won't be carried over, hence the order may vary between sessions.

@Lissy93 Lissy93 closed this as completed Feb 25, 2023
@liss-bot liss-bot removed the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Feb 25, 2023
@Zixim
Copy link
Author

Zixim commented Feb 25, 2023

@Lissy93 thanks for your clarification. It just doesn't seem to be working at all.

Here's what is stored in Local Storage :
image
This for a Dashy instance that has been set to sortby most-used for all sections for many weeks, i.e. :

  - name: Online media
    icon: fas fa-book
    displayData:
      sortBy: most-used
      rows: 1
      cols: 3
      collapsed: true
      hideForGuests: false
    items:
      .....

Something must be wrong somewhere ?

@Lissy93
Copy link
Owner

Lissy93 commented Feb 26, 2023

Oh yeah, you're right - looks like the itemId is undefined when it gets passed to that function. It should have been this.item.id instead of this.id. I've opened a PR to fix this in #1123 :)

Lissy93 added a commit that referenced this issue Feb 26, 2023
[FIX] Counter for most-used + last-used, and lint warns
Fixes #1056 and #1033 for @hypatia1 and @Zixim
@Lissy93 Lissy93 closed this as completed Feb 26, 2023
akash5474 added a commit to akash5474/dashy that referenced this issue Oct 10, 2023
* 💙 Makes author list

* 💛 Updates repo diagram

* Update new pricing policy of Heroku

* 📝 Updates hyperlink to dashboard-icons

* 🐳 Temp remove Azure Registry from Docker build

* fix: upgrade simple-icons from 7.17.0 to 7.19.0

Snyk has created this PR to upgrade simple-icons from 7.17.0 to 7.19.0.

See this package in npm:


See this project in Snyk:
https://app.snyk.io/org/lissy93/project/564ca11b-8665-48b8-befa-ccd607c3e09a?utm_source=github&utm_medium=referral&page=upgrade-pr

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* ✨ Adds update support to image widget (Lissy93#992)

* ✨ Adds support for dimensions on Image Widget

* ✨ Improved update support for iframe widget, plus shows loader (Lissy93#992)

* 📄 Adds docs for image widget dimensions

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* 🌐 Added cs locale

* Bumped version

* Added import statement for json with translations

* 🔖 Keep at 2.1.1

* 💙 Makes author list

* 💛 Updates repo diagram

* Updated manifest's start_url to bare root path

* Adding Guest translations

* 🌐 correct and complete de locale

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Makes author list

* 💛 Updates repo diagram

* Added Widget for drone.io

* Added info for Drone Widget

* Allow multiple Project Keys for HealthChecks

* Possible to translate footer now.

Signed-off-by: DimitriDR <dimitridroeck@gmail.com>

* XKCD: Use tooltip for alt text

* Localizable strings for the App Info page

Signed-off-by: DimitriDR <dimitridroeck@gmail.com>

* Updated localization. Fixed my own bug...

* New Window + update support

* Adding error messages and splash screen.

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* Use `drone-io` in config and minor doc improvement for drone-io

* WIP: updated drone

* Rename DroneIo to DroneCi

Drone CI is the current term used for the Build System (or just Drone,
which is a bit to unspecific for identification)

* Add update function for DroneCi Widget

* updated Format and allow single repo listing

* Added skipped icon, use correct status

* Added Mvg Widget

Display mvg departure times for MVG station.

* Solve background image resize

* 💙 Updates contributor SVG

* 💙 Makes author list

* 🐛 Add trailing slash to quick fix Lissy93#1064

* Add trailing slash to switch-view-buttons on Workspace sidebar. This prevents a bug when later using switch view buttons on Default/Minimal view switchers.

* 🐛 Serve index.html as fallback to fix Lissy93#1067

* Update fr.json

Added missing character

* Added authentication to Pi-Hole widgets

* Remove trailing space

* Added productId to the endpoint and improved docs

* Update healthcheck to 5s timeout

* Update health-check to support SSL properly

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* Added mvg connection + doc updates

* Fixed deepscan analysis warnings

* Fix CodeSonar warnings

* Fixed as suggested

* Fix HealthChecks linting errors

* Correct config export removing leading space

* added: new language (Turkish).

* 🤖 Update version of Contributor workflow

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Makes author list

* 💛 Updates repo diagram

* 👷 update update-authors action

* 💜 Updates contributors list

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* ⬆️ Upgrade Keycloak-js dependency

* 🩹 Allow Keycloak authentication to pass 'IdP Hint'

* add App Config option for 'IdP Hint' under Keycloak Authentication
* refactor the authentication trigger mechanism to allow direct call
  to keyjclaok-js adapter login() function
* remove `onLoad` from construction options (as it belongs to init())

* 📝 Add documentation for 'appConfig.auth.keycloak.idpHint' option.

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* fix: upgrade vue-select from 3.18.3 to 3.20.2

Snyk has created this PR to upgrade vue-select from 3.18.3 to 3.20.2.

See this package in npm:


See this project in Snyk:
https://app.snyk.io/org/lissy93/project/564ca11b-8665-48b8-befa-ccd607c3e09a?utm_source=github&utm_medium=referral&page=upgrade-pr

* Added linkding widget

* 📝Add new language (Bengali)

* Added documentation

* 📝 Adds stats

* 💜 Updates contributors list

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* 🚨 Fix lint error (single quotes) in MvgConnection widget

* 📝 Adds missing languages to readme, sorts alphabetically

* 🚚 Sorts languages alphabetically, by code

* 🌐 Adds Bengali (thanks @Soaibuzzaman 🙌 Lissy93#1107)

* 🌐 Adds Turkish (thanks @imsakg  🙌 Lissy93#1188)

* Update zh-CN.json

* 🌐 Credits @imsakg for Turkish translations (Lissy93#1088)

* 🔄 Re-run CI builds

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* 🚨 Fix lint warn, single quotes in clock

* 🚨 Fix lint warn, indentation in Mvg widget

* 🐛 Fix most-used / last-used storage (Lissy93#1056, Lissy93#1033)

* 📌 Updates yarn.lock dependency pins

* 🚧 Temporarily removes GHCR

* 🚧 Temp removes GHCR + ACR

* 🔧 Re-enable GHCR Docker Push

* 🐛 Updates the endpoint for currency flags (Lissy93#1096)

* 📝 Fixes incorrect value, for enableServiceWorker

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* Update fr.json

* Update fr.json

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Makes author list

* 💛 Updates repo diagram

* Update GlancesMixin.js

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 👽️ Updates path to currency-flag assets

Data fetched from: https://github.com/Lissy93/currency-flags

* 💜 Updates contributors list

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* 💙 Makes author list

* 💛 Updates repo diagram

* Tweak GlCpuTemp widget to support other sensor units

The current code assumes all sensors report temperature, when in fact glances' sensor plugin also reports rpm (eg fan speeds) and percentages (eg batteries).

Changes:

 * Add support for percentages
 * Add support for rpm

Note: this widget should really be called something like `GlSensors`, but I haven't been able to easily find a way of renaming it without breaking people's existing configs and workflows.

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* 💙 Makes author list

* 💛 Updates repo diagram

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* Add in rss parsing library and option to use it instead of the API

* Bump version

* 🔖 Keep at 2.1.1

* 📝 Fix link to Healthcheck Status widget

* 🤖 Automation to mirror to CodeBerg

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* Add support searching multiple words.

* Fixing issues raised by SonarCloud

* swapping incorrect icons

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Makes author list

* 💛 Updates repo diagram

* Update node version in package.json

* get the correct tooltip for subitem

* ✨ Permit users to choose Celsius or Fahrenheit.

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* 🤖 Increase stale time, from 30 to 90 days

Less annoying notification

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

* 💜 Updates contributors list

* 💛 Updates sponsors table

* 💙 Updates contributor SVG

* 💙 Makes author list

* 💛 Updates repo diagram

---------

Signed-off-by: DimitriDR <dimitridroeck@gmail.com>
Co-authored-by: Alicia Bot <87835202+liss-bot@users.noreply.github.com>
Co-authored-by: repo-visualizer <repo-visualizer@users.noreply.github.com>
Co-authored-by: jrobles98 <jose98_21@hotmail.com>
Co-authored-by: Alicia Sykes <alicia@omg.lol>
Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: liss-bot <liss-bot@d0h.co>
Co-authored-by: Tuzi555 <jakub.tuzar@gmail.com>
Co-authored-by: Kieran Eglin <kieran.eglin@gmail.com>
Co-authored-by: Dylan-Bs <35694107+Dylan-Bs@users.noreply.github.com>
Co-authored-by: Alexander Mnich <56564725+a-mnich@users.noreply.github.com>
Co-authored-by: Matthias Bilger <matthias@bilger.info>
Co-authored-by: DimitriDR <dimitridroeck@gmail.com>
Co-authored-by: BySempron <barquin_rkz@hotmail.com>
Co-authored-by: itsmejoeeey <9375730+itsmejoeeey@users.noreply.github.com>
Co-authored-by: kxenox <floriandel@msn.com>
Co-authored-by: Alberto Caravaca <3170731+albcp@users.noreply.github.com>
Co-authored-by: rtm516 <rtm516@users.noreply.github.com>
Co-authored-by: Mert Sefa AKGUN <git@msakg.com>
Co-authored-by: Sergio <15928132+BySempron@users.noreply.github.com>
Co-authored-by: Marcell Fülöp <marekful@protonmail.com>
Co-authored-by: soaibsafi <soaib.safi@gmail.com>
Co-authored-by: zcq100 <zcq100@gmail.com>
Co-authored-by: EVOTk <45015615+EVOTk@users.noreply.github.com>
Co-authored-by: poisonadder7 <github.com@loginz.uk>
Co-authored-by: Luis Pabon <luis.pabon@auronconsulting.co.uk>
Co-authored-by: hockeymikey <hockeymikey@hockeymikey.com>
Co-authored-by: ssrangisetti <46807508+ssrangisetti@users.noreply.github.com>
Co-authored-by: ssrangisetti <ssrangisetti@protonmail.com>
Co-authored-by: Garrett Brown <gdbrown09@gmail.com>
Co-authored-by: baifengheixi <98794233+baifengheixi@users.noreply.github.com>
Co-authored-by: huangshaohuai <huangshaohuai@163.com>
Co-authored-by: Chris Nielsen <nielsen.chris@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤷‍♂️ Question [ISSUE] Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants