Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-add lock file, fix build breaks #297

Merged
merged 1 commit into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Tools/WinMLDashboard/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
.env.test.local
.env.production.local

# vscode
# vscode
.vscode/*

# generated static files
public/*
!public/favicon.ico
!public/index.html
!public/index.html
!public/manifest.json
!public/winml_icon.ico
!public/about.html
Expand All @@ -49,5 +49,3 @@ public/*
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
package-lock.json
12 changes: 10 additions & 2 deletions Tools/WinMLDashboard/deps/copy_netron.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,16 @@ def main():
if rebuild_needed(static_scripts, bundle_destination):
import tempfile
with tempfile.NamedTemporaryFile() as f:
f.write(bundle_scripts(static_scripts))
minify(f.name, bundle_destination)
bundled_scripts = bundle_scripts(static_scripts)
f.write(bundled_scripts)
try:
minify(f.name, bundle_destination)
except:
import traceback
traceback.print_exc()
print('Minifying Netron failed! A non-minified build will be done instead')
with open(bundle_destination, 'wb') as f:
f.write(bundled_scripts)
else:
print('Bundle is already up to date')

Expand Down
32 changes: 16 additions & 16 deletions Tools/WinMLDashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,42 @@
},
"dependencies": {
"@types/ncp": "^2.0.1",
"electron-log": "^2.2.17",
"electron-log": "^4.0.7",
"electron-squirrel-startup": "^1.0.0"
},
"devDependencies": {
"@types/fs-extra": "^5.0.4",
"@types/jest": "^23.3.0",
"@types/fs-extra": "^8.1.0",
"@types/jest": "^25.1.3",
"@types/md5": "^2.1.33",
"@types/node": "^10.5.3",
"@types/prop-types": "^15.5.4",
"@types/react": "^16.4.7",
"@types/react-dom": "^16.0.6",
"@types/react-redux": "^6.0.11",
"@types/react-select": "^2.0.6",
"@types/webdriverio": "^4.13.0",
"@types/react-redux": "^7.1.7",
"@types/react-select": "^3.0.10",
"@types/webdriverio": "^5.0.0",
"@types/yauzl": "^2.9.0",
"ajv": "^6.5.2",
"babel-minify": "^0.4.3",
"babel-minify": "^0.5.1",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"electron": "^3.0.11",
"electron-winstaller": "^2.7.0",
"fs-extra": "^7.0.1",
"electron-winstaller": "^4.0.0",
"fs-extra": "^8.1.0",
"md5": "^2.2.1",
"mocha": "^5.2.0",
"mocha": "^7.1.0",
"ncp": "^2.0.0",
"npm-font-open-sans": "^1.1.0",
"office-ui-fabric-react": "^6.40.0",
"react": "^16.5.2",
"react-app-rewired": "^1.5.2",
"react-app-rewired": "^2.1.5",
Copy link
Member

@zhangxiang1993 zhangxiang1993 Mar 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the lower version of react-app-rewired because of this timarney/react-app-rewired#358. Or you can leave this, I can chnage this in my PR.

"react-dom": "^16.4.1",
"react-markdown": "^3.4.1",
"react-redux": "^5.0.7",
"react-scripts-ts": "^2.16.0",
"react-select": "^2.1.1",
"react-markdown": "^4.3.1",
"react-redux": "^7.2.0",
"react-scripts-ts": "^3.1.0",
"react-select": "^3.0.8",
"redux": "^4.0.0",
"spectron": "^5.0.0",
"spectron": "^10.0.1",
"typescript": "^3.2.2",
"yauzl": "^2.10.0"
}
Expand Down
2 changes: 1 addition & 1 deletion Tools/WinMLDashboard/src/components/KeyValueEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class KeyValueEditor extends React.Component<IComponentProperties, IComponentSta
}

private copyRenameKey = (obj: any, oldKey: string, newKey: string) => {
return Object.entries(obj).reduce((acc: any[], keyValue: [string, string]) => {
return Object.entries(obj).reduce((previousValue: any, keyValue: [string, string], currentIndex: number, acc: any[]) => {
const [key, value] = keyValue;
acc[key === oldKey ? newKey : key] = value;
return acc;
Expand Down
23 changes: 13 additions & 10 deletions Tools/WinMLDashboard/src/view/run/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
<div className='ArgumentsControl'>
{this.getArgumentsView()}
</div>
<DefaultButton id='RunButton' text='Run'
disabled={!this.state.model || (this.state.capture === Capture.Debug && !(this.state.inputPath && this.state.outputPath))}
<DefaultButton id='RunButton' text='Run'
disabled={!this.state.model || (this.state.capture === Capture.Debug && !(this.state.inputPath && this.state.outputPath))}
onClick={this.execModelRunner}/>
</div>
)
Expand Down Expand Up @@ -322,9 +322,13 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
});
}

private logError = (error: string | Error) => {
const message = typeof error === 'string' ? error : (`${error.stack ? `${error.stack}: ` : ''}${error.message}`);
log.error(message)
private logError = (error: string | Error | Error[]) => {
const toString = (error: string | Error) => typeof error === 'string' ? error : (`${error.stack ? `${error.stack}: ` : ''}${error.message}`);
Copy link
Member

@zhangxiang1993 zhangxiang1993 Mar 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TSLint would complain shadowing variable here.

if (Array.isArray(error)) {
log.error(error.map(toString).join('\n'));
} else {
log.error(toString(error));
}
}

private printMessage = (message: string) => {
Expand All @@ -351,7 +355,7 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
save(ModelProtoSingleton.serialize(true), this.getDebugModelPath());
runPath = debugRunnerPath;
procParameters = [this.getDebugModelPath(), this.state.inputPath];
}
}

this.setState({
console: '',
Expand All @@ -367,7 +371,7 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
this.logError(e);
this.printMessage("\n---------------------------\nRun Failed!\n")
this.printMessage(`\n${(e as Error).message}`)

log.info(this.state.model + " is failed to run");
this.setState({
currentStep: Step.Idle,
Expand All @@ -393,7 +397,7 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
ncp.ncp(ModelProtoSingleton.getCurrentModelDebugDir(), filename, this.copyCallbackFunction);
}

private copyCallbackFunction = (err: Error) => {
private copyCallbackFunction = (err: Error[] | null) => {
const runDialogOptions = {
message: '',
title: 'run result',
Expand All @@ -402,7 +406,6 @@ class RunView extends React.Component<IComponentProperties, IComponentState> {
this.logError(err);
runDialogOptions.message = 'Run failed! See console log for details.'
require('electron').remote.dialog.showMessageBox(require('electron').remote.getCurrentWindow(), runDialogOptions)

} else {
runDialogOptions.message = 'Run Successful: Debug capture saved to output path'
require('electron').remote.dialog.showMessageBox(require('electron').remote.getCurrentWindow(), runDialogOptions)
Expand All @@ -422,4 +425,4 @@ const mapDispatchToProps = {
setFile,
}

export default connect(mapStateToProps, mapDispatchToProps)(RunView);
export default connect(mapStateToProps, mapDispatchToProps)(RunView);
Loading