@@ -321,6 +332,34 @@ class Views extends TableView {
}
renderEmpty() {
+ if (!this.props.params.name) {
+ if (this.state.views.length > 0) {
+ return (
+
+ );
+ }
+ return (
+
+ Use views to display aggregated data from your classes.{' '}
+
+ Learn more
+
+ .
+
+ }
+ cta="Create a view"
+ action={() => this.setState({ showCreate: true })}
+ />
+ );
+ }
return No data available
;
}
@@ -336,7 +375,9 @@ class Views extends TableView {
current={current}
params={this.props.location?.search}
linkPrefix={'views/'}
- classClicked={() => {}}
+ classClicked={() => {
+ window.scrollTo({ top: 0 });
+ }}
categories={categories}
/>
);
@@ -345,15 +386,14 @@ class Views extends TableView {
renderToolbar() {
const subsection = this.props.params.name || '';
let editMenu = null;
+ let refreshButton = null;
if (this.props.params.name) {
editMenu = (
{}}>
);
+ refreshButton = (
+ <>
+
+
+ Refresh
+
+
+ >
+ );
}
+
return (
+ {refreshButton}
{editMenu}
);
@@ -402,10 +451,7 @@ class Views extends TableView {
this.setState(
state => ({ showCreate: false, views: [...state.views, view] }),
() => {
- ViewPreferences.saveViews(
- this.context.applicationId,
- this.state.views
- );
+ ViewPreferences.saveViews(this.context.applicationId, this.state.views);
this.loadViews(this.context);
}
);
@@ -433,10 +479,7 @@ class Views extends TableView {
return { editView: null, editIndex: null, views: newViews };
},
() => {
- ViewPreferences.saveViews(
- this.context.applicationId,
- this.state.views
- );
+ ViewPreferences.saveViews(this.context.applicationId, this.state.views);
this.loadViews(this.context);
}
);
@@ -456,10 +499,7 @@ class Views extends TableView {
return { deleteIndex: null, views: newViews };
},
() => {
- ViewPreferences.saveViews(
- this.context.applicationId,
- this.state.views
- );
+ ViewPreferences.saveViews(this.context.applicationId, this.state.views);
if (this.props.params.name === name) {
const path = generatePath(this.context, 'views');
this.props.navigate(path);
@@ -486,9 +526,7 @@ class Views extends TableView {
}
handlePointerClick({ className, id, field = 'objectId' }) {
- const filters = JSON.stringify([
- { field, constraint: 'eq', compareTo: id },
- ]);
+ const filters = JSON.stringify([{ field, constraint: 'eq', compareTo: id }]);
const path = generatePath(
this.context,
`browser/${className}?filters=${encodeURIComponent(filters)}`