-
Notifications
You must be signed in to change notification settings - Fork 122
feat: tokens modal #3084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
jog1t
wants to merge
1
commit into
10-07-feat_accept_org_invitation_flow
from
10-07-feat_tokens_modal
Closed
feat: tokens modal #3084
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,103 @@ | ||
import { faQuestionCircle, faRailway, Icon } from "@rivet-gg/icons"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { useRouteContext } from "@tanstack/react-router"; | ||
import * as ConnectRailwayForm from "@/app/forms/connect-railway-form"; | ||
import { HelpDropdown } from "@/app/help-dropdown"; | ||
import { | ||
Button, | ||
type DialogContentProps, | ||
DiscreteInput, | ||
Frame, | ||
Label, | ||
Skeleton, | ||
} from "@/components"; | ||
import { | ||
useCloudDataProvider, | ||
useEngineCompatDataProvider, | ||
} from "@/components/actors"; | ||
import { defineStepper } from "@/components/ui/stepper"; | ||
import { cloudEnv, engineEnv } from "@/lib/env"; | ||
|
||
interface TokensFrameContentProps extends DialogContentProps {} | ||
|
||
export default function TokensFrameContent({ | ||
onClose, | ||
}: TokensFrameContentProps) { | ||
return ( | ||
<> | ||
<Frame.Header> | ||
<Frame.Title className="gap-2 flex items-center"> | ||
<div>Namespace Tokens</div> | ||
<HelpDropdown> | ||
<Button variant="ghost" size="icon"> | ||
<Icon icon={faQuestionCircle} /> | ||
</Button> | ||
</HelpDropdown> | ||
</Frame.Title> | ||
<Frame.Description> | ||
These tokens are used to authenticate requests to the Rivet | ||
Engine API. Keep them secret! | ||
</Frame.Description> | ||
</Frame.Header> | ||
<Frame.Content> | ||
<div className="items-center grid grid-cols-1 gap-6"> | ||
<SecretToken /> | ||
<PublishableToken /> | ||
</div> | ||
</Frame.Content> | ||
<Frame.Footer> | ||
<Button variant="secondary" onClick={onClose}> | ||
Close | ||
</Button> | ||
</Frame.Footer> | ||
</> | ||
); | ||
} | ||
|
||
function SecretToken() { | ||
const dataProvider = useRouteContext({ | ||
from: "/_context/_cloud/orgs/$organization/projects/$project/ns/$namespace", | ||
select: (c) => c.dataProvider, | ||
}); | ||
const { data, isLoading } = useQuery( | ||
dataProvider.engineAdminTokenQueryOptions(), | ||
); | ||
return ( | ||
<div className="space-y-2"> | ||
<Label>Secret Token</Label> | ||
{isLoading ? ( | ||
<Skeleton className="w-56 h-10" /> | ||
) : ( | ||
<DiscreteInput value={data || ""} /> | ||
)} | ||
<p className="text-sm text-muted-foreground"> | ||
Only use in secure server environments. Grants full access to | ||
your namespace. Used to connect your Runners to your namespace. | ||
</p> | ||
</div> | ||
); | ||
} | ||
|
||
function PublishableToken() { | ||
const dataProvider = useRouteContext({ | ||
from: "/_context/_cloud/orgs/$organization/projects/$project/ns/$namespace", | ||
select: (c) => c.dataProvider, | ||
}); | ||
const { data, isLoading } = useQuery( | ||
dataProvider.publishableTokenQueryOptions(), | ||
); | ||
return ( | ||
<div className="space-y-2"> | ||
<Label>Publishable Token</Label> | ||
{isLoading ? ( | ||
<Skeleton className="w-56 h-10" /> | ||
) : ( | ||
<DiscreteInput value={data || ""} /> | ||
)} | ||
<p className="text-sm text-muted-foreground"> | ||
Safe to use in public contexts like client-side code. Allows | ||
your frontend to interact with Rivet services. | ||
</p> | ||
</div> | ||
); | ||
} |
This file contains hidden or 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,35 @@ | ||
import { Link } from "@tanstack/react-router"; | ||
import { | ||
Button, | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle, | ||
} from "@/components"; | ||
|
||
export function NotFoundCard() { | ||
return ( | ||
<div className="bg-card h-full border my-2 mr-2 rounded-lg"> | ||
<div className="mt-2 flex flex-col items-center justify-center h-full"> | ||
<div className="w-full sm:w-96"> | ||
<Card> | ||
<CardHeader> | ||
<CardTitle className="flex items-center"> | ||
404 | ||
</CardTitle> | ||
<CardDescription> | ||
The page was not found | ||
</CardDescription> | ||
</CardHeader> | ||
<CardContent> | ||
<Button asChild variant="secondary"> | ||
<Link to="/">Go home</Link> | ||
</Button> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
1 change: 1 addition & 0 deletions
1
frontend/src/routes/_context/_cloud/orgs.$organization/projects.$project.tsx
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.