fix: role name is error in role configure (#3618)
This commit is contained in:
parent
d708c93b22
commit
c5dd034452
@ -31,7 +31,6 @@ export const useAvailableActions = () => {
|
|||||||
|
|
||||||
export const DataSourceTable = () => {
|
export const DataSourceTable = () => {
|
||||||
const record = useRecord();
|
const record = useRecord();
|
||||||
console.log(record.key);
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<SchemaComponentContext.Provider value={{ designable: false }}>
|
<SchemaComponentContext.Provider value={{ designable: false }}>
|
||||||
|
@ -3,12 +3,12 @@ import React, { useContext } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useAPIClient, useRequest, SchemaComponent, useRecord } from '@nocobase/client';
|
import { useAPIClient, useRequest, SchemaComponent, useRecord } from '@nocobase/client';
|
||||||
import { PermissionContext } from './PermisionProvider';
|
import { PermissionContext } from './PermisionProvider';
|
||||||
|
import { CurrentRolesContext } from './';
|
||||||
|
|
||||||
export const RoleConfigure = () => {
|
export const RoleConfigure = () => {
|
||||||
const { update, currentRecord } = useContext(PermissionContext);
|
const { update } = useContext(PermissionContext);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { key } = useRecord();
|
const { key } = useRecord();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SchemaComponent
|
<SchemaComponent
|
||||||
schema={{
|
schema={{
|
||||||
@ -18,12 +18,13 @@ export const RoleConfigure = () => {
|
|||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
useValues: (options) => {
|
useValues: (options) => {
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
|
const role = useContext(CurrentRolesContext);
|
||||||
return useRequest(
|
return useRequest(
|
||||||
() =>
|
() =>
|
||||||
api
|
api
|
||||||
.resource(`dataSources/${key}/roles`)
|
.resource(`dataSources/${key}/roles`)
|
||||||
.get({
|
.get({
|
||||||
filterByTk: currentRecord.name,
|
filterByTk: role.name,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const record = res?.data?.data;
|
const record = res?.data?.data;
|
||||||
|
Loading…
Reference in New Issue
Block a user