Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Working towards compatibility with updated file-loading system.
- Loading branch information
jdurrant
committed
Mar 13, 2022
1 parent
1ff8d3d
commit 123afe6
Showing
56 changed files
with
13,401 additions
and
11,293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
web_app/src/UI/FileLoaderSystem/Common/CommonProps.VueFuncs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Released under the Apache 2.0 License. See LICENSE.md or go to | ||
// https://opensource.org/licenses/Apache-2.0 for full details. Copyright 2022 | ||
// Jacob D. Durrant. | ||
|
||
// A place to put properties that are common to multiple components. | ||
|
||
// Common to mol-loader, and file loaders. | ||
export var commonMultipleFilesProps = { | ||
"multipleFiles": { | ||
"type": Boolean, | ||
"default": false | ||
}, | ||
"saveMultipleFilesToDatabase": { | ||
// Saves copies of files to database for use elsewhere (even after page | ||
// reload). But I can imagine scenarios when you'd want to load multiple | ||
// files without realoading the page, so false by default. | ||
"type": Boolean, | ||
"default": false | ||
}, | ||
} | ||
|
||
// Properties common to file load, from PDB, from URL, etc. | ||
export var commonFileLoaderProps = { | ||
"id": { | ||
"type": String, | ||
"required": false | ||
}, | ||
"required": { | ||
"type": Boolean, | ||
"default": true, | ||
}, | ||
"accept": { | ||
"type": String, | ||
"default": "", // e.g., ".pdbqt, .out, .pdb" | ||
}, | ||
"convert": { | ||
"type": String, | ||
"default": "", // e.g., ".sdf, .mol2" | ||
}, | ||
"valid": { | ||
"type": Boolean, | ||
"default": true | ||
} | ||
} | ||
|
||
export var commonProteinEditingProps = { | ||
"allowAtomExtract": { | ||
"type": Boolean, | ||
"default": false | ||
}, | ||
"allowAtomDelete": { | ||
"type": Boolean, | ||
"default": true | ||
} | ||
} | ||
|
||
// Used in both queue-catcher and queue-controller. | ||
export var commonQueueProps = { | ||
"trigger": { | ||
"type": Boolean, | ||
"default": false, | ||
"required": true | ||
}, | ||
"countDownSeconds": { | ||
"type": Number, | ||
"default": 5 | ||
}, | ||
"molLoaderIds": { | ||
"type": Array, | ||
"required": true | ||
}, | ||
"outputZipFilename": { | ||
"type": String, | ||
"default": "output.zip" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,55 @@ | ||
// This file is released under the Apache 2.0 License. See | ||
// https://opensource.org/licenses/Apache-2.0 for full details. Copyright 2021 | ||
// https://opensource.org/licenses/Apache-2.0 for full details. Copyright 2022 | ||
// Jacob D. Durrant. | ||
|
||
import { ISelection, ParentMol } from "../Mols/ParentMol"; | ||
|
||
export interface IVueXVar { | ||
name: string; | ||
val: any; | ||
} | ||
|
||
export interface IConvert extends IFileInfo{ | ||
onConvertDone: Function; | ||
export interface IConvert extends IFileInfo { | ||
onConvertDone: Function; // Must return IFileInfo | ||
onConvertCancel: Function; | ||
} | ||
|
||
export interface IFileInfo { | ||
filename: string; | ||
fileContents: string; | ||
// onConvertDone: IConvert; | ||
// convertedResolveFunc?: Function; | ||
// convertedRejectFunc?: Function; | ||
// id?: string; // associated component id | ||
mol: ParentMol; | ||
} | ||
|
||
export interface IFileLoadError { | ||
title: string; | ||
body: string; | ||
} | ||
|
||
// export interface IFileFromTextField { | ||
// placeholder: string; | ||
// tabName: string; | ||
// loadFunc: Function | ||
// onSuccess: Function; | ||
// onError: Function; | ||
// } | ||
|
||
export interface IAllFiles { | ||
selectedFilename: string; | ||
allFiles: {[key: string]: string}; // filename => contents | ||
} | ||
|
||
export interface IResidueInfo { | ||
residueId: string[], | ||
residuePdbLines: string | ||
export interface IExtractInfo { | ||
selection: ISelection[], | ||
pdbLines: string, | ||
origFilename: string, | ||
suggestedNewFilename: string | ||
} | ||
|
||
/** | ||
* Converts ISelection to a string for labelling. | ||
* @param {ISelection} sel | ||
* @returns string | ||
*/ | ||
export function iSelectionToStr(sel: ISelection): string { | ||
if (sel["chains"] && !sel["resnames"] && !sel["resids"]) { | ||
// Only has chain. | ||
return "Chain: " + sel["chains"]; | ||
} | ||
|
||
let prts = []; | ||
if (sel["resnames"]) { prts.push(sel["resnames"]); } | ||
if (sel["resids"]) { prts.push(sel["resids"]); } | ||
if (sel["chains"]) { prts.push(sel["chains"]); } | ||
return prts.join(":"); | ||
} |
2 changes: 2 additions & 0 deletions
2
web_app/src/UI/FileLoaderSystem/Common/SmallPillBtn.Vue/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
You can omit this if this component is registered globally (lots of other | ||
components you use might already be using this one). |
53 changes: 53 additions & 0 deletions
53
web_app/src/UI/FileLoaderSystem/Common/SmallPillBtn.Vue/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// This file is released under the Apache 2.0 License. See | ||
// https://opensource.org/licenses/Apache-2.0 for full details. Copyright 2022 | ||
// Jacob D. Durrant. | ||
|
||
declare var Vue; | ||
|
||
/** An object containing the vue-component computed functions. */ | ||
let computedFunctions = {} | ||
|
||
/** | ||
* Setup the small-pill-btn Vue commponent. | ||
* @returns void | ||
*/ | ||
export function setupSmallPillBtn(): void { | ||
Vue.component('small-pill-btn', { | ||
/** | ||
* Get the data associated with this component. | ||
* @returns any The data. | ||
*/ | ||
"data": function() { | ||
return {} | ||
}, | ||
"computed": computedFunctions, | ||
"template": /* html */ ` | ||
<b-button | ||
pill :variant="actionStyling === 'delete' ? 'secondary' : 'outline-secondary'" size="sm" | ||
class="py-0 px-1" | ||
style="line-height:14px; font-size:90%; margin-right:2px;" | ||
@click="onClick" | ||
> | ||
<span | ||
v-if="actionStyling === 'extract'" | ||
style="display:inline-block; transform: scaleX(-1);">➚ | ||
</span> | ||
<span v-else>✖</span> | ||
<slot></slot> | ||
</b-button> | ||
<!-- style="line-height:14px; font-size:80%;" --> | ||
`, | ||
"props": { | ||
"actionStyling": { | ||
"type": String, | ||
"default": "delete" // Can also be "extract" | ||
} | ||
}, | ||
"methods": { | ||
"onClick"(): void { | ||
this.$emit("click"); | ||
} | ||
}, | ||
"mounted"() {} | ||
}) | ||
} |
Oops, something went wrong.