Skip to content

Commit

Permalink
+ Add api: batch query instances status.
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjianhua committed Sep 13, 2022
1 parent b9dbbdd commit 8972341
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions frontend/module/cne/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,37 @@ public function queryStatus($instance)
return $result;
}

/**
* Query status of instance list.
*
* @param object $instanceList
* @access public
* @return object|null
*/
public function batchQueryStatus($instanceList)
{
$apiParams = new stdclass;
$apiParams->cluster = '';
$apiParams->apps = array();

foreach($instanceList as $instance)
{
$app = new stdclass;
$app->name = $instance->k8name;
$app->chart = $instance->chart;
$app->namespace = $instance->spaceData->k8space;
$app->channel = empty($instance->channel) ? $this->config->CNE->api->channel : $instance->channel;

$apiParams->apps[] = $app;
}

$apiUrl = "/api/cne/app/status/multi";
$result = $this->apiGet($apiUrl, $apiParams, $this->config->CNE->api->headers);
if($result && $result->code == 200) return $result;

return $result;
}

/**
* Get all database list of app.
*
Expand Down

0 comments on commit 8972341

Please sign in to comment.