Skip to content

Commit d544c18

Browse files
authored
Merge pull request #47 from timo/patch-1
cro web: allow F5 to work even after navigating
2 parents 0f5d6ad + a91f79e commit d544c18

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

lib/Cro/Tools/Web.pm6

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ sub web(Str $host, Int $port, $runner) is export {
3232
get -> {
3333
content 'text/html', %?RESOURCES<web/index.html>.slurp;
3434
}
35+
get -> $app-route {
36+
content 'text/html', %?RESOURCES<web/index.html>.slurp;
37+
}
3538
post -> 'service' {
3639
request-body -> %json {
3740
my @commands = <start restart stop

resources/web/js/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57175,7 +57175,7 @@ var App = function (_React$Component) {
5717557175
),
5717657176
_react2.default.createElement(
5717757177
"select",
57178-
{ id: "templateSelectInput", defaultValue: this.props.stubReducer.current.id, className: "form-control", onChange: function onChange(e) {
57178+
{ id: "templateSelectInput", defaultValue: this.props.stubReducer.current && this.props.stubReducer.current.id || '', className: "form-control", onChange: function onChange(e) {
5717957179
return _this2.props.onStubSelect(e.target.selectedIndex);
5718057180
} },
5718157181
this.props.stubReducer.templates.map(function (t) {
@@ -57186,7 +57186,7 @@ var App = function (_React$Component) {
5718657186
);
5718757187
})
5718857188
),
57189-
_react2.default.createElement(Template, { fullPath: this.props.stubReducer.fullPath,
57189+
this.props.stubReducer.current && _react2.default.createElement(Template, { fullPath: this.props.stubReducer.fullPath,
5719057190
idText: this.props.stubReducer.idText,
5719157191
nameText: this.props.stubReducer.nameText,
5719257192
pathText: this.props.stubReducer.pathText,

web-frontend/src/stub-service/components.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,25 @@ class App extends React.Component {
6363
<div className="alert alert-danger" role="alert">{this.props.stubReducer.notify} {this.props.stubReducer.stubErrors}</div>
6464
}
6565
<label className="control-label" htmlFor="templateSelectInput">Service Template</label>
66-
<select id="templateSelectInput" defaultValue={this.props.stubReducer.current.id} className="form-control" onChange={(e) => this.props.onStubSelect(e.target.selectedIndex)}>
66+
<select id="templateSelectInput" defaultValue={this.props.stubReducer.current && this.props.stubReducer.current.id || ''} className="form-control" onChange={(e) => this.props.onStubSelect(e.target.selectedIndex)}>
6767
{this.props.stubReducer.templates.map(t => (
6868
<option key={t.id} value={t.id}>{t.name}</option>
6969
))}
7070
</select>
71-
<Template fullPath={this.props.stubReducer.fullPath}
72-
idText={this.props.stubReducer.idText}
73-
nameText={this.props.stubReducer.nameText}
74-
pathText={this.props.stubReducer.pathText}
75-
template={this.props.stubReducer.current}
76-
links={this.props.stubReducer.links}
77-
disable={this.props.stubReducer.disable}
78-
onChangeIdText={this.props.onChangeIdText}
79-
onChangePathText={this.props.onChangePathText}
80-
onChangeNameText={this.props.onChangeNameText}
81-
onChangeOption={this.props.onChangeOption}
82-
onChangeLink={this.props.onChangeLink}
83-
onStubSent={this.props.onStubSent} />
71+
{this.props.stubReducer.current &&
72+
<Template fullPath={this.props.stubReducer.fullPath}
73+
idText={this.props.stubReducer.idText}
74+
nameText={this.props.stubReducer.nameText}
75+
pathText={this.props.stubReducer.pathText}
76+
template={this.props.stubReducer.current}
77+
links={this.props.stubReducer.links}
78+
disable={this.props.stubReducer.disable}
79+
onChangeIdText={this.props.onChangeIdText}
80+
onChangePathText={this.props.onChangePathText}
81+
onChangeNameText={this.props.onChangeNameText}
82+
onChangeOption={this.props.onChangeOption}
83+
onChangeLink={this.props.onChangeLink}
84+
onStubSent={this.props.onStubSent} />}
8485
</div>
8586
);
8687
}

0 commit comments

Comments
 (0)