Skip to content

initial commit for RC integration scaffolding #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions electron/app/js/childProcessExecutor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright (c) 2021, Oracle and/or its affiliates.
* Copyright (c) 2021, 2022, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
*/
const { exec, execFile, spawn } = require('child_process');
Expand Down Expand Up @@ -45,7 +45,20 @@ async function executeChildProcess(currentWindow, executable, argList, env, stdo
return child.exitCode;
}

function getSpawnOptions(env, shell, detached, windowsHide) {
function spawnDaemonChildProcess(executable, argList, env, extraOptions = {}, {
shell = false,
detached = false,
windowHide = true,
} = {}) {
const command = workaroundNodeJsIssue38490(shell, executable, argList);
const options = getSpawnOptions(env, shell, detached, windowHide, extraOptions);

getLogger().debug('Spawning daemon process %s with arguments %s and options %s',
command.executable, command.argList, JSON.stringify(options));
return spawn(command.executable, command.argList, options);
}

function getSpawnOptions(env, shell, detached, windowsHide, extraOptions = {}) {
const options = {
stdio: [ 'pipe', 'pipe', 'pipe' ],
shell: shell,
Expand All @@ -56,6 +69,10 @@ function getSpawnOptions(env, shell, detached, windowsHide) {
if (envIsNotEmpty(env)) {
options['env'] = env;
}

for (const [key, value] of Object.entries(extraOptions)) {
options[key] = value;
}
return options;
}

Expand Down Expand Up @@ -199,5 +216,6 @@ module.exports = {
executeChildProcess,
executeChildShellScript,
executeFileCommand,
executeScriptCommand
executeScriptCommand,
spawnDaemonChildProcess
};
7 changes: 6 additions & 1 deletion electron/app/js/ipcRendererPreload.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ contextBridge.exposeInMainWorld(
'project-created',
'project-opened',
'project-saved',
'set-wrc-backend-port',
'start-add-model-file',
'start-add-variable-file',
'start-add-archive-file',
Expand Down Expand Up @@ -198,7 +199,11 @@ contextBridge.exposeInMainWorld(
'k8s-delete-object',
'openssl-generate-certs',
'validate-k8s-namespaces-exist',
'validate-wko-domain-exist'
'validate-wko-domain-exist',
'get-wrc-home-directory',
'get-wrc-app-image',
'wrc-get-home-default-value',
'wrc-set-home-and-start'
];
return new Promise((resolve, reject) => {
if (validChannels.includes(channel)) {
Expand Down
20 changes: 19 additions & 1 deletion electron/app/js/userSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const { getErrorMessage } = require('./errorUtils');

// eslint-disable-next-line no-unused-vars
const userSettableFieldNames = [
'webLogicRemoteConsoleHome',
'proxy',
'logging',
'skipQuickstartAtStartup',
Expand All @@ -31,6 +32,7 @@ let _userSettingsFileName;
// Here is an example with every possible field specified:
//
// {
// "webLogicRemoteConsoleHome": "The path to the WebLogic Remote Console installation",
// "proxy": {
// "httpsProxyUrl": "The proxy to use for the application's all https outbound communication",
// "bypassProxyHosts: "The value to use to set the NO_PROXY environment variable for child processes"
Expand Down Expand Up @@ -89,6 +91,20 @@ function applyUserSettingsFromRemote(remoteUserSettingsJson) {
logger.debug('user settings saved...restart the application to pick up logger settings changes');
}

function getWebLogicRemoteConsoleHome() {
let wlRemoteConsoleHome;
const userSettingsObj = _getUserSettings();
if ('webLogicRemoteConsoleHome' in userSettingsObj) {
wlRemoteConsoleHome = userSettingsObj['webLogicRemoteConsoleHome'];
}
return wlRemoteConsoleHome;
}

function setWebLogicRemoteConsoleHome(wlRemoteConsoleHome) {
const settings = _getUserSettings();
settings['webLogicRemoteConsoleHome'] = wlRemoteConsoleHome;
}

function getHttpsProxyUrl() {
let httpsProxyUrl;
const userSettingsObj = _getUserSettings();
Expand Down Expand Up @@ -413,5 +429,7 @@ module.exports = {
setWindowSize,
getLoggingConfiguration,
getUserSettingsForRemote,
saveUserSettings
saveUserSettings,
getWebLogicRemoteConsoleHome,
setWebLogicRemoteConsoleHome
};
Loading