File tree Expand file tree Collapse file tree 5 files changed +85
-0
lines changed Expand file tree Collapse file tree 5 files changed +85
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ interface Window {
5555 getHeatmapData : ( params : {
5656 path : string ;
5757 } ) => Promise < import ( '../types/api/schema' ) . TEvDescribeSchemeResult > ;
58+ getTopic : ( params : {
59+ path ?: string ;
60+ } ) => Promise < import ( '../types/api/topic' ) . DescribeTopicResult > ;
5861 [ method : string ] : Function ;
5962 } ;
6063}
Original file line number Diff line number Diff line change @@ -129,6 +129,13 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
129129 path,
130130 } ) ;
131131 }
132+ getTopic ( { path} ) {
133+ return this . get ( this . getPath ( '/viewer/json/describe_topic' ) , {
134+ enums : true ,
135+ include_stats : true ,
136+ path,
137+ } ) ;
138+ }
132139 getPoolInfo ( poolName ) {
133140 return this . get ( this . getPath ( '/viewer/json/storage' ) , {
134141 pool : poolName ,
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import network from './network';
1717import pool from './pool' ;
1818import tenants from './tenants' ;
1919import tablet from './tablet' ;
20+ import topic from './topic' ;
2021import executeQuery from './executeQuery' ;
2122import explainQuery from './explainQuery' ;
2223import tabletsFilters from './tabletsFilters' ;
@@ -55,6 +56,7 @@ export const rootReducer = {
5556 pool,
5657 tenants,
5758 tablet,
59+ topic,
5860 executeQuery,
5961 explainQuery,
6062 tabletsFilters,
Original file line number Diff line number Diff line change 1+ import type { Reducer } from 'redux' ;
2+
3+ import type { ITopicAction , ITopicState } from '../../types/store/topic' ;
4+ import '../../services/api' ;
5+
6+ import { createRequestActionTypes , createApiRequest } from '../utils' ;
7+
8+ export const FETCH_TOPIC = createRequestActionTypes ( 'topic' , 'FETCH_TOPIC' ) ;
9+
10+ const initialState = {
11+ loading : true ,
12+ wasLoaded : false ,
13+ data : { } ,
14+ } ;
15+
16+ const topic : Reducer < ITopicState , ITopicAction > = ( state = initialState , action ) => {
17+ switch ( action . type ) {
18+ case FETCH_TOPIC . REQUEST : {
19+ return {
20+ ...state ,
21+ loading : true ,
22+ } ;
23+ }
24+ case FETCH_TOPIC . SUCCESS : {
25+ return {
26+ ...state ,
27+ data : action . data ,
28+ loading : false ,
29+ wasLoaded : true ,
30+ error : undefined ,
31+ } ;
32+ }
33+ case FETCH_TOPIC . FAILURE : {
34+ return {
35+ ...state ,
36+ error : action . error ,
37+ loading : false ,
38+ } ;
39+ }
40+ default :
41+ return state ;
42+ }
43+ } ;
44+
45+ export function getTopic ( path ?: string ) {
46+ return createApiRequest ( {
47+ request : window . api . getTopic ( { path} ) ,
48+ actions : FETCH_TOPIC ,
49+ } ) ;
50+ }
51+
52+ export default topic ;
Original file line number Diff line number Diff line change 1+ import { FETCH_TOPIC } from '../../store/reducers/topic' ;
2+ import type { ApiRequestAction } from '../../store/utils' ;
3+ import type { IResponseError } from '../api/error' ;
4+ import type { DescribeTopicResult } from '../api/topic' ;
5+
6+ export interface ITopicState {
7+ loading : boolean ;
8+ wasLoaded : boolean ;
9+ data ?: DescribeTopicResult ;
10+ error ?: IResponseError ;
11+ }
12+
13+ export type ITopicAction = ApiRequestAction <
14+ typeof FETCH_TOPIC ,
15+ DescribeTopicResult ,
16+ IResponseError
17+ > ;
18+
19+ export interface ITopicRootStateSlice {
20+ topic : ITopicState ;
21+ }
You can’t perform that action at this time.
0 commit comments