Skip to content

Commit

Permalink
fix: Honor simwrapper/ folder contents for SUBFOLDER dashboards only
Browse files Browse the repository at this point in the history
Create a "simwrapper" folder in the root of a project, in order to
set up dashboards, topsheets, etc for SUBFOLDERS of that project.

The dashboards will not show up in the root folder, only subfolders.

fixes simwrapper#108
  • Loading branch information
billyc committed Mar 30, 2022
1 parent 6c430f4 commit 373685a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/js/HTTPFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,31 +232,29 @@ class SVNFileSystem {

// first find all simwrapper folders
let currentPath = '/'
const { dirs } = await this.getDirectory(currentPath)
if (dirs.indexOf(YAML_FOLDER) > -1)
configFolders.push(`${currentPath}/${YAML_FOLDER}`.replaceAll('//', '/'))
// const { dirs } = await this.getDirectory(currentPath)
// if (dirs.indexOf(YAML_FOLDER) > -1) {
// configFolders.push(`${currentPath}/${YAML_FOLDER}`.replaceAll('//', '/'))
// }

const pathChunks = folder.split('/')
for (const chunk of pathChunks) {
for (const chunk of pathChunks.slice(0, pathChunks.length - 1)) {
currentPath = `${currentPath}${chunk}/`
try {
const { dirs } = await this.getDirectory(currentPath)
if (dirs.indexOf(YAML_FOLDER) > -1)
if (dirs.indexOf(YAML_FOLDER) > -1) {
configFolders.push(`${currentPath}/${YAML_FOLDER}`.replaceAll('//', '/'))
} catch (e) {
// doesn't matter, skip if it can't read it
}
}
} catch (e) {}
}

// also add current working folder as final option, which supercedes all others
configFolders.push(folder)

// console.log('configFolders', configFolders)

// find all dashboards, topsheets, and viz-* yamls in each configuration folder.
// Overwrite keys as we go; identically-named configs from parent folders get superceded as we go.
const dashboard = 'dashboard*.y?(a)ml'
const topsheet = '{topsheet,table}*.y?(a)ml'
const topsheet = '(topsheet|table)*.y?(a)ml'
const viz = 'viz*.y?(a)ml'
const config = 'simwrapper-config.y?(a)ml'

Expand Down

0 comments on commit 373685a

Please sign in to comment.