Commit 5af6835b authored by Jacob Durrant's avatar Jacob Durrant
Browse files

Added docstrings.

parent 141a4ebc
......@@ -5,24 +5,47 @@
declare var Vue;
/**
* Setup the check-box Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('check-box', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {}
},
"computed": {
"val": {
get() {
/**
* Get the value from the vinaParams object.
* @returns any
*/
get(): any {
return this.$store.state["vinaParams"][this["id"]];
},
set(val) {
/**
* Set the vinaParams object value.
* @param {any} val The new value.
* @returns void
*/
set(val: any): void {
this.$store.commit("setVinaParam", {
name: this["id"],
val: val
});
}
},
"desc"() {
/**
* Generates a description string.
* @returns string The description.
*/
"desc"(): string {
return this["description"] + (this["required"] !== true ? " (Leave blank to use default value.)" : "");
}
},
......
......@@ -5,9 +5,17 @@
declare var Vue;
/**
* Setup the file-input Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('file-input', {
"data": function() {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data"(): any {
return {
"file": false
}
......@@ -49,10 +57,20 @@ export function setup(): void {
},
"computed": {
"val": {
get() {
/**
* Get the file.
* @returns any A blob?
*/
get(): any {
return this["file"]
},
set(val) {
/**
* Set the vinaParams object value.
* @param {any} val The new value.
* @returns void
*/
set(val: any): void {
if (val === null) {
// Reseting the value. Nothing to do here.
return;
......@@ -116,11 +134,21 @@ export function setup(): void {
fr.readAsArrayBuffer(val);
}
},
/**
* Determine whether the component value is valid.
* @returns boolean True if it is valid, false otherwise.
*/
"isValid"(): boolean {
return (this["file"] !== false) && (this["file"] !== null);
}
},
"mounted"() {
/**
* Runs when the vue component is mounted.
* @returns void
*/
"mounted"(): void {
// Make default validation entry.
if (this.$store.state["validation"][this["id"]] === undefined) {
this.$store.commit("setValidationParam", {
......
......@@ -5,12 +5,24 @@
declare var Vue;
/**
* Setup the form-button Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('form-button', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {}
},
"computed": {
/**
* Determine which class to add to this buttno.
* @returns string The classes.
*/
"classToUse"(): string {
let classes = [this["cls"]];
if (this["small"] === true) {
......@@ -18,6 +30,11 @@ export function setup(): void {
}
return classes.join(" ");
},
/**
* Determine which button size to use.
* @returns string The size.
*/
"sizeToUse"(): string {
if (this["small"] === true) {
return "sm";
......
......@@ -5,18 +5,40 @@
declare var Vue;
/**
* Setup the form-group Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('form-group', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {}
},
"computed": {
/**
* Determines whether this component has a label.
* @returns boolean True if it does, false otherwise.
*/
hasLabel(): boolean {
return this["label"] !== "" && this["label"] !== undefined;
},
/**
* Determines if label should be placed to the left or above.
* @returns number Returns 3 if it has a label, 0 otherwise.
*/
"labelCols"(): number {
return ((this.hasLabel === true) && (this["labelToLeft"] === true)) ? 3 : 0;
},
/**
* Determines if label should be placed to the left or above.
* @returns number Returns 2 if it has a label, 0 otherwise.
*/
"labelColsLg"(): number {
return ((this.hasLabel === true) && (this["labelToLeft"] === true)) ? 2 : 0;
}
......
......@@ -5,8 +5,16 @@
declare var Vue;
/**
* Setup the numeric-input Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('numeric-input', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {
"invalidMsg": "This field is required."
......@@ -14,10 +22,20 @@ export function setup(): void {
},
"computed": {
"val": {
get() {
/**
* Get the value from the vinaParams object.
* @returns any
*/
get(): any {
return this.$store.state["vinaParams"][this["id"]];
},
set(val) {
/**
* Set the vinaParams object value.
* @param {any} val The new value.
* @returns void
*/
set(val: any): void {
// Save the value to the store
val = (val === "") ? undefined : +val;
if (isNaN(val)) {
......@@ -54,6 +72,11 @@ export function setup(): void {
});
}
},
/**
* Generates a description string.
* @returns string The description.
*/
"desc"(): string {
let toAdd = "";
if ((this["required"] !== true) && (this["default"] === undefined)) {
......@@ -61,6 +84,11 @@ export function setup(): void {
}
return this["description"] + toAdd;
},
/**
* Determine whether the component value is valid.
* @returns boolean True if it is valid, false otherwise.
*/
"isValid"(): boolean {
let val = this.$store.state["validation"][this["id"]];
return val;
......@@ -108,7 +136,12 @@ export function setup(): void {
"default": undefined
}
},
"mounted"() {
/**
* Runs when the vue component is mounted.
* @returns void
*/
"mounted"(): void {
// Always start by assuming it validates fine.
if (this.$store.state["validation"][this["id"]] === undefined) {
this.$store.commit("setValidationParam", {
......
......@@ -5,8 +5,16 @@
declare var Vue;
/**
* Setup the triple-numeric-input Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('triple-numeric-input', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {}
},
......
......@@ -5,27 +5,55 @@
declare var Vue;
/**
* Setup the open-modal Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('open-modal', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {}
},
"computed": {
"modalShow": {
get() {
/**
* Get the modalShow value..
* @returns boolean
*/
get(): boolean {
return this.$store.state["modalShow"];
},
set(val) {
/**
* Set the mmodalShow value.
* @param {boolean} val The new value.
* @returns void
*/
set(val: boolean): void {
this.$store.commit("setVar", {
name: "modalShow",
val
});
}
},
"title"() {
/**
* Gets the modal title.
* @returns string The title.
*/
"title"(): string {
return this.$store.state["modalTitle"];
},
"body"() {
/**
* Get's the modal body.
* @returns string The body.
*/
"body"(): string {
return this.$store.state["modalBody"];
}
},
......
......@@ -5,12 +5,24 @@
declare var Vue;
/**
* Setup the results-table Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('results-table', {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data": function() {
return {}
},
"computed": {
/**
* Gets the items in the results table.
* @returns any[] The array of items.
*/
"items"(): any[] {
// let data = [[[1,48.4,0,0],"HETATM 1 C"],[[1,48.4,0,0],"HETATM 1 C"],[[1,48.4,0,0],"HETATM 1 C"]]; //this.$store.state["pdbOutputFrames"];
let data = this.$store.state["pdbOutputFrames"];
......@@ -45,6 +57,11 @@ export function setup(): void {
}
return items;
},
/**
* Get's the field descriptions of each item in the results list.
* @returns any[] A list of the field descriptions.
*/
"fields"(): any[] {
return [
{
......@@ -72,7 +89,13 @@ export function setup(): void {
`,
"props": {},
"methods": {
"rowClicked"(data, idx) {
/**
* Runs when the table row is clicked. Updates visualization.
* @param {any} data Not used.
* @param {number} idx The index of the clicked row.
* @returns void
*/
"rowClicked"(data: any, idx: number): void {
let ligPDBTxt = this.$store.state["pdbOutputFrames"][idx][1];
this.$store.commit("setVar", {
name: "dockedContents",
......
......@@ -5,9 +5,17 @@
declare var Vue;
/**
* Setup the sub-section Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('sub-section', {
"data": function() {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data"(): any {
return {}
},
"computed": {},
......
......@@ -5,6 +5,10 @@
declare var Vue;
/**
* Setup the start-over Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('start-over', {
"template": `
......@@ -15,15 +19,23 @@ export function setup(): void {
`,
"props": {},
"computed": {},
"data"() {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data"(): any {
return {}
},
"methods": {
/**
* Runs when the start-over button is clicked.
* @returns void
*/
"onSubmitClick"(): void {
jQuery("body").addClass("waiting");
location.reload();
}
},
"mounted"() {}
}
})
}
......@@ -5,6 +5,10 @@
declare var Vue;
/**
* Setup the vina-existing-output Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('vina-existing-output', {
"template": `
......@@ -49,10 +53,20 @@ export function setup(): void {
`,
"props": {},
"computed": {},
"data"() {
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data"(): any {
return {}
},
"methods": {
/**
* Runs when the user indicates he or she wants to use example
* output files rather than provide their own.
* @returns void
*/
"useExampleOutputFiles"(): void {
// These values should now validate.
let validateVars = ["receptor", "output"];
......@@ -85,7 +99,16 @@ export function setup(): void {
this["onSubmitClick"](null, promise);
},
"onSubmitClick"(e, promise=undefined): void {
/**
* Runs when the user clicks the submit button.
* @param {any} e Not sure what this
* is.
* @param {Promise<any>=undefined} promise A promise to continue
* from.
* @returns void
*/
"onSubmitClick"(e: any, promise: Promise<any>=undefined): void {
if (this["validate"]() === true) {
// Disable some tabs
this.$store.commit("disableTabs", {
......@@ -113,6 +136,12 @@ export function setup(): void {
});
}
},
/**
* Determines whether valid parameters have been provided.
* Otherwise, cannot display the mock Vina output.
* @returns boolean True if everything is valid, false otherwise.
*/
"validate"(): boolean {
let validations = this.$store.state["validation"];
......@@ -135,7 +164,6 @@ export function setup(): void {
return validate;
},
},
"mounted"() { return; }
}
})
}
......@@ -6,6 +6,10 @@
declare var Vue;
declare var FileSaver;
/**
* Setup the vina-output Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('vina-output', {
"template": `
......@@ -69,30 +73,56 @@ export function setup(): void {
`,
"props": {},
"computed": {
/**
* Get's Vina's standard output.
* @returns string The standard output.
*/
"stdOut"(): string {
return this.$store.state["stdOut"];
},
/**
* Get's Vina's output file.
* @returns string The output file.
*/
"outputContents"(): string {
return this.$store.state["outputContents"];
},
/**
* Get the execution time.
* @returns string The time.
*/
"time"(): string {
return this.$store.state["time"].toString();
}
},
/**
* Get the data associated with this component.
* @returns any The data.
*/
"data"() {
return {}
},
"methods": {
/**
* Runs when the user clicks the stdout download button.
* @returns void
*/
"stdOutDownload"(): void {
var blob = new Blob([this["stdOut"]], {type: "text/plain;charset=utf-8"});
FileSaver.saveAs(blob, "stdout.txt");
},
/**
* Runs when the user clicks the download output button.
* @returns void
*/
"vinaOutputContentsDownload"(): void {
var blob = new Blob([this["outputContents"]], {type: "text/plain;charset=utf-8"});
FileSaver.saveAs(blob, "webina_out.pdbqt");
}
},
"mounted"() { return; }
}
})
}
......@@ -8,6 +8,10 @@ import * as Utils from "../../Utils";
declare var Vue;
declare var Webina;
/**
* Setup the vina-params Vue commponent.
* @returns void
*/
export function setup(): void {
Vue.component('vina-params', {
"template": `
......@@ -236,10 +240,21 @@ export function setup(): void {
`,
"props": {},
"computed": {
/**
*
* Whether to hide the vina docking-box parameters.
* @returns boolean True if they should be hidden, false
* otherwise.
*/
"hideDockingBoxParams"(): boolean {
return this.$store.state.hideDockingBoxParams;
}
},
/**