mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-03 09:55:01 +00:00
configurator: fix displayed scenario path
fix displayed scenario path Tracked-On: #6691 Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
This commit is contained in:
@@ -66,15 +66,12 @@ export default class CreateNewOrImportAnExistingScenario extends Component {
|
|||||||
let {configurator} = this.context
|
let {configurator} = this.context
|
||||||
return configurator.programLayer.loadScenario(this.scenarioXMLSelect.current.value)
|
return configurator.programLayer.loadScenario(this.scenarioXMLSelect.current.value)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
let printPath = configurator.WorkingFolder;
|
this.setState({selected: this.getScenarioPath()})
|
||||||
if (_.endsWith(configurator.WorkingFolder, "/") || _.endsWith(configurator.WorkingFolder, "\\")) {
|
|
||||||
printPath = printPath + 'scenario.xml'
|
|
||||||
} else {
|
|
||||||
printPath = printPath + (configurator.WorkingFolder[1] === ":" ? "\\" : '/') + 'scenario.xml'
|
|
||||||
}
|
|
||||||
this.setState({selected: printPath})
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
document.querySelectorAll(".accordion-button")[2].click()
|
let tabButton = document.querySelectorAll(".accordion-button")[2];
|
||||||
|
if (tabButton.className.indexOf('collapsed') >= 0) {
|
||||||
|
tabButton.click()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((reason) => {
|
.catch((reason) => {
|
||||||
console.log(reason)
|
console.log(reason)
|
||||||
@@ -82,6 +79,17 @@ export default class CreateNewOrImportAnExistingScenario extends Component {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getScenarioPath = () => {
|
||||||
|
let {configurator} = this.context
|
||||||
|
let printPath = configurator.WorkingFolder;
|
||||||
|
if (_.endsWith("/", configurator.WorkingFolder) || _.endsWith("\\", configurator.WorkingFolder)) {
|
||||||
|
printPath = printPath + 'scenario.xml'
|
||||||
|
} else {
|
||||||
|
printPath = printPath + (configurator.WorkingFolder[1] === ":" ? "\\" : '/') + 'scenario.xml'
|
||||||
|
}
|
||||||
|
return printPath;
|
||||||
|
}
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
let {configurator} = this.context
|
let {configurator} = this.context
|
||||||
let scenarioHistorySelect = this.state.scenarioConfigFiles.map((optionValue, index) => {
|
let scenarioHistorySelect = this.state.scenarioConfigFiles.map((optionValue, index) => {
|
||||||
@@ -101,7 +109,7 @@ export default class CreateNewOrImportAnExistingScenario extends Component {
|
|||||||
{this.state.selected ? this.state.selected : "none selected"}</p>
|
{this.state.selected ? this.state.selected : "none selected"}</p>
|
||||||
<div className="py-4 text-center">
|
<div className="py-4 text-center">
|
||||||
<CreateScenarioModal cb={() => {
|
<CreateScenarioModal cb={() => {
|
||||||
this.setState({selected: configurator.WorkingFolder + '/scenario.xml'})
|
this.setState({selected: this.getScenarioPath()})
|
||||||
}}/>
|
}}/>
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
|
Reference in New Issue
Block a user