Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getSelectedItemFromHash(items: (DataCube | Collection)[], hash: string, viewType: ViewType): DataCube | Collection {
// can change header from hash
var parts = this.parseHash(hash);
var itemName = parts[viewType === COLLECTION ? 1 : 0];
return findByName(items, itemName);
}
getSelectedItemFromHash(items: (DataCube | Collection)[], hash: string, viewType: ViewType): DataCube | Collection {
// can change header from hash
var parts = this.parseHash(hash);
var itemName = parts[viewType === COLLECTION ? 1 : 0];
return findByName(items, itemName);
}
openModal(name: string) {
this.setState({
modal: findByName(this.modals, name)
});
}
public getDataCube(dataCubeName: string): DataCube {
return findByName(this.dataCubes, dataCubeName);
}
public getCluster(clusterName: string): Cluster {
return findByName(this.clusters, clusterName);
}
constructor(parameters: AppSettingsValue) {
const {
version,
clusters,
customization,
dataCubes,
linkViewConfig,
collections
} = parameters;
for (var dataCube of dataCubes) {
if (dataCube.clusterName === 'native') continue;
if (!findByName(clusters, dataCube.clusterName)) {
throw new Error(`data cube '${dataCube.name}' refers to an unknown cluster '${dataCube.clusterName}'`);
}
}
this.version = version || 0;
this.clusters = clusters;
checkNamedArrayUnique(this.clusters);
this.customization = customization;
this.dataCubes = dataCubes;
checkNamedArrayUnique(this.dataCubes);
this.linkViewConfig = linkViewConfig;
this.collections = collections;
checkNamedArrayUnique(this.collections);
}