Skip to content

Commit

Permalink
Merge pull request #45 from ISADBA/feature/yangchuan/v5
Browse files Browse the repository at this point in the history
feat(collaboration): support database resource role
  • Loading branch information
HSunboy authored Apr 8, 2024
2 parents 9049ecf + f4d2eb0 commit 4025972
Show file tree
Hide file tree
Showing 18 changed files with 425 additions and 95 deletions.
25 changes: 22 additions & 3 deletions src/common/network/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function listDatabases(
*/
containsUnassigned?: boolean,
existed?: boolean,
includesPermittedAction?: boolean
includesPermittedAction?: boolean,
): Promise<IResponseData<IDatabase>> {
const res = await request.get(`/api/v2/database/databases`, {
params: {
Expand All @@ -48,7 +48,7 @@ export async function listDatabases(
environmentId,
containsUnassigned,
existed,
includesPermittedAction
includesPermittedAction,
},
});

Expand All @@ -70,11 +70,30 @@ export async function createDataBase(database: DeepPartial<IDatabase>): Promise<
return res?.data;
}

export async function updateDataBase(databaseIds: number[], projectId: number): Promise<Boolean> {
export async function updateDataBase(
databaseIds: number[],
projectId: number,
ownerIds: number[],
): Promise<Boolean> {
const res = await request.post(`/api/v2/database/databases/transfer`, {
data: {
databaseIds,
projectId,
ownerIds,
},
});
return res?.data;
}

export async function updateDataBaseOwner(
databaseIds: number[],
projectId: number,
ownerIds: number[],
): Promise<Boolean> {
const res = await request.put(`/api/v2/database/databases/owner/${projectId}`, {
data: {
databaseIds,
ownerIds,
},
});
return res?.data;
Expand Down
4 changes: 3 additions & 1 deletion src/common/network/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ export async function getTaskFlowExists(name: string): Promise<boolean> {
export async function getResourceRoles(
params?: IRequestListParamsV2,
): Promise<IResponseData<IResourceRole>> {
const result = await request.get('/api/v2/iam/resourceRoles');
const result = await request.get('/api/v2/iam/resourceRoles', {
params,
});
return result?.data;
}

Expand Down
3 changes: 1 addition & 2 deletions src/component/Task/component/ApprovalModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ const ApprovalModal: React.FC<IProps> = inject('taskStore')(
<TextArea
rows={5}
placeholder={formatMessage({
id:
'odc.TaskManagePage.component.ApprovalModal.PleaseEnterHandlingCommentsWithin',
id: 'odc.TaskManagePage.component.ApprovalModal.PleaseEnterHandlingCommentsWithin',
})} /*请输入处理意见,200字以内*/
/>
</Form.Item>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,23 @@
.editTable {
border: 1px solid var(--neutral-grey4-color);
}

.thead {
display: grid;
grid-template-columns: 80px 80px 108px 1fr;
line-height: 24px;
grid-gap: 1px;
background-color: var(--neutral-grey4-color);
border-bottom: 1px solid var(--neutral-grey4-color);

.theadCell {
background-color: var(--background-primary-color);
padding: 0 8px;
font-size: 12px;
font-weight: 500;
}
}
.row {
display: grid;
grid-template-columns: 80px 80px 108px 1fr;
align-items: center;
height: 72px;
grid-gap: 1px;
background-color: var(--neutral-grey4-color);
.td {
.table {
width: 100%;
border-spacing: 0;
background-color: #fff;
thead {
line-height: 24px;
display: flex;
height: 100%;
background-color: var(--background-primary-color);
vertical-align: middle;
.content {
width: 100%;
display: inline-flex;
padding: 0 8px;
line-height: 62px;
text-align: left;
background-color: #fafafa;
border-bottom: none;
th {
border: 1px solid #e9e9e9;
padding: 0 5px;
}
}
.ruleFormItem {
width: 100%;
padding: 4px 8px;
td .content {
padding: 5px 8px;
}
.typeSelect {
display: flex;
td {
border: 1px solid #e9e9e9;
vertical-align: middle;
padding: 0 8px;
line-height: 72px;
:global {
.ant-form-item {
margin-bottom: 0px;
line-height: unset;
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.pickerLabel{
display: flex;
justify-content: space-between;
align-items: center;
.picker{
display: inline-block;
opacity: 0;
width: 0;
height: 0;
}
}
.pickerLabel {
display: flex;
justify-content: space-between;
align-items: center;
.picker {
display: inline-block;
opacity: 0;
width: 0;
height: 0;
}
}
18 changes: 9 additions & 9 deletions src/component/Task/component/PartitionPolicyTable/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@
line-height: 27px;
}

.configDrawer{
:global{
.ant-drawer-body{
.configDrawer {
:global {
.ant-drawer-body {
display: flex;
flex-direction: column;
}
}
.sqlWrapper{
.sqlWrapper {
flex: 1;
}
.sqlContent{
.sqlContent {
height: 100%;
}
}

.rules{
:global{
.ant-descriptions-row > td{
.rules {
:global {
.ant-descriptions-row > td {
padding-bottom: 2px;
}
}
}
}
2 changes: 1 addition & 1 deletion src/component/Task/component/SimpleTextItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const SimpleTextItem: React.FC<{
direction?: 'row' | 'column';
className?: string;
}> = (props) => {
const { label, content, direction = 'row', className='' } = props;
const { label, content, direction = 'row', className = '' } = props;
return (
<div
className={className}
Expand Down
15 changes: 14 additions & 1 deletion src/d.ts/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ export interface IDatabase {
environment: IEnvironment;
existed: boolean;
authorizedPermissionTypes?: DatabasePermissionType[];
/**
* 数据库负责人
*/
owners: IDatabaseOwner[];
}

/**
* 数据库负责人
*/
export interface IDatabaseOwner {
accountName: string;
id: number;
name: string;
}

export interface IUnauthorizedDatabase {
Expand All @@ -57,4 +70,4 @@ export interface IUnauthorizedDatabase {
project: IProject;
dataSource: IDatasource;
environment: IEnvironment;
}
}
1 change: 1 addition & 0 deletions src/d.ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export enum IManagerResourceType {
integration = 'ODC_INTEGRATION',
environment = 'ODC_ENVIRONMENT',
individual_organization = 'ODC_INDIVIDUAL_ORGANIZATION',
database = 'ODC_DATABASE',
}

export enum actionTypes {
Expand Down
13 changes: 12 additions & 1 deletion src/locales/must/strings/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -4837,6 +4837,7 @@
"odc.component.DetailContent.CreationTime": "Created At",
"odc.Datasource.Info.CharacterEncoding": "Character Set",
"odc.Database.AddDataBaseButton.SelectAnUnassignedDatabase": "Select a database that hasn't been assigned to a project",
"odc.Database.AddDataBaseButton.SelectDatabaseOwner": "Select a database owner",
"odc.MaskingAlgorithm.components.ViewMaskingAlgorithmDrawer.NotEnabled": "Disabled",
"odc.Env.components.EditPropertyComponent.EnterLabel": "Specify a {label}",
"odc.Setting.Info.EnterADescription": "Enter the description",
Expand Down Expand Up @@ -4950,6 +4951,7 @@
"odc.SensitiveRule.components.CheckboxInput.SelectAtLeastOneRecognition": "Select at least one identification object.",
"odc.NewSSODrawerButton.SSOForm.AuthorizeTheServerToCall": "The URL for the authorization server to call back ODC. If a callback allowlist is available for SSO, add the allowlist.",
"odc.Database.AddDataBaseButton.Database": "Database",
"odc.Database.AddDataBaseButton.DatabaseOwner": "Owner; If not selected, the system will default to the project administrator",
"odc.component.TaskTable.Status": "Status",
"odc.ExternalIntegration.SqlInterceptor.FailedToEnable": "Enabling failed.",
"odc.SensitiveColumn.components.ScanForm.EnterAColumnName": "Enter a column name",
Expand Down Expand Up @@ -5054,6 +5056,8 @@
"odc.components.SensitiveRule.Cancel": "Cancel",
"odc.Env.components.InnerEnvironment.RuleType": "Rule Type",
"odc.Project.Database.DatabaseName": "Database Name",
"odc.Project.Database.Owner": "Database Owner",
"odc.Project.Database.OwnerEmptyText": "Not set",
"odc.Project.Sensitive.SensitiveColumn": "Sensitive Column",
"odc.Project.Database.LogOnToTheDatabase": "Log on to Database",
"odc.Form.DBTypeItem.DataSourceType": "Data Source Type",
Expand All @@ -5078,6 +5082,11 @@
"odc.components.SensitiveColumn.EnableStatus": "Enabling Status",
"odc.SensitiveRule.components.ViewSensitiveRuleDrawer.Enable": "Enable",
"odc.Database.AddDataBaseButton.AddDatabase": "Add Database",
"odc.Database.ChangeOwnerModal.OperationSucceeded": "Operation succeeded.",
"odc.Database.ChangeOwnerModal.ModifyOwner": "Update Database Owner",
"odc.Info.ChangeOwnerModal.DatabaseName": "Database:",
"odc.Database.ChangeOwnerModal.DatabaseOwner": "Database Owner; If not selected, the system will default to the project administrator",
"odc.Database.ChangeOwnerModal.SelectDatabaseOwner": "Select a database owner",
"odc.DataArchiveTask.CreateModal.Create": "Create",
"odc.component.CommonDetailModal.TaskExecuteRecord.DataCleansing": "Data Cleanup",
"odc.component.AuthNode.AddAnApprovalNode": "Add Approval Node",
Expand Down Expand Up @@ -5238,6 +5247,7 @@
"odc.Datasource.Info.AreYouSureYouWant": "Are you sure you want to delete it?",
"odc.DataClearTask.DetailContent.DataCleansing": "Data Cleanup",
"odc.component.AuthNode.Role": "Role",
"odc.component.AuthNode.Role.DatabaseOwner": "DataBase Owner",
"odc.page.Gateway.newCloudConnection.PersonalSpaceDoesNotExist": "The personal workspace does not exist.",
"odc.component.ResourceSelector.const.DataSource": "Data Source",
"odc.page.Secure.interface.NoNeedToImprove": "Improvement Not Required",
Expand Down Expand Up @@ -6146,6 +6156,7 @@
"odc.src.page.Workspace.components.SQLResultSet.InitiateApproval": "Initiate Approval",
"odc.src.page.Project.Sensitive.components.SensitiveColumn.components.ScanFailure": "Scan failed",
"odc.src.page.Project.Database.ModifyTheProject": "Update Assigned Project",
"odc.src.page.Project.Database.ModifyOwner": "Update Owner",
"odc.src.layout.UserStatusIsBeingChecked": "Checking user status",
"odc.src.component.Task.AlterDdlTask.CreateModal.PleaseSelectTheTableName": "Please select the table name switch method.",
"odc.src.page.Workspace.components.Trace.EndTime": "Time Ended",
Expand Down Expand Up @@ -6259,4 +6270,4 @@
"odc.src.component.Task.PartitionTask.DetailContent.CreationTime": "Created At",
"odc.src.component.Task.PartitionTask.DetailContent.NextExecutionTime": "Next Execution Time",
"odc.src.page.Secure.components.RecordPage.ApplicationProjectPermissions": "Apply for Project Permissions"
}
}
11 changes: 11 additions & 0 deletions src/locales/must/strings/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2648,6 +2648,11 @@
"odc.component.CommonDetailModal.TaskTools.Execute": "执行",
"odc.SensitiveRule.components.ViewSensitiveRuleDrawer.Enable": "启用",
"odc.Database.AddDataBaseButton.AddDatabase": "添加数据库",
"odc.Database.ChangeOwnerModal.OperationSucceeded": "修改负责人成功",
"odc.Database.ChangeOwnerModal.ModifyOwner": "修改负责人",
"odc.Info.ChangeOwnerModal.DatabaseName": "数据库名称:",
"odc.Database.ChangeOwnerModal.DatabaseOwner": "数据库负责人(未设置时默认是项目负责人)",
"odc.Database.ChangeOwnerModal.SelectDatabaseOwner": "请选择数据库负责人",
"odc.DataArchiveTask.CreateModal.Create": "新建",
"odc.DataArchiveTask.CreateModal.VariableConfig.AddVariables": "添加变量",
"odc.component.FormModal.TheNameAlreadyExists": "名称已存在",
Expand Down Expand Up @@ -2861,6 +2866,7 @@
"odc.component.TaskTable.No": "编号",
"odc.component.FormModal.TheNameCannotExceedCharacters": "名称不超过 64 个字符",
"odc.Database.AddDataBaseButton.Database": "数据库",
"odc.Database.AddDataBaseButton.DatabaseOwner": "数据库负责人(未设置时默认是项目负责人)",
"odc.MaskingAlgorithm.components.ViewMaskingAlgorithmDrawer.Enable": "启用",
"odc.DataArchiveTask.CreateModal.ArchiveRange.PleaseSelect": "请选择",
"odc.Script.ScriptFile.SearchScript": "搜索脚本",
Expand All @@ -2886,6 +2892,8 @@
"odc.User.AddUserModal.AddedSuccessfully": "添加成功",
"odc.components.SensitiveRule.Cancel": "取消",
"odc.Project.Database.DatabaseName": "数据库名称",
"odc.Project.Database.Owner": "负责人",
"odc.Project.Database.OwnerEmptyText": "未设置",
"odc.ExternalIntegration.SqlInterceptor.AreYouSureYouWant": "是否确认删除{title}?",
"odc.components.SensitiveColumn.Disable": "禁用",
"odc.component.CommonDetailModal.TaskTools.Rollback": "回滚",
Expand Down Expand Up @@ -3166,6 +3174,7 @@
"odc.Env.components.EditRuleDrawer.Edit": "编辑",
"odc.component.FormModal.Disable": "停用",
"odc.component.AuthNode.Role": "角色",
"odc.component.AuthNode.Role.DatabaseOwner": "数据库负责人",
"odc.page.Gateway.newCloudConnection.PersonalSpaceDoesNotExist": "个人空间不存在!",
"odc.component.ResourceSelector.const.DataSource": "数据源",
"odc.SensitiveRule.components.FormSensitiveRuleDrawer.TableName": "表名",
Expand Down Expand Up @@ -3285,6 +3294,7 @@
"odc.ResourceTree.Nodes.synonym.CommonSynonyms": "公共同义词",
"odc.component.ResourceSelector.IncludingDataSourcesProjectsRoles": "包括数据源、项目、角色、用户的管理权限(新建/管理/编辑/查看)",
"odc.Database.AddDataBaseButton.SelectAnUnassignedDatabase": "请选择未分配项目的数据库",
"odc.Database.AddDataBaseButton.SelectDatabaseOwner": "请选择数据库的负责人",
"odc.DataArchiveTask.CreateModal.VariableConfig.Hours": "小时",
"odc.component.FormModal.EnterATaskFlowName": "请输入任务流程名称",
"odc.NewSSODrawerButton.SSOForm.AuthenticationMethodUsedWhenSending": "在向资源服务器发送资源请求中的承载访问令牌时使用的身份验证方法",
Expand Down Expand Up @@ -3898,6 +3908,7 @@
"odc.src.page.Datasource.Info.NewDataBaseButton.Project": "项目",
"odc.src.page.Project.Project.ApplicationProjectPermissions": "申请项目权限",
"odc.src.page.Project.Database.ModifyTheProject": "\n 修改所属项目\n ",
"odc.src.page.Project.Database.ModifyOwner": "\n 修改负责人\n ",
"odc.src.component.Task.ApplyPermission.CreateModal.AllowingLoginDatabaseExecution": "允许登录数据库、执行 SQL、提交工单等,通常是开发人员",
"odc.src.component.Task.component.ArchiveRangeTip.Data7DaysAgo": " 7 天前的数据,可设置:",
"odc.src.component.Task.component.CommonDetailModal.StartTheNameSwitching": "开始表名切换",
Expand Down
Loading

0 comments on commit 4025972

Please sign in to comment.