-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor and cleanup token regeneration ui (#191)
- Loading branch information
1 parent
4437d44
commit 73340f0
Showing
3 changed files
with
44 additions
and
39 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
import React, {useState} from "react"; | ||
import ResetToken from "./actions/ResetToken"; | ||
import {Button} from "react-bootstrap"; | ||
|
||
const ActionsTab = (props) => { | ||
const [actionState, setActionState] = useState("menu") | ||
|
||
const [showResetTokenModal, setShowResetTokenModal] = useState(false); | ||
const openResetTokenModal = () => setShowResetTokenModal(true); | ||
const closeResetTokenModal = () => setShowResetTokenModal(false); | ||
|
||
let defaultActionsTabComponent = ( | ||
<div> | ||
<button onClick={openResetTokenModal}>Regenerate Token</button> | ||
return ( | ||
<div className={"actions-tab"}> | ||
<h3>Regenerate your account token <strong>(DANGER!)</strong>?</h3> | ||
<p> | ||
Regenerating your account token will stop all environments and shares from operating properly! | ||
</p> | ||
<p> | ||
You will need to <strong>manually</strong> edit your | ||
<code> ${HOME}/.zrok/environment.json</code> files (in each environment) to use the new | ||
<code> zrok_token</code> . Updating these files will restore the functionality of your environments. | ||
</p> | ||
<p> | ||
Alternatively, you can just <code>zrok disable</code> any enabled environments and re-enable using the | ||
new account token. Running <code>zrok disable</code> will <strong>delete</strong> your environments and | ||
any shares they contain (including reserved shares). So if you have environments and reserved shares you | ||
need to preserve, your best bet is to update the <code>zrok_token</code> in those environments as | ||
described above. | ||
</p> | ||
<Button variant={"danger"} onClick={openResetTokenModal}>Regenerate Account Token</Button> | ||
<ResetToken show={showResetTokenModal} onHide={closeResetTokenModal} user={props.user}/> | ||
</div> | ||
) | ||
|
||
const renderActions = () => { | ||
switch (actionState) { | ||
default: | ||
return defaultActionsTabComponent | ||
} | ||
} | ||
|
||
return ( | ||
renderActions() | ||
) | ||
} | ||
|
||
export default ActionsTab; | ||
|
||
export default ActionsTab; |
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