From 498abdc06027309b5e196bcbf8ee0e574fcbaa0c Mon Sep 17 00:00:00 2001 From: msyu Date: Mon, 7 Apr 2025 14:55:12 +0300 Subject: [PATCH] 081 instance.explained status --- v1/Application.cfc | 2 +- v1/resources/instance.cfc | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/v1/Application.cfc b/v1/Application.cfc index 779a569..e5a5eee 100644 --- a/v1/Application.cfc +++ b/v1/Application.cfc @@ -51,7 +51,7 @@ //variables.framework.docs={}; variables.framework.docs.APIName="Deck API"; - variables.framework.docs.APIVersion="0.080"; + variables.framework.docs.APIVersion="0.081"; variables.framework.globalHeaders = structNew(); variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location"; diff --git a/v1/resources/instance.cfc b/v1/resources/instance.cfc index c37bc32..fd3283d 100644 --- a/v1/resources/instance.cfc +++ b/v1/resources/instance.cfc @@ -38,6 +38,21 @@ u.login as updater_login u.shortname as updater_shortname (select cast(st.instance_data->>'params' as json)->>'resourceRealm' from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) as resourceRealm + + (case + when + (select st.instance_data->>'isDeleted' from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) = 'true' then 'deleted' + when + (select st.instance_data->>'suspended' from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) = 'true' then 'suspended' + when + (select coalesce(st.instance_data->>'isDeleted','false') from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) = 'false' AND (select coalesce(st.instance_data->>'suspended','false') from instance_state st where st.instance_uid=e.instance_uid order by version desc limit 1) = 'false' then 'running' + when + not exists (select * from instance_operation o where o.instance_uid=e.instance_uid) then 'not configured' + when + not exists (select * from instance_state st where st.instance_uid=e.instance_uid) then 'not created' + else null end + ) as explained_status + from instance e left outer join specification_item i on (e.specification_item_id=i.specification_item_id)