Skip to content

Commit

Permalink
Merge branch 'enterprise' into c/sb
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinplemelon committed Aug 28, 2024
2 parents bbb0c2b + 086fba0 commit d93e808
Show file tree
Hide file tree
Showing 93 changed files with 2,461 additions and 1,112 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,21 @@ jobs:
- check_package_version
if: (github.ref == 'refs/heads/enterprise') || startsWith(github.ref, 'refs/tags/e')
uses: ./.github/workflows/build_enterprise_package.yaml

bump_dashboard_version:
needs:
- set_version
- check_package_version
- build_ce_dashboard_package
- build_ee_dashboard_package
runs-on: ubuntu-latest
steps:
- name: Create PR in emqx/emqx
env:
GH_TOKEN: ${{ secrets.CI_GITHUB_TOKEN_EMQX_RW }}
EMQX_NAME: ${{ needs.set_version.outputs.emqx-name }}
VERSION: ${{ github.ref_name }}
run: |
gh --repo emqx/emqx workflow run bump-dashboard-version.yaml \
-f emqx-name=${EMQX_NAME} \
-f version=${VERSION}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
6 changes: 3 additions & 3 deletions src/api/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { pick } from 'lodash'
import qs from 'qs'

export function listClients(params = {}) {
return http.get('/clients', {
return http.get('/clients_v2', {
params,
// Multi-search support
paramsSerializer: (params: any) => {
Expand All @@ -13,11 +13,11 @@ export function listClients(params = {}) {
})
}

export function searchClients(clientId: string) {
export function exactSearchClient(clientId: string) {
return http.get(`/clients/${encodeURIComponent(clientId)}`)
}

// 搜索单个节点的连接
// Search for connections of a single node
export function searchNodeClients(nodeName: string, clientId: string) {
return http.get(`/nodes/${nodeName}/clients/${encodeURIComponent(clientId)}`)
}
Expand Down
6 changes: 5 additions & 1 deletion src/api/messageTransformation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import http from '@/common/http'
import { Metrics } from '@/types/common'
import { MessageTransform } from '@/types/typeAlias'
import { MessageTransform, TestMessageTransformData } from '@/types/typeAlias'

export const getMessageTransforms = (): Promise<Array<MessageTransform>> => {
return http.get(`/message_transformations`)
Expand Down Expand Up @@ -39,3 +39,7 @@ export const getMessageTransformMetrics = (name: string): Promise<Metrics> => {
export const resetMessageTransformMetrics = (name: string): Promise<void> => {
return http.post(`/message_transformations/transformation/${name}/metrics/reset`)
}

export const testMessageTransform = (data: TestMessageTransformData): Promise<any> => {
return http.post(`/message_transformations/dryrun`, data)
}
Binary file added src/assets/img/datalayers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {

export const API_BASE_URL = 'api/v5'

export const QoS_LIST = [0, 1, 2]

export const WEB_SOCKET_STATUS = {
Connecting: 'MCONNECTING',
Connected: 'MCONNECTED',
Expand Down Expand Up @@ -281,7 +279,7 @@ export const ADMIN_USERNAMES = ['admin', 'root', 'administrator']
const { VUE_APP_VERSION } = process.env
export const IS_ENTERPRISE = VUE_APP_VERSION === 'enterprise'

export const BRIDGE_TYPES_NOT_USE_SCHEMA = [BridgeType.InfluxDB]
export const BRIDGE_TYPES_NOT_USE_SCHEMA = [BridgeType.InfluxDB, BridgeType.Datalayers]

export const CONNECTOR_TYPES_WITH_TWO_DIRECTIONS = [BridgeType.MQTT, BridgeType.RabbitMQ]

Expand Down
28 changes: 21 additions & 7 deletions src/common/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { toLogin } from '@/router'
import store from '@/store'
import { stringifyObjSafely } from '@emqx/shared-ui-utils'
import _ from 'lodash'
import { API_BASE_URL, REQUEST_TIMEOUT_CODE } from '@/common/constants'
import { BAD_TOKEN, TOKEN_TIME_OUT, NAME_PWD_ERROR } from '@/common/customErrorCode'
Expand Down Expand Up @@ -58,6 +59,25 @@ const readBlobResponse = async (data) => {
}
}

const getErrorMessage = (data, status) => {
if (!data) {
return `${status} Network error`
}
if (typeof data !== 'object') {
return `${status}: ${data.toString()}`
}
const { code, message } = data
if (code || message) {
const popupMsg = message
? typeof message === 'object'
? JSON.stringify(message)
: message.toString()
: ''
return `${status} ${code ?? ''}: ${popupMsg}`
}
return `${status}: ${stringifyObjSafely(data)}`
}

/**
* there are some custom configurations
* doNotTriggerProgress: The request progress bar is not affected when the request is initiated or after the request is ended
Expand Down Expand Up @@ -114,14 +134,8 @@ axios.interceptors.response.use(
if (!handleErrorSelf) {
if (data.code === NAME_PWD_ERROR) {
ElNotification.error(i18n.global.t('Base.namePwdError'))
} else if (data.code || data.message) {
data.message =
typeof data.message === 'object' ? JSON.stringify(data.message) : data.message
const code = data.code !== null && data.code !== undefined ? data.code : ''
const message = data.message ? data.message.toString() : ''
CustomMessage.error(`${status} ${code}: ${message}`)
} else {
CustomMessage.error(`${status} Network error`)
CustomMessage.error(getErrorMessage(data, status))
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/components/AdvancedSettingContainer.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="btn-container">
<AdvancedSettingsBtn v-model="showAdvancedSettings" />
<AdvancedSettingsBtn v-model="showAdvancedSettings" :button-text="buttonText" />
</div>
<el-collapse-transition>
<div class="advanced-settings" v-if="showAdvancedSettings">
Expand All @@ -10,10 +10,14 @@
</template>

<script setup lang="ts">
import { ref } from 'vue'
import AdvancedSettingsBtn from '@/components/AdvancedSettingsBtn.vue'
import { defineProps, ref } from 'vue'
import { useStore } from 'vuex'
defineProps<{
buttonText?: string
}>()
const showAdvancedSettings = ref(false)
const { getters } = useStore()
/**
Expand Down
5 changes: 4 additions & 1 deletion src/components/AdvancedSettingsBtn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
link
@click="toggle"
>
{{ tl('advancedSettings') }}
{{ buttonText ?? tl('advancedSettings') }}
<el-icon :class="{ 'is-rotate': modelValue }"><ArrowRight /></el-icon>
</div>
</template>
Expand All @@ -22,6 +22,9 @@ const props = defineProps({
type: Boolean,
default: false,
},
buttonText: {
type: String,
},
})
const emit = defineEmits(['update:modelValue'])

Expand Down
8 changes: 8 additions & 0 deletions src/components/ArrayEditor.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<p class="value" v-if="readonly">
{{ Array.isArray(modelValue) ? modelValue.join(', ') : modelValue }}
</p>
<el-select
v-else
class="array-editor"
v-model="selected"
multiple
Expand Down Expand Up @@ -36,6 +40,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
readonly: {
type: Boolean,
default: false,
},
})
const emit = defineEmits(['update:modelValue'])
Expand Down
1 change: 1 addition & 0 deletions src/components/CodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export default {
top: 6px;
right: 8px;
cursor: pointer;
color: #fff;
}
}
.el-popper {
Expand Down
35 changes: 34 additions & 1 deletion src/components/ListenerDrawer/ListenerDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@
<el-row :gutter="20" v-if="!gatewayName">
<el-col :span="24"><el-divider /></el-col>
<el-col :span="12">
<el-form-item :label="tl('showLimiter')"> </el-form-item>
<el-form-item>
<template #label>
<form-item-label
:label="tl('showLimiter')"
:desc="tl('showLimiterDesc')"
desc-marked
/>
</template>
</el-form-item>
</el-col>
<el-col :span="12" />
<el-col v-if="!typesWithoutMaxConnectionRate.includes(listenerRecord.type)" :span="12">
Expand Down Expand Up @@ -172,6 +180,30 @@
<el-input v-model="listenerRecord.mountpoint" />
</el-form-item>
</el-col>
<template v-if="isCoAP && listenerRecord.health_check">
<el-col :span="12">
<el-form-item prop="health_check.request">
<template #label>
<FormItemLabel
:label="t('Gateway.healthCheck')"
:desc="$t('Gateway.healthCheckDesc')"
/>
</template>
<el-input v-model="listenerRecord.health_check.request" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="t('Gateway.healthCheckResponse')" prop="health_check.reply">
<template #label>
<FormItemLabel
:label="t('Gateway.healthCheckResponse')"
:desc="$t('Gateway.healthCheckResponseDesc')"
/>
</template>
<el-input v-model="listenerRecord.health_check.reply" />
</el-form-item>
</el-col>
</template>
<el-col :span="12" v-if="!isUDP">
<el-form-item :label="$t('BasicConfig.acceptors')" prop="acceptors">
<CustomInputNumber v-model="listenerRecord.acceptors" />
Expand Down Expand Up @@ -466,6 +498,7 @@ const {
showUDPConfig,
showSSLConfig,
isDTLS,
isCoAP,
SSLConfigKey,
showWSConfig,
listenerFormRules,
Expand Down
22 changes: 12 additions & 10 deletions src/components/Metrics/OverviewMetrics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<div>
<p class="metric-name">{{ getMetricItemLabel(totals[typeMetricsData.name]) }}</p>
<p class="metric-num">
{{ formatNumber(currentMetrics[totals[typeMetricsData.name]]) }}
{{ formatNumber(get(currentMetrics, totals[typeMetricsData.name])) }}
</p>
</div>
</el-col>
Expand Down Expand Up @@ -71,10 +71,10 @@
<p class="metric-name">{{ getMetricItemLabel(rateMetrics.current) }}</p>
<p class="metric-num">
<span class="num">
{{ formatNumber(currentMetrics[rateMetrics.current]) }}
{{ formatNumber(get(currentMetrics, rateMetrics.current)) }}
</span>
<span class="unit">
{{ t(rateMetrics.unitKey, currentMetrics[rateMetrics.current]) }}
{{ t(rateMetrics.unitKey, get(currentMetrics, rateMetrics.current)) }}
</span>
</p>
</div>
Expand All @@ -91,21 +91,21 @@
<p class="metric-name">{{ getMetricItemLabel(rateMetrics.right1) }}</p>
<p class="metric-num">
<span class="num">
{{ formatNumber(currentMetrics[rateMetrics.right1]) }}
{{ formatNumber(get(currentMetrics, rateMetrics.right1)) }}
</span>
<span class="unit">
{{ t(rateMetrics.unitKey, currentMetrics[rateMetrics.right1]) }}
{{ t(rateMetrics.unitKey, get(currentMetrics, rateMetrics.right1)) }}
</span>
</p>
</div>
<div v-if="rateMetrics.right2" class="metric-rate-item">
<p class="metric-name">{{ getMetricItemLabel(rateMetrics.right2) }}</p>
<p class="metric-num">
<span class="num">
{{ formatNumber(currentMetrics[rateMetrics.right2]) }}
{{ formatNumber(get(currentMetrics, rateMetrics.right2)) }}
</span>
<span class="unit">
{{ t(rateMetrics.unitKey, currentMetrics[rateMetrics.right2]) }}
{{ t(rateMetrics.unitKey, get(currentMetrics, rateMetrics.right2)) }}
</span>
</p>
</div>
Expand All @@ -117,7 +117,7 @@
<div class="metric-block" v-if="showChildrenStats">
<div class="block-hd">
<p class="block-title">
{{ tl('action') }}
{{ childrenTitle ?? tl('action') }}
</p>
</div>
<div v-for="(typeMetricsData, index) in typeMetricsDataSets" :key="index">
Expand All @@ -137,7 +137,7 @@
{{ getMetricItemLabel(totals[typeMetricsDataChild.name]) }}
</p>
<p class="metric-num">
{{ formatNumber(currentMetrics[totals[typeMetricsDataChild.name]]) }}
{{ formatNumber(get(currentMetrics, totals[typeMetricsDataChild.name])) }}
</p>
</div>
</el-col>
Expand Down Expand Up @@ -185,6 +185,7 @@ import useSyncPolling from '@/hooks/useSyncPolling'
import { Metrics, MetricsDataWithExtraData, SetItem } from '@/types/common'
import { Close, Refresh } from '@element-plus/icons-vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { get } from 'lodash'
import { computed, defineProps, inject, ref } from 'vue'
import TypeMetrics from './TypeMetrics.vue'

Expand Down Expand Up @@ -221,6 +222,7 @@ const props = defineProps<{
title?: string
tableData?: Array<string>
nodeStatusDesc?: string
childrenTitle?: string
}>()

// Special handling of metric styles under Flow nodes
Expand Down Expand Up @@ -311,7 +313,7 @@ const { updateBarData } = useRateChart()
const getInitRateData = () => createEmptyRateData(rateDataLength)
let rateData = getInitRateData()
const updateRateData = (metrics: Metrics) => {
const rate = metrics[props.rateMetrics.current]
const rate = get(metrics, props.rateMetrics.current)
return addRateDataItem(rate, rateData, rateDataLength)
}

Expand Down
31 changes: 21 additions & 10 deletions src/components/SchemaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -676,17 +676,28 @@ const SchemaForm = defineComponent({
return ele
}
case 'oneof': {
const props = { modelValue, items: property.oneOf }
if (isComplexOneof(property)) {
return (
<OneofRefs
{...props}
property={property}
colSpan={getColSpan(property)}
getText={getText}
readonly
/>
)
const props = {
modelValue,
property,
getText,
items: property.oneOf,
readonly: true,
colSpan: getColSpan(property),
}
if (property.useNewCom) {
return (
<OneofRefsSelect
{...props}
key={property.path}
fieldValue={modelValue}
onChange={(selectedProperty: any) =>
handleSelectOneof(property, selectedProperty)
}
/>
)
}
return <OneofRefs {...props} />
}
return <p class="value">{modelValue}</p>
}
Expand Down
1 change: 0 additions & 1 deletion src/hooks/Auth/useAuthnCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ export default function useAuthnCreate() {
const getKerberosConfig = () => {
return {
enable: true,
keytab_file: '',
principal: '',
}
}
Expand Down
Loading

0 comments on commit d93e808

Please sign in to comment.