-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathExampleDetailPanel.tsx
More file actions
34 lines (31 loc) · 1.21 KB
/
ExampleDetailPanel.tsx
File metadata and controls
34 lines (31 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Copyright (c) 2023-2026 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
import React, { PureComponent } from 'react';
import { DetailPanelWithModel, QueryConfig, SchemaQuery } from '@labkey/components';
import { getServerContext } from '@labkey/api';
interface Props {
asPanel?: boolean
}
export class ExampleDetailPanel extends PureComponent<Props> {
// This function will return the QueryConfig definition for the LabKey schema/query to use for the API call
// to get data from the LabKey server about the given container (i.e. keyValue).
getQueryConfig(): QueryConfig {
return {
schemaQuery: new SchemaQuery('core', 'Containers'),
keyValue: getServerContext().container.id
};
}
// The render function of this component just passes along the QueryConfig to the @labkey/component's
// DetailPanelWithModel component. That component will make the API call to get the data and render the results.
render() {
return (
<DetailPanelWithModel
asPanel={this.props.asPanel}
queryConfig={this.getQueryConfig()}
/>
)
}
}