Skip to content

Commit

Permalink
#2250 Automatically show properties editor after choosing file from s…
Browse files Browse the repository at this point in the history
…ystem-fixing-final

Signed-off-by: Jerin George <[email protected]>
  • Loading branch information
Jerinjk14 committed Dec 3, 2024
1 parent 238bc29 commit d60ed75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default class SidePanelForms extends React.Component {
var filename = evt.target.files[0].name;
var fileExt = filename.substring(filename.lastIndexOf(".") + 1);
if (fileExt === "json") {
this.setState({ canvasDiagram: evt.target.files[0] });
this.setState({ canvasDiagram: evt.target.files[0] }, () => this.submitCanvas());
this.props.log("Canvas diagram JSON file selected", filename);
}
}
Expand All @@ -173,7 +173,7 @@ export default class SidePanelForms extends React.Component {
var filename = evt.target.files[0].name;
var fileExt = filename.substring(filename.lastIndexOf(".") + 1);
if (fileExt === "json") {
this.setState({ canvasDiagram2: evt.target.files[0] });
this.setState({ canvasDiagram2: evt.target.files[0] }, () => this.submitCanvas2());
this.props.log("Canvas diagram JSON file selected", filename);
}
}
Expand All @@ -186,7 +186,7 @@ export default class SidePanelForms extends React.Component {
var filename = evt.target.files[0].name;
var fileExt = filename.substring(filename.lastIndexOf(".") + 1);
if (fileExt === "json") {
this.setState({ canvasPalette: evt.target.files[0] });
this.setState({ canvasPalette: evt.target.files[0] }, () => this.submitPalette());
this.props.log("Canvas palette JSON file selected", filename);
}
}
Expand All @@ -199,7 +199,7 @@ export default class SidePanelForms extends React.Component {
var filename = evt.target.files[0].name;
var fileExt = filename.substring(filename.lastIndexOf(".") + 1);
if (fileExt === "json") {
this.setState({ canvasPalette2: evt.target.files[0] });
this.setState({ canvasPalette2: evt.target.files[0] }, () => this.submitPalette2());
this.props.log("Canvas palette JSON file selected", filename);
}
}
Expand Down Expand Up @@ -404,15 +404,7 @@ export default class SidePanelForms extends React.Component {
small={"true"}
buttonLabel="Choose file"
accept={[".json"]}
onChange={(evt) => {
this.onCanvasFileSelect(evt);
// Time out for completing the action
setTimeout(() => {
if (this.isReadyToSubmitCanvasData) {
this.submitCanvas();
}
}, 0);
}}
onChange={this.onCanvasFileSelect}
iconDescription="Delete file"
filenameStatus={this.isReadyToSubmitCanvasData ? "complete" : "uploading"}
/>
Expand All @@ -435,14 +427,7 @@ export default class SidePanelForms extends React.Component {
small={"true"}
buttonLabel="Choose file"
accept={[".json"]}
onChange={(evt) => {
this.onCanvasPaletteSelect(evt);
setTimeout(() => {
if (this.isReadyToSubmitPaletteData) {
this.submitPalette();
}
}, 0);
}}
onChange={this.onCanvasPaletteSelect}
iconDescription="Delete file"
filenameStatus={this.isReadyToSubmitPaletteData ? "complete" : "uploading"}
/>
Expand Down Expand Up @@ -493,14 +478,7 @@ export default class SidePanelForms extends React.Component {
small={"true"}
buttonLabel="Chose file"
accept={[".json"]}
onChange={(evt) => {
this.onCanvasFileSelect2(evt);
setTimeout(() => {
if (this.isReadyToSubmitCanvasData2) {
this.submitCanvas2();
}
}, 0);
}}
onChange={this.onCanvasFileSelect2}
iconDescription="Delete file"
filenameStatus={this.isReadyToSubmitCanvasData2 ? "complete" : "uploading"}
/>
Expand All @@ -524,14 +502,7 @@ export default class SidePanelForms extends React.Component {
small={"true"}
buttonLabel="Chose file"
accept={[".json"]}
onChange={(evt) => {
this.onCanvasPaletteSelect2(evt);
setTimeout(() => {
if (this.isReadyToSubmitPaletteData2) {
this.submitPalette2();
}
}, 0);
}}
onChange={this.onCanvasPaletteSelect2}
iconDescription="Delete file"
filenameStatus={this.isReadyToSubmitPaletteData2 ? "complete" : "uploading"}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default class SidePanelProperties extends React.Component {
if (fileExt === "json") {
this.setState({
commonProperties: evt.target.files[0],
});
}, () => this.submitProperties());
this.props.log("Common Properties JSON file selected", filename);
}
}
Expand Down Expand Up @@ -258,14 +258,7 @@ export default class SidePanelProperties extends React.Component {
small={"true"}
buttonLabel="Choose file"
accept={[".json"]}
onChange={(evt) => {
this.onPropertiesSelect(evt);
setTimeout(() => {
if (this.isReadyToSubmitProperties) {
this.submitProperties();
}
}, 0);
}}
onChange={this.onPropertiesSelect}
iconDescription="Delete file"
filenameStatus={this.isReadyToSubmitProperties ? "complete" : "uploading"}
/>
Expand Down

0 comments on commit d60ed75

Please sign in to comment.