imcp 0.1.7 → 0.1.8-dev
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/cli/commands/install.js +1 -106
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/list.js +1 -90
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/pull.js +1 -16
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/serve.js +1 -33
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/uninstall.js +1 -46
- package/dist/cli/commands/uninstall.js.map +1 -0
- package/dist/cli/index.js +1 -65
- package/dist/cli/index.js.map +1 -0
- package/dist/core/installers/clients/BaseClientInstaller.js +1 -282
- package/dist/core/installers/clients/BaseClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstaller.js +1 -163
- package/dist/core/installers/clients/ClientInstaller.js.map +1 -0
- package/dist/core/installers/clients/ClientInstallerFactory.js +1 -36
- package/dist/core/installers/clients/ClientInstallerFactory.js.map +1 -0
- package/dist/core/installers/clients/ClineInstaller.js +1 -30
- package/dist/core/installers/clients/ClineInstaller.js.map +1 -0
- package/dist/core/installers/clients/ExtensionInstaller.js +1 -151
- package/dist/core/installers/clients/ExtensionInstaller.js.map +1 -0
- package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -68
- package/dist/core/installers/clients/GithubCopilotInstaller.js.map +1 -0
- package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -28
- package/dist/core/installers/clients/MSRooCodeInstaller.js.map +1 -0
- package/dist/core/installers/index.js +1 -8
- package/dist/core/installers/index.js.map +1 -0
- package/dist/core/installers/requirements/BaseInstaller.js +1 -56
- package/dist/core/installers/requirements/BaseInstaller.js.map +1 -0
- package/dist/core/installers/requirements/CommandInstaller.js +1 -213
- package/dist/core/installers/requirements/CommandInstaller.js.map +1 -0
- package/dist/core/installers/requirements/GeneralInstaller.js +1 -126
- package/dist/core/installers/requirements/GeneralInstaller.js.map +1 -0
- package/dist/core/installers/requirements/InstallerFactory.js +1 -99
- package/dist/core/installers/requirements/InstallerFactory.js.map +1 -0
- package/dist/core/installers/requirements/NpmInstaller.js +1 -235
- package/dist/core/installers/requirements/NpmInstaller.js.map +1 -0
- package/dist/core/installers/requirements/NugetInstaller.js +1 -188
- package/dist/core/installers/requirements/NugetInstaller.js.map +1 -0
- package/dist/core/installers/requirements/PipInstaller.js +1 -192
- package/dist/core/installers/requirements/PipInstaller.js.map +1 -0
- package/dist/core/installers/requirements/RequirementInstaller.js +1 -2
- package/dist/core/installers/requirements/RequirementInstaller.js.map +1 -0
- package/dist/core/loaders/ConfigurationLoader.js +1 -256
- package/dist/core/loaders/ConfigurationLoader.js.map +1 -0
- package/dist/core/loaders/ConfigurationProvider.js +1 -383
- package/dist/core/loaders/ConfigurationProvider.js.map +1 -0
- package/dist/core/loaders/InstallOperationManager.js +1 -310
- package/dist/core/loaders/InstallOperationManager.js.map +1 -0
- package/dist/core/loaders/ServerSchemaLoader.js +1 -108
- package/dist/core/loaders/ServerSchemaLoader.js.map +1 -0
- package/dist/core/loaders/ServerSchemaProvider.js +1 -89
- package/dist/core/loaders/ServerSchemaProvider.js.map +1 -0
- package/dist/core/loaders/SystemSettingsManager.js +1 -256
- package/dist/core/loaders/SystemSettingsManager.js.map +1 -0
- package/dist/core/metadatas/constants.js +1 -100
- package/dist/core/metadatas/constants.js.map +1 -0
- package/dist/core/metadatas/recordingConstants.js +1 -46
- package/dist/core/metadatas/recordingConstants.js.map +1 -0
- package/dist/core/metadatas/types.js +1 -15
- package/dist/core/metadatas/types.js.map +1 -0
- package/dist/core/onboard/FeedOnboardService.js +1 -422
- package/dist/core/onboard/FeedOnboardService.js.map +1 -0
- package/dist/core/onboard/OnboardProcessor.js +1 -333
- package/dist/core/onboard/OnboardProcessor.js.map +1 -0
- package/dist/core/onboard/OnboardStatus.js +1 -9
- package/dist/core/onboard/OnboardStatus.js.map +1 -0
- package/dist/core/onboard/OnboardStatusManager.js +1 -360
- package/dist/core/onboard/OnboardStatusManager.js.map +1 -0
- package/dist/core/validators/FeedValidator.js +1 -133
- package/dist/core/validators/FeedValidator.js.map +1 -0
- package/dist/core/validators/IServerValidator.js +1 -1
- package/dist/core/validators/IServerValidator.js.map +1 -0
- package/dist/core/validators/SSEServerValidator.js +1 -38
- package/dist/core/validators/SSEServerValidator.js.map +1 -0
- package/dist/core/validators/ServerValidatorFactory.js +1 -44
- package/dist/core/validators/ServerValidatorFactory.js.map +1 -0
- package/dist/core/validators/StdioServerValidator.js +1 -281
- package/dist/core/validators/StdioServerValidator.js.map +1 -0
- package/dist/index.js +1 -18
- package/dist/index.js.map +1 -0
- package/dist/services/InstallationService.js +1 -81
- package/dist/services/InstallationService.js.map +1 -0
- package/dist/services/MCPManager.js +1 -197
- package/dist/services/MCPManager.js.map +1 -0
- package/dist/services/RequirementService.js +1 -548
- package/dist/services/RequirementService.js.map +1 -0
- package/dist/services/ServerService.js +1 -127
- package/dist/services/ServerService.js.map +1 -0
- package/dist/services/TelemetryService.js +1 -53
- package/dist/services/TelemetryService.js.map +1 -0
- package/dist/utils/UpdateCheckTracker.js +1 -79
- package/dist/utils/UpdateCheckTracker.js.map +1 -0
- package/dist/utils/adoUtils.js +1 -254
- package/dist/utils/adoUtils.js.map +1 -0
- package/dist/utils/clientUtils.js +1 -65
- package/dist/utils/clientUtils.js.map +1 -0
- package/dist/utils/feedUtils.js +1 -28
- package/dist/utils/feedUtils.js.map +1 -0
- package/dist/utils/githubAuth.js +1 -177
- package/dist/utils/githubAuth.js.map +1 -0
- package/dist/utils/githubUtils.js +1 -125
- package/dist/utils/githubUtils.js.map +1 -0
- package/dist/utils/logger.js +1 -176
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/macroExpressionUtils.js +1 -93
- package/dist/utils/macroExpressionUtils.js.map +1 -0
- package/dist/utils/osUtils.js +1 -664
- package/dist/utils/osUtils.js.map +1 -0
- package/dist/utils/versionUtils.js +1 -101
- package/dist/utils/versionUtils.js.map +1 -0
- package/dist/web/contract/serverContract.js +1 -1
- package/dist/web/contract/serverContract.js.map +1 -0
- package/dist/web/public/js/api.js +2 -132
- package/dist/web/public/js/api.js.map +1 -0
- package/dist/web/public/js/detailsWidget.js +2 -264
- package/dist/web/public/js/detailsWidget.js.map +1 -0
- package/dist/web/public/js/flights/flights.js +2 -127
- package/dist/web/public/js/flights/flights.js.map +1 -0
- package/dist/web/public/js/modal/index.js +2 -52
- package/dist/web/public/js/modal/index.js.map +1 -0
- package/dist/web/public/js/modal/installModal.js +2 -162
- package/dist/web/public/js/modal/installModal.js.map +1 -0
- package/dist/web/public/js/modal/installation.js +2 -266
- package/dist/web/public/js/modal/installation.js.map +1 -0
- package/dist/web/public/js/modal/loadingModal.js +2 -182
- package/dist/web/public/js/modal/loadingModal.js.map +1 -0
- package/dist/web/public/js/modal/modalSetup.js +2 -595
- package/dist/web/public/js/modal/modalSetup.js.map +1 -0
- package/dist/web/public/js/modal/modalUtils.js +2 -37
- package/dist/web/public/js/modal/modalUtils.js.map +1 -0
- package/dist/web/public/js/modal/versionUtils.js +2 -20
- package/dist/web/public/js/modal/versionUtils.js.map +1 -0
- package/dist/web/public/js/modal.js +2 -42
- package/dist/web/public/js/modal.js.map +1 -0
- package/dist/web/public/js/notifications.js +2 -137
- package/dist/web/public/js/notifications.js.map +1 -0
- package/dist/web/public/js/onboard/formProcessor.js +2 -1037
- package/dist/web/public/js/onboard/formProcessor.js.map +1 -0
- package/dist/web/public/js/onboard/index.js +2 -374
- package/dist/web/public/js/onboard/index.js.map +1 -0
- package/dist/web/public/js/onboard/publishHandler.js +2 -172
- package/dist/web/public/js/onboard/publishHandler.js.map +1 -0
- package/dist/web/public/js/onboard/state.js +2 -76
- package/dist/web/public/js/onboard/state.js.map +1 -0
- package/dist/web/public/js/onboard/templates.js +2 -342
- package/dist/web/public/js/onboard/templates.js.map +1 -0
- package/dist/web/public/js/onboard/uiHandlers.js +2 -1076
- package/dist/web/public/js/onboard/uiHandlers.js.map +1 -0
- package/dist/web/public/js/onboard/validationHandlers.js +2 -493
- package/dist/web/public/js/onboard/validationHandlers.js.map +1 -0
- package/dist/web/public/js/serverCategoryDetails.js +2 -364
- package/dist/web/public/js/serverCategoryDetails.js.map +1 -0
- package/dist/web/public/js/serverCategoryList.js +2 -241
- package/dist/web/public/js/serverCategoryList.js.map +1 -0
- package/dist/web/public/js/settings.js +2 -314
- package/dist/web/public/js/settings.js.map +1 -0
- package/dist/web/server.js +1 -404
- package/dist/web/server.js.map +1 -0
- package/package.json +8 -2
- package/.github/ISSUE_TEMPLATE/JitAccess.yml +0 -28
- package/.github/acl/access.yml +0 -20
- package/.github/compliance/inventory.yml +0 -5
- package/.github/policies/jit.yml +0 -19
- package/.github/workflows/build.yml +0 -28
- package/.roo/rules-code/rules.md +0 -88
- package/dist/cli/commands/start.d.ts +0 -2
- package/dist/cli/commands/start.js +0 -32
- package/dist/cli/commands/sync.d.ts +0 -2
- package/dist/cli/commands/sync.js +0 -17
- package/dist/core/ConfigurationLoader.d.ts +0 -32
- package/dist/core/ConfigurationLoader.js +0 -236
- package/dist/core/ConfigurationProvider.d.ts +0 -35
- package/dist/core/ConfigurationProvider.js +0 -375
- package/dist/core/InstallationService.d.ts +0 -50
- package/dist/core/InstallationService.js +0 -350
- package/dist/core/MCPManager.d.ts +0 -28
- package/dist/core/MCPManager.js +0 -188
- package/dist/core/RequirementService.d.ts +0 -40
- package/dist/core/RequirementService.js +0 -110
- package/dist/core/ServerSchemaLoader.d.ts +0 -11
- package/dist/core/ServerSchemaLoader.js +0 -43
- package/dist/core/ServerSchemaProvider.d.ts +0 -17
- package/dist/core/ServerSchemaProvider.js +0 -120
- package/dist/core/constants.d.ts +0 -47
- package/dist/core/constants.js +0 -94
- package/dist/core/installers/BaseInstaller.d.ts +0 -74
- package/dist/core/installers/BaseInstaller.js +0 -253
- package/dist/core/installers/ClientInstaller.d.ts +0 -23
- package/dist/core/installers/ClientInstaller.js +0 -564
- package/dist/core/installers/CommandInstaller.d.ts +0 -37
- package/dist/core/installers/CommandInstaller.js +0 -173
- package/dist/core/installers/GeneralInstaller.d.ts +0 -33
- package/dist/core/installers/GeneralInstaller.js +0 -85
- package/dist/core/installers/InstallerFactory.d.ts +0 -54
- package/dist/core/installers/InstallerFactory.js +0 -97
- package/dist/core/installers/NpmInstaller.d.ts +0 -26
- package/dist/core/installers/NpmInstaller.js +0 -127
- package/dist/core/installers/PipInstaller.d.ts +0 -28
- package/dist/core/installers/PipInstaller.js +0 -127
- package/dist/core/installers/RequirementInstaller.d.ts +0 -33
- package/dist/core/installers/RequirementInstaller.js +0 -3
- package/dist/core/types.d.ts +0 -166
- package/dist/core/types.js +0 -16
- package/dist/services/InstallRequestValidator.d.ts +0 -21
- package/dist/services/InstallRequestValidator.js +0 -99
- package/dist/web/public/js/modal/installHandler.js +0 -227
- package/dist/web/public/js/modal/loadingUI.js +0 -74
- package/dist/web/public/js/modal/messageQueue.js +0 -112
- package/dist/web/public/js/modal/modalUI.js +0 -214
- package/dist/web/public/js/modal/version.js +0 -20
- package/dist/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +0 -370
- package/docs/ONBOARDING_PAGE_DESIGN.md +0 -260
- package/docs/Telemetry.md +0 -136
- package/memory-bank/activeContext.md +0 -26
- package/memory-bank/decisionLog.md +0 -91
- package/memory-bank/productContext.md +0 -41
- package/memory-bank/progress.md +0 -35
- package/memory-bank/systemPatterns.md +0 -10
- package/src/cli/commands/install.ts +0 -139
- package/src/cli/commands/list.ts +0 -113
- package/src/cli/commands/pull.ts +0 -16
- package/src/cli/commands/serve.ts +0 -39
- package/src/cli/commands/uninstall.ts +0 -64
- package/src/cli/index.ts +0 -82
- package/src/core/installers/clients/BaseClientInstaller.ts +0 -341
- package/src/core/installers/clients/ClientInstaller.ts +0 -222
- package/src/core/installers/clients/ClientInstallerFactory.ts +0 -43
- package/src/core/installers/clients/ClineInstaller.ts +0 -35
- package/src/core/installers/clients/ExtensionInstaller.ts +0 -165
- package/src/core/installers/clients/GithubCopilotInstaller.ts +0 -79
- package/src/core/installers/clients/MSRooCodeInstaller.ts +0 -32
- package/src/core/installers/index.ts +0 -11
- package/src/core/installers/requirements/BaseInstaller.ts +0 -85
- package/src/core/installers/requirements/CommandInstaller.ts +0 -231
- package/src/core/installers/requirements/GeneralInstaller.ts +0 -133
- package/src/core/installers/requirements/InstallerFactory.ts +0 -114
- package/src/core/installers/requirements/NpmInstaller.ts +0 -271
- package/src/core/installers/requirements/NugetInstaller.ts +0 -203
- package/src/core/installers/requirements/PipInstaller.ts +0 -207
- package/src/core/installers/requirements/RequirementInstaller.ts +0 -42
- package/src/core/loaders/ConfigurationLoader.ts +0 -298
- package/src/core/loaders/ConfigurationProvider.ts +0 -462
- package/src/core/loaders/InstallOperationManager.ts +0 -367
- package/src/core/loaders/ServerSchemaLoader.ts +0 -117
- package/src/core/loaders/ServerSchemaProvider.ts +0 -99
- package/src/core/loaders/SystemSettingsManager.ts +0 -278
- package/src/core/metadatas/constants.ts +0 -122
- package/src/core/metadatas/recordingConstants.ts +0 -65
- package/src/core/metadatas/types.ts +0 -202
- package/src/core/onboard/FeedOnboardService.ts +0 -501
- package/src/core/onboard/OnboardProcessor.ts +0 -356
- package/src/core/onboard/OnboardStatus.ts +0 -60
- package/src/core/onboard/OnboardStatusManager.ts +0 -416
- package/src/core/validators/FeedValidator.ts +0 -135
- package/src/core/validators/IServerValidator.ts +0 -21
- package/src/core/validators/SSEServerValidator.ts +0 -43
- package/src/core/validators/ServerValidatorFactory.ts +0 -51
- package/src/core/validators/StdioServerValidator.ts +0 -313
- package/src/index.ts +0 -44
- package/src/services/InstallationService.ts +0 -102
- package/src/services/MCPManager.ts +0 -249
- package/src/services/RequirementService.ts +0 -627
- package/src/services/ServerService.ts +0 -161
- package/src/services/TelemetryService.ts +0 -59
- package/src/utils/UpdateCheckTracker.ts +0 -86
- package/src/utils/adoUtils.ts +0 -293
- package/src/utils/clientUtils.ts +0 -72
- package/src/utils/feedUtils.ts +0 -31
- package/src/utils/githubAuth.ts +0 -212
- package/src/utils/githubUtils.ts +0 -164
- package/src/utils/logger.ts +0 -195
- package/src/utils/macroExpressionUtils.ts +0 -104
- package/src/utils/osUtils.ts +0 -700
- package/src/utils/versionUtils.ts +0 -114
- package/src/web/contract/serverContract.ts +0 -74
- package/src/web/public/css/detailsWidget.css +0 -235
- package/src/web/public/css/modal.css +0 -757
- package/src/web/public/css/notifications.css +0 -101
- package/src/web/public/css/onboard.css +0 -107
- package/src/web/public/css/serverCategoryList.css +0 -120
- package/src/web/public/css/serverDetails.css +0 -139
- package/src/web/public/index.html +0 -359
- package/src/web/public/js/api.js +0 -132
- package/src/web/public/js/detailsWidget.js +0 -264
- package/src/web/public/js/flights/flights.js +0 -127
- package/src/web/public/js/modal/index.js +0 -52
- package/src/web/public/js/modal/installModal.js +0 -162
- package/src/web/public/js/modal/installation.js +0 -266
- package/src/web/public/js/modal/loadingModal.js +0 -182
- package/src/web/public/js/modal/modalSetup.js +0 -595
- package/src/web/public/js/modal/modalUtils.js +0 -37
- package/src/web/public/js/modal/versionUtils.js +0 -20
- package/src/web/public/js/modal.js +0 -42
- package/src/web/public/js/notifications.js +0 -137
- package/src/web/public/js/onboard/formProcessor.js +0 -1037
- package/src/web/public/js/onboard/index.js +0 -374
- package/src/web/public/js/onboard/publishHandler.js +0 -172
- package/src/web/public/js/onboard/state.js +0 -76
- package/src/web/public/js/onboard/templates.js +0 -342
- package/src/web/public/js/onboard/uiHandlers.js +0 -1076
- package/src/web/public/js/onboard/validationHandlers.js +0 -493
- package/src/web/public/js/serverCategoryDetails.js +0 -364
- package/src/web/public/js/serverCategoryList.js +0 -241
- package/src/web/public/js/settings.js +0 -314
- package/src/web/public/modal.html +0 -84
- package/src/web/public/onboard.html +0 -296
- package/src/web/public/settings.html +0 -135
- package/src/web/public/styles.css +0 -277
- package/src/web/server.ts +0 -478
- package/tsconfig.json +0 -18
- package/wiki/Installation.md +0 -3
- package/wiki/Publish.md +0 -3
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
// import { delayedAppendInstallLoadingMessage } from './messageQueue.js'; // No longer used directly for steps
|
|
2
|
-
import { showInstallLoadingModal, updateOverallInstallStatus, addInstallationStep } from './loadingModal.js';
|
|
3
|
-
import { showToast } from '../notifications.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Handle bulk client installations
|
|
7
|
-
* @param {string} categoryName - The category name
|
|
8
|
-
* @param {string} serverName - The server name
|
|
9
|
-
* @param {string[]} targets - Target clients
|
|
10
|
-
* @param {Object} envVars - Environment variables
|
|
11
|
-
* @param {string} installingMessage - Installation message
|
|
12
|
-
* @param {Object} serverData - Server data
|
|
13
|
-
* @param {Object} serverInstallOptions - Server installation options
|
|
14
|
-
*/
|
|
15
|
-
export async function handleBulkClientInstall(categoryName, serverName, targets, envVars = {}, installingMessage = "Starting installation...", serverData = null, serverInstallOptions = null) {
|
|
16
|
-
console.log('[LoadingModal] handleBulkClientInstall called', { categoryName, serverName, targets, envVars, serverInstallOptions });
|
|
17
|
-
// Hide install modal, show loading modal
|
|
18
|
-
const installModal = document.getElementById('installModal');
|
|
19
|
-
console.log('[LoadingModal] installModal:', installModal);
|
|
20
|
-
if (installModal) installModal.style.display = "none";
|
|
21
|
-
|
|
22
|
-
// Store category and server name for potential refresh
|
|
23
|
-
if (categoryName) {
|
|
24
|
-
localStorage.setItem('lastSelectedCategory', categoryName);
|
|
25
|
-
}
|
|
26
|
-
if (serverName) {
|
|
27
|
-
localStorage.setItem('lastSelectedServerName', serverName);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// If serverData is provided, extract the installing message from it (latest status)
|
|
31
|
-
if (serverData?.data?.installationStatus?.serversStatus) {
|
|
32
|
-
const serverStatuses = serverData.data.installationStatus.serversStatus;
|
|
33
|
-
const serverStatus = serverStatuses[serverName] || { installedStatus: {} };
|
|
34
|
-
if (targets?.length > 0) {
|
|
35
|
-
const target = targets[0];
|
|
36
|
-
const msg = serverStatus.installedStatus?.[target]?.message;
|
|
37
|
-
if (msg) installingMessage = msg;
|
|
38
|
-
}
|
|
39
|
-
// Append the installing message for user visibility
|
|
40
|
-
if (installingMessage && installingMessage !== "Starting installation...") {
|
|
41
|
-
delayedAppendInstallLoadingMessage(installingMessage);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
showInstallLoadingModal(`Installing ${serverName}`); // Pass initial server name
|
|
46
|
-
// delayedAppendInstallLoadingMessage(installingMessage); // Old way
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
// delayedAppendInstallLoadingMessage("Installing, please wait..."); // Old way
|
|
50
|
-
|
|
51
|
-
// Use serverInstallOptions if provided, otherwise build the traditional options
|
|
52
|
-
const requestBody = {
|
|
53
|
-
serverList: {
|
|
54
|
-
[serverName]: serverInstallOptions || {
|
|
55
|
-
targetClients: targets,
|
|
56
|
-
env: envVars
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const response = await fetch(`/api/categories/${categoryName}/install`, {
|
|
62
|
-
method: 'POST',
|
|
63
|
-
headers: {
|
|
64
|
-
'Content-Type': 'application/json',
|
|
65
|
-
'Accept': 'application/json'
|
|
66
|
-
},
|
|
67
|
-
body: JSON.stringify(requestBody)
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
console.log('[LoadingModal] fetch install response:', response);
|
|
71
|
-
|
|
72
|
-
if (!response.ok) {
|
|
73
|
-
const errorData = await response.text();
|
|
74
|
-
// delayedAppendInstallLoadingMessage(`<span style="color:#f59e0b;">Failed: ${errorData || response.statusText}</span>`); // Old way
|
|
75
|
-
updateOverallInstallStatus('failed', `Installation request failed: ${errorData || response.statusText}`);
|
|
76
|
-
console.error('[LoadingModal] Failed:', errorData || response.statusText);
|
|
77
|
-
throw new Error(`Installation failed: ${errorData || response.statusText}`);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const result = await response.json();
|
|
81
|
-
console.log('[LoadingModal] install result:', result);
|
|
82
|
-
if (!result.success) {
|
|
83
|
-
// delayedAppendInstallLoadingMessage(`<span style="color:#f59e0b;">${result.error || 'Operation failed'}</span>`); // Old way
|
|
84
|
-
updateOverallInstallStatus('failed', result.error || 'Installation operation failed to start.');
|
|
85
|
-
console.error('[LoadingModal] Error:', result.error || 'Operation failed');
|
|
86
|
-
throw new Error(result.error || 'Installation failed');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Start polling for install status
|
|
90
|
-
pollNewInstallStatus(categoryName, serverName, 2000); // New polling
|
|
91
|
-
} catch (error) {
|
|
92
|
-
console.error('[LoadingModal] Error applying configuration:', error);
|
|
93
|
-
// delayedAppendInstallLoadingMessage(`<span style="color:red;">Error: ${error.message}</span>`); // Old way
|
|
94
|
-
updateOverallInstallStatus('failed', `Error: ${error.message}`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Poll install status using the new API endpoint for detailed steps.
|
|
100
|
-
* @param {string} categoryName - The category name
|
|
101
|
-
* @param {string} serverName - The server name
|
|
102
|
-
* @param {number} interval - Polling interval in milliseconds
|
|
103
|
-
*/
|
|
104
|
-
async function pollNewInstallStatus(categoryName, serverName, interval = 2000) {
|
|
105
|
-
let completionMessageSent = false;
|
|
106
|
-
const startTime = Date.now();
|
|
107
|
-
const maxTimeout = 10 * 60 * 1000; // 10 minutes
|
|
108
|
-
|
|
109
|
-
while (Date.now() - startTime < maxTimeout && !completionMessageSent) {
|
|
110
|
-
try {
|
|
111
|
-
const resp = await fetch(`/api/categories/${categoryName}/servers/${serverName}/installation/status`);
|
|
112
|
-
if (resp.ok) {
|
|
113
|
-
const result = await resp.json();
|
|
114
|
-
if (result.success && result.data) {
|
|
115
|
-
const { steps, overallStatus, error } = result.data;
|
|
116
|
-
|
|
117
|
-
updateOverallInstallStatus(overallStatus, error || `Installation ${overallStatus}`);
|
|
118
|
-
|
|
119
|
-
// Always update or insert each step, so UI stays in sync with backend
|
|
120
|
-
steps.forEach(step => {
|
|
121
|
-
addInstallationStep(step.name, step.message, step.status, step.timestamp);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
if (overallStatus === 'completed' || overallStatus === 'failed') {
|
|
125
|
-
completionMessageSent = true;
|
|
126
|
-
// The hideInstallLoadingModal will be called by the user or after a timeout.
|
|
127
|
-
// We can add a "Close" button or auto-close logic here if needed.
|
|
128
|
-
// For now, just stop polling.
|
|
129
|
-
// Ensure final status is displayed
|
|
130
|
-
const finalMessage = overallStatus === 'completed' ?
|
|
131
|
-
`Installation completed successfully for ${serverName}.` :
|
|
132
|
-
`Installation failed for ${serverName}`;
|
|
133
|
-
updateOverallInstallStatus(overallStatus, finalMessage);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
} else if (!result.success && resp.status === 404) {
|
|
137
|
-
// Still waiting for the status file to be created.
|
|
138
|
-
updateOverallInstallStatus('in-progress', `Waiting for installation to start for ${serverName}...`);
|
|
139
|
-
} else if (!result.success) {
|
|
140
|
-
updateOverallInstallStatus('failed', `Error fetching status: ${result.error || 'Unknown error'}`);
|
|
141
|
-
completionMessageSent = true; // Stop polling on error
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
} else if (resp.status === 404) {
|
|
145
|
-
updateOverallInstallStatus('in-progress', `Installation status not yet available for ${serverName}. Retrying...`);
|
|
146
|
-
} else {
|
|
147
|
-
const errorText = await resp.text();
|
|
148
|
-
updateOverallInstallStatus('failed', `Error fetching status: ${errorText || resp.statusText}`);
|
|
149
|
-
completionMessageSent = true; // Stop polling on error
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
} catch (error) {
|
|
153
|
-
console.error('[LoadingModal] Error polling new install status:', error);
|
|
154
|
-
updateOverallInstallStatus('failed', `Error polling status: ${error.message}`);
|
|
155
|
-
completionMessageSent = true; // Stop polling on error
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
await new Promise(resolve => setTimeout(resolve, interval));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (!completionMessageSent) {
|
|
162
|
-
updateOverallInstallStatus('failed', `Operation timed out for ${serverName} - Please check logs or refresh.`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Handle client uninstallation for multiple targets
|
|
168
|
-
* @param {string} categoryName - The category name
|
|
169
|
-
* @param {Object} serverList - List of servers to uninstall
|
|
170
|
-
* @param {string[]} targets - Target clients
|
|
171
|
-
*/
|
|
172
|
-
export async function uninstallTools(categoryName, serverList, targets) {
|
|
173
|
-
|
|
174
|
-
console.log('[LoadingModal] uninstallTools called', { categoryName, serverList, targets });
|
|
175
|
-
// Store category and server name for potential refresh
|
|
176
|
-
if (categoryName) {
|
|
177
|
-
console.log('[LoadingModal] Setting lastSelectedCategory:', categoryName);
|
|
178
|
-
localStorage.setItem('lastSelectedCategory', categoryName);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Get selected targets from window.selectedClients or the provided targets
|
|
182
|
-
const selectedTargets = window.selectedClients || (Array.isArray(targets) ? targets : [targets]);
|
|
183
|
-
|
|
184
|
-
// Validate selected targets
|
|
185
|
-
if (!selectedTargets || selectedTargets.length === 0) {
|
|
186
|
-
showToast('Please select at least one client to uninstall.', 'error');
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Ensure showInstallLoadingModal is called if not already visible,
|
|
191
|
-
// or ensure overall status is updated if it is.
|
|
192
|
-
// For simplicity, we assume the modal is shown by the caller (e.g., modalSetup.js)
|
|
193
|
-
// Add uninstall started step
|
|
194
|
-
if (typeof addInstallationStep === 'function') {
|
|
195
|
-
addInstallationStep(
|
|
196
|
-
'Uninstalling',
|
|
197
|
-
`Uninstallation process started for ${Object.keys(serverList).join(', ')}`,
|
|
198
|
-
'in-progress',
|
|
199
|
-
new Date().toISOString()
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
updateOverallInstallStatus('in-progress', `Starting uninstallation for ${Object.keys(serverList).join(', ')}...`);
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
const serverListKeys = Object.keys(serverList);
|
|
206
|
-
serverListKeys.forEach(server => {
|
|
207
|
-
console.log('[LoadingModal] Setting lastSelectedServerName:', server);
|
|
208
|
-
localStorage.setItem('lastSelectedServerName', server);
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
const response = await fetch(`/api/categories/${categoryName}/uninstall`, {
|
|
212
|
-
method: 'POST',
|
|
213
|
-
headers: { 'Content-Type': 'application/json' },
|
|
214
|
-
body: JSON.stringify({
|
|
215
|
-
serverList: serverList,
|
|
216
|
-
options: {
|
|
217
|
-
targets: selectedTargets,
|
|
218
|
-
removeData: true
|
|
219
|
-
}
|
|
220
|
-
})
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
if (!response.ok) {
|
|
224
|
-
const errorData = await response.text();
|
|
225
|
-
updateOverallInstallStatus('failed', `Uninstallation request failed: ${errorData || response.statusText}`);
|
|
226
|
-
throw new Error(`Uninstallation failed: ${errorData || response.statusText}`);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const result = await response.json();
|
|
230
|
-
if (!result.success) {
|
|
231
|
-
updateOverallInstallStatus('failed', `Uninstallation failed: ${result.error || 'Operation failed'}`);
|
|
232
|
-
throw new Error(result.error || 'Uninstallation failed');
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Add uninstall finished step with 1s delay before updating overall status
|
|
236
|
-
if (typeof addInstallationStep === 'function') {
|
|
237
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
238
|
-
addInstallationStep(
|
|
239
|
-
'Uninstalling',
|
|
240
|
-
`Uninstallation process finished for ${Object.keys(serverList).join(', ')}`,
|
|
241
|
-
'completed',
|
|
242
|
-
new Date().toISOString()
|
|
243
|
-
);
|
|
244
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
245
|
-
addInstallationStep(
|
|
246
|
-
'Uninstall Finished',
|
|
247
|
-
`Uninstallation finished for ${Object.keys(serverList).join(', ')}`,
|
|
248
|
-
'completed',
|
|
249
|
-
new Date().toISOString()
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
253
|
-
updateOverallInstallStatus('completed', `Successfully uninstalled from ${selectedTargets.join(', ')}.`);
|
|
254
|
-
window.selectedClients = []; // Clear selected clients
|
|
255
|
-
|
|
256
|
-
} catch (error) {
|
|
257
|
-
console.error('Error uninstalling tools:', error);
|
|
258
|
-
// The status should have been updated by the specific error handlers above.
|
|
259
|
-
// If an error occurs before those, update status here.
|
|
260
|
-
const overallStatusTextEl = document.getElementById('overallStatusText'); // Check if element exists
|
|
261
|
-
if (overallStatusTextEl && overallStatusTextEl.textContent.startsWith('Starting uninstallation')) {
|
|
262
|
-
updateOverallInstallStatus('failed', `Error uninstalling tools: ${error.message}`);
|
|
263
|
-
}
|
|
264
|
-
showToast(`Error uninstalling tools: ${error.message}`, 'error');
|
|
265
|
-
}
|
|
266
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
// import { delayedAppendInstallLoadingMessage } from './messageQueue.js'; // Not directly used here anymore for appending
|
|
2
|
-
|
|
3
|
-
const ICONS = {
|
|
4
|
-
IN_PROGRESS: '<div class="status-spinner"></div>',
|
|
5
|
-
COMPLETED: '<div class="status-icon-circled icon-check-container"><span class="status-icon icon-check">✓</span></div>',
|
|
6
|
-
FAILED: '<span class="status-icon icon-cross">✗</span>', // Assuming cross doesn't need a circle for now
|
|
7
|
-
CANCELED: '<span class="status-icon icon-minus">–</span>', // Simple minus for canceled
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
let overallStatusIconEl, overallStatusTextEl, installStepDetailsListEl;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Display the installation loading modal and prepare it for messages.
|
|
14
|
-
* @param {string} [initialOperationText='Installing'] - The initial overall operation text.
|
|
15
|
-
*/
|
|
16
|
-
export function showInstallLoadingModal(initialOperationText = 'Installing') {
|
|
17
|
-
const loadingModal = document.getElementById('installLoadingModal');
|
|
18
|
-
// Assuming modal-content is the direct child where content should be placed.
|
|
19
|
-
const modalContent = loadingModal ? loadingModal.querySelector('.modal-content') : null;
|
|
20
|
-
|
|
21
|
-
if (loadingModal && modalContent) {
|
|
22
|
-
modalContent.innerHTML = `
|
|
23
|
-
<button id="installLoadingModalCloseBtn" class="modal-close-btn">×</button>
|
|
24
|
-
<div class="installation-status-header">
|
|
25
|
-
<div id="overallStatusIconContainer" class="overall-status-icon">
|
|
26
|
-
${ICONS.IN_PROGRESS}
|
|
27
|
-
</div>
|
|
28
|
-
<h3 id="overallStatusText" class="overall-status-text">${initialOperationText}...</h3>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="installation-steps-container">
|
|
31
|
-
<ul id="installStepDetailsList" class="install-step-details-list"></ul>
|
|
32
|
-
</div>
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
overallStatusIconEl = modalContent.querySelector('#overallStatusIconContainer');
|
|
36
|
-
overallStatusTextEl = modalContent.querySelector('#overallStatusText');
|
|
37
|
-
installStepDetailsListEl = modalContent.querySelector('#installStepDetailsList');
|
|
38
|
-
|
|
39
|
-
const closeButton = modalContent.querySelector('#installLoadingModalCloseBtn');
|
|
40
|
-
if (closeButton) {
|
|
41
|
-
closeButton.addEventListener('click', hideInstallLoadingModal);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
loadingModal.style.display = 'block';
|
|
45
|
-
} else {
|
|
46
|
-
console.error('[LoadingModal] Required elements not found: #installLoadingModal or .modal-content');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Updates the overall status display in the loading modal.
|
|
52
|
-
* @param {'in-progress' | 'completed' | 'failed'} status - The overall status.
|
|
53
|
-
* @param {string} message - The message to display for the overall status.
|
|
54
|
-
*/
|
|
55
|
-
export function updateOverallInstallStatus(status, message) {
|
|
56
|
-
if (!overallStatusIconEl || !overallStatusTextEl) {
|
|
57
|
-
// console.warn('[LoadingModal] Overall status elements not initialized or found.');
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
let iconHtml = ICONS.IN_PROGRESS;
|
|
62
|
-
let statusClass = 'in-progress';
|
|
63
|
-
|
|
64
|
-
switch (status) {
|
|
65
|
-
case 'completed':
|
|
66
|
-
iconHtml = ICONS.COMPLETED;
|
|
67
|
-
statusClass = 'completed';
|
|
68
|
-
break;
|
|
69
|
-
case 'failed':
|
|
70
|
-
iconHtml = ICONS.FAILED;
|
|
71
|
-
statusClass = 'failed';
|
|
72
|
-
break;
|
|
73
|
-
case 'in-progress':
|
|
74
|
-
default:
|
|
75
|
-
// iconHtml and statusClass already set
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
overallStatusIconEl.innerHTML = iconHtml;
|
|
80
|
-
overallStatusIconEl.className = `overall-status-icon ${statusClass}`; // Update class for styling
|
|
81
|
-
overallStatusTextEl.textContent = message || (status.charAt(0).toUpperCase() + status.slice(1));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Adds a step to the installation details list.
|
|
86
|
-
* @param {string} stepName - The name/title of the step.
|
|
87
|
-
* @param {string} message - The message associated with the step.
|
|
88
|
-
* @param {'pending'|'in-progress'|'completed'|'failed'|'canceled'} status - The status of the step.
|
|
89
|
-
* @param {string} timestamp - ISO timestamp string for the step.
|
|
90
|
-
*/
|
|
91
|
-
export function addInstallationStep(stepName, message, status, timestamp) {
|
|
92
|
-
if (!installStepDetailsListEl) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Use stepName as a unique identifier for the step
|
|
97
|
-
const stepId = `install-step-${stepName.replace(/[^a-zA-Z0-9_-]/g, '_')}`;
|
|
98
|
-
let listItem = document.getElementById(stepId);
|
|
99
|
-
|
|
100
|
-
let statusClass = '';
|
|
101
|
-
let stepIcon = '';
|
|
102
|
-
|
|
103
|
-
switch (status) {
|
|
104
|
-
case 'completed':
|
|
105
|
-
statusClass = 'success';
|
|
106
|
-
stepIcon = '<span class="step-icon icon-check-small">✓</span>';
|
|
107
|
-
break;
|
|
108
|
-
case 'failed':
|
|
109
|
-
statusClass = 'error';
|
|
110
|
-
stepIcon = '<span class="step-icon icon-cross-small">✗</span>';
|
|
111
|
-
break;
|
|
112
|
-
case 'canceled':
|
|
113
|
-
statusClass = 'canceled';
|
|
114
|
-
stepIcon = '<span class="step-icon icon-minus-small">–</span>';
|
|
115
|
-
break;
|
|
116
|
-
case 'in-progress':
|
|
117
|
-
case 'pending':
|
|
118
|
-
default:
|
|
119
|
-
statusClass = 'in-progress';
|
|
120
|
-
stepIcon = '<div class="status-spinner step-spinner"></div>';
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
let timeString = '';
|
|
125
|
-
if (timestamp) {
|
|
126
|
-
try {
|
|
127
|
-
timeString = new Date(timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false });
|
|
128
|
-
} catch (e) { /* ignore */ }
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const innerHTML = `
|
|
132
|
-
${stepIcon}
|
|
133
|
-
<div class="step-info">
|
|
134
|
-
<span class="step-name">${stepName}</span>
|
|
135
|
-
<span class="step-message">${message || (
|
|
136
|
-
status === 'completed' ? 'Completed' :
|
|
137
|
-
status === 'failed' ? 'Failed' :
|
|
138
|
-
status === 'canceled' ? 'Canceled' :
|
|
139
|
-
'In Progress'
|
|
140
|
-
)}</span>
|
|
141
|
-
</div>
|
|
142
|
-
<span class="step-timestamp">${timeString}</span>
|
|
143
|
-
`;
|
|
144
|
-
|
|
145
|
-
if (listItem) {
|
|
146
|
-
// Update existing step
|
|
147
|
-
listItem.className = `step-detail-item ${statusClass}`;
|
|
148
|
-
listItem.innerHTML = innerHTML;
|
|
149
|
-
} else {
|
|
150
|
-
// Create new step
|
|
151
|
-
listItem = document.createElement('li');
|
|
152
|
-
listItem.id = stepId;
|
|
153
|
-
listItem.className = `step-detail-item ${statusClass}`;
|
|
154
|
-
listItem.innerHTML = innerHTML;
|
|
155
|
-
installStepDetailsListEl.appendChild(listItem);
|
|
156
|
-
// Scroll to the bottom of the list
|
|
157
|
-
installStepDetailsListEl.scrollTop = installStepDetailsListEl.scrollHeight;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Hide the install loading modal.
|
|
164
|
-
*/
|
|
165
|
-
export function hideInstallLoadingModal() {
|
|
166
|
-
console.log('[LoadingModal] Hiding installation modal');
|
|
167
|
-
const loadingModal = document.getElementById('installLoadingModal');
|
|
168
|
-
if (loadingModal) {
|
|
169
|
-
loadingModal.style.display = 'none';
|
|
170
|
-
|
|
171
|
-
// Clear references to avoid stale elements if modal is reshown
|
|
172
|
-
overallStatusIconEl = null;
|
|
173
|
-
overallStatusTextEl = null;
|
|
174
|
-
installStepDetailsListEl = null;
|
|
175
|
-
|
|
176
|
-
// Dispatch an event to signal that the main modal content should be refreshed
|
|
177
|
-
document.dispatchEvent(new CustomEvent('refreshMainModalContent'));
|
|
178
|
-
console.log('[LoadingModal] Dispatched refreshMainModalContent event.');
|
|
179
|
-
} else {
|
|
180
|
-
console.error('[LoadingModal] loading modal DOM not found');
|
|
181
|
-
}
|
|
182
|
-
}
|