[Cortex Scaffolder] Creating new service: Plugins Tech Radar - #18
[Cortex Scaffolder] Creating new service: Plugins Tech Radar#18cortex-app[bot] wants to merge 10 commits into
Conversation
|
Moving into draft -- please mark as ready for review when appropriate! |
There was a problem hiding this comment.
Please delete this. Customers should decide for themselves how to represent this in their own Cortex instance (gitops vs UI), and since we recommend forking they will likely have different repository information.
| @@ -0,0 +1,28 @@ | |||
| # Tech Radar Plugin | |||
There was a problem hiding this comment.
Please add instructions on how to set up this plugin, including any proxy setup requirements for this to function properly.
There was a problem hiding this comment.
Unused -- please delete.
There was a problem hiding this comment.
Unused -- please delete.
| import App from "./App"; | ||
|
|
||
| describe("App", () => { | ||
| it("indicates that it's an awesome plugin", () => { |
There was a problem hiding this comment.
Please update the description of the test to be accurate.
| ): Promise<void> => { | ||
| // Run CQL job to get all services with language specified... | ||
| const response = await CortexApi.proxyFetch( | ||
| `https://api.getcortexapp.com/api/v1/queries`, |
There was a problem hiding this comment.
again, read base URL from context
| const labels: any = chartDataSet?.labels; | ||
| let data: any = chartDataSet?.datasets[0].data; |
There was a problem hiding this comment.
Could we avoid any if possible here? What do these actually look like?
| const promises: Array<Promise<any>> = []; | ||
| supportedLanguages.forEach((language) => { | ||
| promises.push(getLanguageCount(language, updateData)); | ||
| }); | ||
| await Promise.all(promises); |
There was a problem hiding this comment.
nit: can be simplified with map
| const promises: Array<Promise<any>> = []; | |
| supportedLanguages.forEach((language) => { | |
| promises.push(getLanguageCount(language, updateData)); | |
| }); | |
| await Promise.all(promises); | |
| await Promise.all( | |
| supportedLanguages.map((language) => { | |
| return getLanguageCount(language, updateData); | |
| } | |
| ); |
| } | ||
| ); | ||
| const [loading, setLoading] = useState(true); | ||
| chartDataSet = data; |
There was a problem hiding this comment.
We definitely should not be mingling file-scoped variables with code inside of components -- please consolidate. A good approach is: abstract state-touching logic into a (or multiple) custom hooks and move pure functions out into a utility library.
| return null; | ||
| }; | ||
|
|
||
| const sleep = async (ms: number): Promise<any> => { |
There was a problem hiding this comment.
Can we please move all of these utility methods that are clearly not component-specific outside of the component file? 🙏
Created by Cortex