forked from SigNoz/signoz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
152 lines (135 loc) · 3.55 KB
/
app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import { QueryObserverBaseResult } from 'react-query';
import { PayloadProps as FeatureFlagPayload } from 'types/api/features/getFeaturesFlags';
import {
Organization,
PayloadProps as OrgPayload,
} from 'types/api/user/getOrganization';
import { UserFlags } from 'types/api/user/setFlags';
import AppReducer, { User } from 'types/reducer/app';
import { ROLES } from 'types/roles';
export const LOGGED_IN = 'LOGGED_IN';
export const SIDEBAR_COLLAPSE = 'SIDEBAR_COLLAPSE';
export const UPDATE_CURRENT_VERSION = 'UPDATE_CURRENT_VERSION';
export const UPDATE_LATEST_VERSION = 'UPDATE_LATEST_VERSION';
export const UPDATE_CURRENT_ERROR = 'UPDATE_CURRENT_ERROR';
export const UPDATE_LATEST_VERSION_ERROR = 'UPDATE_LATEST_VERSION_ERROR';
export const UPDATE_USER_ACCESS_REFRESH_ACCESS_TOKEN =
'UPDATE_USER_ACCESS_REFRESH_ACCESS_TOKEN';
export const UPDATE_USER_IS_FETCH = 'UPDATE_USER_IS_FETCH';
export const UPDATE_USER_ORG_ROLE = 'UPDATE_USER_ORG_ROLE';
export const UPDATE_USER = 'UPDATE_USER';
export const UPDATE_ORG_NAME = 'UPDATE_ORG_NAME';
export const UPDATE_ORG = 'UPDATE_ORG';
export const UPDATE_CONFIGS = 'UPDATE_CONFIGS';
export const UPDATE_USER_FLAG = 'UPDATE_USER_FLAG';
export const UPDATE_FEATURE_FLAG_RESPONSE = 'UPDATE_FEATURE_FLAG_RESPONSE';
export interface LoggedInUser {
type: typeof LOGGED_IN;
payload: {
isLoggedIn: boolean;
};
}
export interface SideBarCollapse {
type: typeof SIDEBAR_COLLAPSE;
payload: boolean;
}
export interface UpdateAppVersion {
type: typeof UPDATE_CURRENT_VERSION;
payload: {
currentVersion: AppReducer['currentVersion'];
ee: AppReducer['ee'];
setupCompleted: AppReducer['setupCompleted'];
};
}
export interface UpdateLatestVersion {
type: typeof UPDATE_LATEST_VERSION;
payload: {
latestVersion: AppReducer['latestVersion'];
};
}
export interface UpdateVersionError {
type: typeof UPDATE_CURRENT_ERROR | typeof UPDATE_LATEST_VERSION_ERROR;
payload: {
isError: boolean;
};
}
export interface UpdateUserOrgRole {
type: typeof UPDATE_USER_ORG_ROLE;
payload: {
role: ROLES | null;
org: OrgPayload | null;
};
}
export interface UpdateAccessRenewToken {
type: typeof UPDATE_USER_ACCESS_REFRESH_ACCESS_TOKEN;
payload: {
accessJwt: User['accessJwt'];
refreshJwt: User['refreshJwt'];
};
}
export interface UpdateUser {
type: typeof UPDATE_USER;
payload: {
email: User['email'];
name: User['name'];
profilePictureURL: User['profilePictureURL'];
userId: User['userId'];
orgName: Organization['name'];
ROLE: ROLES;
orgId: Organization['id'];
userFlags: UserFlags;
};
}
export interface UpdateUserIsFetched {
type: typeof UPDATE_USER_IS_FETCH;
payload: {
isUserFetching: AppReducer['isUserFetching'];
};
}
export interface UpdateOrgName {
type: typeof UPDATE_ORG_NAME;
payload: {
name: string;
orgId: string;
};
}
export interface UpdateUserFlag {
type: typeof UPDATE_USER_FLAG;
payload: {
flags: UserFlags | null;
};
}
export interface UpdateOrg {
type: typeof UPDATE_ORG;
payload: {
org: AppReducer['org'];
};
}
export interface UpdateConfigs {
type: typeof UPDATE_CONFIGS;
payload: {
configs: AppReducer['configs'];
};
}
export interface UpdateFeatureFlag {
type: typeof UPDATE_FEATURE_FLAG_RESPONSE;
payload: {
featureFlag: FeatureFlagPayload;
refetch: QueryObserverBaseResult['refetch'];
};
}
export type AppAction =
| LoggedInUser
| SideBarCollapse
| UpdateAppVersion
| UpdateLatestVersion
| UpdateVersionError
| UpdateAccessRenewToken
| UpdateUserIsFetched
| UpdateUserOrgRole
| UpdateUser
| UpdateOrgName
| UpdateOrg
| UpdateConfigs
| UpdateUserFlag
| UpdateFeatureFlag;