diff --git a/webs/cmp-web/src/views/resource/ctstack/page/database/components/security/list/List.vue b/webs/cmp-web/src/views/resource/ctstack/page/database/components/security/list/List.vue new file mode 100644 index 0000000..fd5bf7e --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/page/database/components/security/list/List.vue @@ -0,0 +1,113 @@ + + + + + + 移除 + + + + + + + + diff --git a/webs/cmp-web/src/views/resource/ctstack/page/database/components/security/list/config.ts b/webs/cmp-web/src/views/resource/ctstack/page/database/components/security/list/config.ts new file mode 100644 index 0000000..9317600 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/page/database/components/security/list/config.ts @@ -0,0 +1,14 @@ +export const columns = [ + { + type: 'selection', + reserveSelection: true + }, + { + label: 'IP地址', + prop: 'securityIp' + } +] +export const searchConfigs: Base.ISearchConfig[] = [ + { type: 'Const', value: 'instanceId', initValue: '' }, + { type: 'Input', label: 'IP地址', value: 'securityIp' } +] diff --git a/webs/cmp-web/src/views/resource/ctstack/page/database/components/security/list/index.vue b/webs/cmp-web/src/views/resource/ctstack/page/database/components/security/list/index.vue new file mode 100644 index 0000000..acd2966 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/page/database/components/security/list/index.vue @@ -0,0 +1,42 @@ + + + 白名单列表 + + + + + diff --git a/webs/cmp-web/src/views/resource/ctstack/page/database/rds/ModifyRole.vue b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/ModifyRole.vue new file mode 100644 index 0000000..3fa79b4 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/ModifyRole.vue @@ -0,0 +1,135 @@ + + + + + + + {{ option.name }} + + 读写 + 只读 + DDL + DML + + + + + + + + + + diff --git a/webs/cmp-web/src/views/resource/ctstack/page/database/rds/RegionItem.vue b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/RegionItem.vue new file mode 100644 index 0000000..19deed9 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/RegionItem.vue @@ -0,0 +1,76 @@ +/** * Created by HaijunZhang on 2019/4/28. */ + + + + + + {{ item.name }} + + + + + + + {{ item.name }} + + + + + + + + diff --git a/webs/cmp-web/src/views/resource/ctstack/page/database/rds/add.vue b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/add.vue new file mode 100644 index 0000000..23a7881 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/add.vue @@ -0,0 +1,525 @@ + + + + + + + + + + + 后付费(按量付费) + 预付费(包年包月) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ scope.row.flavorUuid }} + + + + + + + + + + + + + + + + + + + + + + 经典网络 + 专有网络 + + + + + + + + + + + + + + + + + + + + + + + 不区分大小写(默认) + 区分大小写 + + + + + + + 上一步 + 下一步 + 确定 + 取消 + + + + diff --git a/webs/cmp-web/src/views/resource/ctstack/page/database/rds/auth.vue b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/auth.vue new file mode 100644 index 0000000..c3dea62 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/auth.vue @@ -0,0 +1,225 @@ + + + + + + + 未授权数据库 + + + + + + + 搜索 + + + + + + + + + + + + + + + + + + + + + + + 已授权数据库 + + 全部设 {{ buttonName }} + + + + + + + + + 读写(DDL+DML) + 只读 + 仅DDL + 仅DML + + + + + + + + + + + diff --git a/webs/cmp-web/src/views/resource/ctstack/page/database/rds/index.vue b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/index.vue new file mode 100644 index 0000000..90b2986 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/index.vue @@ -0,0 +1,894 @@ + + + + + 新增 + + + + {{ filter[status] }} + + + + {{ filter[type] }} + + + {{ filter[instanceNetworkType] }} + + + {{ filter[payType] }} + + + {{ (record.instanceId || '--') + ' / ' + val }} + + + 重启 + + 释放实例 + + + + + + {{ detailData.name }} + {{ filter[detailData.status] }} + {{ detailData.dataStoreVersion }} + {{ filter[detailData.type] }} + {{ detailData.dataStoreType }} + {{ filter[detailData.instanceNetworkType] }} + {{ filter[detailData.payType] }} + {{ detailData.flavorId }} + {{ detailData.region }} + + + + 创建账号 + + + + + {{ scope.row.permission | typeFilter }} + + + + + {{ scope.row.status | statusFilter('status') }} + + + + + {{ item.name }} {{ item.accountPrivilege | authFilter }} + + + + + + 重置密码 + + + 修改权限 + + + 删除 + + + + + + + + {{ resetData.username }} + + + + + + + 取 消 + 确 定 + + + + + + + + + + + + + 取 消 + 确 定 + + + + + + + + + + + + + 高权限账号 + 普通账号 + + + + + + + + + + + 请输入备注说明,最多256个字符 + + 创建 + 取消 + + + + + + + + + 创建数据库 + + + + + + + + + + {{ item.account }} + + + + + + + 删除 + + + + + + + + + + + + + + + + + + 读写 + 只读 + 仅DDL + 仅DML + + + + + 请输入备注说明,最多256个字符 + + 创建 + 取消 + + + + + + + + + {{ instanceNetworkTypeMap[scope.row.instanceNetworkType] + '(' + ipTypeMap[scope.row.ipType] + ')' }} + + + + + + + + + + + + + + + diff --git a/webs/cmp-web/src/views/resource/ctstack/page/database/rds/validate.js b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/validate.js new file mode 100644 index 0000000..4f58511 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/page/database/rds/validate.js @@ -0,0 +1,439 @@ +export const keywords = [ + // RDS MySQL + 'ACTION', + 'ADD', + 'ADMIN', + 'ALL', + 'ALTER', + 'ANALYZE', + 'AND', + 'AS', + 'ASC', + 'ASENSITIVE', + 'BEFORE', + 'BETWEEN', + 'BIGINT', + 'BINARY', + 'BLOB', + 'BOTH', + 'BY', + 'CALL', + 'CASCADE', + 'CASE', + 'CHANGE', + 'CHAR', + 'CHARACTER', + 'CHECK', + 'COLLATE', + 'COLUMN', + 'CONDITION', + 'CONNECTION', + 'CONSTRAINT', + 'CONTINUE', + 'CONVERT', + 'CREATE', + 'CROSS', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'CURSOR', + 'DATABASE', + 'DATABASES', + 'DAY_HOUR', + 'DAY_MICROSECOND', + 'DAY_MINUTE', + 'DAY_SECOND', + 'DEC', + 'DECIMAL', + 'DECLARE', + 'DEFAULT', + 'DELAYED', + 'DELETE', + 'DESC', + 'DESCRIBE', + 'DETERMINISTIC', + 'DISTINCT', + 'DISTINCTROW', + 'DIV', + 'DOUBLE', + 'DROP', + 'DUAL', + 'EACH', + 'EAGLEYE', + 'ELSE', + 'ELSEIF', + 'ENCLOSED', + 'ESCAPED', + 'EXISTS', + 'EXIT', + 'EXPLAIN', + 'FALSE', + 'FETCH', + 'FLOAT', + 'FLOAT4', + 'FLOAT8', + 'FOR', + 'FORCE', + 'FOREIGN', + 'FROM', + 'FULLTEXT', + 'GOTO', + 'GRANT', + 'GROUP', + 'GUEST', + 'HAVING', + 'HIGH_PRIORITY', + 'HOUR_MICROSECOND', + 'HOUR_MINUTE', + 'HOUR_SECOND', + 'IF', + 'IGNORE', + 'IN', + 'INDEX', + 'INFILE', + 'INFORMATION_SCHEMA', + 'INNER', + 'INOUT', + 'INSENSITIVE', + 'INSERT', + 'INT', + 'INT1', + 'INT2', + 'INT3', + 'INT4', + 'INT8', + 'INTEGER', + 'INTERVAL', + 'INTO', + 'IS', + 'ITERATE', + 'JOIN', + 'KEY', + 'KEYS', + 'KILL', + 'LABEL', + 'LEADING', + 'LEAVE', + 'LEFT', + 'LIKE', + 'LIMIT', + 'LINEAR', + 'LINES', + 'LOAD', + 'LOCALTIME', + 'LOCALTIMESTAMP', + 'LOCK', + 'LONG', + 'LONGBLOB', + 'LONGTEXT', + 'LOOP', + 'LOW_PRIORITY', + 'MATCH', + 'MEDIUMBLOB', + 'MEDIUMINT', + 'MEDIUMTEXT', + 'MIDDLEINT', + 'MINUTE_MICROSECOND', + 'MINUTE_SECOND', + 'MOD', + 'MODIFIES', + 'MYSQL', + 'NATURAL', + 'NO_WRITE_TO_BINLOG', + 'NOT', + 'NULL', + 'NUMERIC', + 'ON', + 'OPTIMIZE', + 'OPTION', + 'OPTIONALLY', + 'OR', + 'ORDER', + 'OUT', + 'OUTER', + 'OUTFILE', + 'PERFORMANCE_SCHEMA', + 'PRECISION', + 'PRIMARY', + 'PROCEDURE', + 'PURGE', + 'RAID0', + 'RANGE', + 'READ', + 'READS', + 'REAL', + 'REFERENCES', + 'REGEXP', + 'RELEASE', + 'RENAME', + 'REPEAT', + 'REPLACE', + 'REPLICATOR', + 'REQUIRE', + 'RESTRICT', + 'RETURN', + 'REVOKE', + 'RIGHT', + 'RLIKE', + 'ROOT', + 'SCHEMA', + 'SCHEMAS', + 'SECOND_MICROSECOND', + 'SELECT', + 'SENSITIVE', + 'SEPARATOR', + 'SET', + 'SHOW', + 'SMALLINT', + 'SPATIAL', + 'SPECIFIC', + 'SQL', + 'SQL_BIG_RESULT', + 'SQL_CALC_FOUND_ROWS', + 'SQL_SMALL_RESULT', + 'SQLEXCEPTION', + 'SQLSTATE', + 'SQLWARNING', + 'SSL', + 'STARTING', + 'STRAIGHT_JOIN', + 'TABLE', + 'TERMINATED', + 'TEST', + 'THEN', + 'TINYBLOB', + 'TINYINT', + 'TINYTEXT', + 'TO', + 'TRAILING', + 'TRIGGER', + 'TRUE', + 'UNDO', + 'UNION', + 'UNIQUE', + 'UNLOCK', + 'UNSIGNED', + 'UPDATE', + 'USAGE', + 'USE', + 'USING', + 'UTC_DATE', + 'UTC_TIME', + 'UTC_TIMESTAMP', + 'VALUES', + 'VARBINARY', + 'VARCHAR', + 'VARCHARACTER', + 'VARYING', + 'WHEN', + 'WHERE', + 'WHILE', + 'WITH', + 'WRITE', + 'X509', + 'XOR', + 'XTRABAK', + 'YEAR_MONTH', + 'ZEROFILL', + + // RDS SQL Server + 'ADD', + 'ADMIN', + 'ADMINISTRATOR', + 'ALL', + 'ALTER', + 'AND', + 'ANY', + 'AS', + 'ASC', + 'AURORA', + 'AUTHORIZATION', + 'BACKUP', + 'BEGIN', + 'BETWEEN', + 'BREAK', + 'BROWSE', + 'BULK', + 'BULKADMIN', + 'BY', + 'CASCADE', + 'CASE', + 'CHECK', + 'CHECKPOINT', + 'CLOSE', + 'CLUSTERED', + 'COALESCE', + 'COLLATE', + 'COLUMN', + 'COMMIT', + 'COMPUTE', + 'CONSTRAINT', + 'CONTAINS', + 'CONTAINSTABLE', + 'CONTINUE', + 'CONVERT', + 'CREATE', + 'CROSS', + 'CURRENT', + 'CURRENT_DATE', + 'CURRENT_TIME', + 'CURRENT_TIMESTAMP', + 'CURRENT_USER', + 'CURSOR', + 'DATABASE', + 'DBCC', + 'DBCREATOR', + 'DEALLOCATE', + 'DECLARE', + 'DEFAULT', + 'DELETE', + 'DENY', + 'DESC', + 'DISK', + 'DISKADMIN', + 'DISTINCT', + 'DISTRIBUTED', + 'DISTRIBUTION', + 'DOUBLE', + 'DROP', + 'DUMMY', + 'DUMP', + 'EAGLEYE', + 'ELSE', + 'END', + 'ERRLVL', + 'ESCAPE', + 'EXCEPT', + 'EXEC', + 'EXECUTE', + 'EXISTS', + 'EXIT', + 'FETCH', + 'FILE', + 'FILLFACTOR', + 'FOR', + 'FOREIGN', + 'FREETEXT', + 'FREETEXTTABLE', + 'FROM', + 'FULL', + 'FUNCTION', + 'GALAXY', + 'GOTO', + 'GRANT', + 'GROUP', + 'GUEST', + 'HAVING', + 'HOLDLOCK', + 'IDENTITY', + 'IDENTITY_INSERT', + 'IDENTITYCOL', + 'IF', + 'IN', + 'INDEX', + 'INNER', + 'INSERT', + 'INTERSECT', + 'INTO', + 'IS', + 'JOIN', + 'KEY', + 'KILL', + 'LEFT', + 'LIKE', + 'LINENO', + 'LOAD', + 'MASTER', + 'MODEL', + 'MSDB', + 'MSSQLD', + 'MSSQLSYSTEMRESOURCE', + 'NATIONAL', + 'NOCHECK', + 'NONCLUSTERED', + 'NOT', + 'NULL', + 'NULLIF', + 'OF', + 'OFF', + 'OFFSETS', + 'ON', + 'OPEN', + 'OPENDATASOURCE', + 'OPENQUERY', + 'OPENROWSET', + 'OPENXML', + 'OPTION', + 'OR', + 'ORDER', + 'OUTER', + 'OVER', + 'PERCENT', + 'PLAN', + 'PRECISION', + 'PRIMARY', + 'PRINT', + 'PROC', + 'PROCEDURE', + 'PROCESSADMIN', + 'PUBLIC', + 'PUBLIC', + 'RAISERROR', + 'READ', + 'READTEXT', + 'RECONFIGURE', + 'REFERENCES', + 'REPLICATION', + 'RESTORE', + 'RESTRICT', + 'RETURN', + 'REVOKE', + 'RIGHT', + 'ROLLBACK', + 'ROOT', + 'ROWCOUNT', + 'ROWGUIDCOL', + 'RULE', + 'SA', + 'SAVE', + 'SCHEMA', + 'SECURITYADMIN', + 'SELECT', + 'SERVERADMIN', + 'SESSION_USER', + 'SET', + 'SETUPADMIN', + 'SETUSER', + 'SHUTDOWN', + 'SOME', + 'STATISTICS', + 'SYSADMIN', + 'SYSTEM_USER', + 'TABLE', + 'TEMPDB', + 'TEXTSIZE', + 'THEN', + 'TO', + 'TOP', + 'TRAN', + 'TRANSACTION', + 'TRIGGER', + 'TRUNCATE', + 'TSEQUAL', + 'UNION', + 'UNIQUE', + 'UPDATE', + 'UPDATETEXT', + 'USE', + 'USER', + 'VALUES', + 'VARYING', + 'VIEW', + 'WAITFOR', + 'WHEN', + 'WHERE', + 'WHILE', + 'WITH', + 'WRITETEXT' +] diff --git a/webs/cmp-web/src/views/resource/ctstack/router.js b/webs/cmp-web/src/views/resource/ctstack/router.js index 658d8fd..c53e1d2 100644 --- a/webs/cmp-web/src/views/resource/ctstack/router.js +++ b/webs/cmp-web/src/views/resource/ctstack/router.js @@ -17,5 +17,8 @@ export default { ctstackCreateCluster: () => import('views/resource/ctstack/page/container/creatCluster/index.vue'), ctstackInstanceAdd: () => import('views/resource/ctstack/page/container/instance/create/index.vue'), ctstackAddBareMetal: () => import('views/resource/ctstack/page/bareMetal/addBareMetal.vue'), - ctstackBareMetal: () => import('views/resource/ctstack/page/bareMetal/index.vue') + ctstackBareMetal: () => import('views/resource/ctstack/page/bareMetal/index.vue'), + // 数据库 + ctstackRds: () => import('views/resource/ctstack/page/database/rds/index.vue') + // ctstackPgSQL: () => import('views/resource/ctstack/page/database/pgsql/cluster/index.vue') } diff --git a/webs/cmp-web/src/views/resource/ctstack/services/database/common.js b/webs/cmp-web/src/views/resource/ctstack/services/database/common.js new file mode 100644 index 0000000..851e7c6 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/services/database/common.js @@ -0,0 +1,24 @@ +import { request } from '@cmp/cmp-element' +import { wrapperParams } from 'utils' + +// 查询实例IP白名单列表 +export function getSecurityIps(url) { + return function (params) { + return request.get(`/cmp/plugins/ctstack/v1/${url}/security/ips`, { + params + }) + } +} +// 修改MongoDB实例IP白名单 +export function modifySecurityIps(url, params) { + // 设置modifyMode传Cover ;删除modifyMode传Delete + return request.put(`/cmp/plugins/ctstack/v1/${url}/${params.id}/security/ips`, wrapperParams(params)) +} + +export function getUserApps(id) { + return request.get(`/sms/v1/users/${id}/apps`) +} + +export function getIps(params) { + return request.get('/cmp/plugins/ctstack/v1/vms/ips', { params }) +} diff --git a/webs/cmp-web/src/views/resource/ctstack/services/database/rds.js b/webs/cmp-web/src/views/resource/ctstack/services/database/rds.js new file mode 100644 index 0000000..73fac01 --- /dev/null +++ b/webs/cmp-web/src/views/resource/ctstack/services/database/rds.js @@ -0,0 +1,79 @@ +import { request } from '@cmp/cmp-element' +import { wrapperParams, downloadFile } from 'utils' +const url = '/cmp/plugins/ctstack/v1/rds' + +export function getRegion(params) { + return request.get(`${url}/mysql/regions`, { params }) +} + +export function getFlavor(params) { + return request.get(`${url}/mysql/flavors`, { params }) +} + +export function getParamGroup(params) { + return request.get(`${url}/mysql/param/groups`, { params }) +} + +export function createRds(params) { + return request.post(`${url}/mysql`, params) +} + +export function getRdsDbs(id, params) { + return request.get(`${url}/mysql/${id}/dbs`, { params }) +} + +export function getRdsCos(id, params) { + return request.get(`${url}/mysql/${id}/nets`, { params }) +} + +export function getAliRds(params) { + return request.get(`${url}/mysql`, { params }) +} + +export function detailAliRds(id) { + return request.get(`${url}/mysql/${id}`) +} + +export function patchAliRds(id) { + return request.patch(`${url}/mysql/${id}`) +} + +export function removeAliRds(id) { + return request.delete(`${url}/mysql/${id}`) +} + +export function getRdsUsers(id, params) { + return request.get(`${url}/mysql/${id}/users`, { params }) +} + +export function createRdsUsers(id, params) { + return request.post(`${url}/mysql/${id}/users`, params) +} + +export function removeRdsUsers(params) { + return request.delete(`${url}/mysql/${params.rdsId}/users/${params.userId}`) +} + +export function resetRdsUserPasd(params) { + return request.put(`${url}/mysql/${params.rdsId}/users/${params.userId}/resetpassword`, wrapperParams(params)) +} + +export function resetRdsUser(params) { + return request.put(`${url}/mysql/${params.rdsId}/users/${params.userId}/resetaccount`, wrapperParams(params)) +} + +export function authRdsUser(params) { + return request.put(`${url}/mysql/${params.rdsId}/users/${params.userId}/dbs`, wrapperParams(params)) +} + +export function createRdsDbs(id, params) { + return request.post(`${url}/mysql/${id}/dbs`, params) +} + +export function removeRdsDbs(params) { + return request.delete(`${url}/mysql/${params.rdsId}/dbs/${params.dbId}`) +} + +export function getFlavorSpec(params) { + return request.get(`${url}/mysql/flavors/spec`, { params }) +}