mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
infrastructure for detecting limited accounts (#320)
This commit is contained in:
parent
9591f5150e
commit
d0cedaf6e5
@ -84,8 +84,20 @@ func overviewHandler(_ metadata.OverviewParams, principal *rest_model_zrok.Princ
|
||||
}
|
||||
envShrsList = append(envShrsList, envShrs)
|
||||
}
|
||||
var alj *store.AccountLimitJournal
|
||||
aljEmpty, err := str.IsAccountLimitJournalEmpty(int(principal.ID), tx)
|
||||
if err != nil {
|
||||
logrus.Errorf("error checking account limit journal for '%v': %v", principal.Email, err)
|
||||
}
|
||||
if !aljEmpty {
|
||||
alj, err = str.FindLatestAccountLimitJournal(int(principal.ID), tx)
|
||||
if err != nil {
|
||||
logrus.Errorf("error getting latest account limit journal entry for '%v': %v", principal.Email, err)
|
||||
return metadata.NewOverviewInternalServerError()
|
||||
}
|
||||
}
|
||||
return metadata.NewOverviewOK().WithPayload(&rest_model_zrok.Overview{
|
||||
AccountLimited: false,
|
||||
AccountLimited: alj != nil && alj.Action == store.LimitAction,
|
||||
Environments: envShrsList,
|
||||
})
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ const Visualizer = (props) => {
|
||||
|
||||
useEffect(() => {
|
||||
console.log("visualizer overview", props.overview);
|
||||
setNetworkGraph(mergeGraph(networkGraph, props.user, props.overview.environments));
|
||||
setNetworkGraph(mergeGraph(networkGraph, props.user, props.overview.accountLimited, props.overview.environments));
|
||||
|
||||
if(isSelectionGone(networkGraph, props.selection)) {
|
||||
// if the selection is no longer in the network graph...
|
||||
|
@ -15,7 +15,7 @@ const nodesEqual = (a, b) => {
|
||||
return a.every((e, i) => e.id === b[i].id && e.limited === b[i].limited);
|
||||
}
|
||||
|
||||
export const mergeGraph = (oldGraph, user, newOverview) => {
|
||||
export const mergeGraph = (oldGraph, user, accountLimited, newOverview) => {
|
||||
let newGraph = {
|
||||
nodes: [],
|
||||
links: []
|
||||
@ -25,6 +25,7 @@ export const mergeGraph = (oldGraph, user, newOverview) => {
|
||||
id: user.token,
|
||||
label: user.email,
|
||||
type: "account",
|
||||
limited: !!accountLimited,
|
||||
val: 50
|
||||
}
|
||||
newGraph.nodes.push(accountNode);
|
||||
@ -36,7 +37,7 @@ export const mergeGraph = (oldGraph, user, newOverview) => {
|
||||
label: env.environment.description,
|
||||
type: "environment",
|
||||
val: 50,
|
||||
limited: env.limited
|
||||
limited: !!env.limited || accountNode.limited
|
||||
};
|
||||
newGraph.nodes.push(envNode);
|
||||
newGraph.links.push({
|
||||
@ -55,7 +56,7 @@ export const mergeGraph = (oldGraph, user, newOverview) => {
|
||||
envZId: env.environment.zId,
|
||||
label: shrLabel,
|
||||
type: "share",
|
||||
limited: !!shr.limited,
|
||||
limited: !!shr.limited || envNode.limited,
|
||||
val: 50
|
||||
};
|
||||
newGraph.nodes.push(shrNode);
|
||||
|
Loading…
Reference in New Issue
Block a user