github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/pkg/cloud/dashboard/src/components/image_info.rs (about) 1 // Copyright © 2021 Alibaba Group Holding Ltd. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 16 use yew::{html, Component,ComponentLink,Html,ShouldRender,Properties}; 17 18 pub struct ImageDetail{ 19 props: Props, 20 } 21 22 #[derive(Properties, Clone)] 23 pub struct Props { 24 pub image_name: String, 25 } 26 27 pub enum Msg {} 28 29 impl Component for ImageDetail{ 30 type Message = Msg; 31 type Properties = Props; 32 33 fn create(props: Self::Properties, _: ComponentLink<Self>) -> Self { 34 ImageDetail{ 35 props, 36 } 37 } 38 39 fn update(&mut self, _msg: Self::Message) -> ShouldRender { 40 true 41 } 42 43 fn change(&mut self, props: Self::Properties) -> ShouldRender { 44 true 45 } 46 47 fn view(&self) -> Html { 48 html! { 49 <div> 50 { "this is image info" } 51 { self.props.image_name.to_string() } 52 </div> 53 } 54 } 55 } 56 57 impl ImageDetail{ 58 fn detail(&self) -> Html { 59 html! { 60 <div class="navbar-brand"> 61 </div> 62 } 63 } 64 }