mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-17 06:24:32 +00:00
Remove bruno
This commit is contained in:
@@ -1,17 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Create API Key
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
put {
|
|
||||||
url: http://localhost:3000/api/v1/api-key
|
|
||||||
body: json
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"isRoot": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Delete API Key
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
delete {
|
|
||||||
url: http://localhost:3000/api/v1/api-key/dm47aacqxxn3ubj
|
|
||||||
body: none
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: List API Key Actions
|
|
||||||
type: http
|
|
||||||
seq: 6
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/api-key/ex0izu2c37fjz9x/actions
|
|
||||||
body: none
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: List Org API Keys
|
|
||||||
type: http
|
|
||||||
seq: 4
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/org/home-lab/api-keys
|
|
||||||
body: none
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: List Root API Keys
|
|
||||||
type: http
|
|
||||||
seq: 3
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/root/api-keys
|
|
||||||
body: none
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Set API Key Actions
|
|
||||||
type: http
|
|
||||||
seq: 5
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/api-key/ex0izu2c37fjz9x/actions
|
|
||||||
body: json
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"actionIds": ["listSites"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Set API Key Orgs
|
|
||||||
type: http
|
|
||||||
seq: 7
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/api-key/ex0izu2c37fjz9x/orgs
|
|
||||||
body: json
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"orgIds": ["home-lab"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: API Keys
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: 2fa-disable
|
|
||||||
type: http
|
|
||||||
seq: 6
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/auth/2fa/disable
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"password": "aaaaa-1A",
|
|
||||||
"code": "377289"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: 2fa-enable
|
|
||||||
type: http
|
|
||||||
seq: 4
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/auth/2fa/enable
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"code": "374138"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: 2fa-request
|
|
||||||
type: http
|
|
||||||
seq: 5
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/auth/2fa/request
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"password": "aaaaa-1A"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: change-password
|
|
||||||
type: http
|
|
||||||
seq: 9
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/auth/change-password
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"oldPassword": "",
|
|
||||||
"newPassword": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: login
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/auth/login
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"email": "admin@fosrl.io",
|
|
||||||
"password": "Password123!"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: logout
|
|
||||||
type: http
|
|
||||||
seq: 3
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:4000/api/v1/auth/logout
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: reset-password-request
|
|
||||||
type: http
|
|
||||||
seq: 10
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/auth/reset-password/request
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"email": "milo@pangolin.net"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: reset-password
|
|
||||||
type: http
|
|
||||||
seq: 11
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/auth/reset-password
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"token": "3uhsbom72dwdhboctwrtntyd6jrlg4jtf5oaxy4k",
|
|
||||||
"newPassword": "aaaaa-1A",
|
|
||||||
"code": "6irqCGR3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: signup
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
put {
|
|
||||||
url: http://localhost:3000/api/v1/auth/signup
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"email": "numbat@pangolin.net",
|
|
||||||
"password": "Password123!"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: verify-email-request
|
|
||||||
type: http
|
|
||||||
seq: 8
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/auth/verify-email/request
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: verify-email
|
|
||||||
type: http
|
|
||||||
seq: 7
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
url: http://localhost:3000/api/v1/auth/verify-email
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"code": "50317187"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: verify-user
|
|
||||||
type: http
|
|
||||||
seq: 4
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3001/api/v1/badger/verify-user?sessionId=mb52273jkb6t3oys2bx6ur5x7rcrkl26c7warg3e
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
params:query {
|
|
||||||
sessionId: mb52273jkb6t3oys2bx6ur5x7rcrkl26c7warg3e
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: createClient
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
put {
|
|
||||||
url: http://localhost:3000/api/v1/site/1/client
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"siteId": 1,
|
|
||||||
"name": "test",
|
|
||||||
"type": "olm",
|
|
||||||
"subnet": "100.90.129.4/30",
|
|
||||||
"olmId": "029yzunhx6nh3y5",
|
|
||||||
"secret": "l0ymp075y3d4rccb25l6sqpgar52k09etunui970qq5gj7x6"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: pickClientDefaults
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/site/1/pick-client-defaults
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Create OIDC Provider
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
put {
|
|
||||||
url: http://localhost:3000/api/v1/org/home-lab/idp/oidc
|
|
||||||
body: json
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"clientId": "JJoSvHCZcxnXT2sn6CObj6a21MuKNRXs3kN5wbys",
|
|
||||||
"clientSecret": "2SlGL2wOGgMEWLI9yUuMAeFxre7qSNJVnXMzyepdNzH1qlxYnC4lKhhQ6a157YQEkYH3vm40KK4RCqbYiF8QIweuPGagPX3oGxEj2exwutoXFfOhtq4hHybQKoFq01Z3",
|
|
||||||
"authUrl": "http://localhost:9000/application/o/authorize/",
|
|
||||||
"tokenUrl": "http://localhost:9000/application/o/token/",
|
|
||||||
"scopes": ["email", "openid", "profile"],
|
|
||||||
"userIdentifier": "email"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Generate OIDC URL
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1
|
|
||||||
body: none
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: IDP
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Traefik Config
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3001/api/v1/traefik-config
|
|
||||||
body: none
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Internal
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Create Newt
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/newt
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Get Token
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/auth/newt/get-token
|
|
||||||
body: json
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
body:json {
|
|
||||||
{
|
|
||||||
"newtId": "o0d4rdxq3stnz7b",
|
|
||||||
"secret": "sy7l09fnaesd03iwrfp9m3qf0ryn19g0zf3dqieaazb4k7vk"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: createOlm
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
put {
|
|
||||||
url: http://localhost:3000/api/v1/olm
|
|
||||||
body: none
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
|
|
||||||
settings {
|
|
||||||
encodeUrl: true
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Olm
|
|
||||||
seq: 15
|
|
||||||
}
|
|
||||||
|
|
||||||
auth {
|
|
||||||
mode: inherit
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Check Id
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/org/checkId
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: listOrgs
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url:
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: createRemoteExitNode
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
put {
|
|
||||||
url: http://localhost:4000/api/v1/org/org_i21aifypnlyxur2/remote-exit-node
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: listResourcesByOrg
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url:
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: listResourcesBySite
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/site/1/resources?limit=10&offset=0
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
params:query {
|
|
||||||
limit: 10
|
|
||||||
offset: 0
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Get Site
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/org/test/sites/mexican-mole-lizard-windy
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: listSites
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url:
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: listTargets
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/resource/web.main.localhost/targets?limit=10&offset=0
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
|
|
||||||
params:query {
|
|
||||||
limit: 10
|
|
||||||
offset: 0
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: Test
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1
|
|
||||||
body: none
|
|
||||||
auth: inherit
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: traefik-config
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3001/api/v1/traefik-config
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: adminListUsers
|
|
||||||
type: http
|
|
||||||
seq: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url: http://localhost:3000/api/v1/users
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: adminRemoveUser
|
|
||||||
type: http
|
|
||||||
seq: 3
|
|
||||||
}
|
|
||||||
|
|
||||||
delete {
|
|
||||||
url: http://localhost:3000/api/v1/user/ky5r7ivqs8wc7u4
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
meta {
|
|
||||||
name: getUser
|
|
||||||
type: http
|
|
||||||
seq: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get {
|
|
||||||
url:
|
|
||||||
body: none
|
|
||||||
auth: none
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "1",
|
|
||||||
"name": "Pangolin",
|
|
||||||
"type": "collection",
|
|
||||||
"ignore": [
|
|
||||||
"node_modules",
|
|
||||||
".git"
|
|
||||||
],
|
|
||||||
"presets": {
|
|
||||||
"requestType": "http",
|
|
||||||
"requestUrl": "http://localhost:3000/api/v1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,6 +24,8 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
import type { PaginationState } from "@tanstack/react-table";
|
||||||
|
import type { DataTablePaginationState } from "@app/components/ui/data-table";
|
||||||
|
|
||||||
type AlertingRulesTableProps = {
|
type AlertingRulesTableProps = {
|
||||||
orgId: string;
|
orgId: string;
|
||||||
@@ -106,16 +108,39 @@ export default function AlertingRulesTable({ orgId }: AlertingRulesTableProps) {
|
|||||||
const [deleteOpen, setDeleteOpen] = useState(false);
|
const [deleteOpen, setDeleteOpen] = useState(false);
|
||||||
const [selected, setSelected] = useState<AlertRuleRow | null>(null);
|
const [selected, setSelected] = useState<AlertRuleRow | null>(null);
|
||||||
const [togglingId, setTogglingId] = useState<number | null>(null);
|
const [togglingId, setTogglingId] = useState<number | null>(null);
|
||||||
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
|
const [pageSize, setPageSize] = useState(() => {
|
||||||
|
if (typeof window === "undefined") return 20;
|
||||||
|
try {
|
||||||
|
const stored = localStorage.getItem("Org-alerting-rules-table-size");
|
||||||
|
if (stored) {
|
||||||
|
const parsed = parseInt(stored, 10);
|
||||||
|
if (parsed > 0 && parsed <= 1000) return parsed;
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
return 20;
|
||||||
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: rows = [],
|
data,
|
||||||
isLoading,
|
isLoading,
|
||||||
refetch,
|
refetch,
|
||||||
isRefetching
|
isRefetching
|
||||||
} = useQuery(orgQueries.alertRules({ orgId }));
|
} = useQuery(orgQueries.alertRules({ orgId, limit: pageSize, offset: pageIndex * pageSize }));
|
||||||
|
|
||||||
|
const rows = data?.alertRules ?? [];
|
||||||
|
const total = data?.pagination.total ?? 0;
|
||||||
|
const pageCount = Math.max(1, Math.ceil(total / pageSize));
|
||||||
|
|
||||||
|
const paginationState: DataTablePaginationState = { pageIndex, pageSize, pageCount };
|
||||||
|
|
||||||
|
const handlePaginationChange = (newState: PaginationState) => {
|
||||||
|
setPageIndex(newState.pageIndex);
|
||||||
|
setPageSize(newState.pageSize);
|
||||||
|
};
|
||||||
|
|
||||||
const invalidate = () =>
|
const invalidate = () =>
|
||||||
queryClient.invalidateQueries(orgQueries.alertRules({ orgId }));
|
queryClient.invalidateQueries({ queryKey: ["ORG", orgId, "ALERT_RULES"] });
|
||||||
|
|
||||||
const setEnabled = async (rule: AlertRuleRow, enabled: boolean) => {
|
const setEnabled = async (rule: AlertRuleRow, enabled: boolean) => {
|
||||||
setTogglingId(rule.alertRuleId);
|
setTogglingId(rule.alertRuleId);
|
||||||
@@ -296,6 +321,8 @@ export default function AlertingRulesTable({ orgId }: AlertingRulesTableProps) {
|
|||||||
enableColumnVisibility
|
enableColumnVisibility
|
||||||
stickyLeftColumn="name"
|
stickyLeftColumn="name"
|
||||||
stickyRightColumn="rowActions"
|
stickyRightColumn="rowActions"
|
||||||
|
pagination={paginationState}
|
||||||
|
onPaginationChange={handlePaginationChange}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|||||||
import { ArrowUpDown, ArrowUpRight, MoreHorizontal } from "lucide-react";
|
import { ArrowUpDown, ArrowUpRight, MoreHorizontal } from "lucide-react";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import type { PaginationState } from "@tanstack/react-table";
|
||||||
|
import type { DataTablePaginationState } from "@app/components/ui/data-table";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert";
|
import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert";
|
||||||
import { usePaidStatus } from "@app/hooks/usePaidStatus";
|
import { usePaidStatus } from "@app/hooks/usePaidStatus";
|
||||||
@@ -75,21 +77,54 @@ export default function HealthChecksTable({
|
|||||||
const [deleteOpen, setDeleteOpen] = useState(false);
|
const [deleteOpen, setDeleteOpen] = useState(false);
|
||||||
const [selected, setSelected] = useState<HealthCheckRow | null>(null);
|
const [selected, setSelected] = useState<HealthCheckRow | null>(null);
|
||||||
const [togglingId, setTogglingId] = useState<number | null>(null);
|
const [togglingId, setTogglingId] = useState<number | null>(null);
|
||||||
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
|
const [pageSize, setPageSize] = useState(() => {
|
||||||
|
if (typeof window === "undefined") return 20;
|
||||||
|
try {
|
||||||
|
const stored = localStorage.getItem(
|
||||||
|
"Org-standalone-health-checks-table-size"
|
||||||
|
);
|
||||||
|
if (stored) {
|
||||||
|
const parsed = parseInt(stored, 10);
|
||||||
|
if (parsed > 0 && parsed <= 1000) return parsed;
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
return 20;
|
||||||
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: rows = [],
|
data,
|
||||||
isLoading,
|
isLoading,
|
||||||
refetch,
|
refetch,
|
||||||
isRefetching
|
isRefetching
|
||||||
} = useQuery({
|
} = useQuery({
|
||||||
...orgQueries.standaloneHealthChecks({ orgId }),
|
...orgQueries.standaloneHealthChecks({
|
||||||
|
orgId,
|
||||||
|
limit: pageSize,
|
||||||
|
offset: pageIndex * pageSize
|
||||||
|
}),
|
||||||
refetchInterval: 10_000
|
refetchInterval: 10_000
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const rows = data?.healthChecks ?? [];
|
||||||
|
const total = data?.pagination.total ?? 0;
|
||||||
|
const pageCount = Math.max(1, Math.ceil(total / pageSize));
|
||||||
|
|
||||||
|
const paginationState: DataTablePaginationState = {
|
||||||
|
pageIndex,
|
||||||
|
pageSize,
|
||||||
|
pageCount
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePaginationChange = (newState: PaginationState) => {
|
||||||
|
setPageIndex(newState.pageIndex);
|
||||||
|
setPageSize(newState.pageSize);
|
||||||
|
};
|
||||||
|
|
||||||
const invalidate = () =>
|
const invalidate = () =>
|
||||||
queryClient.invalidateQueries(
|
queryClient.invalidateQueries({
|
||||||
orgQueries.standaloneHealthChecks({ orgId })
|
queryKey: ["ORG", orgId, "STANDALONE_HEALTH_CHECKS"]
|
||||||
);
|
});
|
||||||
|
|
||||||
const handleToggleEnabled = async (
|
const handleToggleEnabled = async (
|
||||||
row: HealthCheckRow,
|
row: HealthCheckRow,
|
||||||
@@ -356,6 +391,8 @@ export default function HealthChecksTable({
|
|||||||
enableColumnVisibility
|
enableColumnVisibility
|
||||||
stickyLeftColumn="name"
|
stickyLeftColumn="name"
|
||||||
stickyRightColumn="rowActions"
|
stickyRightColumn="rowActions"
|
||||||
|
pagination={paginationState}
|
||||||
|
onPaginationChange={handlePaginationChange}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -256,14 +256,25 @@ export const orgQueries = {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
alertRules: ({ orgId }: { orgId: string }) =>
|
alertRules: ({
|
||||||
|
orgId,
|
||||||
|
limit = 20,
|
||||||
|
offset = 0
|
||||||
|
}: {
|
||||||
|
orgId: string;
|
||||||
|
limit?: number;
|
||||||
|
offset?: number;
|
||||||
|
}) =>
|
||||||
queryOptions({
|
queryOptions({
|
||||||
queryKey: ["ORG", orgId, "ALERT_RULES"] as const,
|
queryKey: ["ORG", orgId, "ALERT_RULES", { limit, offset }] as const,
|
||||||
queryFn: async ({ signal, meta }) => {
|
queryFn: async ({ signal, meta }) => {
|
||||||
const res = await meta!.api.get<
|
const res = await meta!.api.get<
|
||||||
AxiosResponse<ListAlertRulesResponse>
|
AxiosResponse<ListAlertRulesResponse>
|
||||||
>(`/org/${orgId}/alert-rules`, { signal });
|
>(`/org/${orgId}/alert-rules?limit=${limit}&offset=${offset}`, { signal });
|
||||||
return res.data.data.alertRules;
|
return {
|
||||||
|
alertRules: res.data.data.alertRules,
|
||||||
|
pagination: res.data.data.pagination
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -289,9 +300,17 @@ export const orgQueries = {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
standaloneHealthChecks: ({ orgId }: { orgId: string }) =>
|
standaloneHealthChecks: ({
|
||||||
|
orgId,
|
||||||
|
limit = 20,
|
||||||
|
offset = 0
|
||||||
|
}: {
|
||||||
|
orgId: string;
|
||||||
|
limit?: number;
|
||||||
|
offset?: number;
|
||||||
|
}) =>
|
||||||
queryOptions({
|
queryOptions({
|
||||||
queryKey: ["ORG", orgId, "STANDALONE_HEALTH_CHECKS"] as const,
|
queryKey: ["ORG", orgId, "STANDALONE_HEALTH_CHECKS", { limit, offset }] as const,
|
||||||
queryFn: async ({ signal, meta }) => {
|
queryFn: async ({ signal, meta }) => {
|
||||||
const res = await meta!.api.get<
|
const res = await meta!.api.get<
|
||||||
AxiosResponse<{
|
AxiosResponse<{
|
||||||
@@ -325,8 +344,11 @@ export const orgQueries = {
|
|||||||
offset: number;
|
offset: number;
|
||||||
};
|
};
|
||||||
}>
|
}>
|
||||||
>(`/org/${orgId}/health-checks`, { signal });
|
>(`/org/${orgId}/health-checks?limit=${limit}&offset=${offset}`, { signal });
|
||||||
return res.data.data.healthChecks;
|
return {
|
||||||
|
healthChecks: res.data.data.healthChecks,
|
||||||
|
pagination: res.data.data.pagination
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
siteStatusHistory: ({
|
siteStatusHistory: ({
|
||||||
|
|||||||
Reference in New Issue
Block a user