зеркало из https://github.com/docker/kitematic.git
Fixing small ui bugs
This commit is contained in:
Родитель
52f388fce6
Коммит
2d403816c4
|
@ -24,8 +24,12 @@ module.exports = React.createClass({
|
|||
},
|
||||
|
||||
componentWillUpdate: function (nextProps, nextState) {
|
||||
if (nextState.username) {
|
||||
if (!this.state.username && nextState.username) {
|
||||
if (nextState.prompted) {
|
||||
this.goBack();
|
||||
} else {
|
||||
this.transitionTo('search');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -16,9 +16,11 @@ module.exports = React.createClass({
|
|||
errors: {}
|
||||
};
|
||||
},
|
||||
|
||||
componentDidMount: function () {
|
||||
React.findDOMNode(this.refs.usernameInput).focus();
|
||||
},
|
||||
|
||||
componentWillReceiveProps: function (nextProps) {
|
||||
this.setState({errors: nextProps.errors});
|
||||
},
|
||||
|
|
|
@ -12,6 +12,10 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
username: function () {
|
||||
return localStorage.getItem('auth.username') || null;
|
||||
},
|
||||
|
||||
// Returns the base64 encoded index token or null if no token exists
|
||||
config: function () {
|
||||
let config = localStorage.getItem('auth.config');
|
||||
|
@ -107,6 +111,7 @@ module.exports = {
|
|||
localStorage.setItem('auth.verified', true);
|
||||
localStorage.setItem('auth.config', new Buffer(username + ':' + password).toString('base64'));
|
||||
accountServerActions.loggedin({username, verified: true});
|
||||
accountServerActions.prompted({prompted: true});
|
||||
require('./RegHubUtil').repos();
|
||||
} else {
|
||||
accountServerActions.errors({errors: {detail: 'Did not receive login token.'}});
|
||||
|
@ -114,6 +119,7 @@ module.exports = {
|
|||
} else if (response.statusCode === 401) {
|
||||
if (data && data.detail && data.detail.indexOf('Account not active yet') !== -1) {
|
||||
accountServerActions.loggedin({username, verified: false});
|
||||
accountServerActions.prompted({prompted: true});
|
||||
localStorage.setItem('auth.username', username);
|
||||
localStorage.setItem('auth.verified', false);
|
||||
localStorage.setItem('auth.config', new Buffer(username + ':' + password).toString('base64'));
|
||||
|
@ -158,6 +164,7 @@ module.exports = {
|
|||
// TODO: save username to localstorage
|
||||
if (response.statusCode === 204) {
|
||||
accountServerActions.signedup({username, verified: false});
|
||||
accountServerActions.prompted({prompted: true});
|
||||
localStorage.setItem('auth.username', username);
|
||||
localStorage.setItem('auth.verified', false);
|
||||
localStorage.setItem('auth.config', new Buffer(username + ':' + password).toString('base64'));
|
||||
|
|
|
@ -88,7 +88,7 @@ module.exports = {
|
|||
|
||||
tags: function (repo) {
|
||||
hubUtil.request({
|
||||
url: `https://registry.hub.docker.com/v2/repositories/${repo}/tags`
|
||||
url: `https://registry.hub.docker.com/v2/repositories/v/tags`
|
||||
}, (error, response, body) => {
|
||||
if (response.statusCode === 200) {
|
||||
let data = JSON.parse(body);
|
||||
|
@ -104,7 +104,7 @@ module.exports = {
|
|||
repositoryServerActions.reposLoading({repos: []});
|
||||
|
||||
hubUtil.request({
|
||||
url: 'https://registry.hub.docker.com/v2/namespaces/',
|
||||
url: 'https://hub.docker.com/v2/user/orgs/',
|
||||
}, (error, response, body) => {
|
||||
if (error) {
|
||||
repositoryServerActions.reposError({error});
|
||||
|
@ -112,7 +112,8 @@ module.exports = {
|
|||
}
|
||||
|
||||
let data = JSON.parse(body);
|
||||
let namespaces = data.namespaces;
|
||||
let namespaces = data.results.map(r => r.orgname);
|
||||
namespaces.push(hubUtil.username());
|
||||
async.map(namespaces, (namespace, cb) => {
|
||||
hubUtil.request({
|
||||
url: `https://registry.hub.docker.com/v2/repositories/${namespace}`
|
||||
|
|
Загрузка…
Ссылка в новой задаче