Skip to content

Commit

Permalink
fix: rename dataSource type from adt to azure_function
Browse files Browse the repository at this point in the history
  • Loading branch information
csm-thu committed Jun 18, 2024
1 parent 6f76e6f commit 959abc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/config/overrides/Workspaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const WORKSPACES = [
},
instanceView: {
dataSource: {
type: 'adt',
type: 'azure_function',
functionUrl: 'https://scenario-download-brewery-dev.azurewebsites.net/api/ScenarioDownload',
functionKey: 'o5Xlur_7s5c00KQKnl0QveXVEFC9DXeBiOkwQEdZGx9xAzFuLsPB5A==',
},
Expand Down
9 changes: 6 additions & 3 deletions src/views/Instance/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const processGraphElements = (instanceViewConfig, scenario, theme) => {
return processedData;
};

async function _fetchDataFromADT(organizationId, workspaceId, scenarioId, dataSource) {
async function _fetchDataFromAzureFunction(organizationId, workspaceId, scenarioId, dataSource) {
const tokens = await Auth.acquireTokens();
const headers = { 'x-functions-key': dataSource.functionKey };
if (tokens?.accessToken) {
Expand Down Expand Up @@ -227,7 +227,10 @@ export async function fetchData(instanceViewConfig, organizationId, workspaceId,

switch (instanceViewConfig.dataSource.type) {
case 'adt':
return _fetchDataFromADT(organizationId, workspaceId, scenarioId, instanceViewConfig.dataSource);
console.warn('The dataSource type "adt" is deprecated, please use value "azure_function" instead.');
// fallthrough: adt and azure_function are equivalent
case 'azure_function':
return _fetchDataFromAzureFunction(organizationId, workspaceId, scenarioId, instanceViewConfig.dataSource);
case 'twingraph_dataset':
if (
!datasets
Expand All @@ -244,7 +247,7 @@ export async function fetchData(instanceViewConfig, organizationId, workspaceId,
return {
error:
`Data source type "${instanceViewConfig.dataSource.type}" is not supported in Instance view.` +
' The only currently supported type is "adt"',
' Supported types are "azure_function" and "twingraph_dataset"',
};
}
}

0 comments on commit 959abc4

Please sign in to comment.