Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions router/admin_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ func AdminRouter(webSvr *gin.Engine, config *bootstrap.Config) {
}
ctx.JSON(http.StatusOK, resp)
})

// 后端server路由组
admin := webSvr.Group("/maintain/v1")
admin.GET("/server/functions", handlers.ReverseProxyNoAuthForServer(&config.PolarisServer, config))
}
6 changes: 5 additions & 1 deletion web/src/polaris/administration/accessLimiting/getColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ export default ({ creators }: AccessLimitingDuck): Column<RateLimit>[] => [
id: string
text: string
fn: (dispatch?: Dispatch<any>, e?) => void
disabled?: boolean
}[] = [
{
id: 'switchStatus',
text: x.disable ? '禁用' : '启用',
disabled: !x.editable,
fn: dispatch => {
const swtichStatusAction = x.disable ? SwitchStatusAction.disable : SwitchStatusAction.start
dispatch(creators.switchStatus(x.id, x.name, swtichStatusAction))
Expand All @@ -91,13 +93,15 @@ export default ({ creators }: AccessLimitingDuck): Column<RateLimit>[] => [
{
id: 'modify',
text: '编辑',
disabled:!x.editable,
fn: dispatch => {
dispatch(creators.modify(x))
},
},
{
id: 'remove',
text: '删除',
disabled:!x.deleteable,
fn: dispatch => {
dispatch(creators.delete(x))
},
Expand All @@ -106,7 +110,7 @@ export default ({ creators }: AccessLimitingDuck): Column<RateLimit>[] => [
return (
<React.Fragment>
{actions.map(action => (
<Action key={action.id} text={action.text} fn={action.fn} />
<Action disabled={action.disabled} key={action.id} text={action.text} fn={action.fn} />
))}
</React.Fragment>
)
Expand Down
2 changes: 2 additions & 0 deletions web/src/polaris/administration/accessLimiting/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export interface RateLimit {
resource: string // 限流资源
// priority: number // 限流规则优先级
// labels: Record<string, MetadataItem>
editable: boolean
deleteable: boolean
}

export interface DescribeLimitRulesResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ export default (props: DuckCmpProps<FaultDetectDuck>): Column<FaultDetectRule>[]
return (
<React.Fragment>
<Action
disabled={!x.editable}
text={'编辑'}
fn={() => {
router.navigate(`/faultDetect-create?id=${x.id}`)
}}
/>
<Action
disabled={!x.deleteable}
text={'删除'}
fn={() => {
dispatch(creators.remove(x))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ export class BreakerRuleCreateDuck extends Form {
send: '',
receive: [],
},
editable: true,
deleteable: true
}
}

Expand Down
2 changes: 2 additions & 0 deletions web/src/polaris/administration/breaker/faultDetect/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export interface FaultDetectRule {
}
ctime?: string
mtime?: string
editable: boolean
deleteable: boolean
}
export enum FaultDetectProtocol {
HTTP = 'HTTP',
Expand Down
3 changes: 3 additions & 0 deletions web/src/polaris/administration/breaker/getColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,22 @@ export default (props: DuckCmpProps<CircuitBreakerDuck>): Column<CircuitBreakerR
return (
<React.Fragment>
<Action
disabled={!x.editable}
text={x.enable ? '禁用' : '启用'}
fn={() => {
dispatch(creators.toggle(x))
}}
/>
<Action
disabled={!x.editable}
text={'编辑'}
fn={() => {
const type = checkRuleType(x?.level)
router.navigate(`/circuitBreaker-create?id=${x.id}&type=${type}`)
}}
/>
<Action
disabled={!x.deleteable}
text={'删除'}
fn={() => {
dispatch(creators.remove(x))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ export class BreakerRuleCreateDuck extends Form {
body: '',
},
},
editable: true,
deleteable: true
}
}

Expand Down
2 changes: 2 additions & 0 deletions web/src/polaris/administration/breaker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export interface CircuitBreakerRule {
ctime?: string
mtime?: string
etime?: string
editable: boolean
deleteable: boolean
}
export interface ErrorCondition {
inputType: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,34 +97,38 @@ export default (
id: string
text: string
fn: (dispatch?: Dispatch<any>, e?) => void
disabled: boolean
}[] = [
{
id: 'switchStatus',
text: x.enable ? '禁用' : '启用',
fn: dispatch => {
const swtichStatusAction = x.enable ? SwitchStatusAction.disable : SwitchStatusAction.start
dispatch(creators.switchStatus(x.id, x.name, swtichStatusAction))
{
id: 'switchStatus',
text: x.enable ? '禁用' : '启用',
fn: dispatch => {
const swtichStatusAction = x.enable ? SwitchStatusAction.disable : SwitchStatusAction.start
dispatch(creators.switchStatus(x.id, x.name, swtichStatusAction))
},
disabled: !x.editable,
},
},
{
id: 'modify',
text: '编辑',
fn: dispatch => {
dispatch(creators.modify(x))
{
id: 'modify',
text: '编辑',
fn: dispatch => {
dispatch(creators.modify(x))
},
disabled: !x.editable,
},
},
{
id: 'remove',
text: '删除',
fn: dispatch => {
dispatch(creators.delete(x))
{
id: 'remove',
text: '删除',
fn: dispatch => {
dispatch(creators.delete(x))
},
disabled: !x.deleteable,
},
},
]
]
return (
<React.Fragment>
{actions.map(action => (
<Action key={action.id} text={action.text} fn={action.fn} />
<Action disabled={action.disabled} key={action.id} text={action.text} fn={action.fn} />
))}
</React.Fragment>
)
Expand Down
20 changes: 11 additions & 9 deletions web/src/polaris/administration/dynamicRoute/customRoute/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ import { apiRequest, getApiRequest, putApiRequest } from '@src/polaris/common/ut

export interface CustomRoute {
id?: string
name: string // 规则名
enable: boolean // 是否启用
priority: number
description: string
routing_config: RoutingConfig
ctime: string
mtime: string
etime: string
routing_policy: string
name?: string // 规则名
enable?: boolean // 是否启用
priority?: number
description?: string
routing_config?: RoutingConfig
ctime?: string
mtime?: string
etime?: string
routing_policy?: string
editable?: boolean
deleteable?: boolean
}

export interface DescribeCustomRouteParams {
Expand Down
8 changes: 8 additions & 0 deletions web/src/polaris/auth/common/UseableResource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ interface Props {
namespaces: StrategyResourceEntry[]
services: StrategyResourceEntry[]
configGroups: StrategyResourceEntry[]
router_rules: StrategyResourceEntry[]
// lane_rules: StrategyResourceEntry[]
circuitbreaker_rules: StrategyResourceEntry[]
faultdetect_rules: StrategyResourceEntry[]
ratelimit_rules: StrategyResourceEntry[]
users: StrategyResourceEntry[]
user_groups: StrategyResourceEntry[]
auth_policies: StrategyResourceEntry[]
}
}
export default purify(function (props: Props) {
Expand Down
Loading
Loading