Skip to content

Commit 571f64e

Browse files
Merge from develop (#95)
* converting all aria-label attributes to use i18n resource bundle (#94) * removing unit tests from application packaging * adding placeholders for target service and port combo boxes * adding busy dialog while fetching service details * eslint warning
1 parent 43492bb commit 571f64e

14 files changed

+101
-56
lines changed

electron/app/locales/en/webui.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"copyright-footer-text": "Copyright (c) 2021, {{currentYear}}, Oracle and/or its affiliates. Licensed under The Universal Permissive License (UPL), Version 1.0, as shown at",
33

4+
"nav-aria-label": "Choose a navigation item",
45
"nav-model": "Model",
56
"nav-project-settings": "Project Settings",
67
"nav-image": "Image",
@@ -81,12 +82,14 @@
8182
"project-settings-form-name": "Project Settings",
8283
"project-settings-title": "Project Settings",
8384
"project-settings-mac-environment-question": "For macOS, do you need to add directories to the PATH or define other environment variables for Docker/Podman or Kubernetes?",
85+
"project-settings-mac-path-table-aria-label": "macOS Extra Path Directories Table",
8486
"project-settings-add-path-row-icon-text": "Add Extra Path Directory",
8587
"project-settings-choose-path-icon-text": "Choose Extra Path Directory",
8688
"project-settings-delete-path-row-icon-text": "Remove Extra Path Directory",
8789
"project-settings-extra-path-directory-header": "Extra Path Directory",
8890
"project-settings-hints-macos-path-directories": "Show System Path Directories",
8991
"project-settings-button-macos-path-directories": "Show System Path",
92+
"project-settings-mac-env-var-table-aria-label": "macOS Extra Environment Variables Table",
9093
"project-settings-add-env-var-row-icon-text": "Add Extra Environment Variable",
9194
"project-settings-delete-env-var-row-icon-text": "Remove Extra Environment Variable",
9295
"project-settings-extra-environment-variable-name-header": "Extra Environment Variable Name",
@@ -144,9 +147,11 @@
144147
"project-settings-credential-store-policy-answer-message": "The Credential Store Policy controls how credentials are handled when the project is saved and loaded. The options are to store them in the machine's native credential store, store them in the project file encrypted with a passphrase, or not store them at all.",
145148

146149
"macos-path-directories-dialog-title": "System Path",
150+
"macos-path-directories-dialog-table-aria-label": "System Path Environment Variable Directories",
147151
"macos-path-directories-dialog-name-header": "Path Directory",
148152

149153
"macos-environment-variables-dialog-title": "System Environment Variables",
154+
"macos-environment-variables-dialog-table-aria-label": "System Environment Variables Table",
150155
"macos-environment-variables-dialog-name-header": "Environment Variable Name",
151156
"macos-environment-variables-dialog-value-header": "Environment Variable Value",
152157

@@ -563,6 +568,7 @@
563568
"domain-design-cluster-additional-java-options-label": "Additional Java Options",
564569
"domain-design-cluster-additional-java-options-help": "A list of additional Java runtime options, separated by spaces, tabs, or commas.",
565570

571+
"domain-design-configmap-table-aria-label": "ConfigMap Properties Table",
566572
"domain-design-configmap-title": "Model Variables Overrides",
567573
"domain-design-configmap-label": "Kubernetes ConfigMap Name",
568574
"domain-design-configmap-help": "The name of the Kubernetes ConfigMap that holds the model variable overrides.",
@@ -599,6 +605,7 @@
599605
"domain-design-propname-header": "Model Variable Name",
600606
"domain-design-propvalue-header": "Model Variable File Value",
601607
"domain-design-propoverride-header": "Model Variable Override Value",
608+
"domain-design-secrets-table-aria-label": "Secrets Table",
602609
"domain-design-secretname-header": "Secret Name",
603610
"domain-design-username-header": "Username",
604611
"domain-design-password-header": "Password",
@@ -645,14 +652,19 @@
645652
"ingress-design-ingress-docker-reg-secret-userpwd-help": "The password used to log in to Docker Hub.",
646653
"ingress-design-ingress-docker-reg-secret-useremail": "Docker Hub Email Address",
647654
"ingress-design-ingress-docker-reg-secret-useremail-help": "The email address of the user logging in to Docker Hub.",
655+
"ingress-design-route-get-services-title": "Getting services for namespace {{namespace}}",
648656

649657
"ingress-design-ingress-routes-title": "Ingress Routes Configuration",
650658
"ingress-design-ingress-route-virtualhost-label": "Virtual Host",
651659
"ingress-design-ingress-route-targetservicenamespace-label": "Target Service Namespace",
652660
"ingress-design-ingress-route-targetservicenamespace-help": "The target service namespace value points to the namespace where the domain is running.",
653661
"ingress-design-ingress-route-accesspoint-label": "Access Point",
654662
"ingress-design-ingress-route-targetservice-label": "Target Service",
663+
"ingress-design-ingress-route-targetservice-placeholder": "Select Domain Service",
664+
"ingress-design-ingress-route-targetservice-placeholder-empty": "No Domain Services Available",
655665
"ingress-design-ingress-route-targetport-label": "Target Port",
666+
"ingress-design-ingress-route-targetport-placeholder": "Select Target Service Port",
667+
"ingress-design-ingress-route-targetport-placeholder-empty": "No Target Service Selected",
656668
"ingress-design-ingress-route-path-label": "Path Expression",
657669
"ingress-design-ingress-route-tls-label": "Transport Options",
658670
"ingress-design-ingress-route-tls-help": "Select the transport option for this ingress route",
@@ -663,6 +675,7 @@
663675
"ingress-design-ingress-route-is-console-svc-help": "For SSL terminating at ingress and accessing WebLogic Console Service, turn on this option. Your domain must have 'WeblogicPluginEnabled: true' in the 'resources->WebAppContainer' section",
664676
"ingress-design-ingress-route-name-label": "Name",
665677
"ingress-design-ingress-route-dialog-title": "Edit Ingress Route",
678+
"ingress-design-ingress-route-annotations-table-aria-label": "Ingress Route Annotations Table",
666679
"ingress-design-ingress-route-annotation-label": "Annotation",
667680
"ingress-design-ingress-route-annotationValue-label": "Value",
668681
"ingress-design-ingress-annotations": "Optional Annotations",
@@ -705,6 +718,7 @@
705718
"ingress-design-generate-tls-subject-label": "Subject to Use for the Generated TLS Certificate",
706719
"ingress-design-generate-tls-subject-help": "The Subject (e.g., /CN=www.mydomain.org) to use when generating TLS certificate. The format must be /type0=value0/type1=value1/type2=...",
707720

721+
"ingress-design-routes-table-aria-label": "Ingress Routes Table",
708722
"ingress-design-add-route-label": "Add Route",
709723
"ingress-design-edit-route-label": "Edit Route",
710724
"ingress-design-delete-route-label": "Delete Route",
@@ -989,10 +1003,14 @@
9891003
"model-page-hints-prepareModel": "Prepare Model for Kubernetes",
9901004
"model-page-model-editor-contents": "Model Editor Contents",
9911005

1006+
"model-properties-table-aria-label": "Model Variables Editable Table",
9921007
"model-properties-name-header": "Variable Name",
9931008
"model-properties-value-header": "Variable Value",
9941009
"model-properties-add-label": "Add Variable",
9951010
"model-properties-delete-label": "Delete",
1011+
1012+
"model-archive-toolbar-aria-label": "Archive Editing Toolbar",
1013+
"model-archive-tree-view-aria-label": "Archive Editor Tree View",
9961014
"model-archive-add-label": "Add",
9971015
"model-archive-delete-label": "Delete",
9981016
"model-archive-no-archive-label": "(no archive)",
@@ -1284,6 +1302,7 @@
12841302
"quickstart-dialog-title": "WebLogic Kubernetes Toolkit (WKT) UI Introduction",
12851303
"quickstart-dialog-stop-showing-quickstart-message": "Stop showing this introduction at startup.",
12861304

1305+
"quickstart-dialog-filmstrip-aria-label": "WebLogic Kubernetes Toolkit UI Tutorial",
12871306
"quickstart-page1-title": "Introduction",
12881307
"quickstart-page1-paragraph-1": "Ready to get your WebLogic Server domain running in Kubernetes?",
12891308
"quickstart-page1-paragraph-2": "This application will guide you through the process of creating a WebLogic Server domain in Kubernetes.",

webui/scripts/hooks/after_build.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ const fsPromises = require('fs/promises');
1212
const { copyFile, lstat, mkdir, readdir } = require('fs/promises');
1313
const path = require('path');
1414

15+
const purgeLocations = [
16+
path.normalize(path.join(__dirname, '..', '..', 'web', 'test'))
17+
];
1518
const sourceDirectories = [
1619
path.normalize(path.join(__dirname, '..', '..', 'web'))
1720
// path.normalize(path.join(__dirname, '..', '..', 'staged-themes'))
@@ -21,6 +24,13 @@ const targetDirectory = path.normalize(path.join(__dirname, '..', '..', '..', 'e
2124
module.exports = function (configObj) {
2225
return new Promise(async (resolve, reject) => {
2326
console.log("Running after_build hook.");
27+
console.log('Purging unnecessary files created by the build...');
28+
for (const purgeLocation of purgeLocations) {
29+
if (fs.existsSync(purgeLocation)) {
30+
fs.rmSync(purgeLocation, { force: true, recursive: true });
31+
}
32+
}
33+
2434
if (configObj.buildType === 'release') {
2535
console.log('Consolidating files for building the release');
2636
for (const sourceDirectory of sourceDirectories) {

webui/src/js/viewModels/ingress-design-view-impl.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,11 @@ function(i18n, accUtils, ko, ArrayDataProvider, BufferingDataProvider, project,
209209
window.api.ipc.invoke('show-error-message', title, message);
210210
};
211211

212-
async function getTargetServiceDetails (project) {
213-
212+
async function getTargetServiceDetails(myProject) {
214213
const kubectlExe = k8sHelper.getKubectlExe();
215214
const kubectlOptions = k8sHelper.getKubectlOptions();
216215
const results = await window.api.ipc.invoke('k8s-get-service-details',
217-
kubectlExe, project.k8sDomain.kubernetesNamespace.value, '', kubectlOptions);
216+
kubectlExe, myProject.k8sDomain.kubernetesNamespace.value, '', kubectlOptions);
218217
let serviceLists = {};
219218
if (results.isSuccess) {
220219
for (const item of results.serviceDetails.items) {
@@ -230,37 +229,37 @@ function(i18n, accUtils, ko, ArrayDataProvider, BufferingDataProvider, project,
230229
return Promise.resolve(false);
231230
}
232231
return Promise.resolve( { serviceList: serviceLists});
233-
};
232+
}
234233

235234
this.handleEditRoute = async (event, context) => {
236235
// using context.item.data directly was causing problems
237236
// when project data was reloaded with matching UIDs.
238237
const index = context.item.index;
239238
let route = this.routes.observable()[index];
240-
getTargetServiceDetails(this.project).then( svc => {
241-
const options = {route: route, serviceList: svc.serviceList};
242-
dialogHelper.promptDialog('route-edit-dialog', options)
243-
.then(result => {
244-
245-
// no result indicates operation was cancelled
246-
if (result) {
247-
let changed = false;
248-
project.ingress.ingressRouteKeys.forEach(key => {
249-
if ((key !== 'uid') && result.hasOwnProperty(key)) {
250-
route[key] = result[key];
251-
changed = true;
252-
}
253-
});
254-
255-
if (changed) {
256-
this.routes.observable.replace(route, route);
239+
240+
dialogHelper.openBusyDialog(this.labelMapper('route-get-services-title',
241+
{ namespace: this.project.k8sDomain.kubernetesNamespace.value }));
242+
const targetServiceDetails = await getTargetServiceDetails(this.project);
243+
dialogHelper.closeBusyDialog();
244+
if (targetServiceDetails) {
245+
const options = {route: route, serviceList: targetServiceDetails.serviceList};
246+
dialogHelper.promptDialog('route-edit-dialog', options).then(result => {
247+
// no result indicates operation was cancelled
248+
if (result) {
249+
let changed = false;
250+
project.ingress.ingressRouteKeys.forEach(key => {
251+
if ((key !== 'uid') && result.hasOwnProperty(key)) {
252+
route[key] = result[key];
253+
changed = true;
257254
}
255+
});
256+
257+
if (changed) {
258+
this.routes.observable.replace(route, route);
258259
}
259-
});
260+
}
261+
});
260262
}
261-
);
262-
263-
264263
};
265264

266265
this.handleCancel = () => {

webui/src/js/viewModels/route-edit-dialog.js

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@
66
'use strict';
77

88
define(['accUtils', 'knockout', 'utils/i18n', 'models/wkt-project', 'utils/view-helper', 'ojs/ojarraydataprovider',
9-
'ojs/ojbufferingdataprovider', 'utils/observable-properties', 'ojs/ojconverter-number', 'ojs/ojinputtext',
10-
'ojs/ojlabel', 'ojs/ojbutton', 'ojs/ojdialog', 'ojs/ojformlayout', 'ojs/ojvalidationgroup', 'ojs/ojselectcombobox'],
11-
function(accUtils, ko, i18n, project, viewHelper, ArrayDataProvider, BufferingDataProvider, props, ojConverterNumber) {
9+
'ojs/ojbufferingdataprovider', 'utils/observable-properties', 'ojs/ojconverter-number', 'utils/wkt-logger',
10+
'ojs/ojinputtext', 'ojs/ojlabel', 'ojs/ojbutton', 'ojs/ojdialog', 'ojs/ojformlayout', 'ojs/ojvalidationgroup',
11+
'ojs/ojselectcombobox'],
12+
function(accUtils, ko, i18n, project, viewHelper, ArrayDataProvider, BufferingDataProvider, props,
13+
ojConverterNumber) {
1214
function RouteEditDialogModel(args) {
1315
const DIALOG_SELECTOR = '#routeEditDialog';
1416

15-
const DEFAULT_ROUTE_PORT = 0;
17+
const DEFAULT_ROUTE_PORT = undefined;
1618

1719
// SIMPLE_PROPERTIES - names matching simple route fields
1820
let EXCLUDE_PROPERTIES = ['uid', 'annotations'];
1921
let SIMPLE_PROPERTIES = project.ingress.ingressRouteKeys.filter(key => !EXCLUDE_PROPERTIES.includes(key));
2022

23+
this.project = project;
24+
this.route = args.route;
25+
this.serviceList = args.serviceList;
26+
2127
this.connected = () => {
2228
accUtils.announce('Route edit dialog loaded.', 'assertive');
23-
2429
// open the dialog after the current thread, which is loading this view model.
2530
// using oj-dialog initial-visibility="show" causes vertical centering issues.
2631
setTimeout(function() {
@@ -36,13 +41,9 @@ function(accUtils, ko, i18n, project, viewHelper, ArrayDataProvider, BufferingDa
3641
return i18n.t(labelId, arg);
3742
};
3843

39-
this.project = project;
40-
this.route = args.route;
41-
this.serviceList = args.serviceList;
42-
4344
this.buildTargetSvcNames = () => {
4445
let options = [];
45-
for(var name in this.serviceList){
46+
for (const name in this.serviceList) {
4647
options.push( { id : name, value: name, text: name});
4748
}
4849
return options;
@@ -52,7 +53,7 @@ function(accUtils, ko, i18n, project, viewHelper, ArrayDataProvider, BufferingDa
5253
let options = [];
5354
if (this.serviceList[svcName]) {
5455
for (const port of this.serviceList[svcName].ports) {
55-
options.push( { id : port.port, value: port.port, text: port.port});
56+
options.push( { id : port.port, value: port.port, text: port.port} );
5657
}
5758
}
5859

@@ -64,7 +65,7 @@ function(accUtils, ko, i18n, project, viewHelper, ArrayDataProvider, BufferingDa
6465
this.targetSvcPorts = ko.observableArray([] );
6566

6667
if (this.route.targetService) {
67-
this.targetSvcPorts = this.buildTargetSvcPorts(this.route.targetService);
68+
this.buildTargetSvcPorts(this.route.targetService).forEach(port => this.targetSvcPorts.push(port));
6869
}
6970

7071
this.savedAnnotations = args.route.annotations || {};
@@ -144,6 +145,24 @@ function(accUtils, ko, i18n, project, viewHelper, ArrayDataProvider, BufferingDa
144145
this[propertyName] = props.createProperty(defaultValue);
145146
});
146147

148+
this.getTargetServicePlaceholder = ko.computed(() => {
149+
if (Array.isArray(this.targetSvcNames) && this.targetSvcNames.length > 0) {
150+
return this.labelMapper('route-targetservice-placeholder');
151+
} else {
152+
return this.labelMapper('route-targetservice-placeholder-empty');
153+
}
154+
});
155+
156+
this.getTargetPortPlaceholder = ko.computed(() => {
157+
console.log('targetSvcPorts is a ' + typeof(this.targetSvcPorts));
158+
const ports = this.targetSvcPorts();
159+
if (Array.isArray(ports) && ports.length > 0) {
160+
return this.labelMapper('route-targetport-placeholder');
161+
} else {
162+
return this.labelMapper('route-targetport-placeholder-empty');
163+
}
164+
});
165+
147166
this.handleAddAnnotation = () => {
148167
const nextIndex = this.nextAnnotationIndex();
149168
const annotation = {uid: getAnnotationUid(nextIndex), key: `annotation-${nextIndex}`};
@@ -186,10 +205,7 @@ function(accUtils, ko, i18n, project, viewHelper, ArrayDataProvider, BufferingDa
186205

187206
this.targetSvcNameChanged = (event) => {
188207
this.targetSvcPorts.removeAll();
189-
const list = this.buildTargetSvcPorts(event.detail.value);
190-
for (const item of list) {
191-
this.targetSvcPorts.push(item);
192-
}
208+
this.buildTargetSvcPorts(event.detail.value).forEach(port => this.targetSvcPorts.push(port));
193209
};
194210

195211
this.okInput = () => {

webui/src/js/views/app-main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div id="pageContent" class="oj-web-applayout-page">
1717
<div id="wkt-container" class="oj-sm-flex-wrap-nowrap oj-flex">
1818
<div id="navlistcontainer" class="oj-bg-neutral-170 oj-color-invert" :class="[[{collapsed : navCollapsed}]]">
19-
<oj-navigation-list aria-label="Choose a navigation item"
19+
<oj-navigation-list :aria-label="[[labelMapper('aria-label')]]"
2020
class="oj-bg-neutral-170 oj-color-invert wkt-navigation-list"
2121
data="[[navDataProvider]]"
2222
display="[[navDisplay]]"

webui/src/js/views/domain-design-view.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ <h6 class="wkt-subheading"><oj-bind-text value="[[labelMapper('configmap-title')
284284

285285
<oj-table id="properties-table"
286286
class="wkt-domain-properties-table"
287-
aria-label="ConfigMap Properties Table"
287+
:aria-label="[[labelMapper('configmap-table-aria-label')]]"
288288
data="{{configMapDP}}"
289289
display="grid"
290290
horizontal-grid-visible="enabled"
@@ -315,7 +315,7 @@ <h6 class="wkt-subheading"><oj-bind-text value="[[labelMapper('configmap-title')
315315
<h6 class="wkt-subheading"><oj-bind-text value="[[labelMapper('secrets-title')]]"></oj-bind-text></h6>
316316
<oj-table id="secrets-table"
317317
class="wkt-domain-secrets-table"
318-
aria-label="Secrets Table"
318+
:aria-label="[[labelMapper('secrets-table-aria-label')]]"
319319
data="[[secretsDP]]"
320320
display="grid"
321321
horizontal-grid-visible="enabled"

webui/src/js/views/ingress-design-view.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ <h6 class="wkt-subheading">
176176
</h6>
177177
<oj-table id="routes-table"
178178
class="wkt-model-properties-table"
179-
aria-label="Editable Properties Table"
179+
:aria-label="[[labelMapper('routes-table-aria-label')]]"
180180
data="[[routesDataProvider]]"
181181
display="grid"
182182
horizontal-grid-visible="enabled"

webui/src/js/views/macos-environment-variables-dialog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="oj-panel wkt-notop wkt-full-height">
1212
<oj-table id="macos-environment-variables-table"
1313
class="wkt-env-vars-table"
14-
aria-label="Inherited Environment Variables Table"
14+
:aria-label="[[labelMapper('table-aria-label')]]"
1515
data="[[environmentVariablesDataProvider]]"
1616
display="grid"
1717
layout="fixed"

webui/src/js/views/macos-path-directories-dialog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="oj-panel wkt-notop wkt-full-height">
1212
<oj-table id="macos-path-variable-table"
1313
class="wkt-paths-table"
14-
aria-label="Inherited PATH Environment Variable Table"
14+
aria-label="[[labelMapper('table-aria-label')]]"
1515
data="[[pathDirectoriesDataProvider]]"
1616
display="grid"
1717
horizontal-grid-visible="enabled"

webui/src/js/views/model-archive-view.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-->
55

66
<div id="wkt-model-archive" class="wkt-model-archive">
7-
<oj-toolbar id='myToolbar1' aria-label='Editing Toolbar' aria-controls='controlled'
7+
<oj-toolbar id='myToolbar1' :aria-label="[[labelMapper('toolbar-aria-label')]]" aria-controls='controlled'
88
class="wkt-archive-toolbar" :class="oj-toolbar-bottom-border">
99

1010
<div class="wkt-archive-label"><oj-bind-text value="[[archiveLabel]]"></oj-bind-text></div>
@@ -27,7 +27,7 @@
2727
data="[[archiveDataProvider]]"
2828
selection-mode="single"
2929
on-selected-changed="[[selectionChanged]]"
30-
aria-label="Tree View with JSON Data">
30+
:aria-label="[[labelMapper('tree-view-aria-label')]]">
3131
<template slot="itemTemplate" data-oj-as="row">
3232
<span class="oj-treeview-item-icon"></span>
3333
<span class="oj-treeview-item-text">

webui/src/js/views/model-properties-view.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-->
55
<oj-table id="properties-table"
66
class="wkt-model-properties-table"
7-
aria-label="Editable Properties Table"
7+
:aria-label="[[labelMapper('table-aria-label')]]"
88
data="[[propertiesDataProvider]]"
99
edit-mode="rowEdit"
1010
display="grid"

0 commit comments

Comments
 (0)