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
47bf1bd2
Commit
47bf1bd2
authored
Sep 11, 2015
by
woodsaj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return 404 when quotas not enabled.
parent
852f9bd2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
pkg/api/quota.go
+10
-0
No files found.
pkg/api/quota.go
View file @
47bf1bd2
...
@@ -4,9 +4,13 @@ import (
...
@@ -4,9 +4,13 @@ import (
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/middleware"
m
"github.com/grafana/grafana/pkg/models"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
)
)
func
GetOrgQuotas
(
c
*
middleware
.
Context
)
Response
{
func
GetOrgQuotas
(
c
*
middleware
.
Context
)
Response
{
if
!
setting
.
Quota
.
Enabled
{
return
ApiError
(
404
,
"Quotas not enabled"
,
nil
)
}
query
:=
m
.
GetQuotasQuery
{
OrgId
:
c
.
ParamsInt64
(
":orgId"
)}
query
:=
m
.
GetQuotasQuery
{
OrgId
:
c
.
ParamsInt64
(
":orgId"
)}
if
err
:=
bus
.
Dispatch
(
&
query
);
err
!=
nil
{
if
err
:=
bus
.
Dispatch
(
&
query
);
err
!=
nil
{
...
@@ -18,6 +22,9 @@ func GetOrgQuotas(c *middleware.Context) Response {
...
@@ -18,6 +22,9 @@ func GetOrgQuotas(c *middleware.Context) Response {
// allow users to query the quotas of their own org.
// allow users to query the quotas of their own org.
func
GetQuotas
(
c
*
middleware
.
Context
)
Response
{
func
GetQuotas
(
c
*
middleware
.
Context
)
Response
{
if
!
setting
.
Quota
.
Enabled
{
return
ApiError
(
404
,
"Quotas not enabled"
,
nil
)
}
query
:=
m
.
GetQuotasQuery
{
OrgId
:
c
.
OrgId
}
query
:=
m
.
GetQuotasQuery
{
OrgId
:
c
.
OrgId
}
if
err
:=
bus
.
Dispatch
(
&
query
);
err
!=
nil
{
if
err
:=
bus
.
Dispatch
(
&
query
);
err
!=
nil
{
...
@@ -28,6 +35,9 @@ func GetQuotas(c *middleware.Context) Response {
...
@@ -28,6 +35,9 @@ func GetQuotas(c *middleware.Context) Response {
}
}
func
UpdateOrgQuota
(
c
*
middleware
.
Context
,
cmd
m
.
UpdateQuotaCmd
)
Response
{
func
UpdateOrgQuota
(
c
*
middleware
.
Context
,
cmd
m
.
UpdateQuotaCmd
)
Response
{
if
!
setting
.
Quota
.
Enabled
{
return
ApiError
(
404
,
"Quotas not enabled"
,
nil
)
}
cmd
.
OrgId
=
c
.
ParamsInt64
(
":orgId"
)
cmd
.
OrgId
=
c
.
ParamsInt64
(
":orgId"
)
cmd
.
Target
=
m
.
QuotaTarget
(
c
.
Params
(
":target"
))
cmd
.
Target
=
m
.
QuotaTarget
(
c
.
Params
(
":target"
))
...
...
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