From 8a972ee5435a13c1b5568d5d34a433ab031b6a07 Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Sun, 1 May 2022 16:48:04 +0100 Subject: [PATCH 1/5] Add "search for" buttons to notifications --- .../editor-client/locales/de/editor.json | 7 +++- .../editor-client/locales/en-US/editor.json | 7 +++- .../editor-client/locales/ja/editor.json | 7 +++- .../editor-client/locales/ko/editor.json | 7 +++- .../editor-client/locales/ru/editor.json | 7 +++- .../editor-client/locales/zh-CN/editor.json | 7 +++- .../editor-client/locales/zh-TW/editor.json | 7 +++- .../@node-red/editor-client/src/js/red.js | 8 ++++ .../editor-client/src/js/ui/deploy.js | 39 ++++++++++++++++++- 9 files changed, 81 insertions(+), 15 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/locales/de/editor.json b/packages/node_modules/@node-red/editor-client/locales/de/editor.json index 222606df0..f002339e3 100755 --- a/packages/node_modules/@node-red/editor-client/locales/de/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/de/editor.json @@ -185,7 +185,8 @@ "create-default-package": "Standardpaketdatei erstellen", "no-thanks": "Nein, Danke", "create-default-project": "Standardprojektdateien erstellen", - "show-merge-conflicts": "Merge-Konflikte anzeigen" + "show-merge-conflicts": "Merge-Konflikte anzeigen", + "unknownNodesButton": "Search for unknown nodes" } }, "clipboard": { @@ -269,7 +270,9 @@ "successfulRestart": "Flows erfolgreich neugestartet", "deployFailed": "Übernahme (deploy) fehlgeschlagen: __message__", "unusedConfigNodes": "Einige Konfigurations-Nodes werden nicht verwendet.", - "unusedConfigNodesLink": "Hier klicken, um sie anzuschauen.", + "unusedConfigNodesButton":"Finden Sie ungenutzte konfig nodes", + "unknownNodesButton":"Finden Sie unbekannte nodes", + "invalidNodesButton":"Finden Sie ungültige nodes", "errors": { "noResponse": "Keine Antwort vom Server" }, diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index 8551d39a6..b834c8808 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -217,7 +217,8 @@ "create-default-package": "Create default package file", "no-thanks": "No thanks", "create-default-project": "Create default project files", - "show-merge-conflicts": "Show merge conflicts" + "show-merge-conflicts": "Show merge conflicts", + "unknownNodesButton": "Search for unknown nodes" } }, "clipboard": { @@ -301,7 +302,9 @@ "successfulRestart": "Successfully restarted flows", "deployFailed": "Deploy failed: __message__", "unusedConfigNodes":"You have some unused configuration nodes.", - "unusedConfigNodesLink":"Click here to see them", + "unusedConfigNodesButton":"Search unused config nodes", + "unknownNodesButton":"Search for unknown nodes", + "invalidNodesButton":"Search for invalid nodes", "errors": { "noResponse": "no response from server" }, diff --git a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json index a6326b635..d4a638137 100644 --- a/packages/node_modules/@node-red/editor-client/locales/ja/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ja/editor.json @@ -217,7 +217,8 @@ "create-default-package": "デフォルトパッケージファイルの作成", "no-thanks": "不要", "create-default-project": "デフォルトプロジェクトファイルの作成", - "show-merge-conflicts": "マージ競合を表示" + "show-merge-conflicts": "マージ競合を表示", + "unknownNodesButton": "不明なノードを検索する" } }, "clipboard": { @@ -301,7 +302,9 @@ "successfulRestart": "フローの再起動が成功しました", "deployFailed": "デプロイが失敗しました: __message__", "unusedConfigNodes": "使われていない設定ノードがあります。", - "unusedConfigNodesLink": "設定を参照する", + "unusedConfigNodesButton":"未使用の構成ノードを検索", + "unknownNodesButton":"不明なノードを検索する", + "invalidNodesButton":"無効なノードを検索する", "errors": { "noResponse": "サーバの応答がありません" }, diff --git a/packages/node_modules/@node-red/editor-client/locales/ko/editor.json b/packages/node_modules/@node-red/editor-client/locales/ko/editor.json index 9e0c74ea8..9890dda9a 100755 --- a/packages/node_modules/@node-red/editor-client/locales/ko/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ko/editor.json @@ -141,7 +141,8 @@ "create-default-package": "기본 패키지 파일 생성", "no-thanks": "괜찮습니다", "create-default-project": "기본 프로젝트 파일 생성", - "show-merge-conflicts": "병합 충돌 보여주기" + "show-merge-conflicts": "병합 충돌 보여주기", + "unknownNodesButton": "알 수 없는 노드 검색" } }, "clipboard": { @@ -203,7 +204,9 @@ "successfulRestart": "플로우 재시작을 성공했습니다", "deployFailed": "배포 실패 : __message__", "unusedConfigNodes": "사용되지 않는 설정노드가 있습니다", - "unusedConfigNodesLink": "여기를 클릭하면 볼 수 있습니다", + "unusedConfigNodesButton":"사용하지 않는 구성 노드 검색", + "unknownNodesButton":"알 수 없는 노드 검색", + "invalidNodesButton":"잘못된 노드 검색", "errors": { "noResponse": "서버의 응답이 없습니다" }, diff --git a/packages/node_modules/@node-red/editor-client/locales/ru/editor.json b/packages/node_modules/@node-red/editor-client/locales/ru/editor.json index 7f4a000a9..d669b3f09 100755 --- a/packages/node_modules/@node-red/editor-client/locales/ru/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/ru/editor.json @@ -183,7 +183,8 @@ "create-default-package": "Создать файл пакета по умолчанию", "no-thanks": "Нет, спасибо", "create-default-project": "Создать файлы проекта по умолчанию", - "show-merge-conflicts": "Показать конфликты слияния" + "show-merge-conflicts": "Показать конфликты слияния", + "unknownNodesButton": "Поиск неизвестных узлов" } }, "clipboard": { @@ -277,7 +278,9 @@ "successfulRestart": "Потоки успешно перезапущены", "deployFailed": "Развертывание не удалось: __message__", "unusedConfigNodes":"У вас есть неиспользуемых узлы конфигурации.", - "unusedConfigNodesLink":"Нажмите здесь, чтобы их увидеть", + "unusedConfigNodesButton":"Поиск неиспользуемых узлов конфигурации", + "unknownNodesButton":"Поиск неизвестных узлов", + "invalidNodesButton":"Поиск недопустимых узлов", "errors": { "noResponse": "нет ответа от сервера" }, diff --git a/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json b/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json index 17323875f..af3e833da 100644 --- a/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/zh-CN/editor.json @@ -182,7 +182,8 @@ "create-default-package": "创建默认的包文件", "no-thanks": "不了,谢谢", "create-default-project": "创建默认项目文件", - "show-merge-conflicts": "显示合并冲突" + "show-merge-conflicts": "显示合并冲突", + "unknownNodesButton": "搜索未知节点" } }, "clipboard": { @@ -264,7 +265,9 @@ "successfulRestart": "成功重启流程", "deployFailed": "部署失败: __message__", "unusedConfigNodes": "您有一些未使用的配置节点", - "unusedConfigNodesLink": "点击此处查看它们", + "unusedConfigNodesButton":"搜索未使用的配置节点", + "unknownNodesButton":"搜索未知节点", + "invalidNodesButton":"搜索无效节点", "errors": { "noResponse": "服务器没有响应" }, diff --git a/packages/node_modules/@node-red/editor-client/locales/zh-TW/editor.json b/packages/node_modules/@node-red/editor-client/locales/zh-TW/editor.json index bbc9328a8..42316176f 100644 --- a/packages/node_modules/@node-red/editor-client/locales/zh-TW/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/zh-TW/editor.json @@ -182,7 +182,8 @@ "create-default-package": "創建默認的包文件", "no-thanks": "不了,謝謝", "create-default-project": "創建默認項目文件", - "show-merge-conflicts": "顯示合併衝突" + "show-merge-conflicts": "顯示合併衝突", + "unknownNodesButton": "搜索未知節點" } }, "clipboard": { @@ -264,7 +265,9 @@ "successfulRestart": "成功重啟流程", "deployFailed": "部署失敗: __message__", "unusedConfigNodes": "您有一些未使用的配置節點", - "unusedConfigNodesLink": "點擊此處查看它們", + "unusedConfigNodesButton":"搜索未使用的配置節點", + "unknownNodesButton":"搜索未知節點", + "invalidNodesButton":"搜索無效節點", "errors": { "noResponse": "伺服器沒有回應" }, diff --git a/packages/node_modules/@node-red/editor-client/src/js/red.js b/packages/node_modules/@node-red/editor-client/src/js/red.js index 47f206a46..d84e727ed 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/red.js +++ b/packages/node_modules/@node-red/editor-client/src/js/red.js @@ -358,6 +358,14 @@ var RED = (function() { } else { options.buttons = [ { + text: RED._("notification.label.unknownNodesButton"), + class: "pull-left", + click: function() { + RED.actions.invoke("core:search", "type:unknown"); + } + }, + { + class: "primary", text: RED._("common.label.close"), click: function() { persistentNotifications[notificationId].hideNotification(); diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js index b40be4b0e..686870866 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js @@ -383,6 +383,13 @@ RED.deploy = (function() { "

"; notificationButtons = [ + { + text: RED._("deploy.unknownNodesButton"), + class: "pull-left", + click: function() { + RED.actions.invoke("core:search","type:unknown"); + } + }, { id: "red-ui-deploy-dialog-confirm-deploy-deploy", text: RED._("deploy.confirm.button.confirm"), @@ -402,6 +409,14 @@ RED.deploy = (function() { RED._('deploy.confirm.confirm') + "

"; notificationButtons = [ + { + text: RED._("deploy.invalidNodesButton"), + class: "pull-left", + click: function() { + notification.close(); + RED.actions.invoke("core:search","is:invalid"); + } + }, { id: "red-ui-deploy-dialog-confirm-deploy-deploy", text: RED._("deploy.confirm.button.confirm"), @@ -462,9 +477,31 @@ RED.deploy = (function() { RED.nodes.version(data.rev); RED.nodes.originalFlow(nns); if (hasUnusedConfig) { + const opts = { + type: "success", + fixed: false, + timeout: 6000, + buttons: [ + { + text: RED._("deploy.unusedConfigNodesButton"), + class: "pull-left", + click: function() { + RED.actions.invoke("core:search","is:config is:unused"); + } + }, + { + text: RED._("common.label.close"), + class: "primary", + click: function () { + save(true); + notification.close(); + } + } + ] + } RED.notify( '

' + RED._("deploy.successfulDeploy") + '

' + - '

' + RED._("deploy.unusedConfigNodes") + ' ' + RED._("deploy.unusedConfigNodesLink") + '

', "success", false, 6000); + '

' + RED._("deploy.unusedConfigNodes") + '

', opts); } else { RED.notify('

' + RED._("deploy.successfulDeploy") + '

', "success"); } From 135427dcc800818efabe3f96a1e946d2b26ea406 Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Mon, 2 May 2022 21:21:09 +0100 Subject: [PATCH 2/5] fix i18n for unknownNodesButton --- .../node_modules/@node-red/editor-client/locales/de/editor.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/locales/de/editor.json b/packages/node_modules/@node-red/editor-client/locales/de/editor.json index f002339e3..11d8e5d96 100755 --- a/packages/node_modules/@node-red/editor-client/locales/de/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/de/editor.json @@ -186,7 +186,7 @@ "no-thanks": "Nein, Danke", "create-default-project": "Standardprojektdateien erstellen", "show-merge-conflicts": "Merge-Konflikte anzeigen", - "unknownNodesButton": "Search for unknown nodes" + "unknownNodesButton": "Finden Sie unbekannte nodes" } }, "clipboard": { From 97b7b7b9688db711deac369d5f307355f8d8db12 Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Mon, 2 May 2022 21:22:45 +0100 Subject: [PATCH 3/5] ensure space after search terms --- packages/node_modules/@node-red/editor-client/src/js/red.js | 2 +- .../@node-red/editor-client/src/js/ui/deploy.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/red.js b/packages/node_modules/@node-red/editor-client/src/js/red.js index d84e727ed..57d2d1e33 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/red.js +++ b/packages/node_modules/@node-red/editor-client/src/js/red.js @@ -361,7 +361,7 @@ var RED = (function() { text: RED._("notification.label.unknownNodesButton"), class: "pull-left", click: function() { - RED.actions.invoke("core:search", "type:unknown"); + RED.actions.invoke("core:search", "type:unknown "); } }, { diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js index 686870866..012a711b3 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js @@ -387,7 +387,7 @@ RED.deploy = (function() { text: RED._("deploy.unknownNodesButton"), class: "pull-left", click: function() { - RED.actions.invoke("core:search","type:unknown"); + RED.actions.invoke("core:search","type:unknown "); } }, { @@ -414,7 +414,7 @@ RED.deploy = (function() { class: "pull-left", click: function() { notification.close(); - RED.actions.invoke("core:search","is:invalid"); + RED.actions.invoke("core:search","is:invalid "); } }, { @@ -486,7 +486,7 @@ RED.deploy = (function() { text: RED._("deploy.unusedConfigNodesButton"), class: "pull-left", click: function() { - RED.actions.invoke("core:search","is:config is:unused"); + RED.actions.invoke("core:search","is:config is:unused "); } }, { From 1ec75035ba9e80a04840500fa9a5015ada139748 Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Mon, 2 May 2022 21:23:36 +0100 Subject: [PATCH 4/5] declare missing var `notification` --- .../node_modules/@node-red/editor-client/src/js/ui/deploy.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js index 012a711b3..2022e98d6 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js @@ -477,6 +477,7 @@ RED.deploy = (function() { RED.nodes.version(data.rev); RED.nodes.originalFlow(nns); if (hasUnusedConfig) { + let notification; const opts = { type: "success", fixed: false, @@ -499,7 +500,7 @@ RED.deploy = (function() { } ] } - RED.notify( + notification = RED.notify( '

' + RED._("deploy.successfulDeploy") + '

' + '

' + RED._("deploy.unusedConfigNodes") + '

', opts); } else { From 3f776397d13a6294bc2538c6c871d1d0a7f5a427 Mon Sep 17 00:00:00 2001 From: Steve-Mcl Date: Mon, 2 May 2022 21:24:46 +0100 Subject: [PATCH 5/5] close parent notification on "search for..." click --- .../node_modules/@node-red/editor-client/src/js/ui/deploy.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js index 2022e98d6..5b73ed271 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/deploy.js @@ -387,6 +387,7 @@ RED.deploy = (function() { text: RED._("deploy.unknownNodesButton"), class: "pull-left", click: function() { + notification.close(); RED.actions.invoke("core:search","type:unknown "); } }, @@ -487,6 +488,7 @@ RED.deploy = (function() { text: RED._("deploy.unusedConfigNodesButton"), class: "pull-left", click: function() { + notification.close(); RED.actions.invoke("core:search","is:config is:unused "); } },