add ability to customize whitch paremeters to show
Some checks failed
Deploy MyApp on Same Server / build-and-deploy (push) Failing after 1s
Some checks failed
Deploy MyApp on Same Server / build-and-deploy (push) Failing after 1s
This commit is contained in:
@@ -28,6 +28,7 @@ function DailyReportContent() {
|
||||
const [activeTab, setActiveTab] = useState<TabType>('summary')
|
||||
const [forecastWeather, setForecastWeather] = useState<WeatherData | null>(null)
|
||||
const [forecastWeatherLoading, setForecastWeatherLoading] = useState(false)
|
||||
const [visibleParams, setVisibleParams] = useState<string[] | null>(null)
|
||||
|
||||
// Map summary param to chart key
|
||||
const paramToChartKey = useCallback((param: string): string => {
|
||||
@@ -113,6 +114,16 @@ function DailyReportContent() {
|
||||
|
||||
const result = await api.listTelemetry({ deviceId, startUtc, endUtc, pageSize: 100000 })
|
||||
setTelemetry(result.items)
|
||||
|
||||
console.log(result.items)
|
||||
// Load visible params from server (controls which parameters are shown)
|
||||
try {
|
||||
const params = await api.getDisplayParameters(deviceId)
|
||||
setVisibleParams(params ?? null)
|
||||
} catch (err) {
|
||||
console.error('Error loading display parameters:', err)
|
||||
setVisibleParams(['gas', 'temperature', 'humidity', 'lux'])
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error loading telemetry:', error)
|
||||
} finally {
|
||||
@@ -243,20 +254,20 @@ function DailyReportContent() {
|
||||
className="md:mx-0 mx-[-1rem] md:rounded-xl rounded-none"
|
||||
>
|
||||
{{
|
||||
summary: <SummaryTab temperature={temp} humidity={hum} soil={soil} gas={gas} lux={lux} forecastWeather={forecastWeather} forecastWeatherLoading={forecastWeatherLoading} onCardClick={handleCardClick} />,
|
||||
summary: <SummaryTab temperature={temp} humidity={hum} soil={soil} gas={gas} lux={lux} forecastWeather={forecastWeather} forecastWeatherLoading={forecastWeatherLoading} onCardClick={handleCardClick} visibleParams={visibleParams} />,
|
||||
charts: (
|
||||
<Suspense fallback={<Loading message="در حال بارگذاری نمودارها..." />}>
|
||||
<ChartsTab sortedTelemetry={sortedTelemetry} dataGaps={dataGaps} />
|
||||
<ChartsTab sortedTelemetry={sortedTelemetry} dataGaps={dataGaps} visibleParams={visibleParams} />
|
||||
</Suspense>
|
||||
),
|
||||
weather: selectedDate ? (
|
||||
weather: selectedDate ? (
|
||||
<Suspense fallback={<Loading message="در حال بارگذاری اطلاعات آب و هوا..." />}>
|
||||
<WeatherTab selectedDate={selectedDate} />
|
||||
<WeatherTab selectedDate={selectedDate} />
|
||||
</Suspense>
|
||||
) : null,
|
||||
analysis: selectedDate ? (
|
||||
<Suspense fallback={<Loading message="در حال بارگذاری تحلیل..." />}>
|
||||
<AnalysisTab deviceId={deviceId} selectedDate={selectedDate} />
|
||||
<AnalysisTab deviceId={deviceId} selectedDate={selectedDate} />
|
||||
</Suspense>
|
||||
) : null,
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user