Skip to content
Snippets Groups Projects
Commit fb8991d0 authored by Xiao Gui's avatar Xiao Gui
Browse files

bugfix: emtpy dataformat will not filter

parent dc764ddc
No related branches found
No related tags found
No related merge requests found
......@@ -63,7 +63,12 @@ const flattenArray = (array) => {
}
const readConfigFile = (filename) => new Promise((resolve, reject) => {
const filepath = path.join(__dirname, '..', 'res', filename)
let filepath
if (process.env.NODE_ENV === 'production') {
filepath = path.join(__dirname, '..', 'res', filename)
} else {
filepath = path.join(__dirname, '..', '..', 'src', 'res', 'ext', filename)
}
fs.readFile(filepath, 'utf-8', (err, data) => {
if(err) reject(err)
resolve(data)
......
......@@ -18,9 +18,13 @@ exports.getAllTemplates = () => new Promise((resolve, reject) => {
})
exports.getTemplate = (template) => new Promise((resolve, reject) => {
const filePath = path.join(__dirname, '..', 'res', `${template}.json`)
fs.readFile(filePath, 'utf-8', (err, data) => {
let filepath
if (process.env.NODE_ENV === 'production') {
filepath = path.join(__dirname, '..', 'res', `${template}.json`)
} else {
filepath = path.join(__dirname, '..', '..', 'src', 'res', 'ext', `${template}.json`)
}
fs.readFile(filepath, 'utf-8', (err, data) => {
if (err) reject(err)
resolve(data)
})
......
......@@ -146,7 +146,10 @@ export class DataBrowserUI implements OnDestroy,OnInit{
this.subscriptions.push(this.metadataMap$.subscribe(map=>(this.metadataMap = map)))
this.subscriptions.push(this.fetchedDataEntries$.subscribe(arr=>(this.dataEntries = arr)))
this.subscriptions.push(this.fetchedDataEntries$.subscribe(arr=>{
console.log('arr', arr)
this.dataEntries = arr
}))
this.subscriptions.push(this.selectParcellation$.subscribe(parcellation=>
this.handleParcellationSelection(parcellation.regions)))
......
......@@ -8,6 +8,8 @@ import { DataEntry } from "../../services/stateStore.service";
export class FilterDataEntriesbyType implements PipeTransform{
public transform(dataEntries:DataEntry[],showDataType:Set<string>):DataEntry[]{
return dataEntries.filter(dataEntry=>dataEntry.formats.some(format => showDataType.has(format)))
return showDataType.size > 0
? dataEntries.filter(dataEntry=>dataEntry.formats.some(format => showDataType.has(format)))
: dataEntries
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment