Browse Source

Normal user can view file tree.

HEAD
Yang Luo 3 years ago
parent
commit
812c2b85a9
4 changed files with 24 additions and 16 deletions
  1. +2
    -2
      web/src/App.js
  2. +2
    -1
      web/src/FileTreePage.js
  3. +2
    -1
      web/src/StoreEditPage.js
  4. +18
    -12
      web/src/StoreListPage.js

+ 2
- 2
web/src/App.js View File

@@ -331,8 +331,8 @@ class App extends Component {
<Route exact path="/signin" render={(props) => this.renderHomeIfSignedIn(<SigninPage {...props} />)}/>
<Route exact path="/home" render={(props) => this.renderSigninIfNotSignedIn(<HomePage account={this.state.account} {...props} />)}/>
<Route exact path="/stores" render={(props) => this.renderSigninIfNotSignedIn(<StoreListPage account={this.state.account} {...props} />)}/>
<Route exact path="/stores/:storeName" render={(props) => this.renderSigninIfNotSignedIn(<StoreEditPage account={this.state.account} {...props} />)}/>
<Route exact path="/stores/:storeName/view" render={(props) => this.renderSigninIfNotSignedIn(<FileTreePage account={this.state.account} {...props} />)}/>
<Route exact path="/stores/:owner/:storeName" render={(props) => this.renderSigninIfNotSignedIn(<StoreEditPage account={this.state.account} {...props} />)}/>
<Route exact path="/stores/:owner/:storeName/view" render={(props) => this.renderSigninIfNotSignedIn(<FileTreePage account={this.state.account} {...props} />)}/>
<Route exact path="/clustering" render={(props) => this.renderSigninIfNotSignedIn(<ClusteringPage account={this.state.account} {...props} />)}/>
<Route exact path="/wordsets" render={(props) => this.renderSigninIfNotSignedIn(<WordsetListPage account={this.state.account} {...props} />)}/>
<Route exact path="/wordsets/:wordsetName" render={(props) => this.renderSigninIfNotSignedIn(<WordsetEditPage account={this.state.account} {...props} />)}/>


+ 2
- 1
web/src/FileTreePage.js View File

@@ -9,6 +9,7 @@ class FileTreePage extends React.Component {
super(props);
this.state = {
classes: props,
owner: props.match.params.owner,
storeName: props.match.params.storeName,
store: null,
};
@@ -19,7 +20,7 @@ class FileTreePage extends React.Component {
}
getStore() {
StoreBackend.getStore(this.props.account.name, this.state.storeName)
StoreBackend.getStore(this.state.owner, this.state.storeName)
.then((store) => {
this.setState({
store: store,


+ 2
- 1
web/src/StoreEditPage.js View File

@@ -11,6 +11,7 @@ class StoreEditPage extends React.Component {
super(props);
this.state = {
classes: props,
owner: props.match.params.owner,
storeName: props.match.params.storeName,
store: null,
};
@@ -21,7 +22,7 @@ class StoreEditPage extends React.Component {
}
getStore() {
StoreBackend.getStore(this.props.account.name, this.state.storeName)
StoreBackend.getStore(this.state.owner, this.state.storeName)
.then((store) => {
this.setState({
store: store,


+ 18
- 12
web/src/StoreListPage.js View File

@@ -20,7 +20,7 @@ class StoreListPage extends React.Component {
}
getStores() {
StoreBackend.getStores(this.props.account.name)
StoreBackend.getGlobalStores()
.then((res) => {
this.setState({
stores: res,
@@ -76,7 +76,7 @@ class StoreListPage extends React.Component {
sorter: (a, b) => a.name.localeCompare(b.name),
render: (text, record, index) => {
return (
<Link to={`/stores/${text}`}>
<Link to={`/stores/${record.owner}/${text}/view`}>
{text}
</Link>
)
@@ -97,16 +97,22 @@ class StoreListPage extends React.Component {
render: (text, record, index) => {
return (
<div>
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} onClick={() => this.props.history.push(`/stores/${record.name}/view`)}>{i18next.t("general:View")}</Button>
<Button style={{marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/stores/${record.name}`)}>{i18next.t("general:Edit")}</Button>
<Popconfirm
title={`Sure to delete store: ${record.name} ?`}
onConfirm={() => this.deleteStore(index)}
okText="OK"
cancelText="Cancel"
>
<Button style={{marginBottom: '10px'}} type="danger">{i18next.t("general:Delete")}</Button>
</Popconfirm>
<Button style={{marginTop: '10px', marginBottom: '10px', marginRight: '10px'}} onClick={() => this.props.history.push(`/stores/${record.owner}/${record.name}/view`)}>{i18next.t("general:View")}</Button>
{
!Setting.isLocalAdminUser(this.props.account) ? null : (
<React.Fragment>
<Button style={{marginBottom: '10px', marginRight: '10px'}} type="primary" onClick={() => this.props.history.push(`/stores/${record.owner}/${record.name}`)}>{i18next.t("general:Edit")}</Button>
<Popconfirm
title={`Sure to delete store: ${record.name} ?`}
onConfirm={() => this.deleteStore(index)}
okText="OK"
cancelText="Cancel"
>
<Button style={{marginBottom: '10px'}} type="danger">{i18next.t("general:Delete")}</Button>
</Popconfirm>
</React.Fragment>
)
}
</div>
)
}


Loading…
Cancel
Save