Просмотр исходного кода

Show os type in Wizard VM selection screen

Show "windows" or "linux" logo in the Wizard VM selection screen based
on the instance `os_type` field.
Sergiu Miclea 3 лет назад
Родитель
Сommit
dc3e2c7c2e

+ 14 - 3
src/components/modules/WizardModule/WizardInstances/WizardInstances.tsx

@@ -28,6 +28,8 @@ import { ThemePalette, ThemeProps } from "@src/components/Theme";
 import type { Instance as InstanceType } from "@src/@types/Instance";
 
 import instanceImage from "./images/instance.svg";
+import instanceLinuxImage from "./images/instance-linux.svg";
+import instanceWindowsImage from "./images/instance-windows.svg";
 import bigInstanceImage from "./images/instance-big.svg";
 
 const Wrapper = styled.div<any>`
@@ -89,9 +91,18 @@ const LoadingText = styled.div<any>`
   margin-top: 38px;
   font-size: 18px;
 `;
-export const Image = styled.div<any>`
+const getOsImage = (osType?: string) => {
+  if (osType === "linux") {
+    return instanceLinuxImage;
+  }
+  if (osType === "windows") {
+    return instanceWindowsImage;
+  }
+  return instanceImage;
+};
+export const InstanceImage = styled.div<{ os?: string }>`
   ${ThemeProps.exactSize("48px")}
-  background: url('${instanceImage}') center no-repeat;
+  background: url('${props => getOsImage(props.os)}') center no-repeat;
 `;
 const Label = styled.div<any>`
   flex-grow: 1;
@@ -367,7 +378,7 @@ class WizardInstances extends React.Component<Props, State> {
                 }}
               />
               <InstanceContent>
-                <Image />
+                <InstanceImage os={instance.os_type} />
                 <Label>
                   <LabelTitle>{instance.name}</LabelTitle>
                   {instanceId !== instance.name ? (

Разница между файлами не показана из-за своего большого размера
+ 35 - 0
src/components/modules/WizardModule/WizardInstances/images/instance-linux.svg


+ 42 - 0
src/components/modules/WizardModule/WizardInstances/images/instance-windows.svg

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg    xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   id="svg1463"
+   version="1.1"
+   viewBox="0 0 48 48"
+   height="48px"
+   width="48px">
+  <!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
+  <desc
+     id="desc1453">Created with Sketch.</desc>
+  <g
+     fill-rule="evenodd"
+     fill="none"
+     stroke-width="1"
+     stroke="none"
+     id="Symbols">
+    <g
+       id="Icon/instance">
+      <rect
+         rx="8"
+         height="48"
+         width="48"
+         y="0"
+         x="0"
+         fill="#D8DBE2"
+         id="Rectangle-Copy-2" />
+    </g>
+  </g>
+  <g
+     transform="matrix(0.30191544,0,0,0.30191544,10.821391,10.776104)"
+     id="g2039"
+     style="fill:#0044ca;fill-opacity:1">
+    <path
+       style="fill:#0044ca;fill-opacity:1"
+       id="path843"
+       d="M 0,12.5 35.7,7.6 V 42.1 H 0 M 40,6.9 87.3,0 V 41.8 H 40 M 0,45.74 h 35.7 v 34.6 L 0,75.34 M 40,46.2 H 87.3 V 87.6 L 40,80.9" />
+  </g>
+</svg>

+ 1 - 1
src/components/modules/WizardModule/WizardScripts/WizardScripts.tsx

@@ -18,7 +18,7 @@ import styled, { css } from "styled-components";
 
 import InfoIcon from "@src/components/ui/InfoIcon";
 import { Close as InputClose } from "@src/components/ui/TextInput";
-import { Image as InstanceImage } from "@src/components/modules/WizardModule/WizardInstances";
+import { InstanceImage } from "@src/components/modules/WizardModule/WizardInstances";
 import StatusIcon from "@src/components/ui/StatusComponents/StatusIcon";
 
 import { ThemePalette, ThemeProps } from "@src/components/Theme";

Некоторые файлы не были показаны из-за большого количества измененных файлов