From 966cfee44e974bef429fa189d697bbd11957d9af Mon Sep 17 00:00:00 2001
From: Yaxue Guo <37635744+yaxue1123@users.noreply.github.com>
Date: Wed, 22 Feb 2023 13:24:28 -0500
Subject: [PATCH] Mockup/site page (#247)
* #238: added mock up page for site details
* #244: updated the yellow tera core ring
* #244: added site HAWI and connections
* #244: updated site name mapping
* #233: updated map and detail table to show Maintenance node
* #233: completed site maintenance info display on resources page and site detail page
* #233: added site detail page link to Slice Builder
* #233: updated portal release number
* #233: updated link to resources page on Slice Builder with site param
* #244: updated international links
---
package-lock.json | 2 +-
package.json | 2 +-
src/App.js | 2 +
src/components/Experiment/Slices.jsx | 4 +-
src/components/Resource/DetailTable.jsx | 88 +++++++++++--
src/components/Resource/SiteDetailPage.jsx | 124 ++++++++++++++++++
src/components/Resource/SummaryTable.jsx | 31 ++++-
src/components/Resource/Topomap.jsx | 24 ++--
src/components/Slice/SlicesTable.jsx | 6 +-
src/components/SliceViewer/SideNodes.jsx | 77 +++++++----
src/components/common/ProgressBar.jsx | 10 +-
src/data/sites.js | 12 +-
src/data/topomap.js | 32 +++--
src/pages/Home.jsx | 14 +-
src/pages/Resources.jsx | 32 ++++-
src/pages/SliceViewer.jsx | 4 +-
src/services/mockData/fakeResources.js | 14 +-
src/services/parser/sitesParser.js | 34 ++++-
src/services/portalData.json | 3 +-
src/styles/custom.scss | 3 +-
...eTimeParser.js => utcToLocalTimeParser.js} | 2 +-
21 files changed, 438 insertions(+), 82 deletions(-)
create mode 100644 src/components/Resource/SiteDetailPage.jsx
rename src/utils/{sliceTimeParser.js => utcToLocalTimeParser.js} (86%)
diff --git a/package-lock.json b/package-lock.json
index 85ab0cfc..d566e205 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12469,7 +12469,7 @@
"fast-json-stable-stringify": "^2.1.0",
"pretty-bytes": "^5.4.1",
"upath": "^1.2.0",
- "webpack-sources": "^1.4.3",
+ "webpack-sources": "^1.4.4",
"workbox-build": "6.5.2"
},
"dependencies": {
diff --git a/package.json b/package.json
index c1683835..3379b4f0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "fabric-portal",
- "version": "1.4.3",
+ "version": "1.4.4",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.32",
diff --git a/src/App.js b/src/App.js
index 9cce0150..19743132 100644
--- a/src/App.js
+++ b/src/App.js
@@ -16,6 +16,7 @@ import SliceViewer from "./pages/SliceViewer";
import NewSliceForm from "./pages/NewSliceForm";
import User from "./pages/User";
import PublicUserProfile from "./components/UserProfile/PublicUserProfile.jsx";
+import SiteDetailPage from "./components/Resource/SiteDetailPage.jsx";
import NotFound from "./pages/NotFound";
import Help from "./pages/Help";
import Header from "./components/Header";
@@ -123,6 +124,7 @@ class App extends React.Component {
- You have no slice in this project. Please create slices in Portal or
+ You have no slices in this project. Please create slices in Portal or
:
- We couldn't find your slice. Please create slices in Portal or
+ We couldn't find your slices. Please create slices in Portal or
{
+const generateProgressBar = (total, free, color, labelColor) => {
return (
@@ -37,11 +96,19 @@ const DetailTable = props => {
- {`${sitesNameMapping.shortNameToAcronym[name]} (${sitesNameMapping.shortToLongName[name]})`}
+ {
+ !resource && parent !== "sitepage" &&
+ `${sitesNameMapping.shortNameToAcronym[name]} (${sitesNameMapping.shortToLongName[name]})`
+ }
+ {
+ !resource && parent === "sitepage" &&
+ `${sitesNameMapping.acronymToShortName[name]} (${sitesNameMapping.acronymToLongName[name]})`
+ }
+ {
+ resource && parent !== "sitepage" &&
+
+ {`${sitesNameMapping.shortNameToAcronym[name]} (${sitesNameMapping.shortToLongName[name]})`}
+
+ }
+ {
+ resource && parent === "sitepage" && sitesNameMapping.acronymToShortName[name] &&
+
+ {`${sitesNameMapping.acronymToShortName[name]} (${sitesNameMapping.acronymToLongName[name]})`}
+
+ }
+ {
+ resource && parent === "sitepage" && !sitesNameMapping.acronymToShortName[name] && name
+ }
Status
{
- resource ? (
- Up
- ) : (Down)
+ !resource &&
+
+ Down
+
+ }
+ {
+ resource &&
+
+ { statusMapping[resource.status.state].state }
+
}
-
{
@@ -50,7 +117,12 @@ const DetailTable = props => {
)
diff --git a/src/components/Resource/SiteDetailPage.jsx b/src/components/Resource/SiteDetailPage.jsx
new file mode 100644
index 00000000..2f255fb2
--- /dev/null
+++ b/src/components/Resource/SiteDetailPage.jsx
@@ -0,0 +1,124 @@
+import React from "react";
+import DetailTable from "./DetailTable";
+import { sitesNameMapping } from "../../data/sites";
+import utcToLocalTimeParser from "../../utils/utcToLocalTimeParser.js";
+import { default as portalData } from "../../services/portalData.json";
+import { Link } from "react-router-dom";
+
+const SiteDetailPage = props => {
+ const statusMapping = {
+ "Maint": {
+ state: "Maintenance",
+ color: "warning",
+ explanation: "no requests would be accepted"
+ },
+ "PreMaint": {
+ state: "Pre-Maintenance",
+ color: "warning",
+ explanation: "requests will be expected until the deadline"
+ },
+ "Active": {
+ state: "Active",
+ color: "primary",
+ explanation: ""
+
+ }
+ }
+
+ const { state } = props.location;
+
+ return (
+ {row[0]}
- {generateProgressBar(resource[row[1]], resource[row[2]])}
+ {
+ generateProgressBar(resource[row[1]],
+ resource[row[2]],
+ statusMapping[resource.status.state].colorHex,
+ statusMapping[resource.status.state].labelColorHex)
+ }
Site - {state.siteData.name}
+
+
+
+ Basic Information
+
+
+ {
+ sitesNameMapping.acronymToShortName[state.siteData.name] &&
+
+
+
+ }
+ Name
+ { sitesNameMapping.acronymToShortName[state.siteData.name] }
+
+
+ Acronym
+ { state.siteData.name }
+
+
+ {
+ state.siteData.status["state"] === "Maint" &&
+ Status
+
+ {
+ state.siteData.status["state"] !== "Active" ?
+ `${statusMapping[state.siteData.status["state"]].state} (${statusMapping[state.siteData.status["state"]].explanation})` :
+ statusMapping[state.siteData.status["state"]].state
+ }
+
+
+
+ }
+ {
+ state.siteData.status["state"] === "PreMaint" &&
+ Expected End Time
+
+ {
+ state.siteData.status["expected_end"] ?
+ utcToLocalTimeParser(state.siteData.status["expected_end"]) : "Unknown"
+ }
+
+
+
+ }
+ {
+ state.siteData.location &&
+ Deadline
+
+ {
+ state.siteData.status["deadline"] ?
+ utcToLocalTimeParser(state.siteData.status["deadline"]) : "Unknown"
+ }
+
+
+
+ }
+
+ Rack Location
+ { JSON.parse(state.siteData.location).postal }
+ Resource Availabilities
+