File tree Expand file tree Collapse file tree 6 files changed +66
-2
lines changed
viewModelBuilders/azul/anvil-cmg/common
site-config/anvil-cmg/dev Expand file tree Collapse file tree 6 files changed +66
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ export { Section } from "../../components/common/MDXMarkdown/components/Section/
3
3
export { default as ExportToTerraStart } from "../common/exportToTerraStart.mdx" ;
4
4
export { default as ExportToTerraSuccess } from "../common/exportToTerraSuccess.mdx" ;
5
5
export { default as DataReleasePolicy } from "./dataReleasePolicy.mdx" ;
6
+ export { default as LoginReminder } from "./loginReminder.mdx" ;
6
7
export { default as LoginTermsOfService } from "./loginTermsOfService.mdx" ;
7
8
export { default as LoginText } from "./loginText.mdx" ;
8
9
export { default as LoginWarning } from "./loginWarning.mdx" ;
Original file line number Diff line number Diff line change
1
+ import { Link } from " @clevercanary/data-explorer-ui/lib/components/Links/components/Link/link" ;
2
+
3
+ <span >
4
+ Access to data explorer is limited for unauthorized users.To view all
5
+ available data please <Link label = " Sign In" url = " /login" />
6
+ </span >
Original file line number Diff line number Diff line change @@ -256,6 +256,21 @@ export const buildDatasetIds = (
256
256
} ;
257
257
} ;
258
258
259
+ /**
260
+ * Build dataset list view list hero warning.
261
+ * Warning serves as a reminder for users to log in.
262
+ * @returns model to be used as props for Alert component.
263
+ */
264
+ export const buildDatasetListViewListHeroWarning = ( ) : React . ComponentProps <
265
+ typeof C . Alert
266
+ > => {
267
+ return {
268
+ severity : "warning" ,
269
+ title : MDX . RenderComponent ( { Component : MDX . LoginReminder } ) ,
270
+ variant : "banner" ,
271
+ } ;
272
+ } ;
273
+
259
274
/**
260
275
* Build props for StatusBadge component from the given datasets response.
261
276
* @param datasetsResponse - Response model return from datasets API.
@@ -827,6 +842,24 @@ function mapCurrentQuery(
827
842
] ;
828
843
}
829
844
845
+ /**
846
+ * Renders configuration component children when the given authentication state is not authorized.
847
+ * @param _ - Unused.
848
+ * @param viewContext - View context.
849
+ * @returns model to be used as props for the ConditionalComponent component.
850
+ */
851
+ export const renderWhenUnAuthorized = (
852
+ _ : DatasetsResponse ,
853
+ viewContext : ViewContext
854
+ ) : React . ComponentProps < typeof C . ConditionalComponent > => {
855
+ const {
856
+ authState : { isAuthorized } ,
857
+ } = viewContext ;
858
+ return {
859
+ isIn : ! isAuthorized ,
860
+ } ;
861
+ } ;
862
+
830
863
/**
831
864
* Renders entity related export when the given datasests response is accessible.
832
865
* @param datasetsResponse - Response model return from datasets API.
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { mainColumn as exportMainColumn } from "../detail/dataset/exportMainColu
16
16
import { mainColumn } from "../detail/dataset/overviewMainColumn" ;
17
17
import { sideColumn } from "../detail/dataset/overviewSideColumn" ;
18
18
import { top } from "../detail/dataset/top" ;
19
+ import { listHero } from "../listView/datasetsListHero" ;
19
20
20
21
/**
21
22
* Entity config object responsible for config related to the /explore/datasets route.
@@ -134,6 +135,9 @@ export const datasetsEntityConfig: EntityConfig<DatasetsResponse> = {
134
135
id : ANVIL_CMG_CATEGORY_KEY . DATASET_TITLE ,
135
136
} ,
136
137
} as ListConfig < DatasetsResponse > ,
138
+ listView : {
139
+ listHero,
140
+ } ,
137
141
route : "datasets" ,
138
142
staticLoad : false ,
139
143
} ;
Original file line number Diff line number Diff line change
1
+ import {
2
+ ComponentConfig ,
3
+ ComponentsConfig ,
4
+ } from "@clevercanary/data-explorer-ui/lib/config/entities" ;
5
+ import { DatasetsResponse } from "../../../../app/apis/azul/anvil-cmg/common/responses" ;
6
+ import * as C from "../../../../app/components" ;
7
+ import * as V from "../../../../app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders" ;
8
+
9
+ export const listHero : ComponentsConfig = [
10
+ {
11
+ children : [
12
+ {
13
+ component : C . Alert ,
14
+ viewBuilder : V . buildDatasetListViewListHeroWarning ,
15
+ } as ComponentConfig < typeof C . Alert > ,
16
+ ] ,
17
+ component : C . ConditionalComponent ,
18
+ viewBuilder : V . renderWhenUnAuthorized ,
19
+ } as ComponentConfig < typeof C . ConditionalComponent , DatasetsResponse > ,
20
+ ] ;
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ import {
3
3
ComponentsConfig ,
4
4
} from "@clevercanary/data-explorer-ui/lib/config/entities" ;
5
5
import * as C from "../../../../app/components" ;
6
- import * as T from "../../../../app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders" ;
6
+ import * as V from "../../../../app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders" ;
7
7
8
8
export const listHero : ComponentsConfig = [
9
9
{
10
10
component : C . Alert ,
11
- viewBuilder : T . buildListWarning ,
11
+ viewBuilder : V . buildListWarning ,
12
12
} as ComponentConfig < typeof C . Alert > ,
13
13
] ;
You can’t perform that action at this time.
0 commit comments