Skip to content
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

UI Corrections #774

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ui/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<title>React App</title>
</head>
<body>
<div id="root"></div>
<body id="root" class="ui5-content-native-scrollbars ui5-content-density-compact">
</body>
</html>
18 changes: 0 additions & 18 deletions ui/src/App.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
Expand All @@ -13,16 +10,6 @@
}
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
Expand All @@ -40,8 +27,3 @@
html {
background-color: #D6D9DC;
}

body {
margin: 0px auto;
width: 100vw;
}
4 changes: 1 addition & 3 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import View from "./components/View";

function App() {
return (
<div id="App" className="App">
<div className="ui5-content-density-compact">
<div id="App" className="App html-wrap flex-container flex-column">
<View />
</div>
</div>
);
}
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/CreateInstanceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function CreateInstanceForm(props: any) {
setLoading(true)
axios
.post<ServiceInstance>(api("service-instances"),
{name: name, planID: planId})
{name: name, service_plan_id: planId})
.then((response) => {
setLoading(false);
// setServiceInstances(response.data);
Expand All @@ -45,7 +45,7 @@ function CreateInstanceForm(props: any) {

setName(generateServiceInstanceName(
props.plan?.name,
props.offering?.catalogName
props.offering?.catalog_name
))

setPlanId(props.plan.id)
Expand All @@ -59,7 +59,7 @@ function CreateInstanceForm(props: any) {
<ui5.Form>
<ui5.FormItem label={<ui5.Label required>Name</ui5.Label>}>
<ui5.Input
style={{ width: "100vw" }}
style={{ width: "100%" }}
required
value={name}
/>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/SecretsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function SecretsView(props: any) {
return (
<>
<ui5.Select
style={{width: "20vw"}}
style={{width: "20%"}}
onChange={(e) => {
props.handler(e.target.value);
}}
Expand Down
34 changes: 21 additions & 13 deletions ui/src/components/ServiceInstancesView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function ServiceInstancesView() {
const [portal, setPortal] = useState<JSX.Element>();

useEffect(() => {
var useTestData = process.env.REACT_APP_USE_TEST_DATA
var useTestData = process.env.REACT_APP_USE_TEST_DATA === "true"
if (!useTestData) {
setLoading(true)
axios
Expand Down Expand Up @@ -55,7 +55,8 @@ function ServiceInstancesView() {
<ui5.TableRow
onClick={() => {
console.log("Row clicked")
const instanceView = <ServiceInstancesDetailsView key={instance.id} instance={instance} open={true} />
const instanceView = <ServiceInstancesDetailsView
key={instance.id} instance={instance} open={true} />
const portal = createPortal( instanceView, document.getElementById("App")!!)
setPortal(portal)
}}
Expand All @@ -78,18 +79,25 @@ function ServiceInstancesView() {
return (
<>
{
<ui5.Card>

<ui5.Table
columns={
<>
<ui5.TableColumn>
<ui5.Label>Service Instance</ui5.Label>
</ui5.TableColumn>

<ui5.TableColumn>
<ui5.Label>Service Namespace</ui5.Label>
</ui5.TableColumn>
</>
}
>
{renderData()}
</ui5.Table>
</ui5.Card>

<ui5.Table
columns={
<>
<ui5.TableColumn>
<ui5.Label>Service Instance</ui5.Label>
</ui5.TableColumn>
</>
}
>
{renderData()}
</ui5.Table>
}
{portal != null && portal}

Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/ServiceOfferingsDetailsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function ServiceOfferingsDetailsView(props: any) {
startContent={
<>
<ui5.Title level="H5">
Create {offering?.catalogName} Service Instance
Create {offering?.metadata.displayName} Service Instance
</ui5.Title>
</>
}
Expand All @@ -96,7 +96,7 @@ function ServiceOfferingsDetailsView(props: any) {
<ui5.Panel headerLevel="H2" headerText="Service Instance Details">
<ui5.Form>
<ui5.FormItem label="Name">
<ui5.Text>{offering?.catalogName}</ui5.Text>
<ui5.Text>{offering?.metadata.displayName}</ui5.Text>
</ui5.FormItem>
<ui5.FormItem label="Description">
<ui5.Text>{offering?.description}</ui5.Text>
Expand Down
32 changes: 18 additions & 14 deletions ui/src/components/ServiceOfferingsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import "@ui5/webcomponents-fiori/dist/illustrations/NoData.js";
import Ok from "../shared/validator";
import {createPortal} from "react-dom";
import ServiceOfferingsDetailsView from "./ServiceOfferingsDetailsView";
import { ResponsiveGridLayout } from "@ui5/webcomponents-react";

function ServiceOfferingsView(props: any) {
const greyImg = "data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
const greyImg = "data:image/svg+xml;base64,PHN2ZyBpZD0icGxhY2Vob2xkZXIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDU2IDU2Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6IzVhN2E5NDt9LmNscy0ye2ZpbGw6IzA0OTFkMDt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPnBsYWNlaG9sZGVyPC90aXRsZT48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik00Ni45NTMsMjAuNTg4YTQuMzYzLDQuMzYzLDAsMCwwL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sMS4yNjYsMS41ODMsMS41ODMsMCwwLDAsMS4yMjYuNTE2aDguNDg4Yy42OTEsMCwxLjAzNS4yMzgsMS4wMzcuNzVhMS41NDcsMS41NDcsMCwwLDEtLjQyMi45NDRMMTMuODA3LDQ0LjVhNi41NDksNi41NDksMCwwLDAtLjk5LDEuMjY2LDMuMTE2LDMuMTE2LDAsMCwwLS40MjQsMS42NDEsNC4yMzcsNC4yMzcsMCwwLDAsMS4zNjcsMy40Nyw0Ljc5MSw0Ljc5MSwwLDAsMCw2LjIyNC0uMDQ3LDQuNTE3LDQuNTE3LDAsMCwwLDEuNDQ1LTMuMjgzLDMuNjMxLDMuNjMxLDAsMCwwLS41MTQtMS44ODljLS4yMTUtLjMwNy0uOTc4LTEuMTU4LS45NzgtMS4xNThMMTguOSw0My4zNzNhMS40OTIsMS40OTIsMCwwLDEtLjM3Ny0uOTM4cTAtLjc1Ljg0OC0uNzVoNS42NThxMS4yMjYsMCwxLjctMS41VjM1LjM0MUgyOC4zNWMuNTU3LDAsMS4wNTQuNTE5LDEuNDg5LjhhMTIuMjkxLDEyLjI5MSwwLDAsMSwxLjIyNi44OTFxLjU2NS40NjksMS4xNzkuODlhMy43ODYsMy43ODYsMCwwLDAsMS44MTYuNDIyLDMuMjU2LDMuMjU2LDAsMCwwLDMuMDg3LTEuNDA2LDUuMTE5LDUuMTE5LDAsMCwwLC45OS0zQTQuNzg4LDQuNzg4LDAsMCwwLDM3LjE0NywzMS4wNzRaIi8+PC9zdmc+"
const [offerings, setOfferings] = useState<ServiceOfferings>();
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
Expand Down Expand Up @@ -66,12 +67,8 @@ function ServiceOfferingsView(props: any) {
const cards = offerings?.items.map((offering, index) => {
// @ts-ignore
return (
<>
<ui5.Card
key={index}
style={{
width: '600px',
}}
onClick={() => {
setPortal(createPortal( <ServiceOfferingsDetailsView offering={offering} />, document.getElementById("App")!!, window.crypto.randomUUID()))
}}
Expand All @@ -82,22 +79,29 @@ function ServiceOfferingsView(props: any) {
<img alt="" src={getImg(offering.metadata.imageUrl)}></img>
</ui5.Avatar>
}
style={{
width: "100%"
}}
subtitleText={offering.description}
titleText={offering.catalogName}
subtitleText={offering.catalog_name}
titleText={offering.metadata.displayName}
status={formatStatus(index, offerings?.numItems)}
interactive
/>
/>
}
/>
</>
>
</ui5.Card>
);
});

return <>
{cards}

<ResponsiveGridLayout
columnsXL={3}
columnsL={2}
columnsM={1}
columnsS={1}
>
{/* <React.Fragment key=".0"> */}
{cards}
{/* </React.Fragment> */}
</ResponsiveGridLayout>
{portal != null && portal}
</>
};
Expand Down
76 changes: 34 additions & 42 deletions ui/src/components/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,57 +18,49 @@ function Overview(props: any) {

return (
<>
<ui5.Page
header={<ui5.Bar design="Header">Service Management UI</ui5.Bar>}
>
<ui5.Title level="H1">Service Marketplace</ui5.Title>
</ui5.Page>

<ui5.Bar
design="Header"
endContent={<span>SAP BTP, Kyma runtime</span>}
startContent={<span>Select your credentials:</span>}
>
<Secrets handler={(e: any) => handler(e)} style={{width: "100vw"}} />
<Secrets handler={(e: any) => handler(e)} style={{width: "100%"}} />
</ui5.Bar>


<div className="flex-container flex-row">



<>
<div>
<ui5.FlexBox
style={{
height: "100vh",
width: "100vw",
}}
>
<ui5.SideNavigation
style={{
width: "10%",
height: "90vh",
}}
>
<ui5.SideNavigationItem
text="Marketplace"
selected
onClick={() => {
setPageContent(<ServiceOfferings secret={secret}/>);
}}
/>
<ui5.SideNavigationItem
text="Service Instances"
onClick={() => {
setPageContent(<ServiceInstancesView/>);
}}
/>
</ui5.SideNavigation>
<ui5.Page
backgroundDesign="Solid"
style={{
width: "90%",
}}
>
<div className="margin-wrapper">

<ui5.SideNavigation>
<ui5.SideNavigationItem
text="Marketplace"
icon="puzzle"
selected
onClick={() => {
setPageContent(<ServiceOfferings secret={secret}/>);
}}
/>
<ui5.SideNavigationItem
text="Service Instances"
icon="connected"
onClick={() => {
setPageContent(<ServiceInstancesView/>);
}}
/>
</ui5.SideNavigation>
</div>


<div className="margin-wrapper scrollable">
{pageContent}
</ui5.Page>
</ui5.FlexBox>
</div>
</div>
</>
</div>

</>
);
}
Expand Down
47 changes: 47 additions & 0 deletions ui/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,56 @@ body {
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
overflow: hidden;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

* {
box-sizing: border-box;
}

#root {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding: 0.5rem 0.5rem 0 0.5rem;
}

.flex-container {
display: flex;
}

.flex-column {
flex-direction: column;
width: 100%;
}

.flex-row {
flex-direction: row;
height: 100%;
}


#App {
display: flex;
min-height: 0;
position: relative;
height: 100%;
}

.margin-wrapper {
margin: 0.5rem 0.5rem 0 0.5rem;
padding: 0.5rem 0.5rem 0 0.5rem;
}

.scrollable {
overflow-y: auto;
height: 100%;
width: 100%;
}
3 changes: 2 additions & 1 deletion ui/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import { ThemeProvider } from "@ui5/webcomponents-react";

import '@ui5/webcomponents-react/dist/Assets';

const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement
);
Expand Down
Loading