Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F41922610
useMetrics.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
869 B
Referenced Files
None
Subscribers
None
useMetrics.js
View Options
import
{
ref
}
from
'vue'
import
{
metricsApi
}
from
'@/plugins/api'
export
function
useMetrics
()
{
const
metrics
=
ref
([])
const
dailySummary
=
ref
([])
const
loading
=
ref
(
false
)
const
error
=
ref
(
null
)
const
fetchDailySummary
=
async
(
serviceId
,
days
=
30
)
=>
{
loading
.
value
=
true
error
.
value
=
null
try
{
dailySummary
.
value
=
await
metricsApi
.
getDailySummary
(
serviceId
,
days
)
}
catch
(
err
)
{
error
.
value
=
err
.
message
}
finally
{
loading
.
value
=
false
}
}
const
fetchLatestMetrics
=
async
()
=>
{
loading
.
value
=
true
error
.
value
=
null
try
{
metrics
.
value
=
await
metricsApi
.
getLatest
()
}
catch
(
err
)
{
error
.
value
=
err
.
message
}
finally
{
loading
.
value
=
false
}
}
return
{
metrics
,
dailySummary
,
loading
,
error
,
fetchDailySummary
,
fetchLatestMetrics
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 8, 02:58 (6 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3909928
Default Alt Text
useMetrics.js (869 B)
Attached To
Mode
rSP ServPulse
Attached
Detach File
Event Timeline
Log In to Comment