Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
bbf12088
Unverified
Commit
bbf12088
authored
Feb 17, 2021
by
kay delaney
Committed by
GitHub
Feb 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce functions for interacting with library panels API (#30993)
parent
c21e45e4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
public/app/features/library-panels/state/api.ts
+57
-0
No files found.
public/app/features/library-panels/state/api.ts
0 → 100644
View file @
bbf12088
import
{
getBackendSrv
}
from
'app/core/services/backend_srv'
;
export
interface
LibraryPanelDTO
{
id
:
number
;
orgId
:
number
;
folderId
:
number
;
uid
:
string
;
name
:
string
;
model
:
any
;
meta
:
LibraryPanelDTOMeta
;
}
export
interface
LibraryPanelDTOMeta
{
canEdit
:
boolean
;
created
:
string
;
updated
:
string
;
createdBy
:
LibraryPanelDTOMetaUser
;
updatedBy
:
LibraryPanelDTOMetaUser
;
}
export
interface
LibraryPanelDTOMetaUser
{
id
:
number
;
name
:
string
;
avatarUrl
:
string
;
}
export
async
function
getLibraryPanels
():
Promise
<
LibraryPanelDTO
[]
>
{
const
{
result
}
=
await
getBackendSrv
().
get
(
`/api/library-panels`
);
return
result
;
}
export
async
function
addLibraryPanel
(
panelSaveModel
:
any
,
folderId
:
number
):
Promise
<
LibraryPanelDTO
>
{
const
{
result
}
=
await
getBackendSrv
().
post
(
`/api/library-panels`
,
{
folderId
,
name
:
panelSaveModel
.
title
,
model
:
panelSaveModel
,
});
return
result
;
}
export
async
function
updateLibraryPanel
(
panelSaveModel
:
any
,
folderId
:
number
):
Promise
<
LibraryPanelDTO
>
{
const
{
result
}
=
await
getBackendSrv
().
patch
(
`/api/library-panels/
${
panelSaveModel
.
libraryPanel
.
uid
}
`
,
{
folderId
,
name
:
panelSaveModel
.
title
,
model
:
panelSaveModel
,
});
return
result
;
}
export
function
deleteLibraryPanel
(
uid
:
string
):
Promise
<
{
message
:
string
}
>
{
return
getBackendSrv
().
delete
(
`/api/library-panels/
${
uid
}
`
);
}
export
async
function
getLibraryPanelConnectedDashboards
(
libraryPanelUid
:
string
):
Promise
<
number
[]
>
{
const
{
result
}
=
await
getBackendSrv
().
get
(
`/api/library-panels/
${
libraryPanelUid
}
/dashboards`
);
return
result
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment