-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
mod api_keys; | ||
mod token; | ||
|
||
pub use api_keys::*; | ||
pub use token::*; |
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,60 @@ | ||
use crate::backend::Token; | ||
use patternfly_yew::*; | ||
use yew::prelude::*; | ||
|
||
#[derive(Clone, PartialEq, Eq, Properties)] | ||
pub struct Props { | ||
pub token: Token, | ||
} | ||
|
||
pub struct CurrentToken { | ||
props: Props, | ||
} | ||
|
||
impl Component for CurrentToken { | ||
type Message = (); | ||
type Properties = Props; | ||
|
||
fn create(props: Self::Properties, _link: ComponentLink<Self>) -> Self { | ||
Self { props } | ||
} | ||
|
||
fn update(&mut self, _msg: Self::Message) -> ShouldRender { | ||
true | ||
} | ||
|
||
fn change(&mut self, props: Self::Properties) -> ShouldRender { | ||
if self.props != props { | ||
self.props = props; | ||
true | ||
} else { | ||
false | ||
} | ||
} | ||
|
||
fn view(&self) -> Html { | ||
let token = self.props.token.refresh_token.as_deref().unwrap_or(""); | ||
|
||
return html! { | ||
<> | ||
<PageSection variant=PageSectionVariant::Light limit_width=true> | ||
<Content> | ||
<Title>{"Current API token"}</Title> | ||
</Content> | ||
</PageSection> | ||
<PageSection> | ||
<Card | ||
title={html!{"Current API refresh token"}} | ||
> | ||
<Clipboard | ||
readonly=true | ||
code=true | ||
variant=ClipboardVariant::Expandable | ||
value=token> | ||
</Clipboard> | ||
</Card> | ||
</PageSection> | ||
</> | ||
}; | ||
} | ||
} |