-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…92) * "#91- Update webgme to the latest version for token support" * WIP-#91: Initial Implementation of tokens management from user-management-page * #91: Display tokens table if atleast one token available * #91 Change glyphicon color to default, display only newly generated token ids, change generate tokens button text to generate token * Move Token Generation Logic to a different page * WIP- Change Tokens Logic to latest webgme code 1. Tokens now have unique display name. 2. Add Copy to clipboard logic to the tokens using navigator.clipboard * WIP- Rename variable tokenID to tokenName in tokensClient.js * WIP- Remove token index from display name * WIP- Gracefully handle errors on tokens generation and deletion, modify existing guest tokens creation logic * WIP - updated webgme version Co-authored-by: kecso <tamas.kecskes@vandebrilt.edu>
- Loading branch information
1 parent
70d2662
commit a9a92f0
Showing
17 changed files
with
3,925 additions
and
2,664 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Tokens client - all rest calls for personal access tokens | ||
* @author Umesh Timalsina / https://github.com/umesh-timalsina | ||
*/ | ||
|
||
/* eslint-env node, browser */ | ||
import BaseClient from './baseClient'; | ||
|
||
export default class TokensClient extends BaseClient { | ||
constructor(baseUrl) { | ||
if (typeof baseUrl !== 'string') { | ||
baseUrl = '/rest/tokens/'; | ||
} | ||
super(baseUrl); | ||
} | ||
|
||
getTokensForCurrentUser() { | ||
return super.get(['']); | ||
} | ||
|
||
createTokenForCurrentUser(name) { | ||
if (!name) { | ||
return super.post(['create']); | ||
} | ||
return super.post(['create', name]); | ||
} | ||
|
||
deleteTokenForCurrentUser(tokenName) { | ||
return super.delete([tokenName]); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Tokens actions | ||
* @author Umesh Timalsina / https://github.com/umesh-timalsina | ||
*/ | ||
|
||
// Self-defined | ||
import TokensClient from '../../client/rest_client/tokensClient'; | ||
const tokensClient = new TokensClient(); | ||
|
||
export const REQUEST_TOKENS = 'REQUEST_TOKENS'; | ||
export const RECEIVE_TOKENS = 'RECEIVE_TOKENS'; | ||
|
||
export const requestTokens = () => { | ||
return { | ||
type: REQUEST_TOKENS, | ||
}; | ||
}; | ||
|
||
export const receiveTokens = (tokens) => { | ||
return { | ||
type: RECEIVE_TOKENS, | ||
tokens, | ||
}; | ||
}; | ||
|
||
export const shouldFetchTokens = (state) => { | ||
const {hasFetched, isFetching} = state.tokens; | ||
|
||
let shouldFetch = true; | ||
if (hasFetched || isFetching) { | ||
shouldFetch = false; | ||
} | ||
|
||
return shouldFetch; | ||
}; | ||
|
||
export const fetchTokens = () => { | ||
return (dispatch) => { | ||
dispatch(requestTokens()); | ||
return tokensClient.getTokensForCurrentUser() | ||
.then((tokens) => { | ||
dispatch(receiveTokens(tokens)); | ||
}); | ||
}; | ||
}; | ||
|
||
export const fetchTokensIfNeeded = () => { | ||
return (dispatch, getState) => { | ||
if (shouldFetchTokens(getState())) { | ||
return dispatch(fetchTokens()); | ||
} | ||
}; | ||
}; | ||
|
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
// Libraries | ||
import React, { Component } from 'react'; | ||
// Self defined | ||
import TokensTable from '../../../containers/content/widgets/data_tables/TokensTable'; | ||
|
||
|
||
export default class TokensPage extends Component { | ||
render() { | ||
return ( | ||
<section className="content"> | ||
<div className="row"> | ||
<div className="col-md-8 col-md-offset-2"> | ||
<div className="box box-primary"> | ||
<TokensTable | ||
basePath={this.props.basePath} | ||
restClient={this.props.restClient}/> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
} | ||
|
||
} |
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
Oops, something went wrong.