Merge pull request #2335 from github/starcke/rename-sup-modelled
Rename supported to modelled.
This commit is contained in:
@@ -16,7 +16,7 @@ import { ModeledMethod } from "../../data-extensions-editor/modeled-method";
|
||||
import { MethodRow } from "./MethodRow";
|
||||
import { assertNever } from "../../pure/helpers-pure";
|
||||
import { vscode } from "../vscode-api";
|
||||
import { calculateSupportedPercentage } from "./supported";
|
||||
import { calculateModeledPercentage } from "./modeled";
|
||||
|
||||
export const DataExtensionsEditorContainer = styled.div`
|
||||
margin-top: 1rem;
|
||||
@@ -97,12 +97,12 @@ export function DataExtensionsEditor({
|
||||
};
|
||||
}, []);
|
||||
|
||||
const supportedPercentage = useMemo(
|
||||
() => calculateSupportedPercentage(externalApiUsages),
|
||||
const modeledPercentage = useMemo(
|
||||
() => calculateModeledPercentage(externalApiUsages),
|
||||
[externalApiUsages],
|
||||
);
|
||||
|
||||
const unsupportedPercentage = 100 - supportedPercentage;
|
||||
const unModeledPercentage = 100 - modeledPercentage;
|
||||
|
||||
const onChange = useCallback(
|
||||
(method: ExternalApiUsage, model: ModeledMethod) => {
|
||||
@@ -140,10 +140,10 @@ export function DataExtensionsEditor({
|
||||
{externalApiUsages.length > 0 && (
|
||||
<>
|
||||
<div>
|
||||
<h3>External API support stats</h3>
|
||||
<h3>External API model stats</h3>
|
||||
<ul>
|
||||
<li>Supported: {supportedPercentage.toFixed(2)}%</li>
|
||||
<li>Unsupported: {unsupportedPercentage.toFixed(2)}%</li>
|
||||
<li>Modeled: {modeledPercentage.toFixed(2)}%</li>
|
||||
<li>Unmodeled: {unModeledPercentage.toFixed(2)}%</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -155,7 +155,7 @@ export const MethodRow = ({
|
||||
value={modeledMethod?.type ?? "none"}
|
||||
onInput={handleTypeInput}
|
||||
>
|
||||
<VSCodeOption value="none">Unmodelled</VSCodeOption>
|
||||
<VSCodeOption value="none">Unmodeled</VSCodeOption>
|
||||
<VSCodeOption value="source">Source</VSCodeOption>
|
||||
<VSCodeOption value="sink">Sink</VSCodeOption>
|
||||
<VSCodeOption value="summary">Flow summary</VSCodeOption>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { calculateSupportedPercentage } from "../supported";
|
||||
import { calculateModeledPercentage } from "../modeled";
|
||||
|
||||
describe("calculateSupportedPercentage", () => {
|
||||
describe("calculateModeledPercentage", () => {
|
||||
it("when there are no external API usages", () => {
|
||||
expect(calculateSupportedPercentage([])).toBe(0);
|
||||
expect(calculateModeledPercentage([])).toBe(0);
|
||||
});
|
||||
|
||||
it("when there are is 1 supported external API usage", () => {
|
||||
it("when there are is 1 modeled external API usage", () => {
|
||||
expect(
|
||||
calculateSupportedPercentage([
|
||||
calculateModeledPercentage([
|
||||
{
|
||||
supported: true,
|
||||
},
|
||||
@@ -15,9 +15,9 @@ describe("calculateSupportedPercentage", () => {
|
||||
).toBe(100);
|
||||
});
|
||||
|
||||
it("when there are is 1 unsupported external API usage", () => {
|
||||
it("when there are is 1 unmodeled external API usage", () => {
|
||||
expect(
|
||||
calculateSupportedPercentage([
|
||||
calculateModeledPercentage([
|
||||
{
|
||||
supported: false,
|
||||
},
|
||||
@@ -25,9 +25,9 @@ describe("calculateSupportedPercentage", () => {
|
||||
).toBe(0);
|
||||
});
|
||||
|
||||
it("when there are multiple supporte and unsupported external API usage", () => {
|
||||
it("when there are multiple modeled and unmodeled external API usage", () => {
|
||||
expect(
|
||||
calculateSupportedPercentage([
|
||||
calculateModeledPercentage([
|
||||
{
|
||||
supported: false,
|
||||
},
|
||||
@@ -0,0 +1,15 @@
|
||||
import { ExternalApiUsage } from "../../data-extensions-editor/external-api-usage";
|
||||
|
||||
export function calculateModeledPercentage(
|
||||
externalApiUsages: Array<Pick<ExternalApiUsage, "supported">>,
|
||||
): number {
|
||||
if (externalApiUsages.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const modeledExternalApiUsages = externalApiUsages.filter((m) => m.supported);
|
||||
|
||||
const modeledRatio =
|
||||
modeledExternalApiUsages.length / externalApiUsages.length;
|
||||
return modeledRatio * 100;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { ExternalApiUsage } from "../../data-extensions-editor/external-api-usage";
|
||||
|
||||
export function calculateSupportedPercentage(
|
||||
externalApiUsages: Array<Pick<ExternalApiUsage, "supported">>,
|
||||
): number {
|
||||
if (externalApiUsages.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const supportedExternalApiUsages = externalApiUsages.filter(
|
||||
(m) => m.supported,
|
||||
);
|
||||
|
||||
const supportedRatio =
|
||||
supportedExternalApiUsages.length / externalApiUsages.length;
|
||||
return supportedRatio * 100;
|
||||
}
|
||||
Reference in New Issue
Block a user