This repository has been archived by the owner on Dec 18, 2024. It is now read-only.
generated from MeasureAuthoringTool/madie-frontend-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #500 from MeasureAuthoringTool/feature/mat-6075-de…
…finitions-used-section-qicore [MAT-6075] Display CQL Definition Callstack
- Loading branch information
Showing
6 changed files
with
153 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm exec pretty-quick --staged && npm exec concurrently npm:test npm:lint | ||
npm exec pretty-quick --staged && npm exec concurrently "npm:lint" "npm:test -- --silent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import axios from "axios"; | ||
import useServiceConfig from "./useServiceConfig"; | ||
import { ServiceConfig } from "./ServiceContext"; | ||
import { useOktaTokens } from "@madie/madie-util"; | ||
import { CqlDefinitionCallstack } from "../components/editTestCase/groupCoverage/QiCoreGroupCoverage"; | ||
|
||
export class CqlParsingService { | ||
constructor(private baseUrl: string, private getAccessToken: () => string) {} | ||
|
||
async getDefinitionCallstacks(cql: string): Promise<CqlDefinitionCallstack> { | ||
try { | ||
const response = await axios.put<string>( | ||
`${this.baseUrl}/cql/callstacks`, | ||
cql, | ||
{ | ||
headers: { | ||
Authorization: `Bearer ${this.getAccessToken()}`, | ||
"Content-Type": "text/plain", | ||
}, | ||
} | ||
); | ||
return response.data as unknown as CqlDefinitionCallstack; | ||
} catch (err) { | ||
const message = `Unable to retrieve used definition references`; | ||
throw new Error(message); | ||
} | ||
} | ||
} | ||
|
||
const useCqlParsingService = (): CqlParsingService => { | ||
const serviceConfig: ServiceConfig = useServiceConfig(); | ||
const { getAccessToken } = useOktaTokens(); | ||
return new CqlParsingService( | ||
serviceConfig?.elmTranslationService.baseUrl, | ||
getAccessToken | ||
); | ||
}; | ||
|
||
export default useCqlParsingService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters