Skip to content

Commit de68b8c

Browse files
committed
mcc: Keep seq no in default process name when changing process type
1 parent 97915de commit de68b8c

File tree

3 files changed

+25
-32
lines changed

3 files changed

+25
-32
lines changed

storage/ndb/mcc/frontend/js/mcc/configuration/calculations.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ function autoConfigure() {
111111

112112
var typeIds = [];
113113
var names = [];
114-
var familyHead = [];
115-
var typeHead = [];
114+
var familyHead = []; // Ptype hashed on family name
115+
var typeHead = []; // Ptype hashed on type name
116116
var dataNodeId = 1;
117117
var otherNodeId = 49;
118118

@@ -135,7 +135,8 @@ function autoConfigure() {
135135
host: host.getId(),
136136
processtype: typeIds[pname],
137137
NodeId: (pname == "ndbd" || pname == "ndbmtd") ?
138-
dataNodeId++ : otherNodeId++
138+
dataNodeId++ : otherNodeId++,
139+
seqno: typeHead[pname].getValue("currSeq")
139140
});
140141
}
141142

storage/ndb/mcc/frontend/js/mcc/gui/hosttree.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ function addProcess(event) {
376376
name: dijit.byId("processname").get("value"),
377377
processtype: +processType,
378378
host: hostTreeItem.treeItem.getId(),
379-
NodeId: nodeId
379+
NodeId: nodeId,
380+
seqno: dijit.byId("seqno").get("value")
380381
})
381382
dijit.byId("addProcessDlg").hide();
382383
}
@@ -391,20 +392,17 @@ function addProcess(event) {
391392

392393
// Setup a dialog for adding new proesses
393394
function addProcessDlgSetup() {
394-
var addProcessDlg;
395395
var subtypes;
396-
var pnamebox;
397-
var addButton;
398-
var cancelButton;
399396

400397
if (!dijit.byId("addProcessDlg")) {
401-
addProcessDlg= new dijit.Dialog({
398+
new dijit.Dialog({
402399
id: "addProcessDlg",
403400
title: "Add new process",
404401
content: "\
405402
<form id='addProcessForm' data-dojo-type='dijit.form.Form'>\
406403
<p>Select process type: <span id=\"processtype\"></span></p>\
407404
<p>Enter process name: <span id=\"processname\"></span></p>\
405+
<span id=\"seqno\"></span>\
408406
<div id=cancelProcDlgButton data-dojo-type='dijit.form.Button'\
409407
data-dojo-props=\"onClick:\
410408
function() {\
@@ -438,13 +436,17 @@ function addProcessDlgSetup() {
438436
var pseq = pfam[0].getValue("currSeq");
439437
dijit.byId("processname").set("value", pname +
440438
" " + pseq);
441-
});
439+
dijit.byId("seqno").set("value", pseq);
440+
});
442441
});
443442
}
444443
}, "processtype");
445444

446-
pnamebox= new dijit.form.TextBox(
447-
{style: "width: 150px"}, "processname");
445+
new dijit.form.TextBox(
446+
{style: "width: 150px"}, "processname");
447+
448+
new dijit.form.TextBox(
449+
{style: "width: 150px", type: "hidden"}, "seqno");
448450

449451
mcc.storage.processTypeStorage().getItems({}).then(function (items) {
450452
dijit.byId("processtype").set("value",
@@ -477,6 +479,7 @@ function showAddProcessDialog() {
477479
var pname = ptype.getValue("nodeLabel");
478480
var pseq = pfam[0].getValue("currSeq");
479481
dijit.byId("processname").set("value", pname + " " + pseq);
482+
dijit.byId("seqno").set("value", pseq);
480483
});
481484
});
482485
dijit.byId("addProcessDlg").show();

storage/ndb/mcc/frontend/js/mcc/gui/hosttreedetails.js

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -195,28 +195,17 @@ function processSelectionDetailsSetup() {
195195
mcc.storage.processTypeStorage().getItem
196196
(pd_types.getValue()).then(
197197
function (ptype) {
198+
var pname = ptype.getValue("nodeLabel");
199+
var pseq = hostTreeItem.storageItem.getValue("seqno");
198200

199-
// Get the prototypical type to get seq no
200-
mcc.storage.processTypeStorage().getItems(
201-
{family: ptype.getValue("family")}).then(
202-
function (pfam) {
201+
// Reset process name widget
202+
dijit.byId("pd_name").set("value", pname +
203+
" " + pseq);
203204

204-
var pname = ptype.getValue("nodeLabel");
205-
var pseq = pfam[0].getValue("currSeq");
206-
207-
// Reset process name widget
208-
dijit.byId("pd_name").set("value", pname +
209-
" " + pseq);
210-
211-
// Take care to store the type as integer
212-
hostTreeItem.storageItem.setValue("processtype",
213-
+ptype.getId());
214-
mcc.storage.processStorage().save();
215-
216-
// Increment currSeq since we have used it
217-
pfam[0].setValue("currSeq", pseq + 1);
218-
mcc.storage.processTypeStorage().save();
219-
});
205+
// Take care to store the type as integer
206+
hostTreeItem.storageItem.setValue("processtype",
207+
+ptype.getId());
208+
mcc.storage.processStorage().save();
220209
}
221210
);
222211
});

0 commit comments

Comments
 (0)