@@ -3,63 +3,101 @@ 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/method" ;
6+ import { CallClassification , Method } from "../../model-editor/method" ;
7+ import { ModeledMethod } from "../../model-editor/modeled-method" ;
8+ import { VSCodeDataGrid } from "@vscode/webview-ui-toolkit/react" ;
9+ import { GRID_TEMPLATE_COLUMNS } from "../../view/model-editor/ModeledMethodDataGrid" ;
710
811export default {
912 title : "CodeQL Model Editor/Method Row" ,
1013 component : MethodRowComponent ,
1114} as Meta < typeof MethodRowComponent > ;
1215
1316const Template : StoryFn < typeof MethodRowComponent > = ( args ) => (
14- < MethodRowComponent { ...args } />
17+ < VSCodeDataGrid gridTemplateColumns = { GRID_TEMPLATE_COLUMNS } >
18+ < MethodRowComponent { ...args } />
19+ </ VSCodeDataGrid >
1520) ;
1621
17- export const MethodRow = Template . bind ( { } ) ;
18- MethodRow . args = {
19- method : {
20- library : "sql2o-1.6.0.jar" ,
21- signature : "org.sql2o.Sql2o#open()" ,
22- packageName : "org.sql2o" ,
23- typeName : "Sql2o" ,
24- methodName : "open" ,
25- methodParameters : "()" ,
26- supported : true ,
27- supportedType : "summary" ,
28- usages : [
29- {
30- label : "open(...)" ,
31- url : {
32- uri : "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java" ,
33- startLine : 14 ,
34- startColumn : 24 ,
35- endLine : 14 ,
36- endColumn : 35 ,
37- } ,
38- classification : CallClassification . Source ,
22+ const method : Method = {
23+ library : "sql2o-1.6.0.jar" ,
24+ signature : "org.sql2o.Sql2o#open()" ,
25+ packageName : "org.sql2o" ,
26+ typeName : "Sql2o" ,
27+ methodName : "open" ,
28+ methodParameters : "()" ,
29+ supported : false ,
30+ supportedType : "summary" ,
31+ usages : [
32+ {
33+ label : "open(...)" ,
34+ url : {
35+ uri : "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java" ,
36+ startLine : 14 ,
37+ startColumn : 24 ,
38+ endLine : 14 ,
39+ endColumn : 35 ,
3940 } ,
40- {
41- label : "open(...)" ,
42- url : {
43- uri : "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java " ,
44- startLine : 25 ,
45- startColumn : 24 ,
46- endLine : 25 ,
47- endColumn : 35 ,
48- } ,
49- classification : CallClassification . Source ,
41+ classification : CallClassification . Source ,
42+ } ,
43+ {
44+ label : "open(...) " ,
45+ url : {
46+ uri : "file:/home/runner/work/sql2o-example/sql2o-example/src/main/java/org/example/HelloController.java" ,
47+ startLine : 25 ,
48+ startColumn : 24 ,
49+ endLine : 25 ,
50+ endColumn : 35 ,
5051 } ,
51- ] ,
52- } ,
53- modeledMethod : {
54- type : "summary" ,
55- input : "Argument[this]" ,
56- output : "ReturnValue" ,
57- kind : "taint" ,
58- provenance : "manual" ,
59- signature : "org.sql2o.Sql2o#open()" ,
60- packageName : "org.sql2o" ,
61- typeName : "Sql2o" ,
62- methodName : "open" ,
63- methodParameters : "()" ,
64- } ,
52+ classification : CallClassification . Source ,
53+ } ,
54+ ] ,
55+ } ;
56+ const modeledMethod : ModeledMethod = {
57+ type : "summary" ,
58+ input : "Argument[this]" ,
59+ output : "ReturnValue" ,
60+ kind : "taint" ,
61+ provenance : "manual" ,
62+ signature : "org.sql2o.Sql2o#open()" ,
63+ packageName : "org.sql2o" ,
64+ typeName : "Sql2o" ,
65+ methodName : "open" ,
66+ methodParameters : "()" ,
67+ } ;
68+
69+ export const Unmodeled = Template . bind ( { } ) ;
70+ Unmodeled . args = {
71+ method,
72+ modeledMethod : undefined ,
73+ } ;
74+
75+ export const Source = Template . bind ( { } ) ;
76+ Source . args = {
77+ method,
78+ modeledMethod : { ...modeledMethod , type : "source" } ,
79+ } ;
80+
81+ export const Sink = Template . bind ( { } ) ;
82+ Sink . args = {
83+ method,
84+ modeledMethod : { ...modeledMethod , type : "sink" } ,
85+ } ;
86+
87+ export const Summary = Template . bind ( { } ) ;
88+ Summary . args = {
89+ method,
90+ modeledMethod : { ...modeledMethod , type : "summary" } ,
91+ } ;
92+
93+ export const Neutral = Template . bind ( { } ) ;
94+ Neutral . args = {
95+ method,
96+ modeledMethod : { ...modeledMethod , type : "neutral" } ,
97+ } ;
98+
99+ export const AlreadyModeled = Template . bind ( { } ) ;
100+ AlreadyModeled . args = {
101+ method : { ...method , supported : true } ,
102+ modeledMethod : undefined ,
65103} ;
0 commit comments