-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add tab to add bossdb dataset * upgrade antd to newest version * use Input.Password antd component which allows to show password * fix tests by not polluting global namespace * fix window mocking in non-test env * update changelog * fix pretty * Add Neuroglancer Dataset with Authentication (#4037) * add authentication upload to neuroglancer add dataset view * fix linting * indicate that credentials are optional and when they are needed * upgrade wk-connect in docker-compose * pretty
- Loading branch information
1 parent
f7ec620
commit 8e5d14b
Showing
22 changed files
with
623 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,8 @@ class RegistrationView extends React.PureComponent<Props> { | |
<Link to="/onboarding">Create a new organization.</Link> | ||
) : ( | ||
<React.Fragment> | ||
Contact <a href="mailto:[email protected]">[email protected]</a> for help on setting up webKnossos. | ||
Contact <a href="mailto:[email protected]">[email protected]</a> for help on | ||
setting up webKnossos. | ||
</React.Fragment> | ||
)} | ||
</Card> | ||
|
157 changes: 157 additions & 0 deletions
157
frontend/javascripts/admin/dataset/dataset_add_boss_view.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
// @flow | ||
import { Form, Input, Button, Col, Row } from "antd"; | ||
import { connect } from "react-redux"; | ||
import React from "react"; | ||
import _ from "lodash"; | ||
|
||
import type { APIDataStore, APIUser } from "admin/api_flow_types"; | ||
import type { OxalisState } from "oxalis/store"; | ||
import { addWkConnectDataset } from "admin/admin_rest_api"; | ||
import messages from "messages"; | ||
import Toast from "libs/toast"; | ||
import * as Utils from "libs/utils"; | ||
import { trackAction } from "oxalis/model/helpers/analytics"; | ||
import { | ||
CardContainer, | ||
DatasetNameFormItem, | ||
DatastoreFormItem, | ||
} from "admin/dataset/dataset_components"; | ||
|
||
const FormItem = Form.Item; | ||
const { Password } = Input; | ||
|
||
const Slash = () => ( | ||
<Col span={1} style={{ textAlign: "center" }}> | ||
<div style={{ marginTop: 35 }}>/</div> | ||
</Col> | ||
); | ||
|
||
type OwnProps = {| | ||
datastores: Array<APIDataStore>, | ||
onAdded: (string, string) => void, | ||
|}; | ||
type StateProps = {| | ||
activeUser: ?APIUser, | ||
|}; | ||
type Props = {| ...OwnProps, ...StateProps |}; | ||
type PropsWithForm = {| | ||
...Props, | ||
form: Object, | ||
|}; | ||
|
||
class DatasetAddBossView extends React.PureComponent<PropsWithForm> { | ||
handleSubmit = evt => { | ||
evt.preventDefault(); | ||
const { activeUser } = this.props; | ||
|
||
this.props.form.validateFields(async (err, formValues) => { | ||
if (err || activeUser == null) return; | ||
|
||
const { name, domain, collection, experiment, username, password } = formValues; | ||
const httpsDomain = domain.startsWith("bossdb://") | ||
? domain.replace(/^bossdb/, "https") | ||
: domain; | ||
const datasetConfig = { | ||
boss: { | ||
[activeUser.organization]: { | ||
[name]: { | ||
domain: httpsDomain, | ||
collection, | ||
experiment, | ||
username, | ||
password, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
trackAction("Add BossDB dataset"); | ||
await addWkConnectDataset(formValues.datastore, datasetConfig); | ||
|
||
Toast.success(messages["dataset.add_success"]); | ||
await Utils.sleep(3000); // wait for 3 seconds so the server can catch up / do its thing | ||
this.props.onAdded(activeUser.organization, formValues.name); | ||
}); | ||
}; | ||
|
||
render() { | ||
const { form, activeUser, datastores } = this.props; | ||
const { getFieldDecorator } = form; | ||
|
||
return ( | ||
<div style={{ padding: 5 }}> | ||
<CardContainer title="Add BossDB Dataset"> | ||
<Form style={{ marginTop: 20 }} onSubmit={this.handleSubmit} layout="vertical"> | ||
<Row gutter={8}> | ||
<Col span={12}> | ||
<DatasetNameFormItem form={form} activeUser={activeUser} /> | ||
</Col> | ||
<Col span={12}> | ||
<DatastoreFormItem form={form} datastores={datastores} /> | ||
</Col> | ||
</Row> | ||
<Row gutter={8}> | ||
<Col span={12}> | ||
<FormItem label="Domain" hasFeedback> | ||
{getFieldDecorator("domain", { | ||
rules: [{ required: true }], | ||
validateFirst: true, | ||
})(<Input />)} | ||
</FormItem> | ||
</Col> | ||
<Slash /> | ||
<Col span={5}> | ||
<FormItem label="Collection" hasFeedback> | ||
{getFieldDecorator("collection", { | ||
rules: [{ required: true }], | ||
validateFirst: true, | ||
})(<Input />)} | ||
</FormItem> | ||
</Col> | ||
<Slash /> | ||
<Col span={5}> | ||
<FormItem label="Experiment" hasFeedback> | ||
{getFieldDecorator("experiment", { | ||
rules: [{ required: true }], | ||
validateFirst: true, | ||
})(<Input />)} | ||
</FormItem> | ||
</Col> | ||
</Row> | ||
<Row gutter={8}> | ||
<Col span={12}> | ||
<FormItem label="Username" hasFeedback> | ||
{getFieldDecorator("username", { | ||
rules: [{ required: true }], | ||
validateFirst: true, | ||
})(<Input />)} | ||
</FormItem> | ||
</Col> | ||
<Col span={12}> | ||
<FormItem label="Password" hasFeedback> | ||
{getFieldDecorator("password", { | ||
rules: [{ required: true }], | ||
validateFirst: true, | ||
})(<Password />)} | ||
</FormItem> | ||
</Col> | ||
</Row> | ||
<FormItem style={{ marginBottom: 0 }}> | ||
<Button size="large" type="primary" htmlType="submit" style={{ width: "100%" }}> | ||
Add | ||
</Button> | ||
</FormItem> | ||
</Form> | ||
</CardContainer> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = (state: OxalisState): StateProps => ({ | ||
activeUser: state.activeUser, | ||
}); | ||
|
||
export default connect<Props, OwnProps, _, _, _, _>(mapStateToProps)( | ||
Form.create()(DatasetAddBossView), | ||
); |
Oops, something went wrong.