Skip to content

Commit

Permalink
Dashboard issues fixed (AOT-Technologies#1740)
Browse files Browse the repository at this point in the history
* Dashboard fixes

* Update Dashboard.js
  • Loading branch information
Bonymol-aot authored Nov 17, 2023
1 parent d448f64 commit 0a51fef
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 79 deletions.
2 changes: 1 addition & 1 deletion forms-flow-web/src/components/Dashboard/CardFormCounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const CardFormCounter = React.memo((props) => {
</Tooltip>
)}
>
<span className="form-title">{formName}</span>
<span className="form-title text-truncate">{formName}</span>
</OverlayTrigger>
</div>
<div>
Expand Down
7 changes: 4 additions & 3 deletions forms-flow-web/src/components/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Loading from "../../containers/Loading";
import LoadError from "../Error";
import DateRangePicker from "@wojtekmaj/react-daterange-picker";
import moment from "moment";
import { Translation, useTranslation } from "react-i18next";
import { useTranslation } from "react-i18next";
import {
setMetricsDateRangeLoading,
setMetricsSubmissionLimitChange,
Expand Down Expand Up @@ -257,19 +257,20 @@ const Dashboard = React.memo(() => {
</div>

<div className="d-flex justify-content-end align-items-center col-12 col-md-4 px-0">
<div className="input-group mr-4">
<div className="input-group mr-2">
<FormControl
as="select"
onChange={(e) => onChangeInput(e.target.value)}
className="form-control"
style={{ padding: ".375rem .3rem" }}
title={t("Choose any")}
aria-label="Select date type"
>
<option value="created">{t("Created Date")}</option>
<option value="modified">{t("Modified Date")}</option>
</FormControl>
</div>
<DateRangePicker className = "bg-white"
<DateRangePicker className = "bg-white mr-2"
onChange={onSetDateRange}
value={dateRange}
dayPlaceholder="dd"
Expand Down
153 changes: 78 additions & 75 deletions forms-flow-web/src/components/Insights/Insights.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import { connect, useSelector,useDispatch } from "react-redux";
import { connect, useSelector, useDispatch } from "react-redux";
import Select from "react-select";
import NoData from "./nodashboard";
import { Route, Redirect } from "react-router";
Expand Down Expand Up @@ -91,84 +91,87 @@ const Insights = React.memo((props) => {

return (
<>
<div className="mb-2">
<Head items={headerList()} page="Insights"/>
<div className="d-flex align-items-center flex-md-row flex-colum justify-content-between mt-3"
data-testid="Insight"
role="main"
>
<h3 className="insight-title" data-testid="Dashboard">
<i className="fa fa-bars mr-2" />{" "}
<Translation>{(t) => t("Dashboard")}</Translation>
</h3>

<div className="col-6 col-md-3 mb-2">
{options.length > 0 && (
<Select
aria-label="Select Dashboard"
options={options}
onChange={setDashboardSelected}
placeholder={t("Select Dashboard")}
value={options.find(
(element) => element.value == activeDashboard.id
)}
/>
)}
</div>
</div>
<LoadingOverlay
active={
!(isDashboardListUpdated || isDashboardDetailUpdated) && !error
}
styles={{
overlay: (base) => ({
...base,
background: "rgba(255, 255, 255)",
}),
}}
className="col-12"
>
{options.length > 0 ? (
activeDashboard.public_url ? (
<iframe
title="dashboard"
style={{
width: "100%",
height: "auto",
overflow: "visible",
border: "none",
minHeight: "60vh",
}}
src={activeDashboard.public_url}
/>
) : !isDashboardDetailUpdated ? (
<div
style={{

<div className="mb-2">


<Head items={headerList()} page="Insights"/>


<div className="d-flex align-items-center flex-md-row flex-colum justify-content-between mt-3"
data-testid="Insight"
role="main"
>
<h3 className="insight-title" data-testid="Dashboard">
<i className="fa fa-bars mr-2" />{" "}
<Translation>{(t) => t("Dashboard")}</Translation>
</h3>

<div className="col-6 col-md-3 mb-2">
{options.length > 0 && (
<Select

aria-label="Select Dashboard"
options={options}
onChange={setDashboardSelected}
placeholder={t("Select Dashboard")}
value={options.find(
(element) => element.value == activeDashboard.id
)}
/>
)}
</div>
</div>

{options.length > 0 ? (
<LoadingOverlay
active={
!(isDashboardListUpdated || isDashboardDetailUpdated) && !error
}
styles={{
overlay: (base) => ({
...base,
background: "rgba(255, 255, 255)",
}),
}}
className="col-12"
>

{activeDashboard.public_url ? (
<iframe
title="dashboard"
style={{
width: "100%",
height: "auto",
overflow: "visible",
border: "none",
minHeight: "60vh",
}}
src={activeDashboard.public_url}
/>
) : !isDashboardDetailUpdated ? (
<div
style={{
position:'absolute',
left: '52%',
marginTop: '400px',
transform: 'translate(-50%, -90%)',
}}>
<Loading />
</div>
) : (
<NoPublicUrlMessage />
)
) : (
<NoData />
)}
</LoadingOverlay>

</div>

}}>
<Loading />
</div>
) : (
<NoPublicUrlMessage />
)
}
</LoadingOverlay>
)
: (
<NoData />
)}


</div>

<Route path={`${BASE_ROUTE}insights/:notAvailable`}>
<Redirect exact to="/404" />
</Route>
Expand Down

0 comments on commit 0a51fef

Please sign in to comment.