Skip to content

Commit eb08427

Browse files
committed
Merge branch 'jira-wktui-498-file-chooser' into 'develop-2.0'
Support file selection for path attributes See merge request weblogic-cloud/weblogic-toolkit-ui!435
2 parents 581cd88 + 47c3293 commit eb08427

34 files changed

+761
-43
lines changed

electron/app/js/ipcRendererPreload.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ contextBridge.exposeInMainWorld(
123123
'get-network-settings',
124124
'choose-archive-file',
125125
'choose-archive-entry-file',
126+
'choose-attribute-file',
126127
'add-archive-entry',
127128
'choose-domain-home',
128129
'choose-java-home',

electron/app/js/modelEdit/modelEditUtils.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const fsPromises = require('fs/promises');
1111
const JSZip = require('jszip');
1212
const fs = require('fs');
1313
const path = require('path');
14+
const wdtArchive = require('../wdtArchive');
1415

1516
const acronyms = [
1617
'ACL', 'ACS', 'CCDI', 'CORS', 'CPU', 'CRL', 'DB', 'DDL', 'EJB', 'HTTP', 'ID', 'JDBC', 'JMS', 'JNDI',
@@ -94,11 +95,11 @@ function addPaths(aliasFolder, path, pathMap) {
9495
}
9596

9697
const wlstType = firstValue['wlst_type'];
97-
98-
// TODO: fix WLST types that are ${abc:xyz}
98+
const usesPath = firstValue['uses_path_tokens'];
9999

100100
attributes[key] = {
101-
wlstType: wlstType
101+
wlstType,
102+
usesPath
102103
};
103104
}
104105

@@ -164,7 +165,14 @@ function getMessagesFile() {
164165
return MESSAGES_FILE;
165166
}
166167

168+
function chooseAttributeFile(targetWindow, fileOption, currentValue) {
169+
const label = fileOption.chooserName || fileOption.label;
170+
return wdtArchive.chooseAttributeFile(targetWindow, label, fileOption.type,
171+
fileOption.extensions, currentValue, 'dialog-chooseAttributeFile');
172+
}
173+
167174
module.exports = {
175+
chooseAttributeFile,
168176
getAliasInfo,
169177
getMessageKeys,
170178
getMessageMap,

electron/app/js/wdtArchive.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ function getEntryTypes() {
6565
subtype: 'emptyDir',
6666
subtypeChoices: [
6767
{ name: 'active', label: i18n.t('wdt-archiveType-coherenceStore-activeLabel')},
68+
{ name: 'backup', label: i18n.t('wdt-archiveType-coherenceStore-backupLabel')},
69+
{ name: 'events', label: i18n.t('wdt-archiveType-coherenceStore-eventsLabel')},
6870
{ name: 'snapshot', label: i18n.t('wdt-archiveType-coherenceStore-snapshotLabel')},
6971
{ name: 'trash', label: i18n.t('wdt-archiveType-coherenceStore-trashLabel')}
7072
],
@@ -217,14 +219,17 @@ function getEntryTypes() {
217219
}
218220

219221
async function chooseArchiveEntryFile(targetWindow, entryType, fileType, fileExtensions, currentValue) {
220-
const i18n = require('./i18next.config');
221-
222222
const typeDetail = getEntryTypes()[entryType];
223223
if (!typeDetail) {
224224
return Promise.reject(new Error(`Unknown archive entry type: ${entryType}`));
225225
}
226+
return chooseAttributeFile(targetWindow, typeDetail.name, fileType, fileExtensions, currentValue, 'dialog-chooseArchiveEntry');
227+
}
228+
229+
async function chooseAttributeFile(targetWindow, typeName, fileType, fileExtensions, currentValue, titleKey) {
230+
const i18n = require('./i18next.config');
226231

227-
const title = i18n.t('dialog-chooseArchiveEntry', {entryType: typeDetail.name});
232+
const title = i18n.t(titleKey, {entryType: typeName});
228233
const openProperty = fileType === 'dir' ? 'openDirectory' : 'openFile';
229234

230235
let options = {
@@ -240,7 +245,7 @@ async function chooseArchiveEntryFile(targetWindow, entryType, fileType, fileExt
240245
}
241246

242247
if (fileType === 'file' && Array.isArray(fileExtensions) && fileExtensions.length > 0) {
243-
const filterName = i18n.t('dialog-archiveEntryFilter', {entryType: typeDetail.name});
248+
const filterName = i18n.t('dialog-archiveEntryFilter', {entryType: typeName});
244249
options['filters'] = [ {name: filterName, extensions: fileExtensions} ];
245250
}
246251

@@ -487,5 +492,6 @@ async function _showArchiveEntryAddError(targetWindow, title, errMessage) {
487492
module.exports = {
488493
getEntryTypes,
489494
addArchiveEntry,
490-
chooseArchiveEntryFile
495+
chooseArchiveEntryFile,
496+
chooseAttributeFile
491497
};

electron/app/locales/en/electron.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
"dialog-openProjectFileCredentialManagerErrorTitle": "Failed to Create Credential Manager",
154154
"dialog-openProjectFileCredentialManagerErrorMessage": "Unable to create credential manager for project file {{projectFileName}} due to an error: {{error}}",
155155
"dialog-openProjectFileSendToWindowErrorTitleErrorTitle": "Failed to Open Project",
156-
"dialog-openProjectFileSendToWindowErrorTitleErrorMessage": "Unable to open project file {{projectFileName}} due to an error initializing the project window: {{err}}",
156+
"dialog-openProjectFileSendToWindowErrorMessage": "Unable to open project file {{projectFileName}} due to an error initializing the project window: {{err}}",
157157
"dialog-createNewProjectTitle": "Create WebLogic Kubernetes Toolkit Project",
158158
"dialog-projectSaveFileLocationNotWritableTitle": "Project Directory Not Writable",
159159
"dialog-projectSaveFileLocationNotWritableError": "The {{projectFileDirectory}} directory chosen to write the new project file is not writable by the current process.",
@@ -202,6 +202,7 @@
202202
"dialog-tls-certfile": "Select TLS cert file",
203203

204204
"dialog-chooseArchiveEntry": "Choose {{entryType}} for Archive",
205+
"dialog-chooseAttributeFile": "Choose {{entryType}}",
205206
"dialog-archiveEntryFilter": "{{entryType}}",
206207
"dialog-getWebLogicRemoteConsoleHome": "Select the WebLogic Remote Console Installation",
207208
"dialog-getWebLogicRemoteConsoleAppImage": "Select the WebLogic Remote Console AppImage file",
@@ -392,6 +393,8 @@
392393

393394
"wdt-archiveType-coherenceStore": "Coherence Persistence Directory",
394395
"wdt-archiveType-coherenceStore-activeLabel": "Active",
396+
"wdt-archiveType-coherenceStore-backupLabel": "Backup",
397+
"wdt-archiveType-coherenceStore-eventsLabel": "Events",
395398
"wdt-archiveType-coherenceStore-snapshotLabel": "Snapshot",
396399
"wdt-archiveType-coherenceStore-trashLabel": "Trash",
397400
"wdt-archiveType-coherenceStore-emptyDirLabel": "Coherence Persistence Directory Name",

electron/app/locales/en/modeledit.json

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,18 @@
113113
"security-model-custom-roles-and-policies-label": "Custom Roles and Policies",
114114
"security-model-dd-only-label": "Deployment Descriptor Only",
115115

116+
"file-select-title": "Select {{attribute}}",
117+
"file-select-label": "Selection type",
118+
"file-select-type-file": "File",
119+
"file-select-type-dir": "Directory",
120+
"file-select-type-emptyDir": "Empty Directory",
121+
"file-select-archive-title": "{{attribute}} Location",
122+
"file-select-archive-label": "Location Type",
123+
"file-select-use-file-location": "Use \"{{fileName}}\" on the local file system",
124+
"file-select-add-to-archive": "Add \"{{fileName}}\" to archive file",
125+
"file-select-archive-empty-dir": "Use a new empty directory in the archive file",
126+
"file-select-local-empty-dir": "Use an empty directory on the file system",
127+
116128
"options-default-label": "Default",
117129
"options-persist-label": "Persistent",
118130
"options-non-persist-label": "Not Persistent",
@@ -426,6 +438,7 @@
426438
"attribute-editor-from-variable": "From variable \"{{variable}}\"",
427439
"attribute-editor-missing-variable": "Missing variable \"{{variable}}\"",
428440
"attribute-editor-options": "Options",
441+
"attribute-editor-select": "Select",
429442

430443
"invalid-integer-error": "Value must be an integer",
431444
"invalid-double-error": "Value must be a decimal number, such as 4 or 3.5",
@@ -866,7 +879,7 @@
866879
"a-BatchSize-label": "Batch Size",
867880
"f-MessagingBridge-a-BatchSize-help": "The number of messages that are processed within one transaction. Batch Size only applies to a messaging bridge instance forwarding messages in synchronous mode and has a QOS (quality of service) that requires two-phase transactions.",
868881

869-
"a-BeaHome-label": "Bea Home",
882+
"a-BeaHome-label": "BEA Home",
870883

871884
"a-BeforeCompletionIterationLimit-label": "Before Completion Iteration Limit",
872885
"a-BeforeCompletionIterationLimit-help": "The maximum number of cycles that the transaction manager performs the beforeCompletion synchronization callback for this WebLogic Server domain. Nothing prevents a Synchronization object from registering another during beforeCompletion, even those whose beforeCompletions have already been called. For example, an EJB can call another in its ejbStore() method. To accommodate this, the transaction manager calls all Synchronization objects, then repeats the cycle if new ones have been registered. This count sets a limit to the number of cycles that synchronization occurs.",
@@ -4872,7 +4885,7 @@
48724885
"a-PlaintextPasswordsEnabled-help": "Specifies whether plaintext passwords are allowed to be used.",
48734886

48744887
"a-PlanDir-label": "Plan Directory",
4875-
"a-PlanDir-help": "The location of this application's configuration area. This directory can contain external descriptor files as specified within the deployment plan document. f the plan directory is a relative path, it is resolved relative to InstallDir if InstallDir is not null; otherwise, it is resolved relative to the domain root.",
4888+
"a-PlanDir-help": "The location of this application's configuration area. This directory can contain external descriptor files as specified within the deployment plan document. If the plan directory is a relative path, it is resolved relative to InstallDir if InstallDir is not null; otherwise, it is resolved relative to the domain root.",
48764889

48774890
"a-PlanPath-label": "Plan Path",
48784891
"a-PlanPath-help": "The path to the deployment plan document on the Administration Server. If the plan path is a relative path, it is resolved relative to PlanDir if PlanDir is not null; otherwise, it is resolved relative to the domain root.",
@@ -4921,7 +4934,7 @@
49214934
"a-PolicyDeploymentEnabled-help": "Specifies whether this Authorization provider stores policies that are created while deploying a Web application or EJB.",
49224935

49234936
"a-PolicySelectionPreference-label": "Policy Selection Preference",
4924-
"f-WebserviceSecurity-a-PolicySelectionPreference-help": "Specifies the value of the PolicySelectionPreference attribute. f NONE is specified, no preference is applied - the first policy alternative is always chosen, and optional policy assertions are ignored.",
4937+
"f-WebserviceSecurity-a-PolicySelectionPreference-help": "Specifies the value of the PolicySelectionPreference attribute. If NONE is specified, no preference is applied - the first policy alternative is always chosen, and optional policy assertions are ignored.",
49254938

49264939
"a-PollingInterval-label": "Polling Interval",
49274940
"a-PollingInterval-help": "The frequency (in seconds) that WebLogic Server checks the attribute value. The default value is 10.",
@@ -7076,7 +7089,7 @@
70767089
"a-coherence_StartScriptName-label": "Coherence Start Script Name",
70777090
"f-NMProperties-a-coherence_StartScriptName-help": "The name of the script to be executed to start the server.",
70787091

7079-
"a-compInfoXMLLocation-label": "Comp Info XML Location",
7092+
"a-compInfoXMLLocation-label": "Component Info XML Location",
70807093
"a-compInfoXMLLocation-help": "The full path to the location of the ComponentInfo.xml file. The default location is ORACLE_HOME/oracle_common/rcu/config.",
70817094

70827095
"a-databaseType-label": "Database Type",
@@ -7171,7 +7184,7 @@
71717184

71727185
"a-st-label": "st",
71737186

7174-
"a-storageXMLLocation-label": "Storage XML Location",
7187+
"a-storageXMLLocation-label": "Storage Info XML Location",
71757188
"a-storageXMLLocation-help": "The full path to the location of the StorageInfo.xml file. The default location is ORACLE_HOME/oracle_common/rcu/config.",
71767189

71777190
"a-street-label": "street",

electron/app/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ class Main {
478478
return project.chooseArchiveFile(event.sender.getOwnerBrowserWindow());
479479
});
480480

481+
ipcMain.handle('choose-attribute-file', async (event, fileOption, currentValue) => {
482+
return modelEditUtils.chooseAttributeFile(event.sender.getOwnerBrowserWindow(), fileOption, currentValue);
483+
});
484+
481485
ipcMain.handle('choose-archive-entry-file', async (event, itemType, fileType,
482486
fileExtensions, currentValue) => {
483487

0 commit comments

Comments
 (0)