microsoft / VoTT

Visual Object Tagging Tool: An electron app for building end to end Object Detection Models from Images and Videos.
MIT License
4.3k stars 837 forks source link

When click export, it should ask to confirm the action #892

Open YanZhangADS opened 5 years ago

YanZhangADS commented 5 years ago

Is your feature request related to a problem? Please describe. When I click "export", it does not ask for confirm - whether to overwrite previous annotation or not; whether the export location/format are correct, etc. I accidentally clicked "export" twice.

Describe the solution you'd like VoTT should ask the user to confirm the action when user clicks "export".

Describe alternatives you've considered NA

Additional context NA

yeshwanth3012 commented 2 years ago

As VoTT code uses one button component to call every function in the tool bar its quite a bit complicate to use export so i tried this new method works fine so whenever the button is clicked it is calling OnClick function from their it is redirecting to the the respective button functionality so i introduced the confirm component in the component where export functionality is called and also it is inherited with main component where in confirm component i called the export functionality in "\src\react\components\toolbar\toolbarItem.tsx" Create reference to the confirm component public ExportConfirm: React.RefObject = React.createRef(); Import confirm component

<Confirm title="Do you want to export Project" ref={this.ExportConfirm as any} // message={(project: IProject) =>${strings.homePage.deleteProject.confirmation} ${project.name}?} message="Do you want to export Project" confirmButtonColor="success" onConfirm={this.onItemClick1} /> copy export functionality from '\src\react\components\toolbar\exportProject.tsx' to toolbar component public onItemClick1 = async () => { const infoId = toast.info(Started export for ${this.props.project.name}...`, { autoClose: false }); const results = await this.props.actions.exportProject(this.props.project);

    toast.dismiss(infoId);

    if (!results || (results && results.errors.length === 0)) {
        toast.success(`Export completed successfully!`);
    } else if (results && results.errors.length > 0) {
        toast.warn(`Successfully exported ${results.completed.length}/${results.count} assets`);
    }
}`

In "\src\react\components\toolbar\exportProject.tsx" call confiem component protected onItemClick = ()=>{ this.ExportConfirm.current.open() }