mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-02-01 16:51:52 +00:00
[API] Update build.func to set the status message correct (#1878)
* Testing * Testing * update /data/page.tsx * Update page.tsx
This commit is contained in:
parent
a0eb173824
commit
cd4bcefa58
@ -195,7 +195,17 @@ const DataFetcher: React.FC = () => {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{paginatedData.map((item, index) => (
|
{paginatedData.map((item, index) => (
|
||||||
<tr key={index}>
|
<tr key={index}>
|
||||||
<td className="px-4 py-2 border-b">{item.status === "done" ? "✔️" : item.status === "failed" ? "❌" : item.status}</td>
|
<td className="px-4 py-2 border-b">
|
||||||
|
{item.status === "done" ? (
|
||||||
|
"✔️"
|
||||||
|
) : item.status === "failed" ? (
|
||||||
|
"❌"
|
||||||
|
) : item.status === "installing" ? (
|
||||||
|
"🔄"
|
||||||
|
) : (
|
||||||
|
item.status
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
<td className="px-4 py-2 border-b">{item.nsapp}</td>
|
<td className="px-4 py-2 border-b">{item.nsapp}</td>
|
||||||
<td className="px-4 py-2 border-b">{item.os_type}</td>
|
<td className="px-4 py-2 border-b">{item.os_type}</td>
|
||||||
<td className="px-4 py-2 border-b">{item.os_version}</td>
|
<td className="px-4 py-2 border-b">{item.os_version}</td>
|
||||||
|
@ -73,6 +73,7 @@ error_handler() {
|
|||||||
local exit_code="$?"
|
local exit_code="$?"
|
||||||
local line_number="$1"
|
local line_number="$1"
|
||||||
local command="$2"
|
local command="$2"
|
||||||
|
post_update_to_api "failed"
|
||||||
local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}"
|
local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}"
|
||||||
echo -e "\n$error_message\n"
|
echo -e "\n$error_message\n"
|
||||||
}
|
}
|
||||||
@ -813,7 +814,7 @@ post_to_api() {
|
|||||||
"nsapp": "$NSAPP",
|
"nsapp": "$NSAPP",
|
||||||
"method": "$METHOD",
|
"method": "$METHOD",
|
||||||
"pve_version": "$pve_version",
|
"pve_version": "$pve_version",
|
||||||
"status": "failed",
|
"status": "installing",
|
||||||
"random_id": "$RANDOM_UUID"
|
"random_id": "$RANDOM_UUID"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -829,12 +830,17 @@ EOF
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
POST_UPDATE_DONE=false
|
||||||
|
|
||||||
post_update_to_api() {
|
post_update_to_api() {
|
||||||
|
if [ "$POST_UPDATE_DONE" = true ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
local API_URL="http://api.community-scripts.org/upload/updatestatus"
|
local API_URL="http://api.community-scripts.org/upload/updatestatus"
|
||||||
|
local status="${1:-}"
|
||||||
JSON_PAYLOAD=$(cat <<EOF
|
JSON_PAYLOAD=$(cat <<EOF
|
||||||
{
|
{
|
||||||
"status": "done",
|
"status": "$status",
|
||||||
"random_id": "$RANDOM_UUID"
|
"random_id": "$RANDOM_UUID"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@ -845,10 +851,10 @@ EOF
|
|||||||
-d "$JSON_PAYLOAD")
|
-d "$JSON_PAYLOAD")
|
||||||
|
|
||||||
if [ "$RESPONSE" -ne 201 ] && [ "$RESPONSE" -ne 302 ]; then
|
if [ "$RESPONSE" -ne 201 ] && [ "$RESPONSE" -ne 302 ]; then
|
||||||
msg_error "API request failed with HTTP code $RESPONSE"
|
msg_error "API UPDATE request failed with HTTP code $RESPONSE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
POST_UPDATE_DONE=true
|
||||||
}
|
}
|
||||||
|
|
||||||
diagnostics_check(){
|
diagnostics_check(){
|
||||||
@ -1231,3 +1237,8 @@ EOF
|
|||||||
post_update_to_api
|
post_update_to_api
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trap 'post_update_to_api "done"' EXIT
|
||||||
|
trap 'post_update_to_api "failed"' SIGINT
|
||||||
|
trap 'post_update_to_api "failed"' SIGTERM
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user