shinydashboard

repository·main·Indexed 21 days ago

https://github.com/rstudio/shinydashboard

An R package used to create professional, dashboard-style user interfaces for Shiny applications. The documentation covers installation from CRAN, JavaScript build tool setup using Node.js, yarn, and Grunt, and specific AdminLTE modifications for box collapse events, local font configuration, and slideDown animation fixes.

Tokens
1.3K
Snippets
7
Records
9
Agent score
76%

What's inside shinydashboard

  1. How box collapse events work in shinydashboard

    main

    The AdminLTE components in this branch have been modified so that the box collapse function triggers shown and hidden events. This allows Shiny to detect when specific outputs are visible or hidden within a dashboard box.

    Note: If you update to a newer version of AdminLTE, you must manually re-apply commit 73f6027 to retain this functionality.

  2. Install and use Grunt for minification and linting

    main

    Grunt is used in shinydashboard for minifying and linting JavaScript code.

    1. Installation

    First, ensure local dependencies are installed via yarn. Then, install the grunt-cli globally so the grunt command is available in your system path:

    sudo yarn global add grunt-cli

    2. Running Tasks

    Navigate to the tools/ directory to execute tasks. The CLI will automatically use the local version of Grunt installed in the project.

    • Run all default tasks (minification and jshint):
      grunt
    - **Run tasks in watch mode** (monitors files for changes and re-runs tasks automatically):
      ```bash
    grunt watch
    # Install CLI globally
    sudo yarn global add grunt-cli
    
    # Run default tasks
    grunt
    
    # Run watch mode
    grunt watch
  3. Fix slideDown animation for empty Shiny outputs

    main

    To ensure the slideDown() animation on sidebar menu items looks smooth when an output is empty, you can insert a code chunk into app.js. This logic checks for a .shiny-bound-output that contains no HTML and inserts a <br/> to provide height for the animation.

    This code should be inserted into the event listener for clicks on sidebar menu items, specifically right before the slideDown() call on the clicked menuItem.

    Note: If you update to a newer version of AdminLTE, you must manually re-apply commit c3a0c59.

    var shinyOutput = checkElement.find('.shiny-bound-output');
    if (shinyOutput.length !== 0 && shinyOutput.first().html().length === 0) {
      shinyOutput.first().html('<br/>');
    }
  4. Add or upgrade JavaScript packages with yarn

    main

    Use yarn to manage dependencies in the tools/ directory:

    • Add a new development package: Use yarn add --dev [packagename]. This updates package.json and yarn.lock.
    • Sync local packages: If package.json has been updated by another developer, run yarn to update your local environment.
    • Upgrade all dependencies: Run yarn upgrade to upgrade all dependencies to the latest version allowed by the version ranges (semantic versioning) specified in package.json.
    • Upgrade a specific package: Run yarn upgrade [package] to upgrade a single package to its latest tag, which may include major version changes.
    yarn add --dev [packagename]
    yarn upgrade
    yarn upgrade [package]
  5. Troubleshoot missing dependency errors

    main

    The package TestAnaAPP fails the dependency check during installation because a required package is not available in the current R environment.

    Error Pattern: Package required but not available: ‘<package_name>’

    Resolution: Identify the missing package (in this case, lordif) and install it before proceeding with the installation of the main package.

    Package required but not available: ‘lordif’
  6. Troubleshoot Matrix version mismatch errors

    main

    Several packages (e.g., AovBay, SeuratExplorer, shinyTempSignal) fail installation during the lazy loading phase due to an outdated Matrix package. The error indicates that the version of Matrix currently loaded in the environment is older than the version required by the package being installed.

    Common Error Patterns:

    • namespace ‘Matrix’ 1.5-4.1 is being loaded, but >= 1.6.0 is required
    • namespace ‘Matrix’ 1.5-4.1 is already loaded, but >= 1.6.4 is required

    Resolution: Ensure the Matrix package is updated to the version specified in the error message (e.g., >= 1.6.0 or >= 1.6.4) before attempting to install the target package.

    Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
      namespace ‘Matrix’ 1.5-4.1 is being loaded, but >= 1.6.0 is required