-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: add connected components for insights
This commit adds connected components for the workload and schema insights pages, for use in the CC Console. Fixes #87693. Release note: None
- Loading branch information
1 parent
eaa0f86
commit 15e8355
Showing
37 changed files
with
705 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
pkg/ui/workspaces/cluster-ui/src/insights/schemaInsights/schemaInsightsPageConnected.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
import { connect } from "react-redux"; | ||
import { RouteComponentProps, withRouter } from "react-router-dom"; | ||
import { | ||
actions, | ||
selectSchemaInsights, | ||
selectSchemaInsightsDatabases, | ||
selectSchemaInsightsError, | ||
selectSchemaInsightsTypes, | ||
selectFilters, | ||
selectSortSetting, | ||
} from "src/store/schemaInsights"; | ||
import { AppState } from "src/store"; | ||
import { | ||
SchemaInsightsView, | ||
SchemaInsightsViewDispatchProps, | ||
SchemaInsightsViewStateProps, | ||
} from "./schemaInsightsView"; | ||
import { SchemaInsightEventFilters } from "../types"; | ||
import { SortSetting } from "src/sortedtable"; | ||
import { actions as localStorageActions } from "../../store/localStorage"; | ||
|
||
const mapStateToProps = ( | ||
state: AppState, | ||
_props: RouteComponentProps, | ||
): SchemaInsightsViewStateProps => ({ | ||
schemaInsights: selectSchemaInsights(state), | ||
schemaInsightsDatabases: selectSchemaInsightsDatabases(state), | ||
schemaInsightsTypes: selectSchemaInsightsTypes(state), | ||
schemaInsightsError: selectSchemaInsightsError(state), | ||
filters: selectFilters(state), | ||
sortSetting: selectSortSetting(state), | ||
}); | ||
|
||
const mapDispatchToProps = { | ||
onFiltersChange: (filters: SchemaInsightEventFilters) => | ||
localStorageActions.update({ | ||
key: "filters/SchemaInsightsPage", | ||
value: filters, | ||
}), | ||
onSortChange: (ss: SortSetting) => | ||
localStorageActions.update({ | ||
key: "sortSetting/SchemaInsightsPage", | ||
value: ss, | ||
}), | ||
refreshSchemaInsights: actions.refresh, | ||
}; | ||
|
||
export const SchemaInsightsPageConnected = withRouter( | ||
connect< | ||
SchemaInsightsViewStateProps, | ||
SchemaInsightsViewDispatchProps, | ||
RouteComponentProps | ||
>( | ||
mapStateToProps, | ||
mapDispatchToProps, | ||
)(SchemaInsightsView), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...paces/cluster-ui/src/insights/workloadInsightDetails/statementInsightDetailsConnected.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
import { connect } from "react-redux"; | ||
import { RouteComponentProps, withRouter } from "react-router-dom"; | ||
import { | ||
StatementInsightDetails, | ||
StatementInsightDetailsStateProps, | ||
} from "./statementInsightDetails"; | ||
import { AppState } from "src/store"; | ||
import { | ||
selectStatementInsightDetails, | ||
selectStatementInsightsError, | ||
} from "src/store/insights/statementInsights"; | ||
|
||
const mapStateToProps = ( | ||
state: AppState, | ||
props: RouteComponentProps, | ||
): StatementInsightDetailsStateProps => { | ||
const insightStatements = selectStatementInsightDetails(state, props); | ||
const insightError = selectStatementInsightsError(state); | ||
return { | ||
insightEventDetails: insightStatements, | ||
insightError: insightError, | ||
}; | ||
}; | ||
|
||
export const StatementInsightDetailsConnected = withRouter( | ||
connect<StatementInsightDetailsStateProps, RouteComponentProps>( | ||
mapStateToProps, | ||
)(StatementInsightDetails), | ||
); |
49 changes: 49 additions & 0 deletions
49
...ces/cluster-ui/src/insights/workloadInsightDetails/transactionInsightDetailsConnected.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
import { | ||
TransactionInsightDetails, | ||
TransactionInsightDetailsStateProps, | ||
TransactionInsightDetailsDispatchProps, | ||
} from "./transactionInsightDetails"; | ||
import { connect } from "react-redux"; | ||
import { RouteComponentProps, withRouter } from "react-router-dom"; | ||
import { AppState } from "src/store"; | ||
import { | ||
selectTransactionInsightDetails, | ||
selectTransactionInsightDetailsError, | ||
actions, | ||
} from "src/store/insightDetails/transactionInsightDetails"; | ||
|
||
const mapStateToProps = ( | ||
state: AppState, | ||
_props: RouteComponentProps, | ||
): TransactionInsightDetailsStateProps => { | ||
const insightDetails = selectTransactionInsightDetails(state); | ||
const insightError = selectTransactionInsightDetailsError(state); | ||
return { | ||
insightEventDetails: insightDetails, | ||
insightError: insightError, | ||
}; | ||
}; | ||
|
||
const mapDispatchToProps = { | ||
refreshTransactionInsightDetails: actions.refresh, | ||
}; | ||
|
||
export const TransactionInsightDetailsConnected = withRouter( | ||
connect< | ||
TransactionInsightDetailsStateProps, | ||
TransactionInsightDetailsDispatchProps, | ||
RouteComponentProps | ||
>( | ||
mapStateToProps, | ||
mapDispatchToProps, | ||
)(TransactionInsightDetails), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.