-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Statements page redux functionality
Redux functionality for Statements page is rewritten with respect to defined behavior in initial implementation in Admin UI. The main reason to avoid usage of current implementation following: - redux store is tightly coupled with other parts of application and cannot be easily broken down into smaller and isolated slice of redux store. - it uses 'redux-thunk' which is obsolete library and 'redux-saga' has to be used instead. Redux functionality is defined per "module" (feature) to group it by functionality so all redux logic related to `StatementsPage` component is defined near component itself. Common redux logic is defined in `src/reduxStore` which doesn't belong to any particular feature. For example, redux state which represents data stored in LocalStorage is defined as common redux functionality. Redux actions, reducer and action types stored in the single file because they all serve single purpose - to define how state can be updated. In fact, followed this recommendation: https://redux.js.org/style-guide/style-guide#structure-files-as-feature-folders-or-ducks Optimize types for `fetchData` function - Optimized input and return types; - Get rid of `any` types - Construction of request payload is moved inside of `fetchData` function to reduce code duplication. Refactor redux actions creation - Follow Flux standard actions conventions - Add `getActionsMap` to generate strongly typed dictionary of available types based on a list of available actions. refactor components integration with CC Initially, statements page components had predefined styles which didn't allow to adjust component to different pages and styles were hard coded to specific needs for console DB ui. The same way internal routing for statements page expected to change routes starting from based path and hadn't provide any way to customize this. This change introduces some level of flexibility for clients which integrate Statements page.
- Loading branch information
Showing
53 changed files
with
1,405 additions
and
83 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import * as protobuf from "protobufjs/minimal"; | ||
import Long from "long"; | ||
|
||
protobuf.util.Long = Long as any; | ||
protobuf.util.Long = Long; | ||
protobuf.configure(); |
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,29 @@ | ||
import { cockroach } from "@cockroachlabs/crdb-protobuf-client"; | ||
import { fetchData } from "src/api"; | ||
|
||
const STATEMENT_DIAGNOSTICS_PATH = "_status/stmtdiagreports"; | ||
const CREATE_STATEMENT_DIAGNOSTICS_REPORT_PATH = "_status/stmtdiagreports"; | ||
|
||
type CreateStatementDiagnosticsReportResponseMessage = cockroach.server.serverpb.CreateStatementDiagnosticsReportResponse; | ||
|
||
export function getStatementDiagnosticsReports(): Promise< | ||
cockroach.server.serverpb.StatementDiagnosticsReportsResponse | ||
> { | ||
return fetchData( | ||
cockroach.server.serverpb.StatementDiagnosticsReportsResponse, | ||
STATEMENT_DIAGNOSTICS_PATH, | ||
); | ||
} | ||
|
||
export function createStatementDiagnosticsReport( | ||
statementsFingerprint: string, | ||
): Promise<CreateStatementDiagnosticsReportResponseMessage> { | ||
return fetchData( | ||
cockroach.server.serverpb.CreateStatementDiagnosticsReportResponse, | ||
CREATE_STATEMENT_DIAGNOSTICS_REPORT_PATH, | ||
cockroach.server.serverpb.CreateStatementDiagnosticsReportRequest, | ||
{ | ||
statement_fingerprint: statementsFingerprint, | ||
}, | ||
); | ||
} |
6 changes: 3 additions & 3 deletions
6
...ics/activateStatementDiagnosticsModal.tsx → ...nts/activateStatementDiagnosticsModal.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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./activateStatementDiagnosticsModal"; | ||
export * from "./diagnosticStatusBadge"; | ||
export * from "./diagnosticStatuses"; | ||
export * from "./components/activateStatementDiagnosticsModal"; | ||
export * from "./components/diagnosticStatusBadge"; | ||
export * from "./components/diagnosticStatuses"; | ||
export * from "./store"; |
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,3 @@ | ||
export * from "./statementDiagnosticsReports.selectors"; | ||
export * from "./statementDiagnosticsReports.reducer"; | ||
export * from "./statementDiagnosticsReports.sagas"; |
Oops, something went wrong.