diff --git a/v1/Application.cfc b/v1/Application.cfc
index cd746d6..c4f0cc8 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.110"; /*$ git config --global --unset user.password*/
+ variables.framework.docs.APIVersion="0.111"; /*$ git config --global --unset user.password*/
variables.framework.globalHeaders = structNew();
diff --git a/v1/resources/instance.cfc b/v1/resources/instance.cfc
index 9b93770..530db78 100644
--- a/v1/resources/instance.cfc
+++ b/v1/resources/instance.cfc
@@ -37,27 +37,24 @@
e.updater_id
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
-
- (select coalesce((io.dt_start IS NOT NULL AND io.dt_finish IS NULL AND io.submit_result='201'),false) from instance_operation io where io.instance_uid=e.instance_uid order by dt_submit desc limit 1) as operation_is_in_progress
- (select coalesce((io.dt_start IS NULL AND io.submit_result='201'),false) from instance_operation io where io.instance_uid=e.instance_uid order by dt_submit desc limit 1) as operation_is_pending
-
-
- (case
- when
- not exists (select * from instance_state st where st.instance_uid=e.instance_uid) then 'not created'
- 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->>'isSuspended' 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->>'isSuspended','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'
-
- else null end
- ) as explained_status
-
+ cast(st.instance_data->>'params' as json)->>'resourceRealm' as resource_realm
+ coalesce((io.dt_start IS NOT NULL AND io.dt_finish IS NULL AND io.submit_result='201'),false) as operation_is_in_progress
+ coalesce((io.dt_start IS NULL AND io.submit_result='201'),false) as operation_is_pending
+ case
+ when io.operation IN ('delete', 'suspend') AND io.is_successful then 0 /*null*/
+ when io.is_successful then extract('epoch' from CURRENT_TIMESTAMP - coalesce(io.dt_finish,CURRENT_TIMESTAMP))
+ else 0 end
+ as uptime
+ (case
+ when st.instance_uid IS NULL then 'not created'
+ when st.is_deleted = 'true' then 'deleted'
+ when st.is_suspended = 'true' then 'suspended'
+ /*when coalesce(st.is_deleted,'false') = 'false' AND coalesce(st.is_suspended, 'false') = 'false' then 'running'*/
+ when coalesce(st.is_deleted,'false') = 'false' AND coalesce(st.is_suspended, 'false') = 'false' then 'running'
+ when io.instance_uid IS NULL then 'not configured'
+ else null end
+ ) as explained_status
+
from instance e
left outer join specification_item i on (e.specification_item_id=i.specification_item_id)
@@ -66,6 +63,17 @@
left outer join contragent k on (d.contragent_id=k.contragent_id)
left outer join svc v on (e.service_id=v.svc_id)
left outer join usr u on (e.updater_id=u.usr_id)
+ left outer join (select ist.instance_state_uid, ist.instance_uid, ist.version, ist.dt_state, ist.is_test
+ ,(ist.instance_data->>'isSuspended') as is_suspended
+ ,(ist.instance_data->>'isDeleted') as is_deleted
+ ,ist.instance_data
+ from instance_state ist join (select instance_uid, max(version) as version from instance_state group by 1) lastv
+ on (ist.instance_uid=lastv.instance_uid AND ist.version=lastv.version) ) st
+ on (e.instance_uid=st.instance_uid)
+ left outer join (select o.instance_operation_uid, o.instance_uid, o.operation, o.dt_submit, o.submit_result, o.dt_start, o.dt_finish, o.is_successful
+ from instance_operation o join (select instance_uid, max(dt_submit) as dt_submit from instance_operation group by 1) lastv
+ on (o.instance_uid=lastv.instance_uid AND o.dt_submit=lastv.dt_submit) ) io
+ on (e.instance_uid=io.instance_uid)
where e.instance_uid=
AND s.specification_id=
@@ -257,7 +265,7 @@
-
+
diff --git a/v1/resources/instance_ls.cfc b/v1/resources/instance_ls.cfc
index 1c7fffa..0b3e523 100644
--- a/v1/resources/instance_ls.cfc
+++ b/v1/resources/instance_ls.cfc
@@ -178,8 +178,7 @@
to_char(st.dt_state, 'YYYY-MM-DD"T"HH24:MI:SS.FF3TZHTZM') as dt_state
- (case
-
+ (case
when st.instance_uid IS NULL then 'not created'
when st.is_deleted = 'true' then 'deleted'
when st.is_suspended = 'true' then 'suspended'
diff --git a/v1/resources/instance_operation_cfs_param.cfc b/v1/resources/instance_operation_cfs_param.cfc
index b350077..2e821cb 100644
--- a/v1/resources/instance_operation_cfs_param.cfc
+++ b/v1/resources/instance_operation_cfs_param.cfc
@@ -251,6 +251,7 @@
+
@@ -271,6 +272,7 @@
+
diff --git a/v1/resources/instance_operation_cfs_subparam_ls.cfc b/v1/resources/instance_operation_cfs_subparam_ls.cfc
new file mode 100644
index 0000000..6e8401c
--- /dev/null
+++ b/v1/resources/instance_operation_cfs_subparam_ls.cfc
@@ -0,0 +1,280 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select instance_operation_cfs_subparam from
+ from instance_operation_cfs_subparam s
+ where iop.instance_operation_cfs_param_uid=
+ AND si.specification_id=
+
+
+
+ select count(*) as cnt
+ from instance_operation_cfs_param iop
+ where iop.instance_operation_cfs_param_uid=
+ AND si.specification_id=
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select
+ io.dt_submit, io.submit_result
+ from instance_operation_cfs_param iop
+ join instance_operation io on iop.instance_operation_uid=io.instance_operation_uid
+ where iop.instance_operation_cfs_param_uid=
+
+
+
+
+
+
+ delete from instance_operation_cfs_param
+ where instance_operation_cfs_param_uid=
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ update instance_operation_cfs_param set
+ dt_created=
+ ,creator_id=
+ ,param_value=
+ ,note=
+ where instance_operation_cfs_param_uid=
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select svc_operation_cfs_param_id
+ from instance_operation_cfs_param
+ where instance_operation_cfs_param_uid=
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select
+ sp.svc_operation_cfs_param_id
+ ,sp.svc_operation_cfs_subparam_id
+ ,sp.svc_operation_cfs_subparam
+ ,sp.label
+ ,sp.data_type
+ ,sp.value_list
+ ,sp.is_required
+ ,sp.descr
+ ,sp.man
+ ,sp.default_value
+ ,sp.minlength
+ ,sp.maxlength
+ ,sp.regex
+ ,sp.sort
+ ,sp.is_sensitive
+ from svc_operation_cfs_subparam sp
+ where sp.svc_operation_cfs_param_id=
+ order by sp.sort
+
+
+
+
+ select
+ sp.instance_operation_cfs_param_uid::text as instance_operation_cfs_param_uid
+ ,sp.instance_operation_cfs_subparam
+ ,sp.note
+ ,sp.sort
+ ,sp.is_sensitive
+ from instance_operation_cfs_subparam sp
+ where sp.instance_operation_cfs_param_uid=
+ order by sp.sort
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select distinct r.resource_realm, r.sort
+ from resource_realm r
+ join resource_realm_access a on
+ (r.resource_realm_id=a.resource_realm_id
+ AND (a.contract_id=
+ OR a.contract_id=0) /*0 means access to any contract*/
+ AND a.is_enabled)
+ join svc s on r.resource_realm_type_id=s.resource_realm_type_id
+ where s.svc_id=
+ order by r.sort, r.resource_realm
+
+
+
+
+
\ No newline at end of file
diff --git a/v1/resources/svc_operation.cfc b/v1/resources/svc_operation.cfc
index 079a9c7..bc15ea8 100644
--- a/v1/resources/svc_operation.cfc
+++ b/v1/resources/svc_operation.cfc
@@ -41,6 +41,7 @@
p.is_required
p.default_value
p.default_compute
+ p.func
p.regex
p.unique_scope
p.maxlength