mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
stackdriver: only load project name if it's not already stored in the ds info json
This commit is contained in:
parent
cd7b454e25
commit
9fb1d3a9a6
@ -222,12 +222,19 @@ export default class StackdriverDatasource {
|
||||
|
||||
async getDefaultProject() {
|
||||
try {
|
||||
const projects = await this.getProjects();
|
||||
if (projects && projects.length > 0) {
|
||||
const test = projects.filter(p => p.id === this.projectName)[0];
|
||||
return test;
|
||||
if (this.projectName) {
|
||||
return {
|
||||
id: this.projectName,
|
||||
name: this.projectName,
|
||||
};
|
||||
} else {
|
||||
throw new Error('No projects found');
|
||||
const projects = await this.getProjects();
|
||||
if (projects && projects.length > 0) {
|
||||
const test = projects.filter(p => p.id === this.projectName)[0];
|
||||
return test;
|
||||
} else {
|
||||
throw new Error('No projects found');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
let message = 'Projects cannot be fetched: ';
|
||||
|
Loading…
Reference in New Issue
Block a user