Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(frontend): service接口重构 #1446 #1815

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions dbm-ui/frontend/src/components/apply-items/BackendQPSSpec.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@
import _ from 'lodash';
import { useI18n } from 'vue-i18n';
import { getSpecResourceCount } from '@services/dbResource';
import RedisClusterSpecModel from '@services/model/resource-spec/redis-cluster-sepc';
import { getSpecResourceCount } from '@services/source/dbresourceResource';
import {
getFilterClusterSpec,
queryQPSRange,
} from '@services/resourceSpec';
} from '@services/source/dbresourceSpec';
import { ClusterTypes } from '@common/const';
Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/frontend/src/components/apply-items/BackendSpec.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
import _ from 'lodash';
import { useI18n } from 'vue-i18n';

import { getSpecResourceCount } from '@services/dbResource';
import RedisClusterSpecModel from '@services/model/resource-spec/redis-cluster-sepc';
import { getFilterClusterSpec } from '@services/resourceSpec';
import { getSpecResourceCount } from '@services/source/dbresourceResource';
import { getFilterClusterSpec } from '@services/source/dbresourceSpec';

import { ClusterTypes } from '@common/const';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';

import { getBizs } from '@services/common';
import { getBizs } from '@services/source/cmdb';
import type { BizItem } from '@services/types/common';

import { nameRegx } from '@common/regex';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';

import { verifyDuplicatedClusterName } from '@services/dbbase';
import { verifyDuplicatedClusterName } from '@services/source/dbbase';

interface Props {
modelValue: string,
Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/frontend/src/components/apply-items/SpecSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';

import { getSpecResourceCount } from '@services/dbResource';
import ResourceSpecModel from '@services/model/resource-spec/resourceSpec';
import { getResourceSpecList } from '@services/resourceSpec';
import { getSpecResourceCount } from '@services/source/dbresourceResource';
import { getResourceSpecList } from '@services/source/dbresourceSpec';

interface ResourceSpecData extends ResourceSpecModel {
count?: number,
Expand Down
5 changes: 4 additions & 1 deletion dbm-ui/frontend/src/components/auth/AuthComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
* the specific language governing permissions and limitations under the License.
*/

import { checkAuthAllowed, getApplyDataLink } from '@services/common';
import {
checkAuthAllowed,
getApplyDataLink,
} from '@services/source/iam';

import './style.less';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';

import { getBizs } from '@services/common';
import { getBizs } from '@services/source/cmdb';
import type { BizItem } from '@services/types/common';

import { useUserProfile } from '@stores';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@
import { useI18n } from 'vue-i18n';

import { getPermissionRules, preCheckAuthorizeRules } from '@services/permission';
import { createTicket } from '@services/ticket';
import { checkHost } from '@services/source/ipchooser';
import { createTicket } from '@services/source/ticket';
import type { ResourceItem } from '@services/types/clusters';
import type { HostDetails } from '@services/types/ip';
import type { AuthorizePreCheckData, PermissionRule } from '@services/types/permission';
import type { WhitelistItem } from '@services/types/whitelist';

Expand Down Expand Up @@ -317,7 +317,7 @@
/**
* ip 选择
*/
function handleChangeIP(data: HostDetails[]) {
function handleChangeIP(data: ServiceReturnType<typeof checkHost>) {
state.formdata.source_ips = data.map(item => ({
ip: item.ip,
bk_host_id: item.host_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
import type { UploadFile } from 'bkui-vue/lib/upload/upload.type';
import { useI18n } from 'vue-i18n';

import { createTicket } from '@services/ticket';
import { createTicket } from '@services/source/ticket';
import type { BaseResponse } from '@services/types/common';
import type {
AuthorizePreCheckData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
} from 'bkui-vue/lib/icon';
import { ref } from 'vue';

import { getPulsarPassword } from '@services/source/bigdata';
import { getPulsarPassword } from '@services/source/pulsar';

import { useCopy } from '@hooks';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
<script lang="tsx">
import { useI18n } from 'vue-i18n';

import type {
HostDetails,
} from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';

type HostDetails = ServiceReturnType<typeof checkHost>[number]

export type IHostTableData = HostDetails;
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
<script lang="tsx">
import { useI18n } from 'vue-i18n';

import type {
HostDetails,
} from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';

type HostDetails = ServiceReturnType<typeof checkHost>[number]

export type IHostTableData = HostDetails;
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
<script lang="tsx">
import { useI18n } from 'vue-i18n';

import type { HostDetails } from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';

type HostDetails = ServiceReturnType<typeof checkHost>[number]

export interface IHostTableDataWithInstance extends HostDetails {
instance_num: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import {
ref,
} from 'vue';

import type {
HostDetails,
} from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';

import { useDebouncedRef } from '@hooks';

import { encodeRegexp } from '@utils';

export default function (originalData: Ref<Array<HostDetails>>) {
type HostDetails = ServiceReturnType<typeof checkHost>

export default function (originalData: Ref<HostDetails>) {
const pagination = reactive({
count: 0,
current: 1,
Expand All @@ -44,7 +44,7 @@ export default function (originalData: Ref<Array<HostDetails>>) {
result.push(item);
}
return result;
}, [] as Array<HostDetails>);
}, [] as HostDetails);
});

const isShowPagination = ref(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@
<script setup lang="tsx">
import { useI18n } from 'vue-i18n';

import type { HostDetails } from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';

import HostSelector from './components/HostSelector.vue';
import ResourcePoolSelector from './components/ResourcePoolSelector.vue';

type HostDetails = ServiceReturnType<typeof checkHost>[number]

export interface TExpansionNode {
// 集群节点展示名
label: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
} from 'vue';
import { useI18n } from 'vue-i18n';
import type { HostDetails } from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';
import { useGlobalBizs } from '@stores';
Expand All @@ -90,6 +90,8 @@
import type { TExpansionNode } from '../Index.vue';
type HostDetails = ServiceReturnType<typeof checkHost>[number]
interface Props {
cloudInfo: {
id: number,
Expand Down Expand Up @@ -133,22 +135,22 @@
{
label: t('节点 IP'),
field: 'ip',
render: ({ data }: {data:HostDetails}) => data.ip || '--',
render: ({ data }: {data: HostDetails}) => data.ip || '--',
},
{
label: t('Agent状态'),
field: 'alive',
render: ({ data }: { data:HostDetails }) => <HostAgentStatus data={data.alive} />,
render: ({ data }: { data: HostDetails }) => <HostAgentStatus data={data.alive} />,
},
{
label: t('磁盘_GB'),
field: 'bk_disk',
render: ({ data }: {data:HostDetails}) => data.bk_disk || '--',
render: ({ data }: {data: HostDetails}) => data.bk_disk || '--',
},
{
label: t('操作'),
width: 100,
render: ({ data }: {data:HostDetails}) => (
render: ({ data }: {data: HostDetails}) => (
<bk-button
text
theme="primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';
import { fetchRecommendSpec } from '@services/dbResource';
import { getResourceSpecList } from '@services/resourceSpec';
import {
fetchRecommendSpec,
getResourceSpecList,
} from '@services/source/dbresourceSpec';
import SpecDetail from '@components/cluster-common/SpecDetailForPopover.vue';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
import { useI18n } from 'vue-i18n';

import type EsNodeModel from '@services/model/es/es-node';
import type { HostDetails } from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';

import {
type IHostTableDataWithInstance,
Expand All @@ -131,7 +131,7 @@
import HostSelector from './components/HostSelector.vue';
import ResourcePoolSelector from './components/ResourcePoolSelector.vue';

export interface TReplaceNode{
export interface TReplaceNode {
// 集群id
clusterId: number,
// 集群的节点类型
Expand Down Expand Up @@ -159,7 +159,7 @@
interface Props {
data: TReplaceNode,
ipSource: string,
disableHostMethod?: (params: HostDetails) => string | boolean
disableHostMethod?: (params: ServiceReturnType<typeof checkHost>[number]) => string | boolean
}

interface Emits {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import type { HostDetails } from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';
import { useGlobalBizs } from '@stores';
Expand All @@ -75,6 +75,8 @@
import type { TReplaceNode } from '../Index.vue';
type HostDetails = ServiceReturnType<typeof checkHost>[number]
interface Props {
data: TReplaceNode,
placehoderId: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';
import { fetchRecommendSpec } from '@services/dbResource';
import { getResourceSpecList } from '@services/resourceSpec';
import {
fetchRecommendSpec,
getResourceSpecList,
} from '@services/source/dbresourceSpec';
import SpecDetail from '@components/cluster-common/SpecDetailForPopover.vue';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@
<script setup lang="tsx">
import { useI18n } from 'vue-i18n';

import type { HostDetails } from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';

import HostSelector from './components/HostSelector.vue';
import ResourcePoolSelector from './components/ResourcePoolSelector.vue';

type HostDetails = ServiceReturnType<typeof checkHost>[number]

export interface TExpansionNode {
// 集群节点展示名
label: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
} from 'vue';
import { useI18n } from 'vue-i18n';
import type { HostDetails } from '@services/types/ip';
import { checkHost } from '@services/source/ipchooser';
import { useGlobalBizs } from '@stores';
Expand All @@ -90,6 +90,8 @@
import type { TExpansionNode } from '../Index.vue';
type HostDetails = ServiceReturnType<typeof checkHost>[number]
interface Props {
cloudInfo: {
id: number,
Expand Down Expand Up @@ -133,22 +135,22 @@
{
label: t('节点 IP'),
field: 'ip',
render: ({ data }: {data:HostDetails}) => data.ip || '--',
render: ({ data }: {data: HostDetails}) => data.ip || '--',
},
{
label: t('Agent状态'),
field: 'alive',
render: ({ data }: { data:HostDetails }) => <HostAgentStatus data={data.alive} />,
render: ({ data }: { data: HostDetails }) => <HostAgentStatus data={data.alive} />,
},
{
label: t('磁盘_GB'),
field: 'bk_disk',
render: ({ data }: {data:HostDetails}) => data.bk_disk || '--',
render: ({ data }: {data: HostDetails}) => data.bk_disk || '--',
},
{
label: t('操作'),
width: 100,
render: ({ data }: {data:HostDetails}) => (
render: ({ data }: {data: HostDetails}) => (
<bk-button
text
theme="primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';
import { fetchRecommendSpec } from '@services/dbResource';
import { getResourceSpecList } from '@services/resourceSpec';
import {
fetchRecommendSpec,
getResourceSpecList,
} from '@services/source/dbresourceSpec';
import SpecDetail from '@components/cluster-common/SpecDetailForPopover.vue';
Expand Down
Loading
Loading