| <template> |
| <PluginComponent |
| :infoPayload="infoPayload" |
| v-model="open" |
| cancelBtnTxt="Cancel" |
| actionBtnTxt="New Project" |
| @onPopupDone="onPopupDone" |
| :isActionBtnEnabled="true" |
| @onUserArgChanged="onUserArgChanged" |
| @onMolCountsChanged="onMolCountsChanged" |
| > |
| |
| |
| <Alert type="warning"> |
| Would you like to save the current project first? If so, press the |
| "Cancel" button, then File -> Save... |
| </Alert> |
| |
| |
| |
| |
| |
| </PluginComponent> |
| </template> |
|
|
| <script lang="ts"> |
| import { Options } from "vue-class-component"; |
| import { IContributorCredit, ISoftwareCredit } from "../../PluginInterfaces"; |
| import FormFile from "@/UI/Forms/FormFile.vue"; |
| import PluginComponent from "@/Plugins/Parents/PluginComponent/PluginComponent.vue"; |
| import { PluginParentClass } from "@/Plugins/Parents/PluginParentClass/PluginParentClass"; |
| import { UserArg } from "@/UI/Forms/FormFull/FormFullInterfaces"; |
| import { ITest } from "@/Testing/TestInterfaces"; |
| import { FileInfo } from "@/FileSystem/FileInfo"; |
| import { TestCmdList } from "@/Testing/TestCmdList"; |
| import Alert from "@/UI/Layout/Alert.vue"; |
| import { closeDownApp } from "@/Core/Utils/CloseAppUtils"; |
| import { Tag } from "@/Plugins/Core/ActivityFocus/ActivityFocusUtils"; |
| import { storeIsDirty, setStoreIsDirty } from "@/Core/SaveOnClose/DirtyStore" |
| |
| |
| |
| |
| @Options({ |
| components: { |
| PluginComponent, |
| FormFile, |
| Alert |
| }, |
| }) |
| export default class NewProjectPlugin extends PluginParentClass { |
| menuPath = "File/[1] Project/[0] New..."; |
| title = "New Project"; |
| softwareCredits: ISoftwareCredit[] = []; |
| contributorCredits: IContributorCredit[] = [ |
| // { |
| // name: "Jacob D. Durrant", |
| // url: "http://durrantlab.com/", |
| // }, |
| ]; |
| filesToLoad: FileInfo[] = []; |
| pluginId = "newproject"; |
| |
| userArgDefaults: UserArg[] = []; |
| |
| hotkey = "n"; |
| intro = "Start a new project. Your current project will be lost."; |
| details = "This plugin clears all current data and starts a fresh session."; |
| tags = [Tag.All]; |
| |
| |
| |
| |
| onPopupDone() { |
| this.closePopup(); |
| this.submitJobs(); |
| } |
| |
| |
| |
| |
| |
| async onBeforePopupOpen() { |
| if (!storeIsDirty) { |
| // Since store is not dirty, just reload page. |
| closeDownApp(undefined, false); |
| } |
| } |
| |
| |
| |
| |
| {Event | undefined} e The event (if any) that triggered this |
| * function. |
| */ |
| { |
| // if (e !== undefined) { |
| // e.preventDefault(); |
| // } |
| |
| { |
| // api.plugins.runPlugin("savemolecules", true); |
| // }, delayForPopupOpenClose); |
| |
| |
| |
| |
| |
| {Promise<void>} Resolves when the job is done. |
| */ |
| async runJobInBrowser(): Promise<void> { |
| setStoreIsDirty(false); |
| closeDownApp(undefined, false); |
| return Promise.resolve(); |
| } |
| |
| |
| |
| |
| |
| |
| {ITest[]} The selenium test commandss. |
| */ |
| async getTests(): Promise<ITest[]> { |
| return [ |
| // First test without saving first |
| { |
| beforePluginOpens: () => new TestCmdList().loadExampleMolecule(), |
| afterPluginCloses: () => new TestCmdList(), |
| }, |
| |
| |
| { |
| // beforePluginOpens: () => new TestCmdList().waitUntilRegex( |
| // "#styles", |
| // "Protein" |
| // ), |
| // closePlugin: () => new TestCmdList() |
| // .click("#modal-newproject .action-btn2") |
| // .wait(3), |
| // afterPluginCloses: () => new TestCmdList() |
| // .text( |
| // "#modal-savemolecules #filename-savemolecules-item", |
| // "test" |
| // ) |
| // .click("#modal-savemolecules .action-btn") |
| // .wait(5) |
| // .click("#modal-simplemsg .cancel-btn"), |
| // }, |
| ]; |
| } |
| } |
| </script> |
| |
| <style scoped lang="scss"> |
| .inverse-indent { |
| text-indent: -1em; |
| padding-left: 1em; |
| } |
| </style> |
|
|