From 89723410f49c81fa2dcc0fc750c4bccc53ca010c Mon Sep 17 00:00:00 2001 From: wangjianhua Date: Tue, 13 Sep 2022 14:39:37 +0800 Subject: [PATCH] + Add api: batch query instances status. --- frontend/module/cne/model.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/frontend/module/cne/model.php b/frontend/module/cne/model.php index 1f87b940..249fcca9 100644 --- a/frontend/module/cne/model.php +++ b/frontend/module/cne/model.php @@ -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. *