Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
4477394
APT TOEKEN: list ui added
shivani170 Jun 10, 2022
53e4850
APP LIST: icon added on the row
shivani170 Jun 10, 2022
fece8bf
API LIST: interaction added in listing page
shivani170 Jun 10, 2022
cc1abc6
GENMERATE TOKEN: ui | info bar added
shivani170 Jun 10, 2022
a71baba
REGENERATE MODAL: created success modal
shivani170 Jun 11, 2022
bb0f20c
COODE REFACTORING: code refactoring and renaming
shivani170 Jun 13, 2022
76a8279
REGENERATE MODAL: added regenerate modal for edit page
shivani170 Jun 13, 2022
c10d9f6
EDIT API TOKEN: ui added
shivani170 Jun 13, 2022
f695e23
CREATE API TOKEN: integration with api
shivani170 Jun 13, 2022
3b39341
API TOKEN LIST: debugging while rendering list
shivani170 Jun 13, 2022
9ad0610
EDIT TOKEN: debugging of userId and selector options passed correctly
shivani170 Jun 15, 2022
77adcd2
EDIT | LIST: delete confirmation dialog box added
shivani170 Jun 15, 2022
a13dd2c
API TOKEN: search filtered added
shivani170 Jun 15, 2022
ff91ba7
EDIT TOKEN: state managed in edit token component
shivani170 Jun 15, 2022
8a9ebc9
API TOKEN: reload after delete fixed
shivani170 Jun 15, 2022
75e3014
API TOKEN: code cleaning | type defined
shivani170 Jun 15, 2022
b2a338d
REFGERATE DATA: api added in regenerated modal
shivani170 Jun 16, 2022
e113d84
renamed auth folder tp api tokens
shivani170 Jun 17, 2022
8503ae0
Quick fix for Authorisation nav item grouping
sohel-rp Jun 17, 2022
00145dd
validation added
shivani170 Jun 20, 2022
b22a7a3
HEADERS: added header and its navigation to listing
shivani170 Jun 20, 2022
8703ace
Added specific & super admin permissions section
sohel-rp Jun 20, 2022
60fd8d4
Fix - nav item selection states
sohel-rp Jun 20, 2022
a5324ef
Text area fix
sohel-rp Jun 20, 2022
0456bb7
Fix - token description text & styling
sohel-rp Jun 20, 2022
14db0c6
CREATE APP: single date picker added
shivani170 Jun 21, 2022
93a73ce
API TOKEN: conflict
shivani170 Jun 21, 2022
dd48e19
API LIST: expired css interaction added
shivani170 Jun 21, 2022
c1ab686
Merge remote-tracking branch 'origin/main' into api_token_1834
sohel-rp Jun 21, 2022
a633d16
CREATE: common expiration
shivani170 Jun 21, 2022
e9a1d23
Merge branch 'api_token_1834' of https://github.com/devtron-labs/dash…
sohel-rp Jun 21, 2022
58cb185
Multiple fixes around expiration date
sohel-rp Jun 21, 2022
8c47cf7
Fixed calendar date selection and other changes
sohel-rp Jun 21, 2022
dd86f0b
Added validations & some fixes around RegeneratedModal flow
sohel-rp Jun 21, 2022
1f804b5
minor collapsed state fix
sohel-rp Jun 21, 2022
aa2ff39
Deleted Token Modal handling
sohel-rp Jun 22, 2022
a2da3b8
Added expiration states & related handling
sohel-rp Jun 22, 2022
6cd4bbc
Showing selected group list
sohel-rp Jun 22, 2022
b5c9054
minor fixes
sohel-rp Jun 22, 2022
9022051
Merge remote-tracking branch 'origin/main' into api_token_1834
sohel-rp Jun 22, 2022
b0abf21
CSS fixes
shivani170 Jun 22, 2022
2198f27
Fixed issues around empty states
sohel-rp Jun 22, 2022
b29429f
Minor validation fixes
sohel-rp Jun 22, 2022
95f0f40
GROUP PERMISSION : css fixes
shivani170 Jun 22, 2022
8fb651b
merge
shivani170 Jun 22, 2022
3f0fef9
merge main
shivani170 Jun 22, 2022
7db9f7a
REMOVED: repetitive icon
shivani170 Jun 22, 2022
a3f90ff
minor fixes around generate token modal
sohel-rp Jun 22, 2022
0bb6853
minor comment fix
sohel-rp Jun 22, 2022
3828efc
Merge remote-tracking branch 'origin/main' into api_token_1834
sohel-rp Jun 23, 2022
f77e80f
UX review changes
sohel-rp Jun 23, 2022
58e29d3
Multiple UX review fixes
sohel-rp Jun 23, 2022
70c4793
CSS fixes
shivani170 Jun 27, 2022
851a457
APP TOKEN LIST: fixed token filter on search
shivani170 Jun 27, 2022
aa9f77b
FIXES UI
shivani170 Jun 27, 2022
5f7050e
UI FIXES
shivani170 Jun 27, 2022
60f6977
GC: SCROLL added on left panel
shivani170 Jun 27, 2022
e4e0b1e
API TOKEN CREATE: app permission dropdown disabled background css fix
shivani170 Jun 27, 2022
16dae00
TOAST: reload info background bug fix
shivani170 Jun 27, 2022
f9a7e8b
FEEDBACK: code deedback incorporated
shivani170 Jun 27, 2022
d5ebbb9
EDIT: description validation added
shivani170 Jun 27, 2022
3c4d5b6
code feedbck
shivani170 Jun 27, 2022
a89c7b6
SingleDatePicker - Fixed disabled color codes for today
sohel-rp Jun 27, 2022
a5b2142
APP LIST: last used by statte fixed
shivani170 Jun 28, 2022
2ee8226
merge
shivani170 Jun 28, 2022
f8f9778
APP LIST & UTILS: code refactoring | css fixes
shivani170 Jun 28, 2022
e6ff7e2
API TOKEN: CODE REFACTORING
shivani170 Jun 28, 2022
0a05dae
VALIDATION: name calidation fixed
shivani170 Jun 28, 2022
f5b37c2
VALIDATION: messaging fixed
shivani170 Jun 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/assets/icons/ic-slant-bulb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 15 additions & 19 deletions src/components/apiTokens/APITokenList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,21 @@ function APITokenList({ tokenList, renderSearchToken, reload }: APITokenListType
history.push(id ? `${key}/${id}` : key)
}

const handleDeleteButton = (tokenList) => {
setSelectedToken(tokenList)
setDeleteConfirmation(true)
}
return (
<div>
<div className="cn-9 fw-6 fs-16">API tokens</div>
<p className="fs-13 fw-4">Tokens you have generated that can be used to access the Devtron API.</p>
<div className="flex content-space">
<p className="fs-12 fw-4">Tokens you have generated that can be used to access the Devtron API.</p>
<div className="flex content-space mb-16">
<button className="flex cta h-32" onClick={() => handleGenerateRowActionButton('create')}>
Generate new token
</button>
{renderSearchToken()}
</div>
<div
className="mt-16 en-2 bw-1 bcn-0 br-8"
style={{ minHeight: 'calc(100vh - 235px)', overflow: 'hidden' }}
>
<div className="api-token__list en-2 bw-1 bcn-0 br-8">
<div className="api-list-row fw-6 cn-7 fs-12 border-bottom pt-10 pb-10 pr-20 pl-20 text-uppercase">
<div></div>
<div>Name</div>
Expand Down Expand Up @@ -81,10 +82,12 @@ function APITokenList({ tokenList, renderSearchToken, reload }: APITokenListType
className={`flexbox cb-5 cursor`}
onClick={() => handleGenerateRowActionButton('edit', list.id)}
>
{list.name}
<span className="ellipsis-right">{list.name}</span>
</div>
<div className="ellipsis-right">
{list.lastUsedAt ? moment(list.lastUsedAt).format(MomentDateFormat) : 'Never used'}
</div>
<div className="ellipsis-right">{moment(list.lastUsedAt).format(MomentDateFormat)}</div>
<div>{list.lastUsedByIp}</div>
<div>{list.lastUsedByIp ? list.lastUsedByIp : '-'}</div>
<div className={`${isTokenExpired(list.expireAtInMs) ? 'cr-5' : ''}`}>
{list.expireAtInMs === 0 ? (
'No expiration date'
Expand All @@ -95,22 +98,15 @@ function APITokenList({ tokenList, renderSearchToken, reload }: APITokenListType
</>
)}
</div>
<div className="api__row-actions flex">
<div className="api__row-actions flex right">
<button
type="button"
className="transparent mr-8 ml-8"
className="transparent mr-18"
onClick={() => handleGenerateRowActionButton('edit', list.id)}
>
<Edit className="icon-dim-20" />
</button>
<button
type="button"
className="transparent"
onClick={() => {
setSelectedToken(list)
setDeleteConfirmation(true)
}}
>
<button type="button" className="transparent" onClick={() => handleDeleteButton(list)}>
<Trash className="scn-6 icon-dim-20" />
</button>
</div>
Expand Down
23 changes: 15 additions & 8 deletions src/components/apiTokens/ApiTokens.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CreateAPIToken from './CreateAPIToken'
import EditAPIToken from './EditAPIToken'
import { TokenListType, TokenResponseType } from './authorization.type'

function ApiTokens({ reloadLists }) {
function ApiTokens() {
const { path } = useRouteMatch()
const history = useHistory()
const { pathname } = useLocation()
Expand Down Expand Up @@ -66,7 +66,11 @@ function ApiTokens({ reloadLists }) {
}, [])

const handleFilterChanges = (_searchText: string): void => {
const _filteredData = tokenList.filter((token) => token.name.indexOf(_searchText) >= 0)
const _searchTextTrimmed = _searchText.trim()
const _filteredData = tokenList.filter(
(_tokenData) =>
_tokenData.name.indexOf(_searchTextTrimmed) >= 0 || _tokenData.token.indexOf(_searchTextTrimmed) >= 0,
)
setFilteredTokenList(_filteredData)
setNoResults(_filteredData.length === 0)
}
Expand Down Expand Up @@ -105,14 +109,14 @@ function ApiTokens({ reloadLists }) {
type="text"
placeholder="Search Token"
value={searchText}
className="search__input bcn-0"
className={`search__input bcn-0 ${searchApplied ? 'search-applied' : ''}`}
onChange={(event) => {
setSearchText(event.target.value)
}}
onKeyDown={handleFilterKeyPress}
/>
{searchApplied && (
<button className="search__clear-button" type="button" onClick={clearSearch}>
<button className="flex search__clear-button" type="button" onClick={clearSearch}>
<Clear className="icon-dim-18 icon-n4 vertical-align-middle" />
</button>
)}
Expand Down Expand Up @@ -170,6 +174,10 @@ function ApiTokens({ reloadLists }) {
)
}

const redirectToCreate = () => {
history.push(`${path}/create`)
}

const renderEmptyState = (): JSX.Element => {
return (
<div className="flex column h-100">
Expand All @@ -181,11 +189,11 @@ function ApiTokens({ reloadLists }) {
<h4 className="title">Generate a token to access the Devtron API</h4>
</EmptyState.Title>
<EmptyState.Subtitle>
API tokens function like ordinary OAuth access tokens. They can be used instead of a password
for Git over HTTPS, or can be used to authenticate to the API over Basic Authentication.
API tokens are like ordinary OAuth access tokens. They can be used instead of username and
password for programmatic access to API.
</EmptyState.Subtitle>
<EmptyState.Button>
<button className="flex cta h-32" onClick={() => history.push(`${path}/create`)}>
<button className="flex cta h-32" onClick={redirectToCreate}>
Generate new token
</button>
</EmptyState.Button>
Expand All @@ -208,7 +216,6 @@ function ApiTokens({ reloadLists }) {
} else if (!pathname.includes('/create') && (!tokenList || tokenList.length === 0)) {
return renderEmptyState()
}

return renderAPITokenRoutes()
}

Expand Down
Loading