File size: 3,735 Bytes
71174bc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | <template>
<PluginComponent
v-model="open"
:infoPayload="infoPayload"
@onPopupDone="onPopupDone"
@onUserArgChanged="onUserArgChanged"
></PluginComponent>
</template>
<script lang="ts">
import {
IContributorCredit,
ISoftwareCredit,
} from "@/Plugins/PluginInterfaces";
import {
UserArg,
IUserArgGroup,
IUserArgMoleculeInputParams,
IUserArgNumber,
} from "@/UI/Forms/FormFull/FormFullInterfaces";
import { MoleculeInput } from "@/UI/Forms/MoleculeInputParams/MoleculeInput";
import { Options } from "vue-class-component";
import PluginComponent from "../Parents/PluginComponent/PluginComponent.vue";
import { PluginParentClass } from "../Parents/PluginParentClass/PluginParentClass";
import { ITest } from "@/Testing/TestInterfaces";
/**
* QueSystemTestPlugin
*/
@Options({
components: {
PluginComponent,
},
})
export default class QueSystemTestPlugin extends PluginParentClass {
menuPath = "[7] Test/Test Component Queue System...";
title = "Load Molecule from PubChem";
softwareCredits: ISoftwareCredit[] = [];
contributorCredits: IContributorCredit[] = [
// {
// name: "Jacob D. Durrant",
// url: "http://durrantlab.com/",
// },
];
pluginId = "testplugin2";
intro = `This is a <b>test</b> component.`;
msgOnJobsFinished = "All jobs finished, moo.";
userArgDefaults: UserArg[] = [
{
// type: UserArgType.Number,
id: "moose",
label: "Moose",
val: 0,
} as IUserArgNumber,
{
// type: UserArgType.MoleculeInputParams,
id: "makemolinputparams",
val: new MoleculeInput({ compoundFormat: "can" }),
} as IUserArgMoleculeInputParams,
{
id: "group",
// type: UserArgType.Group,
label: "Labelme",
val: [
{
// type: UserArgType.Number,
id: "moose2",
label: "Moose2",
val: 0,
},
{
// type: UserArgType.Text,
id: "moose3",
label: "Moose3",
val: "face",
},
],
startOpened: true,
} as IUserArgGroup,
];
/**
* Runs when the user presses the action button and the popup closes.
*/
onPopupDone() {
const jobParams = [];
for (let i = 0; i < 10; i++) {
const jobParam = {
delay: Math.random() * 10000, // ms
};
jobParams.push(jobParam);
}
this.submitJobs(jobParams, Math.round(Math.random() * 2)); // , 10000);
}
/**
* Every plugin runs some job. This is the function that does the job running.
*
* @param {any} _args The user arguments to pass to the "executable."
* @returns {Promise<undefined>} A promise that resolves when the job is
* done.
*/
runJobInBrowser(_args: any): Promise<void> {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, _args.delay);
});
// console.log(_args);
// Submit some jobs that delay randomly.
// debugger;
// return Promise.resolve(undefined);
}
/**
* Gets the test commands for the plugin. For advanced use.
*
* @gooddefault
* @document
* @returns {ITest[]} The selenium test commands.
*/
getTests(): ITest[] {
// No tests for this simple plugin.
return [];
}
}
</script>
<style scoped lang="scss"></style>
|