Skip to content

Commit

Permalink
refactor(data integration): remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon authored and ysfscream committed Jan 7, 2025
1 parent 83e1da8 commit d0c7615
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 141 deletions.
8 changes: 0 additions & 8 deletions src/hooks/Rule/bridge/useDeleteBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ interface DeleteBridgeResult {
showSecondConfirm: Ref<boolean>
usingBridgeRules: Ref<string[]>
currentDeleteBridgeId: Ref<string>
currentDelName: Ref<string>
showDeleteWebhookAssociatedTip: Ref<boolean>
handleDeleteSuc: () => void
handleDeleteBridge: (data: BridgeItem) => Promise<void>
}
Expand All @@ -24,8 +22,6 @@ export default (deletedCallBack: () => void): DeleteBridgeResult => {
const usingBridgeRules: Ref<Array<string>> = ref([])
const currentDeleteBridgeId = ref('')

const currentDelName = ref('')
const showDeleteWebhookAssociatedTip = ref(false)
const { judgeIsWebhookAction } = useWebhookUtils()

const handleDeleteSuc = () => {
Expand All @@ -43,8 +39,6 @@ export default (deletedCallBack: () => void): DeleteBridgeResult => {
const { deleteAction } = useHandleActionItem()
const handleDeleteBridge = async (item: BridgeItem) => {
if (judgeIsWebhookAction(item)) {
currentDelName.value = item.name
showDeleteWebhookAssociatedTip.value = true
return
}
if (item.rules?.length) {
Expand All @@ -71,8 +65,6 @@ export default (deletedCallBack: () => void): DeleteBridgeResult => {
showSecondConfirm,
usingBridgeRules,
currentDeleteBridgeId,
currentDelName,
showDeleteWebhookAssociatedTip,
handleDeleteSuc,
handleDeleteBridge,
}
Expand Down
10 changes: 1 addition & 9 deletions src/hooks/Rule/connector/useHandleConnectorItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ interface ConnectorHandlerResult {
isTesting: Ref<boolean>
testConnectivity: (data: NowConnector) => Promise<void>
showDelTip: Ref<boolean>
currentDelName: Ref<string>
showDeleteWebhookAssociatedTip: Ref<boolean>
handleDeleteConnector: (data: Connector, callback: () => void | Promise<void>) => Promise<void>
}

Expand Down Expand Up @@ -138,18 +136,14 @@ export default (): ConnectorHandlerResult => {
return confirmDel(() => deleteConnector(id))
}

const currentDelName = ref('')
const showDeleteWebhookAssociatedTip = ref(false)
const { judgeIsWebhookConnector } = useWebhookUtils()

const handleDeleteConnector = async (
connector: Connector,
callback: () => void | Promise<void>,
) => {
const { id, actions, sources, name } = connector
const { id, actions, sources } = connector
if (judgeIsWebhookConnector(connector)) {
currentDelName.value = name
showDeleteWebhookAssociatedTip.value = true
return
}
if ((actions && actions.length) || (sources && sources.length)) {
Expand Down Expand Up @@ -180,8 +174,6 @@ export default (): ConnectorHandlerResult => {
isTesting,
testConnectivity,
showDelTip,
currentDelName,
showDeleteWebhookAssociatedTip,
handleDeleteConnector,
}
}
8 changes: 0 additions & 8 deletions src/views/RuleEngine/Bridge/BridgeDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@
:id="currentDeleteBridgeId"
@submitted="handleDeleteSuc"
/>
<DeleteWebhookAssociatedTip
v-model="showDeleteWebhookAssociatedTip"
type="action"
:name="currentDelName"
/>
</div>
</template>

Expand All @@ -164,7 +159,6 @@ import _ from 'lodash'
import type { Ref } from 'vue'
import { computed, defineExpose, defineProps, onMounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import DeleteWebhookAssociatedTip from '../components/DeleteWebhookAssociatedTip.vue'
import TargetItemStatus from '../components/TargetItemStatus.vue'
import BridgeItemOverview from './Components/BridgeItemOverview.vue'
import DeleteBridgeSecondConfirm from './Components/DeleteBridgeSecondConfirm.vue'
Expand Down Expand Up @@ -364,8 +358,6 @@ const {
showSecondConfirm,
usingBridgeRules,
currentDeleteBridgeId,
showDeleteWebhookAssociatedTip,
currentDelName,
handleDeleteSuc,
handleDeleteBridge,
} = useDeleteBridge(goBack)
Expand Down
8 changes: 0 additions & 8 deletions src/views/RuleEngine/Bridge/DataBridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@
:direction="BridgeDirection.Egress"
@submitted="handleDeleteSuc"
/>
<DeleteWebhookAssociatedTip
v-model="showDeleteWebhookAssociatedTip"
type="action"
:name="currentDelName"
/>
</template>

<script lang="ts" setup>
Expand All @@ -115,7 +110,6 @@ import { ElMessageBox, ElMessage as M } from 'element-plus'
import type { Ref } from 'vue'
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import DeleteWebhookAssociatedTip from '../components/DeleteWebhookAssociatedTip.vue'
import OperateWebhookAssociatedPopover from '../components/OperateWebhookAssociatedPopover.vue'
import TableItemDropDown from '../components/TableItemDropDown.vue'
import TargetItemStatus from '../components/TargetItemStatus.vue'
Expand Down Expand Up @@ -178,8 +172,6 @@ const {
showSecondConfirm,
usingBridgeRules,
currentDeleteBridgeId,
currentDelName,
showDeleteWebhookAssociatedTip,
handleDeleteSuc,
handleDeleteBridge,
} = useDeleteBridge(listBridge)
Expand Down
8 changes: 0 additions & 8 deletions src/views/RuleEngine/Connector/Connector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@
<CreateRuleWithConnector v-model="showCreateRuleDialog" :connector="createdConnector" />
</div>
<DelConnectorTip v-model="showDelTip" :connector="currentConnector" />
<DeleteWebhookAssociatedTip
v-model="showDeleteWebhookAssociatedTip"
type="connector"
:name="currentDelName"
/>
<DisableConnectorConfirm
v-model="showDisableConfirm"
:connector="(currentConnector as Connector)"
Expand All @@ -129,7 +124,6 @@ import { ConnectionStatus } from '@/types/enum'
import { BridgeItem, Connector } from '@/types/rule'
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import DeleteWebhookAssociatedTip from '../components/DeleteWebhookAssociatedTip.vue'
import OperateWebhookAssociatedPopover from '../components/OperateWebhookAssociatedPopover.vue'
import TableItemDropDown from '../components/TableItemDropDown.vue'
import TargetItemStatus from '../components/TargetItemStatus.vue'
Expand Down Expand Up @@ -174,8 +168,6 @@ const {
currentConnector,
handleToggleConnectorEnable,
showDelTip,
currentDelName,
showDeleteWebhookAssociatedTip,
} = useHandleConnectorItem()
const { judgeIsWebhookConnector } = useWebhookUtils()
Expand Down
7 changes: 0 additions & 7 deletions src/views/RuleEngine/Connector/ConnectorDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@
</div>
<CopySubmitDialog v-model="showNameInputDialog" :target="copyTarget" />
<DelConnectorTip v-model="showDelTip" :connector="connectorData" />
<DeleteWebhookAssociatedTip
v-model="showDeleteWebhookAssociatedTip"
type="connector"
:name="connectorData.name"
/>
<DisableConnectorConfirm
v-model="showDisableConfirm"
:connector="(currentConnector as Connector)"
Expand Down Expand Up @@ -145,7 +140,6 @@ import { lowerCase } from 'lodash'
import { computed, defineProps, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import CopySubmitDialog from '../components/CopySubmitDialog.vue'
import DeleteWebhookAssociatedTip from '../components/DeleteWebhookAssociatedTip.vue'
import TargetItemStatus from '../components/TargetItemStatus.vue'
import DelConnectorTip from './components/DelConnectorTip.vue'
import useConnectorFormComponent from './components/useConnectorFormComponent'
Expand Down Expand Up @@ -204,7 +198,6 @@ const {
testConnectivity,
handleDeleteConnector,
showDelTip,
showDeleteWebhookAssociatedTip,
} = useHandleConnectorItem()
/* Webhook associated */
Expand Down
10 changes: 0 additions & 10 deletions src/views/RuleEngine/Rule/Rule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@
</div>
</div>
</div>
<DeleteWebhookAssociatedTip
v-model="showDeleteWebhookAssociatedTip"
type="rule"
:name="currentDelId"
/>
<DeleteRuleConfirm v-model="showDeleteConfirm" :rule="currentRule" @submitted="handleDeleteSuc" />
</template>

Expand All @@ -116,7 +111,6 @@ import type { Ref } from 'vue'
import { onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import DeleteWebhookAssociatedTip from '../components/DeleteWebhookAssociatedTip.vue'
import OperateWebhookAssociatedPopover from '../components/OperateWebhookAssociatedPopover.vue'
import TableItemDropDown from '../components/TableItemDropDown.vue'
import DeleteRuleConfirm from './components/DeleteRuleConfirm.vue'
Expand Down Expand Up @@ -175,8 +169,6 @@ const copyRuleItem = (rule: RuleItem) => {
router.push({ name: 'rule-create', query: { target: rule.id, action: 'copy' } })
}
const currentDelId = ref('')
const showDeleteWebhookAssociatedTip = ref(false)
const { judgeIsWebhookRule } = useWebhookUtils()
const showDeleteConfirm = ref(false)
Expand All @@ -187,8 +179,6 @@ const deleteRule = async (rule: RuleItem) => {
return
}
if (judgeIsWebhookRule(rule)) {
currentDelId.value = id
showDeleteWebhookAssociatedTip.value = true
return
}
currentRule.value = rule
Expand Down
10 changes: 0 additions & 10 deletions src/views/RuleEngine/Rule/RuleDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@
</el-tabs>
<CopySubmitDialog :target="copyTarget" v-model="showNameInputDialog" />
</div>
<DeleteWebhookAssociatedTip
v-model="showDeleteWebhookAssociatedTip"
type="rule"
:name="currentDelId"
/>
<DeleteRuleConfirm v-model="showDeleteConfirm" :rule="currentRule" @submitted="handleDeleteSuc" />
</template>

Expand All @@ -104,7 +99,6 @@ import { computed, onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router'
import CopySubmitDialog from '../components/CopySubmitDialog.vue'
import DeleteWebhookAssociatedTip from '../components/DeleteWebhookAssociatedTip.vue'
import RuleForm from '../components/RuleForm.vue'
import DeleteRuleConfirm from './components/DeleteRuleConfirm.vue'
import RuleItemOverview from './components/RuleItemOverview.vue'
Expand Down Expand Up @@ -172,8 +166,6 @@ const enableOrDisableRule = async () => {
}
}
const currentDelId = ref('')
const showDeleteWebhookAssociatedTip = ref(false)
const { judgeIsWebhookRule } = useWebhookUtils()
/* Webhook associated */
Expand All @@ -188,8 +180,6 @@ const showDeleteConfirm = ref(false)
const currentRule = ref<undefined | RuleItem>(undefined)
const deleteRule = async () => {
if (isWebhookRule.value) {
currentDelId.value = id
showDeleteWebhookAssociatedTip.value = true
return
}
currentRule.value = ruleInfo.value
Expand Down
73 changes: 0 additions & 73 deletions src/views/RuleEngine/components/DeleteWebhookAssociatedTip.vue

This file was deleted.

0 comments on commit d0c7615

Please sign in to comment.