@airporting/tech-app 0.0.24 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,11 +4,13 @@ export interface GetDashboardAmexResponse {
4
4
  merchantPendingChargebacks: number;
5
5
  merchantPendingTransactions: number;
6
6
  merchantProblem: boolean;
7
+ merchantProblemMessages: string[];
7
8
  merchantTodayAdjustments: number;
8
9
  merchantTodayChargesbacks: number;
9
10
  merchantTodayTransactions: number;
10
11
  purchasePendingTransactions: number;
11
12
  purchaseProblem: boolean;
13
+ purchaseProblemMessages: string[];
12
14
  purchaseTodayBalances: number;
13
15
  purchaseTodayTransactions: number;
14
16
  }
@@ -51,6 +53,12 @@ export interface GetGasDashboardResponse {
51
53
  lastDate: string;
52
54
  };
53
55
  }
56
+ export interface GetGithubHostLabelsResponse {
57
+ runners: {
58
+ labels: string[];
59
+ name: string;
60
+ }[];
61
+ }
54
62
  export interface GetGithubJobsRunnerResponse {
55
63
  list: JobsRunnerAssigned[];
56
64
  }
@@ -61,6 +69,9 @@ export interface GetGsheetDashboardResponse {
61
69
  pending: number;
62
70
  running: number;
63
71
  }
72
+ export interface GetLabelsV1Params {
73
+ host: string;
74
+ }
64
75
  export interface GetNotionDashboardResponse {
65
76
  bugs: string[][];
66
77
  users: NotionUser[];
@@ -69,12 +80,18 @@ export interface GetPayfitDashboardResponse {
69
80
  pending: PayfitDashboardItem;
70
81
  today: PayfitDashboardItem;
71
82
  }
83
+ export interface GetRunStatsResponse {
84
+ currentJobsCounters: UsersRunStatsResponse;
85
+ }
72
86
  export interface GetSynchroDashboardResponse {
73
87
  askedToday: number;
74
88
  errorsToday: number;
75
89
  running: number;
76
90
  waiting: number;
77
91
  }
92
+ export interface GetTasksResponse {
93
+ tasks: TaskItem[];
94
+ }
78
95
  export interface JobsRunnerAssigned {
79
96
  repo: string;
80
97
  runner_tag: string | null;
@@ -94,6 +111,45 @@ export interface PayfitDashboardItem {
94
111
  siretsCount: number;
95
112
  sum: number;
96
113
  }
114
+ export interface PutStopTaskV1Params {
115
+ id: number;
116
+ }
117
+ export interface ResetOwnerStatsV1Params {
118
+ owner: string;
119
+ value: string;
120
+ }
121
+ export interface TaskItem {
122
+ beta: boolean;
123
+ /** @format date-time */
124
+ created: string;
125
+ finished: boolean;
126
+ /** @format date-time */
127
+ finishedAt?: string;
128
+ gas_started: boolean;
129
+ github_job: string;
130
+ id: number;
131
+ job_name: string;
132
+ job_name_fr: string;
133
+ need_gas: boolean;
134
+ owner: string;
135
+ ready: boolean;
136
+ recipe_uuid: string;
137
+ /** @format date-time */
138
+ startedAt?: string;
139
+ triggered: number;
140
+ }
141
+ export interface UserItemRunStats {
142
+ db: number;
143
+ redis: number;
144
+ }
145
+ export interface UsersRunStatsResponse {
146
+ 'mathieu.kim-robin': UserItemRunStats;
147
+ alexandre: UserItemRunStats;
148
+ comptabilite: UserItemRunStats;
149
+ dhia: UserItemRunStats;
150
+ marwa: UserItemRunStats;
151
+ mathieu: UserItemRunStats;
152
+ }
97
153
  export declare namespace Github {
98
154
  /**
99
155
  * No description
@@ -109,6 +165,22 @@ export declare namespace Github {
109
165
  type RequestHeaders = {};
110
166
  type ResponseBody = GetGithubJobsRunnerResponse;
111
167
  }
168
+ /**
169
+ * No description
170
+ * @tags Github
171
+ * @name GetLabelsV1
172
+ * @request GET:/v1/github/labels/{host}
173
+ * @response `200` `GetGithubHostLabelsResponse`
174
+ */
175
+ namespace GetLabelsV1 {
176
+ type RequestParams = {
177
+ host: string;
178
+ };
179
+ type RequestQuery = {};
180
+ type RequestBody = never;
181
+ type RequestHeaders = {};
182
+ type ResponseBody = GetGithubHostLabelsResponse;
183
+ }
112
184
  }
113
185
  export declare namespace Notion {
114
186
  /**
@@ -126,6 +198,69 @@ export declare namespace Notion {
126
198
  type ResponseBody = object;
127
199
  }
128
200
  }
201
+ export declare namespace Synchro {
202
+ /**
203
+ * No description
204
+ * @tags Synchro
205
+ * @name GetRunStatsV1
206
+ * @request GET:/v1/synchro/run/stats
207
+ * @response `200` `GetRunStatsResponse`
208
+ */
209
+ namespace GetRunStatsV1 {
210
+ type RequestParams = {};
211
+ type RequestQuery = {};
212
+ type RequestBody = never;
213
+ type RequestHeaders = {};
214
+ type ResponseBody = GetRunStatsResponse;
215
+ }
216
+ /**
217
+ * No description
218
+ * @tags Synchro
219
+ * @name GetTasksV1
220
+ * @request GET:/v1/synchro/tasks
221
+ * @response `200` `GetTasksResponse`
222
+ */
223
+ namespace GetTasksV1 {
224
+ type RequestParams = {};
225
+ type RequestQuery = {};
226
+ type RequestBody = never;
227
+ type RequestHeaders = {};
228
+ type ResponseBody = GetTasksResponse;
229
+ }
230
+ /**
231
+ * No description
232
+ * @tags Synchro
233
+ * @name PutStopTaskV1
234
+ * @request PUT:/v1/synchro/tasks/stop/{id}
235
+ * @response `200` `void`
236
+ */
237
+ namespace PutStopTaskV1 {
238
+ type RequestParams = {
239
+ id: number;
240
+ };
241
+ type RequestQuery = {};
242
+ type RequestBody = never;
243
+ type RequestHeaders = {};
244
+ type ResponseBody = void;
245
+ }
246
+ /**
247
+ * No description
248
+ * @tags Synchro
249
+ * @name ResetOwnerStatsV1
250
+ * @request PUT:/v1/synchro/run/stats/{owner}/{value}
251
+ * @response `200` `void`
252
+ */
253
+ namespace ResetOwnerStatsV1 {
254
+ type RequestParams = {
255
+ owner: string;
256
+ value: string;
257
+ };
258
+ type RequestQuery = {};
259
+ type RequestBody = never;
260
+ type RequestHeaders = {};
261
+ type ResponseBody = void;
262
+ }
263
+ }
129
264
  export type QueryParamsType = Record<string | number, any>;
130
265
  export type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
131
266
  export interface FullRequestParams extends Omit<RequestInit, 'body'> {
@@ -186,11 +321,11 @@ export declare class HttpClient<SecurityDataType = unknown> {
186
321
  request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
187
322
  }
188
323
  /**
189
- * @title My Cool API
324
+ * @title Tech API
190
325
  * @version 1.0
191
326
  * @contact
192
327
  *
193
- * Change this info in src/main.ts
328
+ * Handles internal technical operations and reports
194
329
  */
195
330
  export declare class TechApi<SecurityDataType extends unknown> {
196
331
  http: HttpClient<SecurityDataType>;
@@ -223,6 +358,15 @@ export declare class TechApi<SecurityDataType extends unknown> {
223
358
  * @response `200` `GetGithubJobsRunnerResponse`
224
359
  */
225
360
  getJobsRunnersV1: (params?: RequestParams) => Promise<HttpResponse<GetGithubJobsRunnerResponse, any>>;
361
+ /**
362
+ * No description
363
+ *
364
+ * @tags Github
365
+ * @name GetLabelsV1
366
+ * @request GET:/v1/github/labels/{host}
367
+ * @response `200` `GetGithubHostLabelsResponse`
368
+ */
369
+ getLabelsV1: ({ host, ...query }: GetLabelsV1Params, params?: RequestParams) => Promise<HttpResponse<GetGithubHostLabelsResponse, any>>;
226
370
  };
227
371
  notion: {
228
372
  /**
@@ -235,5 +379,43 @@ export declare class TechApi<SecurityDataType extends unknown> {
235
379
  */
236
380
  getKikouV1: (params?: RequestParams) => Promise<HttpResponse<object, any>>;
237
381
  };
382
+ synchro: {
383
+ /**
384
+ * No description
385
+ *
386
+ * @tags Synchro
387
+ * @name GetRunStatsV1
388
+ * @request GET:/v1/synchro/run/stats
389
+ * @response `200` `GetRunStatsResponse`
390
+ */
391
+ getRunStatsV1: (params?: RequestParams) => Promise<HttpResponse<GetRunStatsResponse, any>>;
392
+ /**
393
+ * No description
394
+ *
395
+ * @tags Synchro
396
+ * @name GetTasksV1
397
+ * @request GET:/v1/synchro/tasks
398
+ * @response `200` `GetTasksResponse`
399
+ */
400
+ getTasksV1: (params?: RequestParams) => Promise<HttpResponse<GetTasksResponse, any>>;
401
+ /**
402
+ * No description
403
+ *
404
+ * @tags Synchro
405
+ * @name PutStopTaskV1
406
+ * @request PUT:/v1/synchro/tasks/stop/{id}
407
+ * @response `200` `void`
408
+ */
409
+ putStopTaskV1: ({ id, ...query }: PutStopTaskV1Params, params?: RequestParams) => Promise<HttpResponse<void, any>>;
410
+ /**
411
+ * No description
412
+ *
413
+ * @tags Synchro
414
+ * @name ResetOwnerStatsV1
415
+ * @request PUT:/v1/synchro/run/stats/{owner}/{value}
416
+ * @response `200` `void`
417
+ */
418
+ resetOwnerStatsV1: ({ owner, value, ...query }: ResetOwnerStatsV1Params, params?: RequestParams) => Promise<HttpResponse<void, any>>;
419
+ };
238
420
  }
239
421
  export {};
Binary file
@@ -1 +1 @@
1
- "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["692"],{9031:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Dashboard});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(837);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(4659);var useApi=__webpack_require__(5944);function useGithubQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","dashboard"],queryFn:async()=>await api.github.getJobsRunnersV1().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var App=__webpack_require__(9008);var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);function GithubApp(){const dashboardResult=useGithubQuery();const dashboard=dashboardResult.data;if(!dashboard)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Chargement..."})});return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:"lighter",fz:"sm",my:"md",span:true,c:"dimmed",children:["Derni\xe8re mise \xe0 jour :"," ",(0,App.p)(dashboardResult?.dataUpdatedAt??Date.now())]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Runners par repo"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ScrollArea,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:800,verticalSpacing:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Repository"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Tag"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Self-hosted"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Runners"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:dashboard.list.map((line,i)=>{const{repo,selfhost,runner_tag,runners}=line;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:`https://github.com/airporting/${repo}`,children:[repo,"\xa0",/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:runner_tag}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:selfhost?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCheck,{size:30,color:"green"}):/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:30,color:"red"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:runners.map((runnerItem,j)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"blue",m:5,children:runnerItem},j))})]},i)})})]})})]})}var providers=__webpack_require__(7034);function Dashboard(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(GithubApp,{})})})}}}]);
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["692"],{9031:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Dashboard});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(837);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(4659);var useApi=__webpack_require__(4148);function useGithubQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","dashboard"],queryFn:async()=>await api.github.getJobsRunnersV1().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var App=__webpack_require__(9008);var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);function GithubApp(){const dashboardResult=useGithubQuery();const dashboard=dashboardResult.data;if(!dashboard)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Chargement..."})});return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:"lighter",fz:"sm",my:"md",span:true,c:"dimmed",children:["Derni\xe8re mise \xe0 jour :"," ",(0,App.p)(dashboardResult?.dataUpdatedAt??Date.now())]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Runners par repo"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ScrollArea,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:800,verticalSpacing:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Repository"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Tag"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Self-hosted"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Runners"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:dashboard.list.map((line,i)=>{const{repo,selfhost,runner_tag,runners}=line;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:`https://github.com/airporting/${repo}`,children:[repo,"\xa0",/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:runner_tag}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:selfhost?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCheck,{size:30,color:"green"}):/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:30,color:"red"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:runners.map((runnerItem,j)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"blue",m:5,children:runnerItem},j))})]},i)})})]})})]})}var providers=__webpack_require__(7034);function Dashboard(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(GithubApp,{})})})}}}]);
@@ -7,4 +7,4 @@
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment");function jsxProd(type,config,maybeKey){var key=null;void 0!==maybeKey&&(key=""+maybeKey);void 0!==config.key&&(key=""+config.key);if("key"in config){maybeKey={};for(var propName in config)"key"!==propName&&(maybeKey[propName]=config[propName])}else maybeKey=config;config=maybeKey.ref;return{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key,ref:void 0!==config?config:null,props:maybeKey}}exports.Fragment=REACT_FRAGMENT_TYPE;exports.jsx=jsxProd;exports.jsxs=jsxProd},5893:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(631)},7936:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{$:()=>AppConfigProvider,M:()=>useAppConfig});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(837);const AppConfigCtx=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}},7034:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{C:()=>Providers});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _airporting_app_front__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1380);var _mantine_core__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(207);var _mantine_modals__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(4142);var _mantine_notifications__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(1455);var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(4659);var radash__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(7524);var _hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(7936);const theme=(0,_mantine_core__WEBPACK_IMPORTED_MODULE_2__.createTheme)((0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.theme,{components:{}}));const cssVarResolver=x=>(0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__.$,{value:config,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClientProvider,{client:tanstack?.queryClient??new _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClient,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_2__.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_modals__WEBPACK_IMPORTED_MODULE_3__.ModalsProvider,{children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_notifications__WEBPACK_IMPORTED_MODULE_4__.Notifications,{}),children]})})})})}},1415:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Synchro});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(837);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);function SynchroApp(){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Synchro - soon"})})}function Synchro(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(SynchroApp,{})})})}}}]);
10
+ */var REACT_ELEMENT_TYPE=Symbol.for("react.transitional.element"),REACT_FRAGMENT_TYPE=Symbol.for("react.fragment");function jsxProd(type,config,maybeKey){var key=null;void 0!==maybeKey&&(key=""+maybeKey);void 0!==config.key&&(key=""+config.key);if("key"in config){maybeKey={};for(var propName in config)"key"!==propName&&(maybeKey[propName]=config[propName])}else maybeKey=config;config=maybeKey.ref;return{$$typeof:REACT_ELEMENT_TYPE,type:type,key:key,ref:void 0!==config?config:null,props:maybeKey}}exports.Fragment=REACT_FRAGMENT_TYPE;exports.jsx=jsxProd;exports.jsxs=jsxProd},5893:function(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__(631)},4148:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{h:()=>useApi});var _src_gen_TechApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(9056);var _src_hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(7936);function useApi(){const config=(0,_src_hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_0__.M)();const client=new _src_gen_TechApi__WEBPACK_IMPORTED_MODULE_1__.eN({baseUrl:config.api.replace(/\/$/,""),baseApiParams:{headers:{Authorization:config.token?`Bearer ${config.token}`:"",From:config.owner}}});return new _src_gen_TechApi__WEBPACK_IMPORTED_MODULE_1__.eT(client)}},5068:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>IconGithub});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);function IconGithub({color="currentColor",size=20,marker,...props}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M12 0.297C5.373 0.297 0 5.67 0 12.297c0 5.292 3.438 9.787 8.205 11.387.6.111.82-.261.82-.58 0-.287-.011-1.244-.016-2.255-3.338.726-4.042-1.609-4.042-1.609-.546-1.389-1.333-1.759-1.333-1.759-1.089-.745.083-.73.083-.73 1.205.085 1.84 1.236 1.84 1.236 1.07 1.834 2.807 1.304 3.492.997.107-.775.419-1.305.762-1.605-2.665-.304-5.466-1.332-5.466-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.536-1.524.116-3.176 0 0 1.008-.322 3.301 1.23a11.51 11.51 0 0 1 3.004-.404 c1.019.005 2.047.138 3.004.404 2.291-1.552 3.297-1.23 3.297-1.23.655 1.652.243 2.873.119 3.176.77.84 1.235 1.91 1.235 3.221 0 4.61-2.805 5.624-5.476 5.921.43.372.823 1.104.823 2.223 0 1.606-.015 2.896-.015 3.293 0 .321.216.697.825.578C20.565 22.08 24 17.585 24 12.297 24 5.67 18.627.297 12 .297z"})})}},9056:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{eN:()=>HttpClient,eT:()=>TechApi});class HttpClient{baseUrl="";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...fetchParams)=>fetch(...fetchParams);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(apiConfig={}){Object.assign(this,apiConfig)}setSecurityData=data=>{this.securityData=data};encodeQueryParam(key,value){const encodedKey=encodeURIComponent(key);return`${encodedKey}=${encodeURIComponent("number"==typeof value?value:`${value}`)}`}addQueryParam(query,key){return this.encodeQueryParam(key,query[key])}addArrayQueryParam(query,key){const value=query[key];return value.map(v=>this.encodeQueryParam(key,v)).join("&")}toQueryString(rawQuery){const query=rawQuery||{};const keys=Object.keys(query).filter(key=>void 0!==query[key]);return keys.map(key=>Array.isArray(query[key])?this.addArrayQueryParam(query,key):this.addQueryParam(query,key)).join("&")}addQueryParams(rawQuery){const queryString=this.toQueryString(rawQuery);return queryString?`?${queryString}`:""}contentFormatters={["application/json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["application/vnd.api+json"]:input=>null!==input&&("object"==typeof input||"string"==typeof input)?JSON.stringify(input):input,["text/plain"]:input=>null!==input&&"string"!=typeof input?JSON.stringify(input):input,["multipart/form-data"]:input=>{if(input instanceof FormData)return input;return Object.keys(input||{}).reduce((formData,key)=>{const property=input[key];formData.append(key,property instanceof Blob?property:"object"==typeof property&&null!==property?JSON.stringify(property):`${property}`);return formData},new FormData)},["application/x-www-form-urlencoded"]:input=>this.toQueryString(input)};mergeRequestParams(params1,params2){return{...this.baseApiParams,...params1,...params2||{},headers:{...this.baseApiParams.headers||{},...params1.headers||{},...params2&&params2.headers||{}}}}createAbortSignal=cancelToken=>{if(this.abortControllers.has(cancelToken)){const abortController=this.abortControllers.get(cancelToken);if(abortController)return abortController.signal;return}const abortController=new AbortController;this.abortControllers.set(cancelToken,abortController);return abortController.signal};abortRequest=cancelToken=>{const abortController=this.abortControllers.get(cancelToken);if(abortController){abortController.abort();this.abortControllers.delete(cancelToken)}};request=async({body,secure,path,type,query,format,baseUrl,cancelToken,...params})=>{const secureParams=("boolean"==typeof secure?secure:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{};const requestParams=this.mergeRequestParams(params,secureParams);const queryString=query&&this.toQueryString(query);const payloadFormatter=this.contentFormatters[type||"application/json"];const responseFormat=format||requestParams.format;return this.customFetch(`${baseUrl||this.baseUrl||""}${path}${queryString?`?${queryString}`:""}`,{...requestParams,headers:{...requestParams.headers||{},...type&&"multipart/form-data"!==type?{"Content-Type":type}:{}},signal:(cancelToken?this.createAbortSignal(cancelToken):requestParams.signal)||null,body:null==body?null:payloadFormatter(body)}).then(async response=>{const r=response;r.data=null;r.error=null;const responseToParse=responseFormat?response.clone():response;const data=responseFormat?await responseToParse[responseFormat]().then(data=>{if(r.ok)r.data=data;else r.error=data;return r}).catch(e=>{r.error=e;return r}):r;if(cancelToken)this.abortControllers.delete(cancelToken);if(!response.ok)throw data;return data})}}class TechApi{http;constructor(http){this.http=http}status=(params={})=>this.http.request({path:"/status",method:"GET",...params});getDashboard=(params={})=>this.http.request({path:"/dashboard",method:"GET",format:"json",...params});github={getJobsRunnersV1:(params={})=>this.http.request({path:"/v1/github/jobs/runners",method:"GET",format:"json",...params}),getLabelsV1:({host,...query},params={})=>this.http.request({path:`/v1/github/labels/${host}`,method:"GET",format:"json",...params})};notion={getKikouV1:(params={})=>this.http.request({path:"/v1/notion/kikou",method:"GET",format:"json",...params})};synchro={getRunStatsV1:(params={})=>this.http.request({path:"/v1/synchro/run/stats",method:"GET",format:"json",...params}),getTasksV1:(params={})=>this.http.request({path:"/v1/synchro/tasks",method:"GET",format:"json",...params}),putStopTaskV1:({id,...query},params={})=>this.http.request({path:`/v1/synchro/tasks/stop/${id}`,method:"PUT",...params}),resetOwnerStatsV1:({owner,value,...query},params={})=>this.http.request({path:`/v1/synchro/run/stats/${owner}/${value}`,method:"PUT",...params})}}},7936:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{$:()=>AppConfigProvider,M:()=>useAppConfig});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(837);const AppConfigCtx=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);const AppConfigProvider=AppConfigCtx.Provider;function useAppConfig(){const config=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(AppConfigCtx);if(!config)throw new Error("Called `useAppConfig` outside a `<AppConfigProvider />`");return config}},7034:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{C:()=>Providers});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _airporting_app_front__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1380);var _mantine_core__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(207);var _mantine_modals__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(4142);var _mantine_notifications__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(1455);var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(4659);var radash__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(7524);var _hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(7936);const theme=(0,_mantine_core__WEBPACK_IMPORTED_MODULE_2__.createTheme)((0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.theme,{components:{}}));const cssVarResolver=x=>(0,radash__WEBPACK_IMPORTED_MODULE_6__.assign)(_airporting_app_front__WEBPACK_IMPORTED_MODULE_1__.cssVarResolver(x),{dark:{},light:{},variables:{}});function Providers(props){const{children,config,mantine,tanstack}=props;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_hooks_useAppConfig__WEBPACK_IMPORTED_MODULE_7__.$,{value:config,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClientProvider,{client:tanstack?.queryClient??new _tanstack_react_query__WEBPACK_IMPORTED_MODULE_5__.QueryClient,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_2__.MantineProvider,{theme:theme,cssVariablesResolver:cssVarResolver,defaultColorScheme:mantine?.defaultColorScheme,forceColorScheme:mantine?.forceColorScheme,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_modals__WEBPACK_IMPORTED_MODULE_3__.ModalsProvider,{children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_notifications__WEBPACK_IMPORTED_MODULE_4__.Notifications,{}),children]})})})})}},5741:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Synchro});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(837);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(4659);var useApi=__webpack_require__(4148);function useSynchroStatsQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","synchro","stats"],queryFn:async()=>await api.synchro.getRunStatsV1().then(x=>x.data),refetchInterval:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var tabler_icons_react_mjs_=__webpack_require__(1257);var esm_index_mjs_=__webpack_require__(1455);function useResetStatsQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useMutation)({mutationFn:async values=>await api.synchro.resetOwnerStatsV1(values).then(x=>x.data),onSuccess:()=>{esm_index_mjs_.notifications.show({title:"Cible remise \xe0 niveau",message:"C'est reparti comme en 40"})},onError:(error,variables,context)=>{console.error(error,variables,context);esm_index_mjs_.notifications.show({color:"red",title:"Erreur !",message:"Nous rencontrons un soucis technique. Veuillez r\xe9essayer plus tard."})}});return query}function useSynchroTasks(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","synchro","tasks","list"],queryFn:async()=>await api.synchro.getTasksV1().then(x=>x.data),refetchInterval:6e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);var date_fns_index_js_=__webpack_require__(4365);function SynchroApp(){const statsResult=useSynchroStatsQuery();const stats=statsResult.data;const tasksListResult=useSynchroTasks();const tasksList=tasksListResult.data;const resetFn=useResetStatsQuery();function resolveStatus(element){if(!element.ready)return"en attente";if(!element.need_gas)return element.finished?"fini":"en cours";if(element.gas_started)return"gas en cours";return"gas en attente"}const rows=tasksList?.tasks.map(element=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.id}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.job_name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.job_name_fr}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(element.created,"dd/MM/yyyy HH:mm:ss")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.startedAt?(0,date_fns_index_js_.format)(element.startedAt,"dd/MM/yyyy HH:mm:ss"):""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:resolveStatus(element)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.need_gas?"Y":""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:element.owner}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:element.github_job,title:"Github runner",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:`https://airporting.grafana.net/d/beegyy3vsp8n4c/recipes?var-trace=${element.recipe_uuid}-${element.id}&orgId=1&from=now-7d&to=now&timezone=browser&showCategory=Logs&refresh=7d`,children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconFileText,{title:"Logs",size:20})}),element.finished?/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}):/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",onClick:async()=>{console.log("stop",element.id)},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconHandStop,{title:"Stop",size:20})})]})]},element.id));return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,my:"md",children:"Synchro"}),/*#__PURE__*/(0,jsx_runtime.jsx)("ul",{children:stats&&Object.entries(stats.currentJobsCounters).map(([key,value])=>/*#__PURE__*/(0,jsx_runtime.jsxs)("li",{children:[key,": ",value.db," db, ",value.redis," redis",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",color:value.db!=value.redis?"red":"green",onClick:async()=>{await resetFn.mutateAsync({owner:key,value:(value.db??0).toString()});await statsResult.refetch()},children:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconRefreshDot,{size:20})})]},key))}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{stickyHeader:true,striped:true,highlightOnHover:true,withTableBorder:true,withColumnBorders:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"ID"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Fonction"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Titre"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Demand\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"D\xe9mar\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Statut"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"GAS"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Owner"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Liens"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows})]})]})}function Synchro(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(SynchroApp,{})})})}}}]);