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

Mdms kpi #1942

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { DssChartConfig } from "../../configs/DssChartConfig";

const searchDssChartV2 = async (module, planId, campaignType, boundaries = []) => {
const searchDssChartV2 = async (module, planId, config, campaignType, boundaries = []) => {
ashish-egov marked this conversation as resolved.
Show resolved Hide resolved
try {

// Validate inputs
if (!module || !planId || !campaignType) {
console.error("Invalid module or planId or campaignType provided");
throw new Error("Invalid module or planId or campaignType provided");
if (!module || !planId || !campaignType || !config) {
console.error("Any of module, planId, campaignType or config is invalid for searchDssChartV2");
throw new Error("Any of module, planId, campaignType or config is invalid for searchDssChartV2");
}

// Find the configuration for the provided module
const moduleConfig = DssChartConfig.find(config => config.module === module);
const moduleConfig = config.find(config => config.module === module);

if (!moduleConfig) {
console.error(`No DSS Chart configuration found for module: ${module}`);
Expand Down Expand Up @@ -38,7 +37,7 @@ const searchDssChartV2 = async (module, planId, campaignType, boundaries = []) =
filters["tenantId"] = [tenantId];

// Collect all unique visualizationCodes (both primary and concatenateKey) for requests
const charts = campaignConfig.charts.filter(chart => chart.active); // Only active charts
const charts = campaignConfig.charts;
const visualizationCodes = new Set();

charts.forEach(chart => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { useQuery } from "react-query";
import { useMyContext } from "../utils/context";
import searchDssChartV2 from "./services/searchDssChartV2";

const useKpiDssSearch = (moduleAndPlanConfig) => {
const { state } = useMyContext();
const module = moduleAndPlanConfig?.module;
const planId = moduleAndPlanConfig?.planId;
const campaignType = moduleAndPlanConfig?.campaignType;
const boundaries = moduleAndPlanConfig?.boundariesForKpi;
const config = state?.DssKpiConfigs;;
ashish-egov marked this conversation as resolved.
Show resolved Hide resolved
const queryString = `dss-${module}-${planId}_${campaignType}_${JSON.stringify(boundaries)}`;
const { isLoading, data, isFetching, refetch } = useQuery([queryString, "/dashboard-analytics/dashboard/getChartV2"], () => searchDssChartV2(module, planId, campaignType, boundaries), {
const { isLoading, data, isFetching, refetch } = useQuery([queryString, "/dashboard-analytics/dashboard/getChartV2"], () => searchDssChartV2(module, planId, config, campaignType, boundaries), {
ashish-egov marked this conversation as resolved.
Show resolved Hide resolved
...{},
cacheTime: 0,
staleTime: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ const PlanInbox = () => {
<div>{`${t("LOGGED_IN_AS")} ${userName} - ${t(userRole)}`}</div>
</div>
</div>
<GenericKpiFromDSS module="MICROPLAN" planId={microplanId} campaignType={campaignObject?.projectType} planEmployee={planEmployee} boundariesForKpi={defaultBoundaries}/>
<GenericKpiFromDSS module="MICROPLAN" planId={microplanId} campaignType={campaignObject?.projectType} planEmployee={planEmployee} boundariesForKpi={defaultBoundaries}/>
ashish-egov marked this conversation as resolved.
Show resolved Hide resolved
<SearchJurisdiction
boundaries={boundaries}
defaultHierarchy={defaultHierarchy}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier
{ name: "facilityStatus" },
{ name: "VehicleDetails" },
{ name: "ContextPathForUser" },
{ name: "DssKpiConfigs" },
],
{
cacheTime: Infinity,
Expand Down