Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bprize15 committed Jan 9, 2024
1 parent a469fa4 commit 242e4e2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,41 +65,6 @@ export default class TokenInputGroups extends React.Component<
Expires in {this.getDuration(expirationDay, expirationHour)}
</InputGroup.Text>
</InputGroup.Append>
{this.props.changeTokenExpirationDate && (
<CalendarButton
currentDate={token.expiration}
afterChangeDate={(newDate: string) => {
if (this.props.extendExpirationDate)
this.props.extendExpirationDate(token, newDate);
}}
/>
)}
<InputGroup.Append>
<CopyButton text={token.token} />
</InputGroup.Append>
<DefaultTooltip
placement={'top'}
overlay={
this.deleteTokenAllowed
? 'Delete the token'
: 'You need to have one valid token'
}
>
<InputGroup.Append>
<Button
variant={'primary'}
onClick={() => this.props.onDeleteToken(token)}
disabled={!this.deleteTokenAllowed}
style={
!this.deleteTokenAllowed
? { pointerEvents: 'none' }
: {}
}
>
<i className={classnames('fa fa-trash')}></i>
</Button>
</InputGroup.Append>
</DefaultTooltip>
<DefaultTooltip
placement={'top'}
overlay={
Expand Down Expand Up @@ -137,6 +102,41 @@ export default class TokenInputGroups extends React.Component<
</Button>
</InputGroup.Append>
</DefaultTooltip>
{this.props.changeTokenExpirationDate && (
<CalendarButton
currentDate={token.expiration}
afterChangeDate={(newDate: string) => {
if (this.props.extendExpirationDate)
this.props.extendExpirationDate(token, newDate);
}}
/>
)}
<InputGroup.Append>
<CopyButton text={token.token} />
</InputGroup.Append>
<DefaultTooltip
placement={'top'}
overlay={
this.deleteTokenAllowed
? 'Delete the token'
: 'You need to have one valid token'
}
>
<InputGroup.Append>
<Button
variant={'primary'}
onClick={() => this.props.onDeleteToken(token)}
disabled={!this.deleteTokenAllowed}
style={
!this.deleteTokenAllowed
? { pointerEvents: 'none' }
: {}
}
>
<i className={classnames('fa fa-trash')}></i>
</Button>
</InputGroup.Append>
</DefaultTooltip>
</InputGroup>
</div>
);
Expand Down
18 changes: 10 additions & 8 deletions src/main/webapp/app/pages/AccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ export class AccountPage extends React.Component<IRegisterProps> {

@action.bound
extendExpirationDate(token: Token, newDate: string) {
this.props.authenticationStore.extendExpirationDate(token, newDate).then(
() => {
notifySuccess('Updated Token');
},
(error: Error) => {
notifyError(error);
}
);
this.props.authenticationStore
.extendTokenExpirationDate(token, newDate)
.then(
() => {
notifySuccess('Updated Token');
},
(error: Error) => {
notifyError(error);
}
);
}

@action.bound
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/app/store/AuthenticationStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class AuthenticationStore {
}

@action
extendExpirationDate(token: Token, newDate: string) {
extendTokenExpirationDate(token: Token, newDate: string) {
return new Promise((resolve, reject) => {
client
.updateTokenUsingPUT({
Expand Down

0 comments on commit 242e4e2

Please sign in to comment.