/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = WirelessDeviceTaskSummary::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'taskId' => $this->taskId, 'devId' => $this->devId, 'instId' => $this->instId]);
     $query->andFilterWhere(['like', 'taskName', $this->taskName])->andFilterWhere(['like', 'objIndex', $this->objIndex])->andFilterWhere(['like', 'objIndexDesc', $this->objIndexDesc])->andFilterWhere(['like', 'averageValue', $this->averageValue])->andFilterWhere(['like', 'maximumValue', $this->maximumValue])->andFilterWhere(['like', 'minimumValue', $this->minimumValue])->andFilterWhere(['like', 'currentValue', $this->currentValue])->andFilterWhere(['like', 'summaryValue', $this->summaryValue]);
     return $dataProvider;
 }
 public function getRightOutSpeed()
 {
     $data = WirelessDeviceTaskSummary::find()->where(["devId" => $this->rightDevice, "taskId" => 5])->orderBy("instId\n        desc")->select("currentValue")->asArray()->scalar();
     return $this->bpsToKbps($data);
 }
 public function actionAjaxDeviceTip()
 {
     $this->layout = false;
     $id = Yii::$app->request->get("id");
     $fromWhere = Yii::$app->request->get("fromWhere");
     if ($fromWhere == 'path') {
         return $this->pathDetail(Yii::$app->request->get("from"), Yii::$app->request->get("to"));
     }
     $device = WirelessDeviceInfo::find()->with(["type", "model"])->where(["id" => $id])->one();
     $deviceConfig = ArrayHelper::map(InfoConfig::getTipConfig(1), "key", "value");
     $perfConfig = ArrayHelper::map(InfoConfig::getTipConfig(2), "key", "value");
     $perfData = WirelessDeviceTaskSummary::find()->where(["taskId" => array_values($perfConfig), "devId" => $id])->select(["taskId", "currentValue"])->groupBy("taskId")->asArray()->all();
     $perfData = ArrayHelper::map($perfData, "taskId", "currentValue");
     return $this->render("tip", ["model" => $device, "deviceConfig" => $deviceConfig, "perfConfig" => $perfConfig, "perfData" => $perfData]);
 }