Skip to main content
Homepage
Explore
Search or go to…
/
Sign in
Explore
Primary navigation
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
?
Collapse sidebar
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
311f5c09
Commit
311f5c09
authored
Apr 18, 2020
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
use Asset.File[] for PD.FileList
parent
be443945
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-plugin-state/actions/file.ts
+3
-5
3 additions, 5 deletions
src/mol-plugin-state/actions/file.ts
src/mol-plugin-ui/controls/parameters.tsx
+9
-3
9 additions, 3 deletions
src/mol-plugin-ui/controls/parameters.tsx
src/mol-util/param-definition.ts
+1
-1
1 addition, 1 deletion
src/mol-util/param-definition.ts
with
13 additions
and
9 deletions
src/mol-plugin-state/actions/file.ts
+
3
−
5
View file @
311f5c09
...
...
@@ -10,7 +10,6 @@ import { Task } from '../../mol-task';
import
{
getFileInfo
}
from
'
../../mol-util/file-info
'
;
import
{
ParamDefinition
as
PD
}
from
'
../../mol-util/param-definition
'
;
import
{
PluginStateObject
}
from
'
../objects
'
;
import
{
Asset
}
from
'
../../mol-util/assets
'
;
export
const
OpenFiles
=
StateAction
.
build
({
display
:
{
name
:
'
Open Files
'
,
description
:
'
Load one or more files and optionally create default visuals
'
},
...
...
@@ -31,12 +30,11 @@ export const OpenFiles = StateAction.build({
plugin
.
log
.
error
(
'
No file(s) selected
'
);
return
;
}
for
(
let
i
=
0
,
il
=
params
.
files
.
length
;
i
<
il
;
++
i
)
{
for
(
const
file
of
params
.
files
)
{
try
{
const
file
=
params
.
files
[
i
];
const
info
=
getFileInfo
(
file
);
const
info
=
getFileInfo
(
file
.
file
!
);
const
isBinary
=
plugin
.
dataFormats
.
binaryExtensions
.
has
(
info
.
ext
);
const
{
data
}
=
await
plugin
.
builders
.
data
.
readFile
({
file
:
Asset
.
File
(
file
)
,
isBinary
});
const
{
data
}
=
await
plugin
.
builders
.
data
.
readFile
({
file
,
isBinary
});
const
provider
=
params
.
format
===
'
auto
'
?
plugin
.
dataFormats
.
auto
(
info
,
data
.
cell
?.
obj
!
)
:
plugin
.
dataFormats
.
get
(
params
.
format
);
...
...
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin-ui/controls/parameters.tsx
+
9
−
3
View file @
311f5c09
...
...
@@ -834,7 +834,13 @@ export class FileControl extends React.PureComponent<ParamProps<PD.FileParam>> {
export
class
FileListControl
extends
React
.
PureComponent
<
ParamProps
<
PD
.
FileListParam
>>
{
change
(
value
:
FileList
)
{
this
.
props
.
onChange
({
name
:
this
.
props
.
name
,
param
:
this
.
props
.
param
,
value
});
const
files
:
Asset
.
File
[]
=
[];
if
(
value
)
{
for
(
let
i
=
0
,
il
=
value
.
length
;
i
<
il
;
++
i
)
{
files
.
push
(
Asset
.
File
(
value
[
i
]));
}
}
this
.
props
.
onChange
({
name
:
this
.
props
.
name
,
param
:
this
.
props
.
param
,
value
:
files
});
}
onChangeFileList
=
(
e
:
React
.
ChangeEvent
<
HTMLInputElement
>
)
=>
{
...
...
@@ -846,8 +852,8 @@ export class FileListControl extends React.PureComponent<ParamProps<PD.FileListP
const
names
:
string
[]
=
[];
if
(
value
)
{
for
(
let
i
=
0
,
il
=
value
.
length
;
i
<
il
;
++
i
)
{
names
.
push
(
value
[
i
]
.
name
);
for
(
const
file
of
value
)
{
names
.
push
(
file
.
name
);
}
}
const
label
=
names
.
length
===
0
...
...
...
...
This diff is collapsed.
Click to expand it.
src/mol-util/param-definition.ts
+
1
−
1
View file @
311f5c09
...
...
@@ -167,7 +167,7 @@ export namespace ParamDefinition {
return
ret
;
}
export
interface
FileListParam
extends
Base
<
FileList
|
null
>
{
export
interface
FileListParam
extends
Base
<
Asset
.
File
[]
|
null
>
{
type
:
'
file-list
'
accept
?:
string
}
...
...
...
...
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