Skip to content

[Cortex Scaffolder] Creating new service: Plugins Tech Radar - #18

Closed
cortex-app[bot] wants to merge 10 commits into
masterfrom
moore-techradar
Closed

[Cortex Scaffolder] Creating new service: Plugins Tech Radar#18
cortex-app[bot] wants to merge 10 commits into
masterfrom
moore-techradar

Conversation

@cortex-app

@cortex-app cortex-app Bot commented Oct 6, 2023

Copy link
Copy Markdown

Created by Cortex

@FoodProduct

Copy link
Copy Markdown
Contributor

Moving into draft -- please mark as ready for review when appropriate!

@FoodProduct
FoodProduct marked this pull request as draft October 6, 2023 21:11
@themsquared
themsquared marked this pull request as ready for review October 31, 2023 15:10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add instructions on how to set up this plugin, including any proxy setup requirements for this to function properly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused -- please delete.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused -- please delete.

import App from "./App";

describe("App", () => {
it("indicates that it's an awesome plugin", () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, read base URL from context

Comment on lines +84 to +85
const labels: any = chartDataSet?.labels;
let data: any = chartDataSet?.datasets[0].data;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we avoid any if possible here? What do these actually look like?

Comment on lines +127 to +131
const promises: Array<Promise<any>> = [];
supportedLanguages.forEach((language) => {
promises.push(getLanguageCount(language, updateData));
});
await Promise.all(promises);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can be simplified with map

Suggested change
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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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> => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please move all of these utility methods that are clearly not component-specific outside of the component file? 🙏

@jreock jreock closed this Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants