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

[BUG] Minimal view as starting view not using correct theme #1604

Open
5 tasks done
DBLouis opened this issue May 29, 2024 · 7 comments
Open
5 tasks done

[BUG] Minimal view as starting view not using correct theme #1604

DBLouis opened this issue May 29, 2024 · 7 comments
Assignees
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working

Comments

@DBLouis
Copy link

DBLouis commented May 29, 2024

Environment

Self-Hosted (Docker)

System

Firefox 125, Ubuntu 23.10, Docker 26.1.3

Version

3.1.0

Describe the problem

I want to have the minimal view as starting view, so I set the environment variable VUE_APP_STARTING_VIEW to minimal. The starting view is indeed the minimal view but the theme I set in my config is not set, it uses the default one instead.

services:
  dashy:
    image: ghcr.io/lissy93/dashy:3.1.0@sha256:b9929261cbf9353f8aee2c63b35e53aafc4951aa9923c1244242de7c1251f49f
    container_name: dashy
    networks:
      - traefik
    volumes:
      - ./conf.yml:/app/user-data/conf.yml
      - /etc/localtime:/etc/localtime:ro
    environment:
      - NODE_ENV=production
      - VUE_APP_STARTING_VIEW=minimal
    restart: 'unless-stopped'
    healthcheck:
      test: ['CMD', 'node', '/app/services/healthcheck']
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s
    security_opt:
      - no-new-privileges
    labels:
      traefik.enable: 'true'
      traefik.http.routers.dashy.entrypoints: 'http'
      traefik.http.routers.dashy.rule: 'Host(`www.example.com`)'
      traefik.http.middlewares.dashy-https-redirect.redirectscheme.scheme: 'https'
      traefik.http.routers.dashy.middlewares: 'dashy-https-redirect'
      traefik.http.routers.dashy-secure.entrypoints: 'https'
      traefik.http.routers.dashy-secure.rule: 'Host(`www.example.com`)'
      traefik.http.routers.dashy-secure.tls: 'true'

networks:
  traefik:
    external: true
---
pageInfo:
  title: Title
  description: Description
  navLinks:
  - title: GitHub
    path: https://github.com/Lissy93/dashy
  - title: Documentation
    path: https://dashy.to/docs

appConfig:
  theme: nord
  layout: vertical
  iconSize: large
  language: fr
  disableConfiguration: true
  defaultOpeningMethod: newtab
  statusCheck: true
  hideComponents:
    hideSettings: true
  preventLocalSave: true
  preventWriteToDisk: true

sections:
  <omitted>

Additional info

No response

Please tick the boxes

@DBLouis DBLouis added the 🐛 Bug [ISSUE] Ticket describing something that isn't working label May 29, 2024
@github-project-automation github-project-automation bot moved this to Awaiting Triage in Dashy V3 May 29, 2024
@CrazyWolf13
Copy link
Collaborator

Hi

Have you already done a rebuild, thorugh the UI, after setting the vue_app_starting_view env ?

@DBLouis
Copy link
Author

DBLouis commented May 29, 2024

I just tried, the theme is still the default one.

@liss-bot liss-bot added the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label May 29, 2024
@DBLouis
Copy link
Author

DBLouis commented May 29, 2024

If I click on settings button the theme is immediately applied.

@CrazyWolf13
Copy link
Collaborator

You're right!

I've just tested this and confirm this weird behaviour, seems like clicking the settings icon, somehwat reload the ui?

Config used for testing:

---
# Page meta info, like heading, footer text and nav links
pageInfo:
  title: Dashy
  description: Welcome to your new dashboard!
  navLinks:
  - title: GitHub
    path: https://github.com/Lissy93/dashy
  - title: Documentation
    path: https://dashy.to/docs

# Optional app settings and configuration
appConfig:
  theme: nord

# Main content - An array of sections, each containing an array of items
sections:
- name: Getting Started
  icon: fas fa-rocket
  items:
  - title: Dashy Live
    description: Development a project management links for Dashy
    icon: https://i.ibb.co/qWWpD0v/astro-dab-128.png
    url: https://live.dashy.to/
    target: newtab
  - title: GitHub
    description: Source Code, Issues and Pull Requests
    url: https://github.com/lissy93/dashy
    icon: favicon
  - title: Docs
    description: Configuring & Usage Documentation
    provider: Dashy.to
    icon: far fa-book
    url: https://dashy.to/docs
  - title: Showcase
    description: See how others are using Dashy
    url: https://github.com/Lissy93/dashy/blob/master/docs/showcase.md
    icon: far fa-grin-hearts
  - title: Config Guide
    description: See full list of configuration options
    url: https://github.com/Lissy93/dashy/blob/master/docs/configuring.md
    icon: fas fa-wrench
  - title: Support
    description: Get help with Dashy, raise a bug, or get in contact
    url: https://github.com/Lissy93/dashy/blob/master/.github/SUPPORT.md
    icon: far fa-hands-helping

.env file:

# Set the default view to load on startup (can be `minimal`, `workspace` or `home`)
VUE_APP_STARTING_VIEW=minimal

Tought a video probably shows this the best:
https://github.com/Lissy93/dashy/assets/96661824/ba290873-e2f0-4a96-9f18-3546beeca5b7

@liss-bot liss-bot removed the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label May 30, 2024
@pulpocaminante
Copy link

document.documentElement.setAttribute('data-theme', 'matrix');

Fixes it, so presumably its just not loading the theme

@liss-bot liss-bot added the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Jun 21, 2024
@pulpocaminante
Copy link

@DBLouis , @CrazyWolf13

A hacky workaround until this gets fixed:

docker exec -it dashy sh

where dashy is the name of your container

then edit /app/dist/index.html and in the js section add:

document.documentElement.setAttribute('data-theme', 'matrix');

Where matrix is the theme you'd like to use

@liss-bot liss-bot removed the 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending label Jun 22, 2024
@CrazyWolf13 CrazyWolf13 removed their assignment Sep 1, 2024
@shotor
Copy link

shotor commented Dec 19, 2024

@DBLouis , @CrazyWolf13

A hacky workaround until this gets fixed:

If you want to get proper dirty but have it persistent across docker restarts:

  1. Copy package.json from the source and place it somewhere

Change:

"build": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build"

To:

"build": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build && node ./fix-theme.js"
  1. Copy this script and place it somewhere - I call it fix-theme.js
const fs = require("fs")

const HTML_FILE = "dist/index.html"
const DEFAULT_THEME = "matrix"

const scriptContent = `
;(() => {
  const theme = localStorage.getItem("theme") || "${DEFAULT_THEME}";
  document.documentElement.setAttribute("data-theme", theme);
})();
`

const htmlContent = fs.readFileSync(HTML_FILE, "utf-8")

const stringToSearch = `setTimeout(() => {`

const updatedHtml = htmlContent.replace(
  stringToSearch,
  `${scriptContent}\n${stringToSearch}`
)

fs.writeFileSync(HTML_FILE, updatedHtml, "utf-8")
  1. Update your docker compose and add these volumes:
    volumes:
      - /path/to/your/package.json:/app/package.json
      - /path/to/your/fix-theme.js:/app/fix-theme.js

@liss-bot liss-bot added 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending and removed 👤 Awaiting Maintainer Response [ISSUE] Response from repo author is pending labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug [ISSUE] Ticket describing something that isn't working
Projects
Status: Up Next
Development

No branches or pull requests

6 participants