@@ -3,7 +3,11 @@ import * as React from "react";
33import { Meta , StoryFn } from "@storybook/react" ;
44
55import { MethodRow as MethodRowComponent } from "../../view/model-editor/MethodRow" ;
6- import { CallClassification } from "../../model-editor/external-api-usage" ;
6+ import {
7+ CallClassification ,
8+ ExternalApiUsage ,
9+ } from "../../model-editor/external-api-usage" ;
10+ import { ModeledMethod } from "../../model-editor/modeled-method" ;
711import { VSCodeDataGrid } from "@vscode/webview-ui-toolkit/react" ;
812import { GRID_TEMPLATE_COLUMNS } from "../../view/model-editor/ModeledMethodDataGrid" ;
913
@@ -18,52 +22,85 @@ const Template: StoryFn<typeof MethodRowComponent> = (args) => (
1822 </ VSCodeDataGrid >
1923) ;
2024
21- export const MethodRow = Template . bind ( { } ) ;
22- MethodRow . args = {
23- externalApiUsage : {
24- library : "sql2o-1.6.0.jar" ,
25- signature : "org.sql2o.Sql2o#open()" ,
26- packageName : "org.sql2o" ,
27- typeName : "Sql2o" ,
28- methodName : "open" ,
29- methodParameters : "()" ,
30- supported : true ,
31- supportedType : "summary" ,
32- usages : [
33- {
34- label : "open(...)" ,
35- url : {
36- uri : "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java" ,
37- startLine : 14 ,
38- startColumn : 24 ,
39- endLine : 14 ,
40- endColumn : 35 ,
41- } ,
42- classification : CallClassification . Source ,
25+ const externalApiUsage : ExternalApiUsage = {
26+ library : "sql2o-1.6.0.jar" ,
27+ signature : "org.sql2o.Sql2o#open()" ,
28+ packageName : "org.sql2o" ,
29+ typeName : "Sql2o" ,
30+ methodName : "open" ,
31+ methodParameters : "()" ,
32+ supported : false ,
33+ supportedType : "summary" ,
34+ usages : [
35+ {
36+ label : "open(...)" ,
37+ url : {
38+ uri : "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java" ,
39+ startLine : 14 ,
40+ startColumn : 24 ,
41+ endLine : 14 ,
42+ endColumn : 35 ,
4343 } ,
44- {
45- label : "open(...)" ,
46- url : {
47- uri : "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java " ,
48- startLine : 25 ,
49- startColumn : 24 ,
50- endLine : 25 ,
51- endColumn : 35 ,
52- } ,
53- classification : CallClassification . Source ,
44+ classification : CallClassification . Source ,
45+ } ,
46+ {
47+ label : "open(...) " ,
48+ url : {
49+ uri : "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java" ,
50+ startLine : 25 ,
51+ startColumn : 24 ,
52+ endLine : 25 ,
53+ endColumn : 35 ,
5454 } ,
55- ] ,
56- } ,
57- modeledMethod : {
58- type : "summary" ,
59- input : "Argument[this]" ,
60- output : "ReturnValue" ,
61- kind : "taint" ,
62- provenance : "manual" ,
63- signature : "org.sql2o.Sql2o#open()" ,
64- packageName : "org.sql2o" ,
65- typeName : "Sql2o" ,
66- methodName : "open" ,
67- methodParameters : "()" ,
68- } ,
55+ classification : CallClassification . Source ,
56+ } ,
57+ ] ,
58+ } ;
59+ const modeledMethod : ModeledMethod = {
60+ type : "summary" ,
61+ input : "Argument[this]" ,
62+ output : "ReturnValue" ,
63+ kind : "taint" ,
64+ provenance : "manual" ,
65+ signature : "org.sql2o.Sql2o#open()" ,
66+ packageName : "org.sql2o" ,
67+ typeName : "Sql2o" ,
68+ methodName : "open" ,
69+ methodParameters : "()" ,
70+ } ;
71+
72+ export const Unmodeled = Template . bind ( { } ) ;
73+ Unmodeled . args = {
74+ externalApiUsage,
75+ modeledMethod : undefined ,
76+ } ;
77+
78+ export const Source = Template . bind ( { } ) ;
79+ Source . args = {
80+ externalApiUsage,
81+ modeledMethod : { ...modeledMethod , type : "source" } ,
82+ } ;
83+
84+ export const Sink = Template . bind ( { } ) ;
85+ Sink . args = {
86+ externalApiUsage,
87+ modeledMethod : { ...modeledMethod , type : "sink" } ,
88+ } ;
89+
90+ export const Summary = Template . bind ( { } ) ;
91+ Summary . args = {
92+ externalApiUsage,
93+ modeledMethod : { ...modeledMethod , type : "summary" } ,
94+ } ;
95+
96+ export const Neutral = Template . bind ( { } ) ;
97+ Neutral . args = {
98+ externalApiUsage,
99+ modeledMethod : { ...modeledMethod , type : "neutral" } ,
100+ } ;
101+
102+ export const AlreadyModeled = Template . bind ( { } ) ;
103+ AlreadyModeled . args = {
104+ externalApiUsage : { ...externalApiUsage , supported : true } ,
105+ modeledMethod : undefined ,
69106} ;
0 commit comments