in src/dialog/dialog-helper.ts [25:79]
public async getODataUrl(): Promise<string> {
let query: QueryHierarchyItem;
let metadata: any;
const queryErrorString = 'The query could not be found. Please make sure this is a valid query.';
const axErrorString = 'Could not get ADO Analytics metadata for this account. Please make sure ADO Analytics is enabled.';
NotesService.instance.clearAllNotes();
// Validate
try {
query = await this.getQueryTemp();
} catch (ex) {
NotesService.instance.newNote('error', queryErrorString);
return null;
}
try {
metadata = await this.getODataMetadata();
} catch (ex) {
NotesService.instance.newNote('error', axErrorString);
return null;
}
if (!(query != null && query.wiql != null)) {
NotesService.instance.newNote('error', queryErrorString);
return null;
}
if (metadata == null) {
NotesService.instance.newNote('error', axErrorString);
return null;
}
const parser = new ODataParser(query, metadata);
if (!parser.isQueryValid()) {
return null;
}
// Try to parse and return query.
try {
const allStatements = parser.makeAllStatements();
// Test length.
if (encodeURI(allStatements).length > 2083) {
NotesService.instance.newNote('warning', `The encoded url has ${encodeURI(allStatements).length} characters and will be too long for some browsers and HTTP clients.`);
}
return allStatements;
} catch (ex) {
NotesService.instance.newNote('error', `An unexpected error occured: ${ex.message}`);
return null;
}
}