mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge remote-tracking branch 'origin/main' into resource-store
This commit is contained in:
commit
e78a5122ce
@ -4553,6 +4553,9 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "3"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "4"]
|
||||
],
|
||||
"public/app/features/library-panels/components/LibraryPanelCard/LibraryPanelCard.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"]
|
||||
],
|
||||
"public/app/features/library-panels/components/LibraryPanelInfo/LibraryPanelInfo.tsx:5381": [
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "0"],
|
||||
[0, 0, 0, "No untranslated strings. Wrap text with <Trans />", "1"],
|
||||
|
@ -35,11 +35,11 @@ $(DRONE): $(BINGO_DIR)/drone.mod
|
||||
@echo "(re)installing $(GOBIN)/drone-v1.5.0"
|
||||
@cd $(BINGO_DIR) && GOWORK=off CGO_ENABLED=0 $(GO) build -mod=mod -modfile=drone.mod -o=$(GOBIN)/drone-v1.5.0 "github.com/drone/drone-cli/drone"
|
||||
|
||||
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.59.0
|
||||
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.59.1
|
||||
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
|
||||
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
|
||||
@echo "(re)installing $(GOBIN)/golangci-lint-v1.59.0"
|
||||
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.59.0 "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
@echo "(re)installing $(GOBIN)/golangci-lint-v1.59.1"
|
||||
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.59.1 "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||
|
||||
JB := $(GOBIN)/jb-v0.5.1
|
||||
$(JB): $(BINGO_DIR)/jb.mod
|
||||
|
@ -4,4 +4,4 @@ go 1.22
|
||||
|
||||
toolchain go1.22.4
|
||||
|
||||
require github.com/golangci/golangci-lint v1.59.0 // cmd/golangci-lint
|
||||
require github.com/golangci/golangci-lint v1.59.1 // cmd/golangci-lint
|
||||
|
@ -20,6 +20,8 @@ github.com/Antonboom/testifylint v1.2.0 h1:015bxD8zc5iY8QwTp4+RG9I4kIbqwvGX9TrBb
|
||||
github.com/Antonboom/testifylint v1.2.0/go.mod h1:rkmEqjqVnHDRNsinyN6fPSLnoajzFwsCcguJgwADBkw=
|
||||
github.com/Antonboom/testifylint v1.3.0 h1:UiqrddKs1W3YK8R0TUuWwrVKlVAnS07DTUVWWs9c+y4=
|
||||
github.com/Antonboom/testifylint v1.3.0/go.mod h1:NV0hTlteCkViPW9mSR4wEMfwp+Hs1T3dY60bkvSfhpM=
|
||||
github.com/Antonboom/testifylint v1.3.1 h1:Uam4q1Q+2b6H7gvk9RQFw6jyVDdpzIirFOOrbs14eG4=
|
||||
github.com/Antonboom/testifylint v1.3.1/go.mod h1:NV0hTlteCkViPW9mSR4wEMfwp+Hs1T3dY60bkvSfhpM=
|
||||
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
|
||||
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
|
||||
@ -130,6 +132,8 @@ github.com/go-toolsmith/typep v1.1.0 h1:fIRYDyF+JywLfqzyhdiHzRop/GQDxxNhLGQ6gFUN
|
||||
github.com/go-toolsmith/typep v1.1.0/go.mod h1:fVIw+7zjdsMxDA3ITWnH1yOiw1rnTQKCsF/sk2H/qig=
|
||||
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 h1:TQcrn6Wq+sKGkpyPvppOz99zsMBaUOKXq6HSv655U1c=
|
||||
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc=
|
||||
github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/go-xmlfmt/xmlfmt v1.1.2 h1:Nea7b4icn8s57fTx1M5AI4qQT5HEM3rVUO8MuE6g80U=
|
||||
github.com/go-xmlfmt/xmlfmt v1.1.2/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM=
|
||||
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
|
||||
@ -146,10 +150,14 @@ github.com/golangci/golangci-lint v1.57.1 h1:cqhpzkzjDwdN12rfMf1SUyyKyp88a1SltNq
|
||||
github.com/golangci/golangci-lint v1.57.1/go.mod h1:zLcHhz3NHc88T5zV2j75lyc0zH3LdOPOybblYa4p0oI=
|
||||
github.com/golangci/golangci-lint v1.59.0 h1:st69YDnAH/v2QXDcgUaZ0seQajHScPALBVkyitYLXEk=
|
||||
github.com/golangci/golangci-lint v1.59.0/go.mod h1:QNA32UWdUdHXnu+Ap5/ZU4WVwyp2tL94UxEXrSErjg0=
|
||||
github.com/golangci/golangci-lint v1.59.1 h1:CRRLu1JbhK5avLABFJ/OHVSQ0Ie5c4ulsOId1h3TTks=
|
||||
github.com/golangci/golangci-lint v1.59.1/go.mod h1:jX5Oif4C7P0j9++YB2MMJmoNrb01NJ8ITqKWNLewThg=
|
||||
github.com/golangci/misspell v0.4.1 h1:+y73iSicVy2PqyX7kmUefHusENlrP9YwuHZHPLGQj/g=
|
||||
github.com/golangci/misspell v0.4.1/go.mod h1:9mAN1quEo3DlpbaIKKyEvRxK1pwqR9s/Sea1bJCtlNI=
|
||||
github.com/golangci/misspell v0.5.1 h1:/SjR1clj5uDjNLwYzCahHwIOPmQgoH04AyQIiWGbhCM=
|
||||
github.com/golangci/misspell v0.5.1/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo=
|
||||
github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs=
|
||||
github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo=
|
||||
github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA=
|
||||
github.com/golangci/modinfo v0.3.4/go.mod h1:wytF1M5xl9u0ij8YSvhkEVPP3M5Mc7XLl1pxH3B2aUM=
|
||||
github.com/golangci/plugin-module-register v0.1.1 h1:TCmesur25LnyJkpsVrupv1Cdzo+2f7zX0H6Jkw1Ol6c=
|
||||
@ -273,6 +281,8 @@ github.com/polyfloyd/go-errorlint v1.4.8 h1:jiEjKDH33ouFktyez7sckv6pHWif9B7SuS8c
|
||||
github.com/polyfloyd/go-errorlint v1.4.8/go.mod h1:NNCxFcFjZcw3xNjVdCchERkEM6Oz7wta2XJVxRftwO4=
|
||||
github.com/polyfloyd/go-errorlint v1.5.1 h1:5gHxDjLyyWij7fhfrjYNNlHsUNQeyx0LFQKUelO3RBo=
|
||||
github.com/polyfloyd/go-errorlint v1.5.1/go.mod h1:sH1QC1pxxi0fFecsVIzBmxtrgd9IF/SkJpA6wqyKAJs=
|
||||
github.com/polyfloyd/go-errorlint v1.5.2 h1:SJhVik3Umsjh7mte1vE0fVZ5T1gznasQG3PV7U5xFdA=
|
||||
github.com/polyfloyd/go-errorlint v1.5.2/go.mod h1:sH1QC1pxxi0fFecsVIzBmxtrgd9IF/SkJpA6wqyKAJs=
|
||||
github.com/prometheus/client_golang v1.12.1 h1:ZiaPsmm9uiBeaSMRznKsCDNtPCS0T3JVDGF+06gjBzk=
|
||||
github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
|
||||
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
||||
@ -305,6 +315,8 @@ github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tM
|
||||
github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ=
|
||||
github.com/sashamelentyev/usestdlibvars v1.25.0 h1:IK8SI2QyFzy/2OD2PYnhy84dpfNo9qADrRt6LH8vSzU=
|
||||
github.com/sashamelentyev/usestdlibvars v1.25.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8=
|
||||
github.com/sashamelentyev/usestdlibvars v1.26.0 h1:LONR2hNVKxRmzIrZR0PhSF3mhCAzvnr+DcUiHgREfXE=
|
||||
github.com/sashamelentyev/usestdlibvars v1.26.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8=
|
||||
github.com/securego/gosec/v2 v2.19.0 h1:gl5xMkOI0/E6Hxx0XCY2XujA3V7SNSefA8sC+3f1gnk=
|
||||
github.com/securego/gosec/v2 v2.19.0/go.mod h1:hOkDcHz9J/XIgIlPDXalxjeVYsHxoWUc5zJSHxcB8YM=
|
||||
github.com/securego/gosec/v2 v2.20.1-0.20240525090044-5f0084eb01a9 h1:rnO6Zp1YMQwv8AyxzuwsVohljJgp4L0ZqiCgtACsPsc=
|
||||
@ -385,6 +397,8 @@ go-simpler.org/sloglint v0.5.0 h1:2YCcd+YMuYpuqthCgubcF5lBSjb6berc5VMOYUHKrpY=
|
||||
go-simpler.org/sloglint v0.5.0/go.mod h1:EUknX5s8iXqf18KQxKnaBHUPVriiPnOrPjjJcsaTcSQ=
|
||||
go-simpler.org/sloglint v0.7.0 h1:rMZRxD9MbaGoRFobIOicMxZzum7AXNFDlez6xxJs5V4=
|
||||
go-simpler.org/sloglint v0.7.0/go.mod h1:g9SXiSWY0JJh4LS39/Q0GxzP/QX2cVcbTOYhDpXrJEs=
|
||||
go-simpler.org/sloglint v0.7.1 h1:qlGLiqHbN5islOxjeLXoPtUdZXb669RW+BDQ+xOSNoU=
|
||||
go-simpler.org/sloglint v0.7.1/go.mod h1:OlaVDRh/FKKd4X4sIMbsz8st97vomydceL146Fthh/c=
|
||||
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
|
||||
@ -401,6 +415,8 @@ golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
|
||||
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
|
||||
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
@ -409,6 +425,8 @@ golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
|
||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||
@ -417,6 +435,8 @@ golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
|
||||
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
|
||||
golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw=
|
||||
golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
|
||||
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
@ -433,3 +453,5 @@ mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 h1:zCr3iRRgdk5eIikZNDphGcM6K
|
||||
mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14/go.mod h1:ZzZjEpJDOmx8TdVU6umamY3Xy0UAQUI2DHbf05USVbI=
|
||||
mvdan.cc/unparam v0.0.0-20240427195214-063aff900ca1 h1:Nykk7fggxChwLK4rUPYESzeIwqsuxXXlFEAh5YhaMRo=
|
||||
mvdan.cc/unparam v0.0.0-20240427195214-063aff900ca1/go.mod h1:ZzZjEpJDOmx8TdVU6umamY3Xy0UAQUI2DHbf05USVbI=
|
||||
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U=
|
||||
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f/go.mod h1:RSLa7mKKCNeTTMHBw5Hsy2rfJmd6O2ivt9Dw9ZqCQpQ=
|
||||
|
@ -14,7 +14,7 @@ CUE="${GOBIN}/cue-v0.5.0"
|
||||
|
||||
DRONE="${GOBIN}/drone-v1.5.0"
|
||||
|
||||
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.59.0"
|
||||
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.59.1"
|
||||
|
||||
JB="${GOBIN}/jb-v0.5.1"
|
||||
|
||||
|
7
.github/workflows/go_lint.yml
vendored
7
.github/workflows/go_lint.yml
vendored
@ -23,11 +23,10 @@ jobs:
|
||||
- run: CODEGEN_VERIFY=1 make gen-cue
|
||||
- run: make gen-go
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: v1.59.0
|
||||
version: v1.59.1
|
||||
args: |
|
||||
--config .golangci.toml --max-same-issues=0 --max-issues-per-linter=0 --verbose ./pkg/... ./pkg/apimachinery/... ./pkg/apiserver/... ./pkg/build/wire/... ./pkg/promlib/... ./pkg/util/xorm/...
|
||||
only-new-issues: true
|
||||
--config .golangci.toml --max-same-issues=0 --max-issues-per-linter=0 --verbose ./pkg/... ./pkg/apiserver/... ./pkg/apimachinery/... ./pkg/promlib/...
|
||||
skip-cache: true
|
||||
install-mode: binary
|
||||
|
@ -270,13 +270,14 @@ You cannot modify the `No Basic Role` permissions.
|
||||
|
||||
1. Refer to the following table to add attributes and values.
|
||||
|
||||
| Attribute | Description |
|
||||
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `name` | The name of the basic role you want to update. You can specify a `uid` instead of a role name. The role `name` or the `uid` are required. |
|
||||
| `orgId` | Identifies the organization to which the role belongs. `global` can be used instead to specify it's a global role. |
|
||||
| `version` | Identifies the version of the role, which prevents overwriting newer changes. |
|
||||
| `from` | List of roles from which to copy permissions. |
|
||||
| `permissions > state` | The state of the permission. You can set it to `absent` to ensure it exclusion from the copy list. |
|
||||
| Attribute | Description |
|
||||
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `name` | The name of the basic role you want to update. You can specify a `uid` instead of a role name. The role `name` or the `uid` are required. |
|
||||
| `orgId` | Identifies the organization to which the role belongs. `global` can be used instead to specify it's a global role. |
|
||||
| `version` | Identifies the version of the role, which prevents overwriting newer changes. |
|
||||
| `overrideRole` | If set to true, role will be updated regardless of its version in the database. There is no need to specify `version` if `overrideRole` is set to `true`. |
|
||||
| `from` | List of roles from which to copy permissions. |
|
||||
| `permissions > state` | The state of the permission. You can set it to `absent` to ensure it exclusion from the copy list. |
|
||||
|
||||
1. Reload the provisioning configuration file.
|
||||
|
||||
|
@ -91,7 +91,8 @@ roles:
|
||||
# <bool> force deletion revoking all grants of the role.
|
||||
force: true
|
||||
- uid: 'basic_editor'
|
||||
version: 2
|
||||
# <bool> always apply the specified changes to the role, regardless of the role version in the data base
|
||||
overrideRole: true
|
||||
global: true
|
||||
# <list> list of roles to copy permissions from.
|
||||
from:
|
||||
|
@ -671,7 +671,7 @@ func (s *store) createPermissions(sess *db.Session, roleID int64, cmd SetResourc
|
||||
/*
|
||||
Add ACTION SET of managed permissions to in-memory store
|
||||
*/
|
||||
if s.shouldStoreActionSet(permission) {
|
||||
if s.shouldStoreActionSet(resource, permission) {
|
||||
actionSetName := GetActionSetName(resource, permission)
|
||||
p := managedPermission(actionSetName, resource, resourceID, resourceAttribute)
|
||||
p.RoleID = roleID
|
||||
@ -683,13 +683,13 @@ func (s *store) createPermissions(sess *db.Session, roleID int64, cmd SetResourc
|
||||
|
||||
// If there are no missing actions for the resource (in case of access level downgrade or resource removal), we don't need to insert any actions
|
||||
// we still want to add the action set (when permission != "")
|
||||
if len(missingActions) == 0 && !s.shouldStoreActionSet(permission) {
|
||||
if len(missingActions) == 0 && !s.shouldStoreActionSet(resource, permission) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// if we have actionset feature enabled and are only working with action sets
|
||||
// skip adding the missing actions to the permissions table
|
||||
if !(s.shouldStoreActionSet(permission) && s.cfg.OnlyStoreAccessActionSets) {
|
||||
if !(s.shouldStoreActionSet(resource, permission) && s.cfg.OnlyStoreAccessActionSets) {
|
||||
for action := range missingActions {
|
||||
p := managedPermission(action, resource, resourceID, resourceAttribute)
|
||||
p.RoleID = roleID
|
||||
@ -706,8 +706,12 @@ func (s *store) createPermissions(sess *db.Session, roleID int64, cmd SetResourc
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *store) shouldStoreActionSet(permission string) bool {
|
||||
return (s.features.IsEnabled(context.TODO(), featuremgmt.FlagAccessActionSets) && permission != "" && isFolderOrDashboardAction(permission))
|
||||
func (s *store) shouldStoreActionSet(resource, permission string) bool {
|
||||
if !(s.features.IsEnabled(context.TODO(), featuremgmt.FlagAccessActionSets) && permission != "") {
|
||||
return false
|
||||
}
|
||||
actionSetName := GetActionSetName(resource, permission)
|
||||
return isFolderOrDashboardAction(actionSetName)
|
||||
}
|
||||
|
||||
func deletePermissions(sess *db.Session, ids []int64) error {
|
||||
|
@ -120,5 +120,4 @@ func addCloudMigrationsMigrations(mg *Migrator) {
|
||||
"updated": "updated",
|
||||
"finished": "finished",
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -19966,6 +19966,7 @@
|
||||
}
|
||||
},
|
||||
"State": {
|
||||
"description": "+enum",
|
||||
"type": "string"
|
||||
},
|
||||
"Status": {
|
||||
@ -20725,6 +20726,7 @@
|
||||
}
|
||||
},
|
||||
"Type": {
|
||||
"description": "+enum",
|
||||
"type": "string"
|
||||
},
|
||||
"TypeMeta": {
|
||||
|
@ -80,11 +80,12 @@ function FolderLink({ libraryPanel }: FolderLinkProps): ReactElement | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
// LibraryPanels API returns folder-less library panels with an empty string folder UID
|
||||
if (!libraryPanel.meta.folderUid) {
|
||||
return (
|
||||
<span className={styles.metaContainer}>
|
||||
<Icon name={'folder'} size="sm" />
|
||||
<span>{libraryPanel.meta.folderName}</span>
|
||||
<span>Dashboards</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
@ -3,22 +3,23 @@ import React from 'react';
|
||||
import { ConfirmModal, Text } from '@grafana/ui';
|
||||
|
||||
import { Trans, t } from '../../../core/internationalization';
|
||||
import { DashboardTreeSelection } from '../../browse-dashboards/types';
|
||||
|
||||
interface Props {
|
||||
isOpen: boolean;
|
||||
onConfirm: () => Promise<void>;
|
||||
onDismiss: () => void;
|
||||
selectedItems: DashboardTreeSelection;
|
||||
selectedDashboards: string[];
|
||||
isLoading: boolean;
|
||||
}
|
||||
|
||||
export const RestoreModal = ({ onConfirm, onDismiss, selectedItems, isLoading, ...props }: Props) => {
|
||||
const numberOfDashboards = selectedItems ? Object.keys(selectedItems.dashboard).length : 0;
|
||||
export const RestoreModal = ({ onConfirm, onDismiss, selectedDashboards, isLoading, ...props }: Props) => {
|
||||
const numberOfDashboards = selectedDashboards.length;
|
||||
|
||||
const onRestore = async () => {
|
||||
await onConfirm();
|
||||
onDismiss();
|
||||
};
|
||||
|
||||
return (
|
||||
<ConfirmModal
|
||||
body={
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { css } from '@emotion/css';
|
||||
import React from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { GrafanaTheme2 } from '@grafana/data/';
|
||||
import { Button, useStyles2 } from '@grafana/ui';
|
||||
@ -17,11 +17,17 @@ export function RecentlyDeletedActions() {
|
||||
const styles = useStyles2(getStyles);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const selectedItems = useActionSelectionState();
|
||||
const selectedItemsState = useActionSelectionState();
|
||||
const [, stateManager] = useRecentlyDeletedStateManager();
|
||||
|
||||
const [restoreDashboard, { isLoading: isRestoreLoading }] = useRestoreDashboardMutation();
|
||||
|
||||
const selectedDashboards = useMemo(() => {
|
||||
return Object.entries(selectedItemsState.dashboard)
|
||||
.filter(([_, selected]) => selected)
|
||||
.map(([uid]) => uid);
|
||||
}, [selectedItemsState.dashboard]);
|
||||
|
||||
const onActionComplete = () => {
|
||||
dispatch(setAllSelection({ isSelected: false, folderUID: undefined }));
|
||||
|
||||
@ -29,9 +35,8 @@ export function RecentlyDeletedActions() {
|
||||
};
|
||||
|
||||
const onRestore = async () => {
|
||||
const promises = Object.entries(selectedItems.dashboard)
|
||||
.filter(([_, selected]) => selected)
|
||||
.map(([uid]) => restoreDashboard({ dashboardUID: uid }));
|
||||
const promises = selectedDashboards.map((uid) => restoreDashboard({ dashboardUID: uid }));
|
||||
|
||||
await Promise.all(promises);
|
||||
onActionComplete();
|
||||
};
|
||||
@ -41,7 +46,7 @@ export function RecentlyDeletedActions() {
|
||||
new ShowModalReactEvent({
|
||||
component: RestoreModal,
|
||||
props: {
|
||||
selectedItems,
|
||||
selectedDashboards,
|
||||
onConfirm: onRestore,
|
||||
isLoading: isRestoreLoading,
|
||||
},
|
||||
|
@ -10345,6 +10345,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"State": {
|
||||
"description": "+enum",
|
||||
"type": "string"
|
||||
},
|
||||
"Status": {
|
||||
@ -11104,6 +11105,7 @@
|
||||
"type": "array"
|
||||
},
|
||||
"Type": {
|
||||
"description": "+enum",
|
||||
"type": "string"
|
||||
},
|
||||
"TypeMeta": {
|
||||
|
Loading…
Reference in New Issue
Block a user