Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
2fbdd549
Commit
2fbdd549
authored
Sep 25, 2018
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
Generate example params in model-server-query app
parent
a192d317
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/apps/model-server-query/index.tsx
+31
-10
31 additions, 10 deletions
src/apps/model-server-query/index.tsx
src/servers/model/server/api.ts
+5
-4
5 additions, 4 deletions
src/servers/model/server/api.ts
with
36 additions
and
14 deletions
src/apps/model-server-query/index.tsx
+
31
−
10
View file @
2fbdd549
...
...
@@ -22,15 +22,6 @@ interface State {
}
class
Root
extends
React
.
Component
<
{
state
:
State
},
{
}
>
{
parseParams
(
str
:
string
)
{
try
{
const
params
=
JSON
.
parse
(
str
);
this
.
props
.
state
.
params
.
next
(
params
);
}
catch
{
this
.
props
.
state
.
params
.
next
({});
}
}
render
()
{
return
<
div
>
<
div
>
...
...
@@ -41,7 +32,7 @@ class Root extends React.Component<{ state: State }, { }> {
</
div
>
<
div
>
Params:
<
br
/>
<
textarea
style
=
{
{
height
:
'
300px
'
}
}
cols
=
{
80
}
onChange
=
{
t
=>
this
.
parseParams
(
t
.
currentTarget
.
value
)
}
/>
<
QueryParams
state
=
{
this
.
props
.
state
}
/>
</
div
>
<
div
>
Model numbers (empty for all):
<
ModelNums
state
=
{
this
.
props
.
state
}
/>
...
...
@@ -65,6 +56,28 @@ class QuerySelect extends React.Component<{ state: State }> {
}
}
class
QueryParams
extends
React
.
Component
<
{
state
:
State
},
{
prms
:
string
}
>
{
state
=
{
prms
:
''
};
parseParams
(
str
:
string
)
{
this
.
setState
({
prms
:
str
});
try
{
const
params
=
JSON
.
parse
(
str
);
this
.
props
.
state
.
params
.
next
(
params
);
}
catch
{
this
.
props
.
state
.
params
.
next
({});
}
}
componentDidMount
()
{
this
.
props
.
state
.
query
.
subscribe
(
q
=>
this
.
setState
({
prms
:
formatParams
(
q
)
}))
}
render
()
{
return
<
textarea
style
=
{
{
height
:
'
300px
'
}
}
value
=
{
this
.
state
.
prms
}
cols
=
{
80
}
onChange
=
{
t
=>
this
.
parseParams
(
t
.
currentTarget
.
value
)
}
/>;
}
}
class
QueryUrl
extends
React
.
Component
<
{
state
:
State
},
{
queryString
:
string
}
>
{
state
=
{
queryString
:
''
};
...
...
@@ -97,6 +110,14 @@ const state: State = {
url
:
new
Rx
.
Subject
()
}
function
formatParams
(
def
:
QueryDefinition
)
{
const
prms
=
Object
.
create
(
null
);
for
(
const
p
of
def
.
params
)
{
prms
[
p
.
name
]
=
p
.
exampleValues
?
p
.
exampleValues
[
0
]
:
void
0
;
}
return
JSON
.
stringify
(
prms
,
void
0
,
2
);
}
function
formatUrl
()
{
const
json
=
JSON
.
stringify
({
name
:
state
.
query
.
value
.
name
,
...
...
This diff is collapsed.
Click to expand it.
src/servers/model/server/api.ts
+
5
−
4
View file @
2fbdd549
...
...
@@ -20,7 +20,7 @@ export interface QueryParamInfo {
description
?:
string
,
required
?:
boolean
,
defaultValue
?:
any
,
exampleValues
?:
string
[],
exampleValues
?:
any
[],
validation
?:
(
v
:
any
)
=>
void
}
...
...
@@ -50,15 +50,15 @@ export interface QueryDefinition {
const
AtomSiteTestParams
:
QueryParamInfo
=
{
name
:
'
atom_site
'
,
type
:
QueryParamType
.
JSON
,
description
:
'
Object or array of objects describing atom properties. Name are same as in wwPDB mmCIF dictionary of the atom_site category.
'
,
exampleValues
:
[
`
{ label_comp_id: 'ALA' }
`
,
`
{ label_seq_id: 123, label_asym_id: 'A' }
`
]
description
:
'
Object or array of objects describing atom properties. Name
s
are same as in wwPDB mmCIF dictionary of the atom_site category.
'
,
exampleValues
:
[{
label_comp_id
:
'
ALA
'
},
{
label_seq_id
:
123
,
label_asym_id
:
'
A
'
}]
};
const
RadiusParam
:
QueryParamInfo
=
{
name
:
'
radius
'
,
type
:
QueryParamType
.
Float
,
defaultValue
:
5
,
exampleValues
:
[
'
5
'
],
exampleValues
:
[
5
],
description
:
'
Value in Angstroms.
'
,
validation
(
v
:
any
)
{
if
(
v
<
1
||
v
>
10
)
{
...
...
@@ -82,6 +82,7 @@ const QueryMap: { [id: string]: Partial<QueryDefinition> } = {
structureTransform
(
p
,
s
)
{
return
StructureSymmetry
.
builderSymmetryMates
(
s
,
p
.
radius
).
run
();
},
params
:
[
RadiusParam
]
},
'
assembly
'
:
{
niceName
:
'
Assembly
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment