|
@@ -1,37 +1,42 @@
|
|
|
+import { converse } from '@converse/headless/core.js';
|
|
|
+
|
|
|
+const { Strophe } = converse.env;
|
|
|
+
|
|
|
export const REPORTABLE_STATUSES = [
|
|
|
- 0, // ERROR'
|
|
|
- 1, // CONNECTING
|
|
|
- 2, // CONNFAIL
|
|
|
- 3, // AUTHENTICATING
|
|
|
- 4, // AUTHFAIL
|
|
|
- 7, // DISCONNECTING
|
|
|
- 10 // RECONNECTING
|
|
|
+ Strophe.Status.ERROR,
|
|
|
+ Strophe.Status.CONNECTING,
|
|
|
+ Strophe.Status.CONNFAIL,
|
|
|
+ Strophe.Status.AUTHENTICATING,
|
|
|
+ Strophe.Status.AUTHFAIL,
|
|
|
+ Strophe.Status.DISCONNECTING,
|
|
|
+ Strophe.Status.RECONNECTING,
|
|
|
];
|
|
|
|
|
|
-export const PRETTY_CONNECTION_STATUS = {
|
|
|
- 0: 'Error',
|
|
|
- 1: 'Connecting',
|
|
|
- 2: 'Connection failure',
|
|
|
- 3: 'Authenticating',
|
|
|
- 4: 'Authentication failure',
|
|
|
- 5: 'Connected',
|
|
|
- 6: 'Disconnected',
|
|
|
- 7: 'Disconnecting',
|
|
|
- 8: 'Attached',
|
|
|
- 9: 'Redirect',
|
|
|
- 10: 'Reconnecting'
|
|
|
-};
|
|
|
+export const PRETTY_CONNECTION_STATUS = Object.fromEntries([
|
|
|
+ [Strophe.Status.ERROR, 'Error'],
|
|
|
+ [Strophe.Status.CONNECTING, 'Connecting'],
|
|
|
+ [Strophe.Status.CONNFAIL, 'Connection failure'],
|
|
|
+ [Strophe.Status.AUTHENTICATING, 'Authenticating'],
|
|
|
+ [Strophe.Status.AUTHFAIL, 'Authentication failure'],
|
|
|
+ [Strophe.Status.CONNECTED, 'Connected'],
|
|
|
+ [Strophe.Status.DISCONNECTED, 'Disconnected'],
|
|
|
+ [Strophe.Status.DISCONNECTING, 'Disconnecting'],
|
|
|
+ [Strophe.Status.ATTACHED, 'Attached'],
|
|
|
+ [Strophe.Status.REDIRECT, 'Redirect'],
|
|
|
+ [Strophe.Status.CONNTIMEOUT, 'Connection timeout'],
|
|
|
+ [Strophe.Status.RECONNECTING, 'Reconnecting'],
|
|
|
+]);
|
|
|
|
|
|
-export const CONNECTION_STATUS_CSS_CLASS = {
|
|
|
- 'Error': 'error',
|
|
|
- 'Connecting': 'info',
|
|
|
- 'Connection failure': 'error',
|
|
|
- 'Authenticating': 'info',
|
|
|
- 'Authentication failure': 'error',
|
|
|
- 'Connected': 'info',
|
|
|
- 'Disconnected': 'error',
|
|
|
- 'Disconnecting': 'warn',
|
|
|
- 'Attached': 'info',
|
|
|
- 'Redirect': 'info',
|
|
|
- 'Reconnecting': 'warn'
|
|
|
-};
|
|
|
+export const CONNECTION_STATUS_CSS_CLASS = Object.fromEntries([
|
|
|
+ [Strophe.Status.ERROR, 'error'],
|
|
|
+ [Strophe.Status.CONNECTING, 'info'],
|
|
|
+ [Strophe.Status.CONNFAIL, 'error'],
|
|
|
+ [Strophe.Status.AUTHENTICATING, 'info'],
|
|
|
+ [Strophe.Status.AUTHFAIL, 'error'],
|
|
|
+ [Strophe.Status.CONNECTED, 'info'],
|
|
|
+ [Strophe.Status.DISCONNECTED, 'error'],
|
|
|
+ [Strophe.Status.DISCONNECTING, 'warn'],
|
|
|
+ [Strophe.Status.ATTACHED, 'info'],
|
|
|
+ [Strophe.Status.REDIRECT, 'info'],
|
|
|
+ [Strophe.Status.RECONNECTING, 'warn'],
|
|
|
+]);
|