node-red-contrib-mobius-flow-base 3.0.0-beta.12 → 3.0.0-beta.14
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.
- package/dist/engine-api-calls.d.ts +1 -0
- package/dist/engine-api-calls.js +23 -2
- package/dist/engine-api-client.d.ts +2 -1
- package/dist/engine-api-client.js +23 -7
- package/dist/engine-websocket.d.ts +3 -1
- package/dist/engine-websocket.js +56 -18
- package/dist/nodes/common/mobsearch.js +52 -26
- package/dist/nodes/mobius-change-admin-password.d.ts +26 -0
- package/dist/nodes/mobius-change-admin-password.html +98 -0
- package/dist/nodes/mobius-change-admin-password.js +87 -0
- package/dist/nodes/mobius-clear-resource.html +15 -9
- package/dist/nodes/mobius-clear-resource.js +0 -1
- package/dist/nodes/mobius-connection-interface.d.ts +45 -0
- package/dist/nodes/mobius-connection-interface.js +2 -0
- package/dist/nodes/mobius-connection.js +29 -7
- package/dist/nodes/mobius-discover-object-list.html +1 -1
- package/dist/nodes/mobius-filter-by-rid-value.html +10 -6
- package/dist/nodes/mobius-flow-inject.html +1 -1
- package/dist/nodes/mobius-get-multi-object.html +1 -1
- package/dist/nodes/mobius-get-multi-object.js +1 -1
- package/dist/nodes/mobius-get-multi-resource.html +2 -1
- package/dist/nodes/mobius-get-object.html +14 -8
- package/dist/nodes/mobius-get-resource.html +16 -10
- package/dist/nodes/mobius-object-cov.html +14 -9
- package/dist/nodes/mobius-resource-cov.html +14 -8
- package/dist/nodes/mobius-set-multi-resource.html +15 -9
- package/dist/nodes/mobius-set-resource.html +14 -8
- package/dist/nodes/mobius-set-resource.js +12 -12
- package/package.json +4 -3
|
@@ -16,3 +16,4 @@ export declare const updateObject: (apiClient: AxiosInstance, uri: string, confi
|
|
|
16
16
|
export declare const filterObjectsByRIDValue: (apiClient: AxiosInstance, uri: string, pids: string[], rid: string, limit: number, func: (v: string | number | boolean) => boolean, callback: Function) => Promise<any>;
|
|
17
17
|
export declare const getHubId: (apiClient: AxiosInstance, callback: Function) => Promise<void>;
|
|
18
18
|
export declare const getNodeConfig: (apiClient: AxiosInstance, uri: string, callback: Function) => Promise<void>;
|
|
19
|
+
export declare const changeAdminPassword: (apiClient: AxiosInstance, password: string, callback: Function) => Promise<void>;
|
package/dist/engine-api-calls.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getNodeConfig = exports.getHubId = exports.filterObjectsByRIDValue = exports.updateObject = exports.getServiceConfig = exports.sendDirectCommand = exports.sendBroadcastCommand = exports.readObject = exports.readResource = exports.clearResource = exports.writeMultiResource = exports.writeResource = exports.discover = void 0;
|
|
3
|
+
exports.changeAdminPassword = exports.getNodeConfig = exports.getHubId = exports.filterObjectsByRIDValue = exports.updateObject = exports.getServiceConfig = exports.sendDirectCommand = exports.sendBroadcastCommand = exports.readObject = exports.readResource = exports.clearResource = exports.writeMultiResource = exports.writeResource = exports.discover = void 0;
|
|
4
4
|
const discover = async (apiClient, uri, callback) => {
|
|
5
5
|
try {
|
|
6
6
|
const response = await apiClient({
|
|
@@ -17,7 +17,7 @@ exports.discover = discover;
|
|
|
17
17
|
const writeResource = async (apiClient, uri, value, priority, callback) => {
|
|
18
18
|
try {
|
|
19
19
|
const response = await apiClient({
|
|
20
|
-
method: '
|
|
20
|
+
method: 'patch',
|
|
21
21
|
url: `/mobius/object/resource/${uri}`,
|
|
22
22
|
data: {
|
|
23
23
|
value,
|
|
@@ -212,3 +212,24 @@ const getNodeConfig = async (apiClient, uri, callback) => {
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
exports.getNodeConfig = getNodeConfig;
|
|
215
|
+
const changeAdminPassword = async (apiClient, password, callback) => {
|
|
216
|
+
try {
|
|
217
|
+
const response = await apiClient({
|
|
218
|
+
method: 'get',
|
|
219
|
+
url: `/auth/user/admin`,
|
|
220
|
+
});
|
|
221
|
+
const adminUserId = response.data;
|
|
222
|
+
await apiClient({
|
|
223
|
+
method: 'patch',
|
|
224
|
+
url: `/auth/user/password/${adminUserId}`,
|
|
225
|
+
data: {
|
|
226
|
+
password,
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
callback(null, 'Ok');
|
|
230
|
+
}
|
|
231
|
+
catch (err) {
|
|
232
|
+
callback(err);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
exports.changeAdminPassword = changeAdminPassword;
|
|
@@ -3,5 +3,6 @@ export declare let tokens: null | {
|
|
|
3
3
|
refreshToken: string;
|
|
4
4
|
};
|
|
5
5
|
export declare let loggedIn: boolean;
|
|
6
|
-
export declare const getApiClient: (protocol:
|
|
6
|
+
export declare const getApiClient: (protocol: 'http' | 'https', host: string, port: number, username: string, password: string) => import("axios").AxiosInstance;
|
|
7
7
|
export declare const setLoggedIn: (value: boolean) => void;
|
|
8
|
+
export declare const closeApiClient: () => void;
|
|
@@ -3,12 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setLoggedIn = exports.getApiClient = exports.loggedIn = exports.tokens = void 0;
|
|
6
|
+
exports.closeApiClient = exports.setLoggedIn = exports.getApiClient = exports.loggedIn = exports.tokens = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const engine_websocket_1 = require("./engine-websocket");
|
|
9
9
|
exports.tokens = null;
|
|
10
10
|
exports.loggedIn = false;
|
|
11
|
+
let reloginInterval = null;
|
|
11
12
|
const getApiClient = (protocol, host, port, username, password) => {
|
|
13
|
+
(0, engine_websocket_1.setWebSocketConnectParams)(host, port, protocol);
|
|
12
14
|
//const baseURL = `http://localhost:8443/api/v1`;
|
|
13
15
|
const baseURL = `${protocol}://${host}:${port}/api/v1`;
|
|
14
16
|
const client = axios_1.default.create({
|
|
@@ -17,6 +19,11 @@ const getApiClient = (protocol, host, port, username, password) => {
|
|
|
17
19
|
'Content-Type': 'application/json',
|
|
18
20
|
},
|
|
19
21
|
});
|
|
22
|
+
reloginInterval = setInterval(() => {
|
|
23
|
+
if (!exports.loggedIn) {
|
|
24
|
+
login();
|
|
25
|
+
}
|
|
26
|
+
}, 30000);
|
|
20
27
|
// Add auth headers to all axios calls
|
|
21
28
|
client.interceptors.request.use((config) => {
|
|
22
29
|
if (!config.url?.endsWith('/auth/login')) {
|
|
@@ -29,6 +36,7 @@ const getApiClient = (protocol, host, port, username, password) => {
|
|
|
29
36
|
Promise.reject(error);
|
|
30
37
|
});
|
|
31
38
|
const login = async () => {
|
|
39
|
+
console.log('Attempting Mobius Engine API Login');
|
|
32
40
|
try {
|
|
33
41
|
const response = await client({
|
|
34
42
|
method: 'post',
|
|
@@ -40,10 +48,11 @@ const getApiClient = (protocol, host, port, username, password) => {
|
|
|
40
48
|
});
|
|
41
49
|
exports.tokens = response.data;
|
|
42
50
|
exports.loggedIn = true;
|
|
43
|
-
console.log('Logged in');
|
|
51
|
+
console.log('Logged in to Mobius Engine API');
|
|
44
52
|
(0, engine_websocket_1.connectToWebSocket)();
|
|
45
53
|
}
|
|
46
54
|
catch (e) {
|
|
55
|
+
(0, engine_websocket_1.disconnectFromWebSocket)();
|
|
47
56
|
exports.loggedIn = false;
|
|
48
57
|
}
|
|
49
58
|
};
|
|
@@ -63,20 +72,21 @@ const getApiClient = (protocol, host, port, username, password) => {
|
|
|
63
72
|
exports.tokens = response.data;
|
|
64
73
|
exports.loggedIn = true;
|
|
65
74
|
}
|
|
66
|
-
catch {
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
catch (err) {
|
|
76
|
+
console.log(JSON.stringify(err, null, 2));
|
|
77
|
+
console.log('Failed to refresh Mobius Engine API token');
|
|
69
78
|
}
|
|
70
79
|
};
|
|
71
|
-
setInterval(refresh, 1000 * 60 *
|
|
80
|
+
setInterval(refresh, 1000 * 60 * 1);
|
|
72
81
|
client.interceptors.response.use((res) => {
|
|
73
82
|
return res;
|
|
74
83
|
}, async (error) => {
|
|
75
84
|
if (!error.response) {
|
|
76
85
|
// notify
|
|
77
86
|
}
|
|
78
|
-
if (
|
|
87
|
+
if (!error.config.url?.endsWith('/auth/login')) {
|
|
79
88
|
console.log(`Logged Out: ${JSON.stringify(error.response)}`);
|
|
89
|
+
(0, engine_websocket_1.disconnectFromWebSocket)();
|
|
80
90
|
exports.loggedIn = false;
|
|
81
91
|
exports.tokens = null;
|
|
82
92
|
login();
|
|
@@ -90,3 +100,9 @@ const setLoggedIn = (value) => {
|
|
|
90
100
|
exports.loggedIn = value;
|
|
91
101
|
};
|
|
92
102
|
exports.setLoggedIn = setLoggedIn;
|
|
103
|
+
const closeApiClient = () => {
|
|
104
|
+
if (reloginInterval) {
|
|
105
|
+
clearInterval(reloginInterval);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.closeApiClient = closeApiClient;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
type WebSocketTopics = 'authorize' | 'subscribe' | 'unsubscribe' | 'connected' | 'authorized' | 'object-cov' | 'resource-cov' | 'service-status' | 'broadcast-command' | 'error' | 'ping' | 'pong';
|
|
2
2
|
type Events = 'connected' | 'disconnected';
|
|
3
|
+
export declare const setWebSocketConnectParams: (hostname: string, port: number, protocol: 'http' | 'https') => void;
|
|
3
4
|
export declare const on: (eventName: Events, callback: Function) => void;
|
|
4
5
|
export declare function registerCallback(topic: WebSocketTopics, callback: Function): void;
|
|
5
6
|
export declare function clearAllCallbacks(): void;
|
|
7
|
+
export declare const killWebSocket: () => void;
|
|
6
8
|
/**
|
|
7
9
|
* Connect to the Mobius WebSocket API
|
|
8
10
|
* This method will connect to the Mobius WebSocket API and authenticate with the API token
|
|
9
11
|
*/
|
|
10
12
|
export declare const connectToWebSocket: () => void;
|
|
11
13
|
/**
|
|
12
|
-
* Disconnect from the Mobius WebSocket API
|
|
14
|
+
* Disconnect from the Mobius WebSocket API - Using this will not stop socket from attempting to reconnect
|
|
13
15
|
* This method will close the connection to the Mobius WebSocket API
|
|
14
16
|
*/
|
|
15
17
|
export declare const disconnectFromWebSocket: () => void;
|
package/dist/engine-websocket.js
CHANGED
|
@@ -3,15 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.unsubscribeToBCMD = exports.subscribeToBCMD = exports.unsubscribeToResourceCOV = exports.subscribeToResourceCOV = exports.unsubscribeToObjectCOV = exports.subscribeToObjectCOV = exports.disconnectFromWebSocket = exports.connectToWebSocket = exports.clearAllCallbacks = exports.registerCallback = exports.on = void 0;
|
|
6
|
+
exports.unsubscribeToBCMD = exports.subscribeToBCMD = exports.unsubscribeToResourceCOV = exports.subscribeToResourceCOV = exports.unsubscribeToObjectCOV = exports.subscribeToObjectCOV = exports.disconnectFromWebSocket = exports.connectToWebSocket = exports.killWebSocket = exports.clearAllCallbacks = exports.registerCallback = exports.on = exports.setWebSocketConnectParams = void 0;
|
|
7
7
|
const ws_1 = __importDefault(require("ws"));
|
|
8
8
|
const engine_api_client_1 = require("./engine-api-client");
|
|
9
9
|
let webSocket = null;
|
|
10
|
-
|
|
10
|
+
let pendingWebSocketMessages = [];
|
|
11
11
|
let pendingWebSocketMessageInterval = null;
|
|
12
12
|
let pingInterval = null;
|
|
13
13
|
let registeredCallbacks = [];
|
|
14
|
-
|
|
14
|
+
let eventListeners = [];
|
|
15
|
+
let reconnectInterval = null;
|
|
16
|
+
let attemptReconnect = false;
|
|
17
|
+
let connectParams = null;
|
|
18
|
+
const setWebSocketConnectParams = (hostname, port, protocol) => {
|
|
19
|
+
connectParams = { hostname, port, protocol };
|
|
20
|
+
};
|
|
21
|
+
exports.setWebSocketConnectParams = setWebSocketConnectParams;
|
|
15
22
|
const on = (eventName, callback) => {
|
|
16
23
|
eventListeners.push({ eventName, callback });
|
|
17
24
|
};
|
|
@@ -49,7 +56,7 @@ function handleWebSocketMessage(message) {
|
|
|
49
56
|
console.log(`Websocket Error: ${message.payload}`);
|
|
50
57
|
}
|
|
51
58
|
if (message.topic === 'authorized') {
|
|
52
|
-
console.log('
|
|
59
|
+
console.log('Engine API Subscription WebSocket Auth Success');
|
|
53
60
|
triggerEvent('connected');
|
|
54
61
|
}
|
|
55
62
|
const callbacks = registeredCallbacks
|
|
@@ -58,30 +65,49 @@ function handleWebSocketMessage(message) {
|
|
|
58
65
|
callbacks.forEach((cb) => cb(message.payload));
|
|
59
66
|
}
|
|
60
67
|
const reconnect = () => {
|
|
61
|
-
console.log('WebSocket Client reconnecting...');
|
|
68
|
+
console.log('Engine API Subscription WebSocket Client reconnecting...');
|
|
62
69
|
(0, exports.connectToWebSocket)();
|
|
63
70
|
};
|
|
64
|
-
|
|
71
|
+
// To be used only when connection node is deleted, hence removal of all callbacks etc.
|
|
72
|
+
const killWebSocket = () => {
|
|
73
|
+
attemptReconnect = false;
|
|
74
|
+
if (reconnectInterval) {
|
|
75
|
+
clearInterval(reconnectInterval);
|
|
76
|
+
}
|
|
77
|
+
registeredCallbacks = [];
|
|
78
|
+
pendingWebSocketMessages = [];
|
|
79
|
+
eventListeners = [];
|
|
80
|
+
if (webSocket) {
|
|
81
|
+
webSocket.close();
|
|
82
|
+
}
|
|
83
|
+
console.log('Killing Engine API Subscription WebSocket Client');
|
|
84
|
+
};
|
|
85
|
+
exports.killWebSocket = killWebSocket;
|
|
65
86
|
/**
|
|
66
87
|
* Connect to the Mobius WebSocket API
|
|
67
88
|
* This method will connect to the Mobius WebSocket API and authenticate with the API token
|
|
68
89
|
*/
|
|
69
90
|
const connectToWebSocket = () => {
|
|
91
|
+
if (!connectParams) {
|
|
92
|
+
console.log('Unabled to connect to Engine API Subscription WebSocket as no connect params are set');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
70
95
|
if (!engine_api_client_1.tokens) {
|
|
71
|
-
console.log('Unabled to connect to
|
|
96
|
+
console.log('Unabled to connect to Engine API Subscription WebSocket as no tokens are available');
|
|
72
97
|
return;
|
|
73
98
|
}
|
|
74
99
|
if (webSocket) {
|
|
75
100
|
webSocket.close();
|
|
76
101
|
webSocket = null;
|
|
77
102
|
}
|
|
78
|
-
let webSocketProtocol = '
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
webSocket = new ws_1.default(
|
|
103
|
+
let webSocketProtocol = 'wss';
|
|
104
|
+
if (connectParams.protocol === 'http') {
|
|
105
|
+
webSocketProtocol = 'ws';
|
|
106
|
+
}
|
|
107
|
+
webSocket = new ws_1.default(`${webSocketProtocol}://${connectParams.hostname}:${connectParams.port}/api/v1/mobius/subscribe/connect`);
|
|
83
108
|
webSocket.onopen = () => {
|
|
84
|
-
|
|
109
|
+
attemptReconnect = true;
|
|
110
|
+
console.log('Engine API Subscription WebSocket Client Connected');
|
|
85
111
|
pingInterval = setInterval(sendPingMessage, 30000);
|
|
86
112
|
clearInterval(reconnectInterval);
|
|
87
113
|
webSocket?.send(JSON.stringify({
|
|
@@ -96,15 +122,22 @@ const connectToWebSocket = () => {
|
|
|
96
122
|
}, 1000);
|
|
97
123
|
};
|
|
98
124
|
webSocket.onclose = () => {
|
|
99
|
-
console.log('WebSocket Client Closed');
|
|
125
|
+
console.log('Engine API Subscription WebSocket Client Closed');
|
|
100
126
|
if (pingInterval) {
|
|
101
127
|
clearInterval(pingInterval);
|
|
102
128
|
}
|
|
129
|
+
webSocket = null;
|
|
130
|
+
clearInterval(reconnectInterval);
|
|
103
131
|
if (pendingWebSocketMessageInterval) {
|
|
104
132
|
clearInterval(pendingWebSocketMessageInterval);
|
|
105
|
-
reconnectInterval = setInterval(reconnect, 5000);
|
|
106
133
|
}
|
|
107
|
-
|
|
134
|
+
if (attemptReconnect) {
|
|
135
|
+
reconnectInterval = setInterval(() => {
|
|
136
|
+
if (engine_api_client_1.loggedIn) {
|
|
137
|
+
reconnect();
|
|
138
|
+
}
|
|
139
|
+
}, 30000);
|
|
140
|
+
}
|
|
108
141
|
triggerEvent('disconnected');
|
|
109
142
|
};
|
|
110
143
|
webSocket.onmessage = (message) => {
|
|
@@ -119,12 +152,17 @@ const connectToWebSocket = () => {
|
|
|
119
152
|
}
|
|
120
153
|
};
|
|
121
154
|
webSocket.on('error', (e) => {
|
|
122
|
-
|
|
155
|
+
if (e.code === 'ECONNREFUSED') {
|
|
156
|
+
(0, engine_api_client_1.setLoggedIn)(false);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
console.error('Engine API Subscription WebSocket Client Error: ', e);
|
|
160
|
+
}
|
|
123
161
|
});
|
|
124
162
|
};
|
|
125
163
|
exports.connectToWebSocket = connectToWebSocket;
|
|
126
164
|
/**
|
|
127
|
-
* Disconnect from the Mobius WebSocket API
|
|
165
|
+
* Disconnect from the Mobius WebSocket API - Using this will not stop socket from attempting to reconnect
|
|
128
166
|
* This method will close the connection to the Mobius WebSocket API
|
|
129
167
|
*/
|
|
130
168
|
const disconnectFromWebSocket = () => {
|
|
@@ -64,18 +64,28 @@ if (typeof selectionIndex === undefined) {
|
|
|
64
64
|
* @param {number} rowIndex - The list row index
|
|
65
65
|
* @param {object} opts - Mobsearch options object
|
|
66
66
|
*/
|
|
67
|
-
function addMobsearchListButton(field, rowIndex, opts) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
function addMobsearchListButton(mobiusSrvc, field, rowIndex, opts) {
|
|
68
|
+
if (mobiusSrvc !== '_ADD_') {
|
|
69
|
+
$.getJSON(`mgetconnected?mobius=${mobiusSrvc}`, function (response) {
|
|
70
|
+
if (!response) {
|
|
71
|
+
field.css('color', '#CCCCCC');
|
|
72
|
+
} else {
|
|
73
|
+
field.click(function () {
|
|
74
|
+
selectionIndex = rowIndex;
|
|
75
|
+
$(`#${opts.containerRowName}`).hide();
|
|
76
|
+
$('#instance-search-sid').val('');
|
|
77
|
+
$('#instance-search-pid').val('');
|
|
78
|
+
$('#instance-search-ins').val('');
|
|
79
|
+
$('#instance-search-rid').val('');
|
|
80
|
+
$('#node-search-return').removeClass('disabled');
|
|
81
|
+
$('#node-search-accept').removeClass('disabled');
|
|
82
|
+
$('#instance-search-row').show();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
field.css('color', '#CCCCCC');
|
|
88
|
+
}
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
/**
|
|
@@ -116,6 +126,9 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
116
126
|
|
|
117
127
|
//Inject new html
|
|
118
128
|
document.getElementById(opts.htmlElementId).innerHTML += `
|
|
129
|
+
<div id="bad-connection-alert" style="color:#FF0000" align="center">
|
|
130
|
+
<p>Setup and deploy MOBiUS connection to allow search.</p>
|
|
131
|
+
</div>
|
|
119
132
|
<div id="instance-search-row">
|
|
120
133
|
<div class="form-row">
|
|
121
134
|
<label for="instance-search-sid"><i class="fa fa-tasks"></i> URI</label>
|
|
@@ -143,12 +156,23 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
143
156
|
|
|
144
157
|
// * INIT SETUP * //
|
|
145
158
|
|
|
159
|
+
let mobConnected = false;
|
|
160
|
+
$.getJSON(`mgetconnected?mobius=${mobiusSrvc}`, function (response) {
|
|
161
|
+
mobConnected = response;
|
|
162
|
+
if (!mobConnected) {
|
|
163
|
+
$('#node-lookup-instance').css('color', '#CCCCCC');
|
|
164
|
+
$('#bad-connection-alert').show();
|
|
165
|
+
} else {
|
|
166
|
+
$('#bad-connection-alert').hide();
|
|
167
|
+
$.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
|
|
168
|
+
$('#instance-search-hid').val(response);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
146
173
|
$('#instance-search-row').hide();
|
|
147
174
|
$('#wildcard-alert-row').hide();
|
|
148
175
|
$('#node-search-return').addClass('disabled');
|
|
149
|
-
$.getJSON(`mgethid?mobius=${mobiusSrvc}`, function (response) {
|
|
150
|
-
$('#instance-search-hid').val(response);
|
|
151
|
-
});
|
|
152
176
|
let readyToAccept = false;
|
|
153
177
|
|
|
154
178
|
let searchObject = {};
|
|
@@ -451,18 +475,20 @@ function getMobsearch(mobiusSrvc, useRid, listed, opts) {
|
|
|
451
475
|
// * CLICK RESPONSE * //
|
|
452
476
|
|
|
453
477
|
$('#node-lookup-instance').click(function () {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
478
|
+
if (mobConnected) {
|
|
479
|
+
//When search button is clicked
|
|
480
|
+
$('#instance-search-sid').val('');
|
|
481
|
+
$('#instance-search-pid').val('');
|
|
482
|
+
$('#instance-search-ins').val('');
|
|
483
|
+
if (useRid) {
|
|
484
|
+
$('#instance-search-rid').val('');
|
|
485
|
+
}
|
|
486
|
+
$('#node-lookup-instance').addClass('disabled');
|
|
487
|
+
$('#node-search-return').removeClass('disabled');
|
|
488
|
+
$('#node-search-accept').removeClass('disabled');
|
|
489
|
+
$('#instance-row').hide();
|
|
490
|
+
$('#instance-search-row').show();
|
|
460
491
|
}
|
|
461
|
-
$('#node-lookup-instance').addClass('disabled');
|
|
462
|
-
$('#node-search-return').removeClass('disabled');
|
|
463
|
-
$('#node-search-accept').removeClass('disabled');
|
|
464
|
-
$('#instance-row').hide();
|
|
465
|
-
$('#instance-search-row').show();
|
|
466
492
|
});
|
|
467
493
|
|
|
468
494
|
$('#instance-search-sid').click(function () {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Copyright (C) 2016, IAConnects Technology Limited
|
|
3
|
+
All Rights Reserved
|
|
4
|
+
|
|
5
|
+
ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
|
|
6
|
+
THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
|
|
7
|
+
IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
|
|
8
|
+
HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
|
|
9
|
+
AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
|
|
10
|
+
DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
|
|
11
|
+
IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
|
|
12
|
+
FROM IACONNECTS TECHNOLOGY LIMITED.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
15
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
16
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
17
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
|
|
18
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
19
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
20
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
21
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
22
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
23
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
24
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
**/
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Copyright (C) 2016, IAConnects Technology Limited
|
|
3
|
+
All Rights Reserved
|
|
4
|
+
|
|
5
|
+
ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
|
|
6
|
+
THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
|
|
7
|
+
IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
|
|
8
|
+
HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
|
|
9
|
+
AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
|
|
10
|
+
DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
|
|
11
|
+
IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
|
|
12
|
+
FROM IACONNECTS TECHNOLOGY LIMITED.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
15
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
16
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
17
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
|
|
18
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
19
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
20
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
21
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
22
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
23
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
24
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
25
|
+
-->
|
|
26
|
+
|
|
27
|
+
<script type="text/x-red" data-template-name="mobius change admin password">
|
|
28
|
+
<div class="form-row">
|
|
29
|
+
<label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
|
|
30
|
+
<input type="text" id="node-input-connection">
|
|
31
|
+
</div>
|
|
32
|
+
<hr>
|
|
33
|
+
|
|
34
|
+
<div class="form-row" id="input-row">
|
|
35
|
+
<label for="node-input-password"><i class="fa fa-key"></i> Password</label>
|
|
36
|
+
<input type="text" id="node-input-password" placeholder="Password (Min 8 Chars)">
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<hr>
|
|
40
|
+
|
|
41
|
+
<div class="form-row">
|
|
42
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
43
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
44
|
+
</div>
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<script type="text/javascript">
|
|
48
|
+
RED.nodes.registerType('mobius change admin password',{
|
|
49
|
+
category: 'mobius',
|
|
50
|
+
defaults: {
|
|
51
|
+
name: {value:""},
|
|
52
|
+
password: {value:"", validate:function(v) {
|
|
53
|
+
if (v.length < 8) {
|
|
54
|
+
return false;
|
|
55
|
+
} else {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}},
|
|
59
|
+
connection: {type:"mobius connection", required:true}
|
|
60
|
+
},
|
|
61
|
+
color:"#6a8cc8",
|
|
62
|
+
inputs:1,
|
|
63
|
+
outputs:0,
|
|
64
|
+
icon: "mobius.png",
|
|
65
|
+
align: "right",
|
|
66
|
+
paletteLabel: 'change admin password',
|
|
67
|
+
label: 'Change Admin Password',
|
|
68
|
+
labelStyle: function() {
|
|
69
|
+
return this.name ? "node_label_italic":"";
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<script type="text/x-red" data-help-name="mobius change admin password">
|
|
75
|
+
<p>Set MOBiUS admin password.</p>
|
|
76
|
+
|
|
77
|
+
<h3>Configuration Page</h3>
|
|
78
|
+
<dl class="message-properties">
|
|
79
|
+
<dt>MOBiUS <span class="property-type">node</span></dt>
|
|
80
|
+
<dd>Shared MOBiUS connection for communication with the MOBiUS Hub.</dd>
|
|
81
|
+
<dt>Password <span class="property-type">string</span></dt>
|
|
82
|
+
<dd>The new admin passsord (must be at least 8 characters).</dd>
|
|
83
|
+
</dl>
|
|
84
|
+
|
|
85
|
+
<h3>Inputs</h3>
|
|
86
|
+
<ol class="node-ports">
|
|
87
|
+
<li>Input message to trigger changes of password
|
|
88
|
+
<dl class="message-properties">
|
|
89
|
+
<dt class="optional">payload.passsword <span class="property-type">string</span></dt>
|
|
90
|
+
<dd>An optional property that overwrites the new password set in the node configuration page.
|
|
91
|
+
If the property is not valid (less than 8 characters) no action is taken.</dd>
|
|
92
|
+
</dl>
|
|
93
|
+
</li>
|
|
94
|
+
</ol>
|
|
95
|
+
|
|
96
|
+
<br>
|
|
97
|
+
<p align="center" style="color:#000080">mobiusflow © 2023</p>
|
|
98
|
+
</script>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
Copyright (C) 2016, IAConnects Technology Limited
|
|
4
|
+
All Rights Reserved
|
|
5
|
+
|
|
6
|
+
ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
|
|
7
|
+
THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
|
|
8
|
+
IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
|
|
9
|
+
HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
|
|
10
|
+
AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
|
|
11
|
+
DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
|
|
12
|
+
IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
|
|
13
|
+
FROM IACONNECTS TECHNOLOGY LIMITED.
|
|
14
|
+
|
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
16
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
17
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
18
|
+
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
|
|
19
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
20
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
21
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
22
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
23
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
24
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
25
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
+
**/
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
module.exports = function (RED) {
|
|
29
|
+
RED.nodes.registerType('mobius change admin password', function (n) {
|
|
30
|
+
RED.nodes.createNode(this, n);
|
|
31
|
+
let node = (() => {
|
|
32
|
+
this['password'] = n.password;
|
|
33
|
+
this['serviceConn'] = RED.nodes.getNode(n.connection);
|
|
34
|
+
return this;
|
|
35
|
+
})();
|
|
36
|
+
if (node.serviceConn) {
|
|
37
|
+
node.status({
|
|
38
|
+
fill: 'red',
|
|
39
|
+
shape: 'ring',
|
|
40
|
+
text: 'Disconnected',
|
|
41
|
+
});
|
|
42
|
+
node.on('input', function (msg) {
|
|
43
|
+
let password = node.password;
|
|
44
|
+
if (msg.hasOwnProperty('payload')) {
|
|
45
|
+
if (msg.payload.hasOwnProperty('password')) {
|
|
46
|
+
password = msg.payload.password;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (password.length < 8) {
|
|
50
|
+
node.error('Password provided must be at least 8 characters long');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (password) {
|
|
54
|
+
node.status({
|
|
55
|
+
fill: 'green',
|
|
56
|
+
shape: 'ring',
|
|
57
|
+
text: 'Busy',
|
|
58
|
+
});
|
|
59
|
+
node.serviceConn.changeAdminPassword(password, (err, response) => {
|
|
60
|
+
if (err) {
|
|
61
|
+
node.status({
|
|
62
|
+
fill: 'yellow',
|
|
63
|
+
shape: 'dot',
|
|
64
|
+
text: 'Error: ' + JSON.stringify(err.code),
|
|
65
|
+
});
|
|
66
|
+
node.error('Mobius error setting admin password ' + JSON.stringify(err));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
node.status({
|
|
70
|
+
fill: 'green',
|
|
71
|
+
shape: 'dot',
|
|
72
|
+
text: 'Admin password changed (use on next login)',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
node.serviceConn.register(node);
|
|
79
|
+
node.on('close', function (done) {
|
|
80
|
+
node.serviceConn.deregister(node, done);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
node.error(RED._('Mobius service not defined'));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
};
|