');
+ //3 fieldset to show conditions, group and status
diaDiv.append('
');
diaDiv.append('
');
diaDiv.append('
');
+ //add the groups into fieldset
+ var groups = $.cookie('groups').split(',');
+ for (var i in groups){
+ var tempStr = '
' + groups[i];
+ diaDiv.find('#changeGroup').append(tempStr);
+ }
+
+ //add the conditions into fieldset
+ if ('' == globalCondition){
+ diaDiv.find('#changePreCond').append('Getting predefined conditions, open this dislogue later.');
+ }
+ else{
+ diaDiv.find('#changePreCond').append(createConditionTable(globalCondition));
+ }
+
+ //create the dislogue
diaDiv.dialog({
modal: true,
- width: 570,
- close: function(event, ui){
+ width: 570,
+ close: function(event, ui){
$(this).remove();
},
buttons: {
@@ -839,47 +977,6 @@ function chCondScopeDia(){
}
}
});
-
- $('#changePreCond').append('Getting predefined conditions.');
- $('#changePreCond').append(createLoader());
- var groups = $.cookie('groups').split(',');
- for (var i in groups){
- var tempStr = '
' + groups[i];
- $('#changeGroup').append(tempStr);
- }
-
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'webrun',
- tgt : '',
- args : 'lscondition',
- msg : ''
- },
-
- success : function(data){
- $('#changePreCond').empty();
- var conditions = data.rsp[0].split(';');
- var name = '';
- var showStr = '
';
-
- $('#changePreCond').append(showStr);
- //adjust the dialog's position
- $('#chScopeDiaDiv').dialog( "option", "position", 'center' );
- }
- });
}
/**
@@ -909,4 +1006,31 @@ function mkResponseDia(){
}
}
});
+}
+
+/**
+ * create the condition table for dialogue
+ *
+ * @param
+
+ * @return
+ *
+ */
+function createConditionTable(cond){
+ var conditions = cond.split(';');
+ var name = '';
+ var showStr = '
';
+
+ return showStr;
}
\ No newline at end of file
diff --git a/xCAT-server/lib/xcat/plugins/web.pm b/xCAT-server/lib/xcat/plugins/web.pm
index 23471c540..d48fb328d 100644
--- a/xCAT-server/lib/xcat/plugins/web.pm
+++ b/xCAT-server/lib/xcat/plugins/web.pm
@@ -258,7 +258,7 @@ sub web_mkcondition{
push (@nodes, @temp[0]);
}
- #xCAT::Utils->runcmd('chcondition -n ' + join(',', @nodes) + '-m m ' + $conditionName);
+ xCAT::Utils->runcmd('chcondition -n ' + join(',', @nodes) + '-m m ' + $conditionName);
$callback->( { data => 'Change scope success.' } );
}
@@ -267,7 +267,7 @@ sub web_mkcondition{
sub web_lsresp {
my ( $request, $callback, $sub_req ) = @_;
my $names = '';
- my @temp = ();
+ my @temp;
my $retInfo = xCAT::Utils->runcmd('lsresponse -d', -1, 1);
shift @$retInfo;
@@ -283,14 +283,29 @@ sub web_lsresp {
sub web_lscondresp {
my ( $request, $callback, $sub_req ) = @_;
- my @ret = `lscondresp`;
- shift @ret;
- shift @ret;
+ my $names = '';
+ my @temp;
+ #if there is condition name, then we only show the condition linked associations.
+ if ($request->{arg}->[1]){
+ my $cmd = 'lscondresp -d ' . $request->{arg}->[1];
+ my $retInfo = xCAT::Utils->runcmd($cmd, -1, 1);
+ if (2 > @$retInfo){
+ $callback->( { data => '' } );
+ return;
+ }
- foreach my $line (@ret) {
- chomp $line;
- $callback->( { data => $line } );
+ shift @$retInfo;
+ shift @$retInfo;
+ for my $line (@$retInfo){
+ @temp = split(':', $line);
+ $names = $names . @temp[1] . ';';
+ }
}
+ else{
+ }
+
+ $names = substr($names, 0, (length($names) - 1));
+ $callback->( { data => $names } );
}
sub web_gettab {