IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
浏览代码

Some improvements to navigation.

master
父节点
当前提交
a7c041799b
共有 4 个文件被更改,包括 26 次插入7 次删除
  1. +6
    -1
      frontend/src/js/component/wb-project-crumbs.js
  2. +12
    -3
      frontend/src/js/page/wb-app.js
  3. +2
    -1
      frontend/src/js/page/wb-browse.js
  4. +6
    -2
      frontend/src/js/page/wb-sign-in.js

+ 6
- 1
frontend/src/js/component/wb-project-crumbs.js 查看文件

@@ -5,10 +5,15 @@ import fetchProjectParents from 'fetch-project-parents';
class WBProjectCrumbs extends Component {
constructor(...args) {
super(...args);
this.state.items = [];
this.state.items = [ { 'name': 'All Projects' } ];
}
fetchCrumbs() {
if (!this.props.uuid) {
this.setState({ 'items': [ { 'name': 'All Projects' } ] });
return;
}
let { arvHost, arvToken } = this.props.appState;
let prom = fetchProjectParents(arvHost, arvToken, this.props.uuid);
prom = prom.then(parents => this.setState({ 'items': parents }));


+ 12
- 3
frontend/src/js/page/wb-app.js 查看文件

@@ -9,12 +9,14 @@ class WBApp extends Component {
super(...args);
this.state.arvHost = window.localStorage['arvHost'];
this.state.arvToken = window.localStorage['arvToken'];
this.state.currentUser = JSON.parse(window.localStorage['currentUser']);
this.appCallbacks = {
'navbarItemClicked': this.navbarItemClicked
'navbarItemClicked': item => this.navbarItemClicked(item)
};
this.appState = {
'arvHost': this.state.arvHost,
'arvToken': this.state.arvToken
'arvToken': this.state.arvToken,
'currentUser': this.state.currentUser
};
}
@@ -24,6 +26,13 @@ class WBApp extends Component {
delete window.localStorage['arvToken'];
delete window.localStorage['currentUser'];
route('/sign-in');
} else if (item['id'] === 'home') {
route('/browse/' + this.appState.currentUser.uuid);
} else if (item['id'] === 'all-projects') {
route('/browse');
}
}
@@ -32,7 +41,7 @@ class WBApp extends Component {
<Router>
<WBLandingPage path="/" />
<WBSignIn path="/sign-in" />
<WBSignIn path="/sign-in" appState={ this.appState } />
<WBBrowse path="/browse/:ownerUuid?/:activePage?"
appCallbacks={ this.appCallbacks }


+ 2
- 1
frontend/src/js/page/wb-browse.js 查看文件

@@ -10,7 +10,8 @@ class WBBrowse extends Component {
return (
<div>
<WBNavbar items={ [
{ 'name': 'Browse', 'active': true },
{ 'name': 'Home', 'id': 'home', 'active': (ownerUuid === appState.currentUser.uuid) },
{ 'name': 'All Projects', 'id': 'all-projects', 'active': (!ownerUuid) },
{ 'name': 'User', 'dropdown': [ { 'id': 'sign-out', 'name': 'Sign Out' } ]}
] } rhs={ (
<WBInlineSearch />


+ 6
- 2
frontend/src/js/page/wb-sign-in.js 查看文件

@@ -6,12 +6,16 @@ import makeArvadosRequest from 'make-arvados-request';
class WBSignIn extends Component {
onSubmit() {
let { appState } = this.props;
let { arvHost, arvToken } = this.state;
window.localStorage['arvHost'] = arvHost;
window.localStorage['arvToken'] = arvToken;
let prom = makeArvadosRequest(arvHost, arvToken, '/arvados/v1/users/current');
prom = prom.then(xhr => {
window.localStorage['arvHost'] = arvHost;
window.localStorage['arvToken'] = arvToken;
window.localStorage['currentUser'] = JSON.stringify(xhr.response);
appState.arvHost = arvHost;
appState.arvToken = arvToken;
appState.currentUser = xhr.response;
route('/browse/' + xhr.response['uuid']);
});
prom = prom.catch(() => {


正在加载...
取消
保存