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,595 +0,0 @@
|
|
|
1
|
-
import { showToast, showConfirm } from '../notifications.js';
|
|
2
|
-
import { showInstallLoadingModal, updateOverallInstallStatus } from './loadingModal.js';
|
|
3
|
-
// import { delayedAppendInstallLoadingMessage } from './messageQueue.js'; // No longer used
|
|
4
|
-
import { uninstallTools } from './installation.js';
|
|
5
|
-
import { handleBulkClientInstall } from './installation.js';
|
|
6
|
-
import { compareVersions } from './versionUtils.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Set up client items in the modal
|
|
10
|
-
*/
|
|
11
|
-
export function setupClientItems(targets, serverStatus, categoryName, serverName, targetDiv) {
|
|
12
|
-
targets.forEach(target => {
|
|
13
|
-
const operationStatus = serverStatus.installedStatus[target] || { status: 'not-installed', type: 'check', target: 'server' };
|
|
14
|
-
|
|
15
|
-
// Determine client status
|
|
16
|
-
let statusText = '';
|
|
17
|
-
let statusClass = '';
|
|
18
|
-
|
|
19
|
-
if (operationStatus.status === 'completed' && operationStatus.type === 'install') {
|
|
20
|
-
statusText = 'Installed';
|
|
21
|
-
statusClass = 'installed';
|
|
22
|
-
} else if (operationStatus.status === 'pending') {
|
|
23
|
-
statusText = 'Pending Requirements';
|
|
24
|
-
statusClass = 'pending';
|
|
25
|
-
} else if (operationStatus.status === 'in-progress') {
|
|
26
|
-
statusText = 'In Progress';
|
|
27
|
-
statusClass = 'pending';
|
|
28
|
-
} else if (operationStatus.status === 'failed') {
|
|
29
|
-
statusText = 'Failed';
|
|
30
|
-
statusClass = 'not-installed';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const isConfigured = operationStatus.status === 'completed' && operationStatus.type === 'install';
|
|
34
|
-
const isInProgress = operationStatus.status === 'in-progress';
|
|
35
|
-
const isSelectable = !isConfigured && !isInProgress;
|
|
36
|
-
|
|
37
|
-
const clientItem = createClientItem(target, statusText, statusClass, isSelectable, isConfigured, isInProgress);
|
|
38
|
-
setupClientItemListeners(clientItem, target, isSelectable);
|
|
39
|
-
setupUninstallButton(clientItem, statusText, operationStatus, target, categoryName, serverName, statusClass);
|
|
40
|
-
targetDiv.appendChild(clientItem);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
addSectionTitle(targetDiv);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Set up environment variables section in the modal
|
|
48
|
-
*/
|
|
49
|
-
export function setupEnvironmentVariables(mcpServer, envInputsDiv, targetData) {
|
|
50
|
-
// For SSE mode, don't show env section at all
|
|
51
|
-
if (mcpServer.mode === 'sse') {
|
|
52
|
-
envInputsDiv.style.display = 'none';
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const envRequirements = mcpServer.installation?.['env'] || mcpServer.installation?.env || {};
|
|
57
|
-
addEnvironmentTitle(envInputsDiv);
|
|
58
|
-
|
|
59
|
-
// Fetch system settings to get userConfigurations for env defaults
|
|
60
|
-
fetch('/api/settings')
|
|
61
|
-
.then(response => response.json())
|
|
62
|
-
.then(data => {
|
|
63
|
-
const userConfigurations = (data && data.data && data.data.userConfigurations) ? data.data.userConfigurations : {};
|
|
64
|
-
if (Object.keys(envRequirements).length === 0) {
|
|
65
|
-
addNoEnvMessage(envInputsDiv);
|
|
66
|
-
} else {
|
|
67
|
-
createEnvironmentInputs(envRequirements, envInputsDiv, targetData.clientMcpSettings, mcpServer.name, userConfigurations);
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
.catch(() => {
|
|
71
|
-
// fallback to old logic if fetch fails
|
|
72
|
-
if (Object.keys(envRequirements).length === 0) {
|
|
73
|
-
addNoEnvMessage(envInputsDiv);
|
|
74
|
-
} else {
|
|
75
|
-
createEnvironmentInputs(envRequirements, envInputsDiv, targetData.clientMcpSettings, mcpServer.name, {});
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Set up installation arguments section in the modal
|
|
82
|
-
*/
|
|
83
|
-
export function setupInstallationArguments(installation, modalArguments, categoryName, mcpServer) {
|
|
84
|
-
// For SSE mode, don't show arguments section at all
|
|
85
|
-
if (mcpServer?.mode === 'sse') {
|
|
86
|
-
modalArguments.style.display = 'none';
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (!installation) return;
|
|
91
|
-
|
|
92
|
-
addArgumentsTitle(modalArguments);
|
|
93
|
-
const container = createArgumentsContainer();
|
|
94
|
-
modalArguments.appendChild(container);
|
|
95
|
-
|
|
96
|
-
if (installation.args && Array.isArray(installation.args)) {
|
|
97
|
-
installation.args.forEach(arg => {
|
|
98
|
-
container.appendChild(createArgumentInput(arg));
|
|
99
|
-
});
|
|
100
|
-
} else {
|
|
101
|
-
container.appendChild(createArgumentInput());
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (installation.command === 'python' || installation.command.includes('python')) {
|
|
105
|
-
addPythonEnvironmentInput(categoryName, mcpServer.name, modalArguments);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Set up server requirements section in the modal
|
|
111
|
-
*/
|
|
112
|
-
export function setupServerRequirements(mcpServer, serverData, categoryName, serverName, modalRequirements) {
|
|
113
|
-
// For SSE mode, don't show requirements section at all
|
|
114
|
-
if (mcpServer.mode === 'sse') {
|
|
115
|
-
modalRequirements.style.display = 'none';
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const serverRequirements = mcpServer.dependencies?.requirements || [];
|
|
120
|
-
const requirements = serverData.data.installationStatus?.requirementsStatus || {};
|
|
121
|
-
|
|
122
|
-
if (serverRequirements.length > 0) {
|
|
123
|
-
const reqHtml = renderRequirements(serverRequirements, requirements, categoryName, serverName);
|
|
124
|
-
modalRequirements.innerHTML = `
|
|
125
|
-
<h3 class="text-lg font-semibold text-gray-700 mb-3">Dependencies</h3>
|
|
126
|
-
<p class="text-sm text-gray-600 mb-4">These dependencies will be automatically installed when installing the server</p>
|
|
127
|
-
${reqHtml}
|
|
128
|
-
`;
|
|
129
|
-
|
|
130
|
-
setupUpdateToggles(modalRequirements);
|
|
131
|
-
} else {
|
|
132
|
-
modalRequirements.innerHTML = '<p class="text-gray-600">No additional dependencies required.</p>';
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Set up the form submit handler
|
|
138
|
-
*/
|
|
139
|
-
export function setupFormSubmitHandler(form, envInputsDiv, modalArguments, modalRequirements, categoryName, serverName, serverStatuses, serverData, mcpServer) {
|
|
140
|
-
form.onsubmit = (e) => {
|
|
141
|
-
e.preventDefault();
|
|
142
|
-
|
|
143
|
-
const envVars = {};
|
|
144
|
-
const args = [];
|
|
145
|
-
const requirementsToUpdate = [];
|
|
146
|
-
let pythonEnv = undefined;
|
|
147
|
-
|
|
148
|
-
// Only collect env, args and requirements if not in SSE mode
|
|
149
|
-
if (mcpServer?.mode !== 'sse') {
|
|
150
|
-
const inputs = envInputsDiv.querySelectorAll('input');
|
|
151
|
-
inputs.forEach(input => {
|
|
152
|
-
if (input.name && input.value) {
|
|
153
|
-
envVars[input.name] = input.value;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
const argInputs = modalArguments.querySelectorAll('.arg-input');
|
|
158
|
-
args.push(...Array.from(argInputs)
|
|
159
|
-
.map(input => input.value.trim())
|
|
160
|
-
.filter(val => val !== ''));
|
|
161
|
-
|
|
162
|
-
const pythonEnvInput = document.getElementById('python_env');
|
|
163
|
-
pythonEnv = pythonEnvInput?.value?.trim();
|
|
164
|
-
|
|
165
|
-
const updateToggles = modalRequirements.querySelectorAll('.toggle-update:checked');
|
|
166
|
-
updateToggles.forEach(toggle => {
|
|
167
|
-
requirementsToUpdate.push({
|
|
168
|
-
name: toggle.dataset.name,
|
|
169
|
-
version: toggle.dataset.version
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// Only POST userConfigurations and/or pythonEnvs if there is a difference, then proceed with install
|
|
175
|
-
fetch('/api/settings')
|
|
176
|
-
.then(response => response.json())
|
|
177
|
-
.then(data => {
|
|
178
|
-
const userConfigurations = (data && data.data && data.data.userConfigurations) ? data.data.userConfigurations : {};
|
|
179
|
-
const pythonEnvs = (data && data.data && data.data.pythonEnvs) ? data.data.pythonEnvs : {};
|
|
180
|
-
const updatedUserConfigurations = { ...userConfigurations };
|
|
181
|
-
const updatedPythonEnvs = { ...pythonEnvs };
|
|
182
|
-
|
|
183
|
-
Object.keys(envVars).forEach(key => {
|
|
184
|
-
updatedUserConfigurations[key] = envVars[key];
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
// Check for userConfigurations difference
|
|
188
|
-
let needsUserConfigUpdate = false;
|
|
189
|
-
const allUserConfigKeys = new Set([...Object.keys(userConfigurations), ...Object.keys(envVars)]);
|
|
190
|
-
for (const key of allUserConfigKeys) {
|
|
191
|
-
if (userConfigurations[key] !== updatedUserConfigurations[key]) {
|
|
192
|
-
needsUserConfigUpdate = true;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// Check for pythonEnvs difference
|
|
198
|
-
let needsPythonEnvUpdate = false;
|
|
199
|
-
if (pythonEnv !== undefined && pythonEnv !== pythonEnvs[`${categoryName}:${serverName}`]) {
|
|
200
|
-
updatedPythonEnvs[`${categoryName}:${serverName}`] = pythonEnv;
|
|
201
|
-
needsPythonEnvUpdate = true;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// If either needs update, POST the merged object
|
|
205
|
-
if (needsUserConfigUpdate || needsPythonEnvUpdate) {
|
|
206
|
-
const postBody = {};
|
|
207
|
-
if (needsUserConfigUpdate) postBody.userConfigurations = updatedUserConfigurations;
|
|
208
|
-
if (needsPythonEnvUpdate) postBody.pythonEnvs = updatedPythonEnvs;
|
|
209
|
-
fetch('/api/settings', {
|
|
210
|
-
method: 'POST',
|
|
211
|
-
headers: { 'Content-Type': 'application/json' },
|
|
212
|
-
body: JSON.stringify(postBody)
|
|
213
|
-
}).then(() => {
|
|
214
|
-
proceedInstall();
|
|
215
|
-
}).catch(() => {
|
|
216
|
-
proceedInstall();
|
|
217
|
-
});
|
|
218
|
-
} else {
|
|
219
|
-
proceedInstall();
|
|
220
|
-
}
|
|
221
|
-
})
|
|
222
|
-
.catch(() => {
|
|
223
|
-
proceedInstall();
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
function proceedInstall() {
|
|
227
|
-
const hasRequirementsToUpdate = requirementsToUpdate.length > 0;
|
|
228
|
-
|
|
229
|
-
const uninstallBtn = document.querySelector('.uninstall-btn');
|
|
230
|
-
if (!uninstallBtn || !uninstallBtn.matches(':active')) {
|
|
231
|
-
const selectedTargets = window.selectedClients;
|
|
232
|
-
if (selectedTargets.length === 0 && !hasRequirementsToUpdate) {
|
|
233
|
-
showToast('Please select at least one client to configure.', 'error');
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
let installingMessage = "Starting installation...";
|
|
238
|
-
const serverStatus = serverStatuses[serverName] || { installedStatus: {} };
|
|
239
|
-
if (selectedTargets.length > 0) {
|
|
240
|
-
const target = selectedTargets[0];
|
|
241
|
-
const msg = serverStatus.installedStatus?.[target]?.message;
|
|
242
|
-
if (msg) installingMessage = msg;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const serverInstallOptions = {
|
|
246
|
-
targetClients: selectedTargets,
|
|
247
|
-
env: envVars,
|
|
248
|
-
args: args,
|
|
249
|
-
settings: pythonEnv ? { pythonEnv: pythonEnv } : {}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
if (requirementsToUpdate.length > 0) {
|
|
253
|
-
serverInstallOptions.requirements = requirementsToUpdate;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
handleBulkClientInstall(categoryName, serverName, selectedTargets, envVars, installingMessage, serverData, serverInstallOptions);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// Helper functions
|
|
263
|
-
function createClientItem(target, statusText, statusClass, isSelectable, isConfigured, isInProgress) {
|
|
264
|
-
const clientItem = document.createElement('div');
|
|
265
|
-
clientItem.className = 'client-item';
|
|
266
|
-
clientItem.dataset.target = target;
|
|
267
|
-
clientItem.dataset.selected = 'false';
|
|
268
|
-
|
|
269
|
-
// Create client info (name)
|
|
270
|
-
const clientInfo = document.createElement('div');
|
|
271
|
-
clientInfo.className = 'client-info';
|
|
272
|
-
|
|
273
|
-
// Client name label
|
|
274
|
-
const clientName = document.createElement('span');
|
|
275
|
-
clientName.className = 'text-sm font-medium text-gray-900';
|
|
276
|
-
clientName.textContent = target;
|
|
277
|
-
|
|
278
|
-
// Add elements to client info
|
|
279
|
-
clientInfo.appendChild(clientName);
|
|
280
|
-
|
|
281
|
-
// Add client info to client item
|
|
282
|
-
clientItem.appendChild(clientInfo);
|
|
283
|
-
|
|
284
|
-
if (!isSelectable) {
|
|
285
|
-
clientItem.classList.add('non-selectable');
|
|
286
|
-
if (isConfigured) {
|
|
287
|
-
clientItem.classList.add('installed-item');
|
|
288
|
-
clientItem.title = 'Already installed';
|
|
289
|
-
} else if (isInProgress) {
|
|
290
|
-
clientItem.classList.add('in-progress-item');
|
|
291
|
-
clientItem.title = 'Installation in progress';
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return clientItem;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function setupClientItemListeners(clientItem, target, isSelectable) {
|
|
299
|
-
if (isSelectable) {
|
|
300
|
-
clientItem.addEventListener('click', () => {
|
|
301
|
-
const isSelected = clientItem.dataset.selected === 'true';
|
|
302
|
-
clientItem.dataset.selected = isSelected ? 'false' : 'true';
|
|
303
|
-
|
|
304
|
-
if (isSelected) {
|
|
305
|
-
clientItem.classList.remove('selected');
|
|
306
|
-
window.selectedClients = window.selectedClients.filter(c => c !== target);
|
|
307
|
-
} else {
|
|
308
|
-
clientItem.classList.add('selected');
|
|
309
|
-
if (!window.selectedClients.includes(target)) {
|
|
310
|
-
window.selectedClients.push(target);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function setupUninstallButton(clientItem, statusText, operationStatus, target, categoryName, serverName, statusClass) {
|
|
318
|
-
if (statusText) {
|
|
319
|
-
const statusContainer = document.createElement('div');
|
|
320
|
-
statusContainer.className = 'status-container';
|
|
321
|
-
|
|
322
|
-
const statusBadge = document.createElement('span');
|
|
323
|
-
statusBadge.className = `status-badge ${statusClass}`;
|
|
324
|
-
statusBadge.textContent = statusText;
|
|
325
|
-
statusContainer.appendChild(statusBadge);
|
|
326
|
-
|
|
327
|
-
if (operationStatus.status === 'completed' && operationStatus.type === 'install') {
|
|
328
|
-
const uninstallBtn = createUninstallButton(target, categoryName, serverName);
|
|
329
|
-
statusContainer.appendChild(uninstallBtn);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
clientItem.appendChild(statusContainer);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
function createUninstallButton(target, categoryName, serverName) {
|
|
337
|
-
const uninstallBtn = document.createElement('button');
|
|
338
|
-
uninstallBtn.className = 'uninstall-btn text-red-600 hover:text-red-800 ml-2';
|
|
339
|
-
uninstallBtn.innerHTML = '<i class="bx bx-trash"></i>';
|
|
340
|
-
uninstallBtn.title = 'Uninstall from this client';
|
|
341
|
-
|
|
342
|
-
uninstallBtn.onclick = async (e) => {
|
|
343
|
-
e.stopPropagation();
|
|
344
|
-
e.preventDefault();
|
|
345
|
-
|
|
346
|
-
const confirmed = await showConfirm('Uninstall Confirmation',
|
|
347
|
-
`Are you sure you want to uninstall ${serverName} from ${target}?`);
|
|
348
|
-
|
|
349
|
-
if (confirmed) {
|
|
350
|
-
window.selectedClients = [target];
|
|
351
|
-
showInstallLoadingModal('Uninstalling');
|
|
352
|
-
const serverList = {
|
|
353
|
-
[serverName]: {
|
|
354
|
-
removeData: true
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
try {
|
|
359
|
-
updateOverallInstallStatus('in-progress', `Uninstalling ${serverName} from ${target}...`);
|
|
360
|
-
await uninstallTools(categoryName, serverList, [target]);
|
|
361
|
-
// uninstallTools will now handle its own final status update via updateOverallInstallStatus
|
|
362
|
-
} catch (error) {
|
|
363
|
-
updateOverallInstallStatus('failed', `Error during uninstall: ${error.message}`);
|
|
364
|
-
// No need to throw here if uninstallTools handles its errors by updating status
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
return false;
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
return uninstallBtn;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
function addSectionTitle(targetDiv) {
|
|
374
|
-
if (!targetDiv.querySelector('.section-title')) {
|
|
375
|
-
const titleElement = document.createElement('h3');
|
|
376
|
-
titleElement.className = 'section-title text-lg font-semibold text-gray-700 mb-3';
|
|
377
|
-
titleElement.textContent = 'Client Status';
|
|
378
|
-
targetDiv.insertBefore(titleElement, targetDiv.firstChild);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
function addEnvironmentTitle(envInputsDiv) {
|
|
383
|
-
if (!envInputsDiv.querySelector('.section-title')) {
|
|
384
|
-
const envTitle = document.createElement('h3');
|
|
385
|
-
envTitle.className = 'section-title text-lg font-semibold text-gray-700 mb-3';
|
|
386
|
-
envTitle.textContent = 'Environment Variables';
|
|
387
|
-
envInputsDiv.insertBefore(envTitle, envInputsDiv.firstChild);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
function addNoEnvMessage(envInputsDiv) {
|
|
392
|
-
const noEnvMessage = document.createElement('p');
|
|
393
|
-
noEnvMessage.className = 'text-gray-600';
|
|
394
|
-
noEnvMessage.textContent = 'No environment variables required for this MCP server.';
|
|
395
|
-
envInputsDiv.appendChild(noEnvMessage);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
function createEnvironmentInputs(envRequirements, envInputsDiv, clientSettings, serverName, userConfigurations = {}) {
|
|
399
|
-
Object.keys(envRequirements).forEach(key => {
|
|
400
|
-
const req = envRequirements[key];
|
|
401
|
-
const inputId = `env_${key}`;
|
|
402
|
-
const inputWrapper = document.createElement('div');
|
|
403
|
-
inputWrapper.className = 'mb-3';
|
|
404
|
-
|
|
405
|
-
const label = document.createElement('label');
|
|
406
|
-
label.htmlFor = inputId;
|
|
407
|
-
label.className = 'block text-sm font-medium text-gray-700 mb-1';
|
|
408
|
-
label.innerHTML = `${key} ${req.Required ? '<span class="text-red-500">*</span>' : ''}`;
|
|
409
|
-
|
|
410
|
-
const input = document.createElement('input');
|
|
411
|
-
input.type = req.isSecret ? 'password' : 'text';
|
|
412
|
-
input.id = inputId;
|
|
413
|
-
input.name = key;
|
|
414
|
-
input.placeholder = req.Description || key;
|
|
415
|
-
input.required = req.Required;
|
|
416
|
-
input.className = 'input-field';
|
|
417
|
-
|
|
418
|
-
// For default value, first check userConfigurations, then client settings, then provided default
|
|
419
|
-
let defaultValue = req.Default || '';
|
|
420
|
-
|
|
421
|
-
// Use userConfigurations if present
|
|
422
|
-
if (userConfigurations && userConfigurations[key]) {
|
|
423
|
-
defaultValue = userConfigurations[key];
|
|
424
|
-
} else if (clientSettings && clientSettings.MSRooCode &&
|
|
425
|
-
clientSettings.MSRooCode.mcpServers &&
|
|
426
|
-
clientSettings.MSRooCode.mcpServers[serverName] &&
|
|
427
|
-
clientSettings.MSRooCode.mcpServers[serverName].env &&
|
|
428
|
-
clientSettings.MSRooCode.mcpServers[serverName].env[key]) {
|
|
429
|
-
defaultValue = clientSettings.MSRooCode.mcpServers[serverName].env[key];
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
input.value = defaultValue;
|
|
433
|
-
|
|
434
|
-
inputWrapper.appendChild(label);
|
|
435
|
-
inputWrapper.appendChild(input);
|
|
436
|
-
|
|
437
|
-
if (req.Description) {
|
|
438
|
-
const description = document.createElement('p');
|
|
439
|
-
description.className = 'text-xs text-gray-500 mt-1';
|
|
440
|
-
description.textContent = req.Description;
|
|
441
|
-
inputWrapper.appendChild(description);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
envInputsDiv.appendChild(inputWrapper);
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function addArgumentsTitle(modalArguments) {
|
|
449
|
-
const argsTitle = document.createElement('h3');
|
|
450
|
-
argsTitle.className = 'section-title text-lg font-semibold text-gray-700 mb-3';
|
|
451
|
-
argsTitle.textContent = 'Arguments';
|
|
452
|
-
modalArguments.appendChild(argsTitle);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
function createArgumentsContainer() {
|
|
456
|
-
const container = document.createElement('div');
|
|
457
|
-
container.className = 'args-container mb-3';
|
|
458
|
-
|
|
459
|
-
const addButton = document.createElement('button');
|
|
460
|
-
addButton.type = 'button';
|
|
461
|
-
addButton.className = 'add-arg-button px-3 py-1 text-sm text-blue-600 hover:text-blue-800 border border-blue-600 hover:border-blue-800 rounded-md mb-2';
|
|
462
|
-
addButton.innerHTML = '<i class="bx bx-plus"></i> Add Argument';
|
|
463
|
-
addButton.onclick = () => container.appendChild(createArgumentInput());
|
|
464
|
-
|
|
465
|
-
container.appendChild(addButton);
|
|
466
|
-
return container;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
function createArgumentInput(value = '') {
|
|
470
|
-
const argWrapper = document.createElement('div');
|
|
471
|
-
argWrapper.className = 'arg-wrapper flex items-center gap-2 mb-2';
|
|
472
|
-
|
|
473
|
-
const input = document.createElement('input');
|
|
474
|
-
input.type = 'text';
|
|
475
|
-
input.className = 'arg-input flex-grow';
|
|
476
|
-
input.value = value;
|
|
477
|
-
input.placeholder = 'Enter argument value';
|
|
478
|
-
|
|
479
|
-
const removeButton = document.createElement('button');
|
|
480
|
-
removeButton.type = 'button';
|
|
481
|
-
removeButton.className = 'remove-arg-button text-red-600 hover:text-red-800';
|
|
482
|
-
removeButton.innerHTML = '<i class="bx bx-trash"></i>';
|
|
483
|
-
removeButton.onclick = () => argWrapper.remove();
|
|
484
|
-
|
|
485
|
-
argWrapper.appendChild(input);
|
|
486
|
-
argWrapper.appendChild(removeButton);
|
|
487
|
-
return argWrapper;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
function addPythonEnvironmentInput(categoryName, serverName, modalArguments) {
|
|
491
|
-
const pythonEnvWrapper = document.createElement('div');
|
|
492
|
-
pythonEnvWrapper.className = 'mt-4';
|
|
493
|
-
|
|
494
|
-
const pythonEnvLabel = document.createElement('label');
|
|
495
|
-
pythonEnvLabel.htmlFor = 'python_env';
|
|
496
|
-
pythonEnvLabel.className = 'block text-sm font-medium text-gray-700 mb-1';
|
|
497
|
-
pythonEnvLabel.textContent = 'Python Environment';
|
|
498
|
-
|
|
499
|
-
const pythonEnvInput = document.createElement('input');
|
|
500
|
-
pythonEnvInput.type = 'text';
|
|
501
|
-
pythonEnvInput.id = 'python_env';
|
|
502
|
-
pythonEnvInput.className = 'input-field';
|
|
503
|
-
pythonEnvInput.placeholder = 'Enter Python environment path (optional)';
|
|
504
|
-
|
|
505
|
-
const envDescription = document.createElement('p');
|
|
506
|
-
envDescription.className = 'text-xs text-gray-500 mt-1';
|
|
507
|
-
envDescription.textContent = 'Specify the Python exectable file(e.g. C:/python312/python) to use for installation. Leave empty to use system default. You can specify value in Settings page';
|
|
508
|
-
|
|
509
|
-
pythonEnvWrapper.appendChild(pythonEnvLabel);
|
|
510
|
-
pythonEnvWrapper.appendChild(pythonEnvInput);
|
|
511
|
-
pythonEnvWrapper.appendChild(envDescription);
|
|
512
|
-
modalArguments.appendChild(pythonEnvWrapper);
|
|
513
|
-
// Fetch system settings and set default value for python_env
|
|
514
|
-
fetch('/api/settings')
|
|
515
|
-
.then(response => response.json())
|
|
516
|
-
.then(data => {
|
|
517
|
-
if (data && data.data && data.data.pythonEnvs) {
|
|
518
|
-
pythonEnvInput.value = data.data.pythonEnvs[`${categoryName}:${serverName}`] || data.data.pythonEnvs['system'] || '';
|
|
519
|
-
}
|
|
520
|
-
})
|
|
521
|
-
.catch(() => {
|
|
522
|
-
// Ignore errors, leave input empty
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
function renderRequirements(serverRequirements, requirements, categoryName, serverName) {
|
|
527
|
-
return serverRequirements.map(req => {
|
|
528
|
-
const status = requirements[req.name] || {};
|
|
529
|
-
let statusClass = status.installed
|
|
530
|
-
? 'text-green-600 bg-green-50'
|
|
531
|
-
: 'text-yellow-600 bg-yellow-50';
|
|
532
|
-
let statusText = status.installed ? 'Installed' : 'Required';
|
|
533
|
-
let versionDisplay = status.version ? ` • <span class="font-medium">${status.version}</span>` : '';
|
|
534
|
-
let updateToggle = '';
|
|
535
|
-
|
|
536
|
-
// Check if there's an available update
|
|
537
|
-
if (status.installed && status.availableUpdate && status.availableUpdate.version) {
|
|
538
|
-
if (status.version && compareVersions(status.availableUpdate.version, status.version) > 0) {
|
|
539
|
-
// Show version update information with yellow color and icon
|
|
540
|
-
statusClass = 'text-yellow-600 bg-yellow-50';
|
|
541
|
-
statusText = `<span style="color: #f59e0b; font-weight: bold; margin-right: 5px;">↑</span>${status.availableUpdate.version}`;
|
|
542
|
-
|
|
543
|
-
// Create a toggle switch for update
|
|
544
|
-
updateToggle = `
|
|
545
|
-
<label class="inline-flex items-center cursor-pointer ml-2">
|
|
546
|
-
<input type="checkbox" class="toggle-update sr-only"
|
|
547
|
-
data-name="${req.name}"
|
|
548
|
-
data-version="${status.availableUpdate.version}"
|
|
549
|
-
data-category="${categoryName}"
|
|
550
|
-
data-server="${serverName}">
|
|
551
|
-
<div class="relative w-10 h-5 bg-gray-200 rounded-full toggle-bg">
|
|
552
|
-
<div class="absolute inset-y-0 left-0 w-5 h-5 bg-white rounded-full transition-transform duration-300 transform"></div>
|
|
553
|
-
</div>
|
|
554
|
-
<span class="ml-2 text-sm text-gray-700">Update</span>
|
|
555
|
-
</label>
|
|
556
|
-
`;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
return `
|
|
561
|
-
<div class="border border-gray-200 p-3 rounded-lg mb-2 hover:bg-gray-50">
|
|
562
|
-
<div class="flex justify-between items-center">
|
|
563
|
-
<div>
|
|
564
|
-
<div class="font-semibold text-gray-800">${req.name}</div>
|
|
565
|
-
<div class="text-sm text-gray-600 shadow-sm p-1 rounded bg-gray-50">
|
|
566
|
-
<span class="font-medium">${status.type || 'package'}</span>${versionDisplay}
|
|
567
|
-
</div>
|
|
568
|
-
</div>
|
|
569
|
-
<div class="flex items-center">
|
|
570
|
-
<span class="${statusClass} inline-flex items-center px-3 py-1 rounded-full text-sm">
|
|
571
|
-
${statusText}
|
|
572
|
-
</span>
|
|
573
|
-
${updateToggle}
|
|
574
|
-
</div>
|
|
575
|
-
</div>
|
|
576
|
-
</div>
|
|
577
|
-
`;
|
|
578
|
-
}).join('');
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
function setupUpdateToggles(modalRequirements) {
|
|
582
|
-
const updateToggles = modalRequirements.querySelectorAll('.toggle-update');
|
|
583
|
-
updateToggles.forEach(toggle => {
|
|
584
|
-
toggle.addEventListener('change', function () {
|
|
585
|
-
const toggleBg = this.parentElement.querySelector('.toggle-bg');
|
|
586
|
-
if (this.checked) {
|
|
587
|
-
toggleBg.classList.add('bg-blue-500');
|
|
588
|
-
toggleBg.querySelector('div').classList.add('translate-x-5');
|
|
589
|
-
} else {
|
|
590
|
-
toggleBg.classList.remove('bg-blue-500');
|
|
591
|
-
toggleBg.querySelector('div').classList.remove('translate-x-5');
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
});
|
|
595
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Close modal and ensure selected category persists
|
|
3
|
-
*/
|
|
4
|
-
export function closeModal() {
|
|
5
|
-
document.getElementById('installModal').style.display = "none";
|
|
6
|
-
|
|
7
|
-
// Get the last selected category from localStorage
|
|
8
|
-
const lastSelected = localStorage.getItem('lastSelectedCategory');
|
|
9
|
-
|
|
10
|
-
// Refresh page and restore selection
|
|
11
|
-
if (lastSelected) {
|
|
12
|
-
setTimeout(() => {
|
|
13
|
-
window.location.href = window.location.pathname + '?category=' + encodeURIComponent(lastSelected);
|
|
14
|
-
}, 100);
|
|
15
|
-
} else {
|
|
16
|
-
location.reload();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Setup toggle switch styles
|
|
22
|
-
*/
|
|
23
|
-
export function setupToggleStyles() {
|
|
24
|
-
const styleElement = document.createElement('style');
|
|
25
|
-
styleElement.textContent = `
|
|
26
|
-
.toggle-bg.bg-blue-500 {
|
|
27
|
-
background-color: #3b82f6;
|
|
28
|
-
}
|
|
29
|
-
.toggle-bg {
|
|
30
|
-
transition: background-color 0.3s;
|
|
31
|
-
}
|
|
32
|
-
.toggle-bg div {
|
|
33
|
-
transition: transform 0.3s;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
document.head.appendChild(styleElement);
|
|
37
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple version comparison function
|
|
3
|
-
* @param {string} v1 First version
|
|
4
|
-
* @param {string} v2 Second version
|
|
5
|
-
* @returns {number} 1 if v1 > v2, -1 if v1 < v2, 0 if equal
|
|
6
|
-
*/
|
|
7
|
-
export function compareVersions(v1, v2) {
|
|
8
|
-
const v1Parts = v1.split('.').map(Number);
|
|
9
|
-
const v2Parts = v2.split('.').map(Number);
|
|
10
|
-
|
|
11
|
-
for (let i = 0; i < Math.max(v1Parts.length, v2Parts.length); i++) {
|
|
12
|
-
const v1Part = v1Parts[i] || 0;
|
|
13
|
-
const v2Part = v2Parts[i] || 0;
|
|
14
|
-
|
|
15
|
-
if (v1Part > v2Part) return 1;
|
|
16
|
-
if (v1Part < v2Part) return -1;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return 0;
|
|
20
|
-
}
|