Skip to content

Commit

Permalink
feat(frontend): webconsole支持redis主从 TencentBlueKing#7764
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 22966
  • Loading branch information
JustaCattt authored and hLinx committed Nov 6, 2024
1 parent 2256000 commit 74181c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@
import { queryAllTypeCluster } from '@services/source/dbbase';
import { DBTypes } from '@common/const';
import { DBTypes, queryClusterTypes } from '@common/const';
import { messageWarn } from '@utils';
import type { ClusterItem } from '../Index.vue';
type ClusterItem = ServiceReturnType<typeof queryAllTypeCluster>[number];
interface Props {
dbType: DBTypes;
Expand Down Expand Up @@ -104,11 +104,6 @@
const routeClusterId = route.query.clusterId;
let clustersRaw: ClusterItem[] = [];
let tippyIns: Instance | undefined;
const queryClusterTypesMap = {
[DBTypes.MYSQL]: 'tendbha,tendbsingle',
[DBTypes.TENDBCLUSTER]: 'tendbcluster',
[DBTypes.REDIS]: 'TwemproxyRedisInstance,PredixyTendisplusCluster,TwemproxyTendisSSDInstance,PredixyRedisCluster',
};
const clutersRef = ref();
const addTabRef = ref();
Expand All @@ -131,7 +126,7 @@
defaultParams: [
{
bk_biz_id: window.PROJECT_CONFIG.BIZ_ID,
cluster_types: queryClusterTypesMap[props.dbType as keyof typeof queryClusterTypesMap],
cluster_types: queryClusterTypes[props.dbType].join(','),
phase: 'online',
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,17 @@
render: ({ data }: { data: RedisModel }) => {
const getOperations = (theme = 'primary') => {
const baseOperations = [
<auth-button
action-id="redis_webconsole"
resource={data.id}
permission={data.permission.redis_webconsole}
disabled={data.isOffline}
text
theme="primary"
class="mr-8"
onClick={() => handleGoWebconsole(data.id)}>
Webconsole
</auth-button>,
<OperationBtnStatusTips
v-db-console="redis.haClusterManage.backup"
data={data}
Expand Down Expand Up @@ -1164,6 +1175,15 @@
deleteKeyState.data = _.cloneDeep(data);
};
const handleGoWebconsole = (clusterId: number) => {
router.push({
name: 'RedisWebconsole',
query: {
clusterId
}
});
}
const handleShowBackup = (data: RedisModel[] = []) => {
if (
data.some(item => item.operations.length > 0
Expand Down

0 comments on commit 74181c6

Please sign in to comment.