diff --git a/dbmind/common/parser/sql_parsing.py b/dbmind/common/parser/sql_parsing.py index 90cbeb75d41b69a4363720b2dc53d29424014ce5..3ea4a969b1d0579b9cf4785a23a3f5a8c27f59da 100644 --- a/dbmind/common/parser/sql_parsing.py +++ b/dbmind/common/parser/sql_parsing.py @@ -246,10 +246,11 @@ def exists_bool_clause(query): def get_in_clause(parsed): for item in parsed: if item.is_group: - if isinstance(item, Parenthesis) and isinstance(item.parent, Comparison): + if isinstance(item, Parenthesis) and isinstance(item.parent, Where): comparisons = [subitem.value for subitem in item.parent.tokens if - subitem.ttype == sqlparse.tokens.Token.Operator.Comparison] - if any(op in comparisons for op in ('not in',)): + subitem.ttype == sqlparse.tokens.Token.Keyword] + if any(comparisons[i - 1] == 'not' for i, x in enumerate(comparisons) if x == 'in') \ + or any(op in comparisons for op in ('not in',)): for sub_item in item.tokens: if isinstance(sub_item, IdentifierList): flags.append(sub_item.value.split(',')) diff --git a/dbmind/controllers/dbmind_core.py b/dbmind/controllers/dbmind_core.py index 041603267abf101c1e82a04908b28ce5541de2cc..51e805592a09a86304d223ad8110bddb55bdd038 100644 --- a/dbmind/controllers/dbmind_core.py +++ b/dbmind/controllers/dbmind_core.py @@ -294,6 +294,14 @@ def get_db_list(): return data_transformer.get_database_list() +@request_mapping('/api/list/users', methods=['GET'], api=True) +@oauth2.token_authentication() +@standardized_api_output +def get_users(): + username, password = oauth2.credential + return data_transformer.get_users(username, password) + + @request_mapping('/api/summary/index_advisor', methods=['GET'], api=True) @oauth2.token_authentication() @standardized_api_output diff --git a/dbmind/service/web/data_transformer.py b/dbmind/service/web/data_transformer.py index 5033dbbec8dee696421db286b8075548363e23c1..098b177046f50bf1740c208b0e4a24d07441c7d8 100644 --- a/dbmind/service/web/data_transformer.py +++ b/dbmind/service/web/data_transformer.py @@ -390,6 +390,15 @@ def get_database_list(): return list(rv) +def get_users(username, password): + stmt = 'select usename from pg_user;' + _res = global_vars.agent_proxy.current_rpc().call_with_another_credential(username, password, 'query_in_postgres', stmt) + res = [] + for user in psycopg2_dict_jsonify(_res).get('rows', []): + res.append(user[0]) + return res + + def get_cluster_summary(): node_status = get_cluster_node_status()['node_list'] nb_node = len(node_status) diff --git a/ui/src/api/aiTool.js b/ui/src/api/aiTool.js index a3c22f650d3f686ad7de5bd200b9b0703cc6413b..9b2686c07f95ff0eb85cbdd481c1bedf3b73cf89 100644 --- a/ui/src/api/aiTool.js +++ b/ui/src/api/aiTool.js @@ -6,6 +6,9 @@ import { export const getItemListInterface = () => { return get('/list/database'); }; +export const getUserItemListInterface = () => { + return get('/list/users'); +}; export const getListIndexAdvisorInterface = (data) => { return post(`/toolkit/advise/index?database=${data.database}&instance=${data.instance}&max_index_num=${data.max_index_num}&max_index_storage=${data.max_index_storage}¤t=${data.current}&pagesize=${data.pagesize}`, data.textareaVal); }; diff --git a/ui/src/components/AutonomousManagement/AlarmsModules/SelfhealingRecordsTable.jsx b/ui/src/components/AutonomousManagement/AlarmsModules/SelfhealingRecordsTable.jsx index 450e08b153ddc68435172eb4cb47dd4f51b7a0a8..0257052dd435f23871534da2236652e86b0bd17b 100644 --- a/ui/src/components/AutonomousManagement/AlarmsModules/SelfhealingRecordsTable.jsx +++ b/ui/src/components/AutonomousManagement/AlarmsModules/SelfhealingRecordsTable.jsx @@ -7,6 +7,10 @@ import Setup from '../../../assets/imgs/Setup.png'; import { getSelfhealingface, getSelfhealingSetting, getSelfhealingSubmit, getSelfhealingDelete, getSelfhealingPause, getSelfhealingResumption } from '../../../api/autonomousManagement'; const { Option } = Select; +const formItemLayout = { + labelCol:{ span: 7,offset: 4}, + wrapperCol:{ span: 12 } +} export default class SelfhealingRecordsTable extends Component { constructor() { super() @@ -374,8 +378,6 @@ export default class SelfhealingRecordsTable extends Component { {!this.state.isModalVisible ? null : this.validateFieldValue()} onCancel={() => this.handleCancel()} okButtonProps={{disabled: this.state.isDisabled}} className='formlistclass'>
- + - + - + - + - + - + - + @@ -435,6 +437,7 @@ export default class SelfhealingRecordsTable extends Component { remove(field.name)} style={{display:this.state.isDisabled ? 'none' :'block',textAlign:'end',marginBottom:24}} /> :null} {this.FormRef.getFieldValue(['detectors', field.name, 'detector_name' ]) === 'GradientDetector' ?:null} {this.FormRef.getFieldValue(['detectors', field.name, 'detector_name' ]) === 'SeasonalDetector' ? :null} {this.FormRef.getFieldValue(['detectors', field.name, 'detector_name' ]) === 'SeasonalDetector' ? : null} {this.FormRef.getFieldValue(['detectors', field.name, 'detector_name' ]) === 'SeasonalDetector' ? :null} {this.FormRef.getFieldValue(['detectors', field.name, 'detector_name' ]) === 'ThresholdDetector' ? this.handleDelete(record)} > - Delete + Delete ); } else { @@ -112,6 +112,10 @@ export default class InspectionTask extends Component { this.setState({ isModalVisible: true }); } async handleOk() { + if(this.state.checkedKey === "real_time_check" && !this.state.startTime){ + message.warning("Please select time!"); + return; + } let params = { inspectionType: this.state.checkedKey, startTime: this.state.startTime, diff --git a/ui/src/components/DatabaseOptimization/IndexTuning.jsx b/ui/src/components/DatabaseOptimization/IndexTuning.jsx index 4afcbc40be242b69a4310417e699c89dc03f3f65..1c71f6929e9157d7e5257597370cbf569d971555 100644 --- a/ui/src/components/DatabaseOptimization/IndexTuning.jsx +++ b/ui/src/components/DatabaseOptimization/IndexTuning.jsx @@ -135,8 +135,8 @@ export default class IndexTuning extends Component { render () { return (
-
- {this.state.showflag ? : +
+ {this.state.showflag ? : <> diff --git a/ui/src/components/DatabaseOptimization/IntelligentSqlCondition.jsx b/ui/src/components/DatabaseOptimization/IntelligentSqlCondition.jsx index 01cba67faf45d4e581907808f1bd06a2f45fc011..2c31e26a0e13a3878950de296952fca361711694 100644 --- a/ui/src/components/DatabaseOptimization/IntelligentSqlCondition.jsx +++ b/ui/src/components/DatabaseOptimization/IntelligentSqlCondition.jsx @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { Button, Input, message, Select, Card, Col, Row, Table, Form, DatePicker, Checkbox, Modal, InputNumber,Radio } from 'antd'; -import { getItemListInterface } from '../../api/aiTool'; +import { getItemListInterface, getUserItemListInterface } from '../../api/aiTool'; import { getIntelligentSqlCondition } from '../../api/databaseOptimization'; import ReactEcharts from 'echarts-for-react'; import moment from 'moment'; @@ -21,6 +21,7 @@ export default class IntelligentSqlCondition extends Component { columns: [], loading: false, options: [], + userDatas: [], optionsSource: ['pg_stat_activity','dbe_perf.statement_history','asp'], selValue: 'pg_stat_activity', isCreateVisible:false, @@ -74,6 +75,14 @@ export default class IntelligentSqlCondition extends Component { message.error(msg) } } + async getUserItemList () { + const { success, data, msg } = await getUserItemListInterface() + if (success) { + this.setState({userDatas: data}) + } else { + message.error(msg) + } + } async getIntelligentSqlAnalysis (params) { this.setState({ loading: true }) const { success, msg, data } = await getIntelligentSqlCondition(params) @@ -196,7 +205,8 @@ export default class IntelligentSqlCondition extends Component { this.setState(() => ({routeTo: flg})) } componentDidMount () { - this.getItemList() + this.getItemList(); + this.getUserItemList(); } render () { return ( @@ -272,35 +282,45 @@ export default class IntelligentSqlCondition extends Component { } - + - + - + + {/* */} { this.changeSelVal(val) }} showSearch diff --git a/ui/src/components/NodeInformation/Node.jsx b/ui/src/components/NodeInformation/Node.jsx index f67f61ed8f3ce4782ad43ad5a7d1f2d061556922..35ed249c17afb46964946d8332b9e8a49b3ede01 100644 --- a/ui/src/components/NodeInformation/Node.jsx +++ b/ui/src/components/NodeInformation/Node.jsx @@ -87,7 +87,7 @@ export default class Node extends Component { return (
{this.state.ifShow ? -