Skip to content

Commit

Permalink
prettier format all webapp code
Browse files Browse the repository at this point in the history
  • Loading branch information
Enet4 committed May 21, 2020
1 parent 1888b6d commit d8b5403
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class AETitleForm extends React.Component {
<div
className="loader-inner ball-pulse"
style={{ visibility: this.props.onhold ? "visible" : "hidden" }}
></div>
/>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,94 +5,93 @@ import AETitleStore from "../../stores/aetitleStore";
import $ from "jquery";

const AETitleView = React.createClass({
getInitialState() {
return {
aetitleText: "",
dirtyValue: false, // aetitle value has unsaved changes
status: "loading"
};
},
getInitialState() {
return {
aetitleText: "",
dirtyValue: false, // aetitle value has unsaved changes
status: "loading"
};
},

componentWillMount() {
this.unsubscribe = AETitleStore.listen(this._onChange);
},
componentWillMount() {
this.unsubscribe = AETitleStore.listen(this._onChange);
},

componentWillUnmount() {
this.unsubscribe();
},
componentWillUnmount() {
this.unsubscribe();
},

componentDidMount() {
AETitleActions.getAETitle();
},
componentDidMount() {
AETitleActions.getAETitle();
},

_onChange(data) {
let toastMessage = data.success ? "Saved." : data.message;
_onChange(data) {
let toastMessage = data.success ? "Saved." : data.message;

if (this.state.status === "done") {
$(".toast")
.stop()
.text(toastMessage)
.fadeIn(400)
.delay(3000)
.fadeOut(400); // fade out after 3 seconds
}

if (!data.success) {
this.setState({
dirtyValue: true
});
} else {
this.setState({
aetitleText: data.message,
status: "done"
});
}
},
if (this.state.status === "done") {
$(".toast")
.stop()
.text(toastMessage)
.fadeIn(400)
.delay(3000)
.fadeOut(400); // fade out after 3 seconds
}

render() {
if (this.state.status === "loading") {
return (
<div className="loader-inner ball-pulse">
<div />
<div />
<div />
</div>
);
}
if (!data.success) {
this.setState({
dirtyValue: true
});
} else {
this.setState({
aetitleText: data.message,
status: "done"
});
}
},

return (
<div className="panel panel-primary topMargin">
<div className="panel-heading">
<h3 className="panel-title">AETitle</h3>
</div>
<div className="panel-body">
<AETitleForm
aetitleText={this.state.aetitleText}
onChangeAETitle={this.handleAETitleChange}
onSubmitAETitle={this.handleSubmitAETitle}
dirtyValue={this.state.dirtyValue}
/>
</div>
<div className="toast">Saved</div>
</div>
render() {
if (this.state.status === "loading") {
return (
<div className="loader-inner ball-pulse">
<div />
<div />
<div />
</div>
);
}

);
},
return (
<div className="panel panel-primary topMargin">
<div className="panel-heading">
<h3 className="panel-title">AETitle</h3>
</div>
<div className="panel-body">
<AETitleForm
aetitleText={this.state.aetitleText}
onChangeAETitle={this.handleAETitleChange}
onSubmitAETitle={this.handleSubmitAETitle}
dirtyValue={this.state.dirtyValue}
/>
</div>
<div className="toast">Saved</div>
</div>
);
},

handleAETitleChange(aetitle) {
this.setState({
aetitleText: aetitle,
dirtyValue: true
});
},
handleAETitleChange(aetitle) {
this.setState({
aetitleText: aetitle,
dirtyValue: true
});
},

handleSubmitAETitle() {
this.setState({
dirtyValue: false
});
handleSubmitAETitle() {
this.setState({
dirtyValue: false
});

AETitleActions.setAETitle(this.state.aetitleText);
}
AETitleActions.setAETitle(this.state.aetitleText);
}
});

export { AETitleView };
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const LoggerView = React.createClass({
return (
<div className="panel panel-primary topMargin">
<div className="panel-heading">
<h3 className="panel-title">Server Log</h3>
<h3 className="panel-title">Server Log</h3>
</div>
<div id="consolediv" className="panel-body scrolldiv">
{this.state.data}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const PluginsView = React.createClass({
this.unsubscribe = PluginStore.listen(this._onPluginsChange);
},

componentDidMount: function () {
componentDidMount: function() {
const pluginTypes = ["query", "index", "storage", "servlet"];
pluginTypes.map(type => PluginActions.get(type));
},

componentWillUnmount: function () {
componentWillUnmount: function() {
this.unsubscribe();
},

Expand Down Expand Up @@ -62,7 +62,7 @@ const PluginsView = React.createClass({
}

// decrease loading plugins by one unit. When all the plugins are loaded, the status will be "done"
this.setState(function (previousState, currentProps) {
this.setState(function(previousState, currentProps) {
let currentlyLoading = previousState.currentlyLoading - 1;
let status = previousState.status;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const StorageView = React.createClass({
return (
<div className="panel panel-primary topMargin">
<div className="panel-heading">
<h3 className="panel-title">Storage Servers</h3>
<h3 className="panel-title">Storage Servers</h3>
</div>
<div className="panel-body">
<select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,12 @@ const AdvancedSearch = React.createClass({
</div>
<div className="globalmargin row">
<div className="subject_text space_up">Date</div>
<input type="text" id="datepicker" className="form-control form-control-date" placeholder={"YYYYMMDD"} />
<input
type="text"
id="datepicker"
className="form-control form-control-date"
placeholder={"YYYYMMDD"}
/>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,9 @@ var PopOverView = React.createClass({
</BootstrapTable>
</div>
<div className="modal-footer">
<Button bsClass="btn btn_dicoogle" onClick={this.props.onHide}>Close</Button>
<Button bsClass="btn btn_dicoogle" onClick={this.props.onHide}>
Close
</Button>
</div>
</Modal>
);
Expand Down Expand Up @@ -479,7 +481,9 @@ var PopOverImageViewer = React.createClass({
</ImageLoader>
</div>
<div className="modal-footer">
<Button bsClass="btn btn_dicoogle" onClick={this.props.onHide}>Close</Button>
<Button bsClass="btn btn_dicoogle" onClick={this.props.onHide}>
Close
</Button>
</div>
</Modal>
);
Expand Down
10 changes: 5 additions & 5 deletions dicoogle/src/main/resources/webapp/js/stores/aetitleStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const Dicoogle = dicoogleClient(Endpoints.base);

const AETitleStore = Reflux.createStore({
listenables: AETitleActions,
init: function () {
init: function() {
this._contents = {};
},

onGetAETitle: function () {
onGetAETitle: function() {
const self = this;

Dicoogle.getAETitle((err, data) => {
Expand All @@ -33,18 +33,18 @@ const AETitleStore = Reflux.createStore({
});
},

onSetAETitle: function (name) {
onSetAETitle: function(name) {
const self = this;

if (! /^[ A-Za-z0-9_.+-]*$/.test(name)) {
if (!/^[ A-Za-z0-9_.+-]*$/.test(name)) {
self.trigger({
success: false,
message: "Invalid AETitle provided"
});
return;
}

Dicoogle.setAETitle(name, (err) => {
Dicoogle.setAETitle(name, err => {
if (err) {
console.error("Service failure", err);

Expand Down
38 changes: 20 additions & 18 deletions dicoogle/src/main/resources/webapp/js/stores/pluginStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const Dicoogle = dicoogleClient(Endpoints.base);

const PluginStore = Reflux.createStore({
listenables: PluginActions,
init: function () {
init: function() {
this._contents = {};
},

onGet: function (type) {
onGet: function(type) {
Dicoogle.request("GET", ["plugins", type]).end((error, data) => {
if (!error) {
//console.log(data.body);
Expand All @@ -30,23 +30,25 @@ const PluginStore = Reflux.createStore({
});
},

onSetAction: function (type, name, action) {
Dicoogle.request("POST", ["plugins", type, name, action]).end((error, data) => {
if (!error) {
this._contents[type].find(plugin => plugin.name === name).enabled =
action === "enable";
this.trigger({
data: this._contents[type],
success: true
});
} else {
this.trigger({
success: false,
status: error.status,
error: "Could not " + action + " the plugin."
});
onSetAction: function(type, name, action) {
Dicoogle.request("POST", ["plugins", type, name, action]).end(
(error, data) => {
if (!error) {
this._contents[type].find(plugin => plugin.name === name).enabled =
action === "enable";
this.trigger({
data: this._contents[type],
success: true
});
} else {
this.trigger({
success: false,
status: error.status,
error: "Could not " + action + " the plugin."
});
}
}
});
);
}
});

Expand Down
2 changes: 1 addition & 1 deletion dicoogle/src/main/resources/webapp/sass/core/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,5 @@ input {
}

.form-control-date {
width: auto;
width: auto;
}
4 changes: 2 additions & 2 deletions dicoogle/src/main/resources/webapp/sass/modules/_topbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
}

.logo-image {
max-height: 60%;
}
max-height: 60%;
}
4 changes: 2 additions & 2 deletions dicoogle/src/main/resources/webapp/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module.exports = {
}),
new webpack.ProvidePlugin({
// required for Bootstrap to work
jQuery: 'jquery',
}),
jQuery: "jquery"
})
],
module: {
rules: [
Expand Down
2 changes: 1 addition & 1 deletion dicoogle/src/main/resources/webapp/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const merge = require("webpack-merge");
const HtmlWebpackPlugin = require("html-webpack-plugin");

process.env.NODE_ENV = 'development';
process.env.NODE_ENV = "development";
const common = require("./webpack.common");
module.exports = merge(common, {
mode: "development",
Expand Down
2 changes: 1 addition & 1 deletion dicoogle/src/main/resources/webapp/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const merge = require("webpack-merge");
const HtmlWebpackPlugin = require("html-webpack-plugin");

process.env.NODE_ENV = 'production';
process.env.NODE_ENV = "production";
const common = require("./webpack.common");
module.exports = merge(common, {
mode: "production",
Expand Down

0 comments on commit d8b5403

Please sign in to comment.