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
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
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
Generate example params in model-server-query app
parent
a192d317
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide 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 {
...
@@ -22,15 +22,6 @@ interface State {
}
}
class
Root
extends
React
.
Component
<
{
state
:
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
()
{
render
()
{
return
<
div
>
return
<
div
>
<
div
>
<
div
>
...
@@ -41,7 +32,7 @@ class Root extends React.Component<{ state: State }, { }> {
...
@@ -41,7 +32,7 @@ class Root extends React.Component<{ state: State }, { }> {
</
div
>
</
div
>
<
div
>
<
div
>
Params:
<
br
/>
Params:
<
br
/>
<
textarea
style
=
{
{
height
:
'
300px
'
}
}
cols
=
{
80
}
onChange
=
{
t
=>
this
.
parseParams
(
t
.
currentTarget
.
value
)
}
/>
<
QueryParams
state
=
{
this
.
props
.
state
}
/>
</
div
>
</
div
>
<
div
>
<
div
>
Model numbers (empty for all):
<
ModelNums
state
=
{
this
.
props
.
state
}
/>
Model numbers (empty for all):
<
ModelNums
state
=
{
this
.
props
.
state
}
/>
...
@@ -65,6 +56,28 @@ class QuerySelect extends React.Component<{ state: 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
}
>
{
class
QueryUrl
extends
React
.
Component
<
{
state
:
State
},
{
queryString
:
string
}
>
{
state
=
{
queryString
:
''
};
state
=
{
queryString
:
''
};
...
@@ -97,6 +110,14 @@ const state: State = {
...
@@ -97,6 +110,14 @@ const state: State = {
url
:
new
Rx
.
Subject
()
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
()
{
function
formatUrl
()
{
const
json
=
JSON
.
stringify
({
const
json
=
JSON
.
stringify
({
name
:
state
.
query
.
value
.
name
,
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 {
...
@@ -20,7 +20,7 @@ export interface QueryParamInfo {
description
?:
string
,
description
?:
string
,
required
?:
boolean
,
required
?:
boolean
,
defaultValue
?:
any
,
defaultValue
?:
any
,
exampleValues
?:
string
[],
exampleValues
?:
any
[],
validation
?:
(
v
:
any
)
=>
void
validation
?:
(
v
:
any
)
=>
void
}
}
...
@@ -50,15 +50,15 @@ export interface QueryDefinition {
...
@@ -50,15 +50,15 @@ export interface QueryDefinition {
const
AtomSiteTestParams
:
QueryParamInfo
=
{
const
AtomSiteTestParams
:
QueryParamInfo
=
{
name
:
'
atom_site
'
,
name
:
'
atom_site
'
,
type
:
QueryParamType
.
JSON
,
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.
'
,
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' }
`
]
exampleValues
:
[{
label_comp_id
:
'
ALA
'
},
{
label_seq_id
:
123
,
label_asym_id
:
'
A
'
}]
};
};
const
RadiusParam
:
QueryParamInfo
=
{
const
RadiusParam
:
QueryParamInfo
=
{
name
:
'
radius
'
,
name
:
'
radius
'
,
type
:
QueryParamType
.
Float
,
type
:
QueryParamType
.
Float
,
defaultValue
:
5
,
defaultValue
:
5
,
exampleValues
:
[
'
5
'
],
exampleValues
:
[
5
],
description
:
'
Value in Angstroms.
'
,
description
:
'
Value in Angstroms.
'
,
validation
(
v
:
any
)
{
validation
(
v
:
any
)
{
if
(
v
<
1
||
v
>
10
)
{
if
(
v
<
1
||
v
>
10
)
{
...
@@ -82,6 +82,7 @@ const QueryMap: { [id: string]: Partial<QueryDefinition> } = {
...
@@ -82,6 +82,7 @@ const QueryMap: { [id: string]: Partial<QueryDefinition> } = {
structureTransform
(
p
,
s
)
{
structureTransform
(
p
,
s
)
{
return
StructureSymmetry
.
builderSymmetryMates
(
s
,
p
.
radius
).
run
();
return
StructureSymmetry
.
builderSymmetryMates
(
s
,
p
.
radius
).
run
();
},
},
params
:
[
RadiusParam
]
},
},
'
assembly
'
:
{
'
assembly
'
:
{
niceName
:
'
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
register
or
sign in
to comment