/**
  * Lists all DcmdNodeGroup models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new DcmdNodeGroupSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $ret = DcmdGroup::findBySql("select gid,gname from dcmd_group where gtype=1 order by gname")->asArray()->all();
     $groupId = array();
     foreach ($ret as $gid) {
         $groupId[$gid['gid']] = $gid['gname'];
     }
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'groupId' => $groupId]);
 }
 /**
  * Select node group model.
  */
 public function actionSelectNodeGroup($app_id, $svr_id, $svr_pool_id)
 {
     $model = DcmdApp::findOne($app_id);
     ///判断用户所属的系统组是否和该应用相同
     $query = DcmdUserGroup::findOne(['uid' => Yii::$app->user->getId(), 'gid' => $model['sa_gid']]);
     if ($query == NULL) {
         Yii::$app->getSession()->setFlash('success', NULL);
         Yii::$app->getSession()->setFlash('error', "对不起, 你没有权限!");
         return $this->redirect(array('dcmd-service-pool/view', 'id' => $svr_pool_id));
     }
     $searchModel = new DcmdNodeGroupSearch();
     $dataProvider = $searchModel->search(array());
     return $this->render('select_node_group', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'app_id' => $app_id, 'svr_id' => $svr_id, 'svr_pool_id' => $svr_pool_id]);
 }