| <template> |
| <PluginComponent |
| v-model="open" |
| :infoPayload="infoPayload" |
| actionBtnTxt="Rename" |
| @onPopupDone="onPopupDone" |
| @onUserArgChanged="onUserArgChanged" |
| @onMolCountsChanged="onMolCountsChanged" |
| ></PluginComponent> |
| </template> |
| <script lang="ts"> |
| import { Options } from "vue-class-component"; |
| import { IContributorCredit, ISoftwareCredit } from "../../PluginInterfaces"; |
| import { PluginParentClass } from "@/Plugins/Parents/PluginParentClass/PluginParentClass"; |
| import PluginComponent from "@/Plugins/Parents/PluginComponent/PluginComponent.vue"; |
| import { UserArg, IUserArgText } from "@/UI/Forms/FormFull/FormFullInterfaces"; |
| import { setStoreVar } from "@/Store/StoreExternalAccess"; |
| import { Tag } from "@/Plugins/Core/ActivityFocus/ActivityFocusUtils"; |
| import { ITest } from "@/Testing/TestInterfaces"; |
| import { TestCmdList } from "@/Testing/TestCmdList"; |
| |
| |
| |
| |
| @Options({ |
| components: { |
| PluginComponent, |
| }, |
| }) |
| export default class RenameProjectPlugin extends PluginParentClass { |
| menuPath = "File/[1] Project/[2] Rename..."; |
| title = "Rename Project"; |
| softwareCredits: ISoftwareCredit[] = []; |
| contributorCredits: IContributorCredit[] = []; |
| pluginId = "renameproject"; |
| intro = "Rename the current project."; |
| details = "This plugin changes the title of the project, which is also used as the default filename when saving."; |
| tags = [Tag.All]; |
| userArgDefaults: UserArg[] = [ |
| { |
| id: "newProjectTitle", |
| label: "Project title", |
| val: "", |
| placeHolder: "New project title...", |
| description: "The new title for the current project.", |
| validateFunc: (val: string) => val.trim().length > 0, |
| } as IUserArgText, |
| ]; |
| logJob = false; |
| |
| |
| |
| |
| {any} payload The payload passed to the plugin. |
| * @returns {Promise<void>} |
| */ |
| async onBeforePopupOpen(payload: any): Promise<void> { |
| this.setUserArg("newProjectTitle", this.$store.state.projectTitle); |
| } |
| |
| |
| |
| |
| onPopupDone() { |
| const newTitle = this.getUserArg("newProjectTitle"); |
| setStoreVar("projectTitle", newTitle); |
| this.closePopup(); |
| } |
| |
| |
| |
| |
| {Promise<void>} |
| */ |
| async runJobInBrowser(): Promise<void> { |
| return Promise.resolve(); // No async job, onPopupDone handles it. |
| } |
| |
| |
| |
| |
| |
| |
| {ITest} The selenium test commands. |
| */ |
| async getTests(): Promise<ITest> { |
| return { |
| beforePluginOpens: () => new TestCmdList().loadExampleMolecule(), |
| pluginOpen: () => new TestCmdList().setUserArg( |
| "newProjectTitle", |
| "My New Project Name", |
| this.pluginId |
| ), |
| afterPluginCloses: () => new TestCmdList(), // Vuex store change will be tested by tab title change which is not easy to check here. |
| }; |
| } |
| } |
| </script> |