Skip to content

Commit

Permalink
fix: graph colors now properly reset when swapping printers
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Bassett <[email protected]>
  • Loading branch information
cadriel committed Apr 10, 2021
1 parent fdd7527 commit 8beb201
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,6 @@ export const appInit = async (apiConfig?: ApiConfig, hostConfig?: HostConfig): P

// apiConfig could have empty strings, meaning we have no valid connection.
await store.dispatch('init', { apiConfig, hostConfig })

return { apiConfig, hostConfig, apiConnected }
}
11 changes: 5 additions & 6 deletions src/plugins/colorSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,11 @@ export class ColorSet {
*/
reset (list: string, force = false): void {
if (this.colorList[list] === undefined) return // not found
this.colorList[list].map(color => {
if (color.name && !force) {
// don't reset colors that have a name.
return color
} else {
return { ...color, used: false }
this.colorList[list].forEach(color => {
// don't reset colors that have a name, unless forced.
if (!color.name || force) {
color.used = false
delete color.name
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default new Vuex.Store<RootState>({
*/
async reset ({ dispatch }, payload: string[]) {
// Reset our color set.
Vue.$colorset.resetAll()
Vue.$colorset.forceResetAll()

// Dispatch a reset for each registered module.
const p: Promise<any>[] = []
Expand Down
1 change: 0 additions & 1 deletion todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

## Next Up

- fix color swap when changing printers
- add cpu time
- clicking legend items when no chart throws error, fix.
- sync instances across moonraker db
Expand Down

0 comments on commit 8beb201

Please sign in to comment.