mirror of
https://github.com/woodchen-ink/clash-and-dashboard.git
synced 2025-07-18 14:01:56 +08:00
Feature: make the selector proxies order as same as the order in the config file (#12)
* make the proxies order the same as the order in config file * ...
This commit is contained in:
parent
48bec46721
commit
73c9681c3c
@ -6,7 +6,7 @@ import classnames from 'classnames'
|
|||||||
import './style.scss'
|
import './style.scss'
|
||||||
|
|
||||||
interface TagsProps extends BaseComponentProps, I18nProps {
|
interface TagsProps extends BaseComponentProps, I18nProps {
|
||||||
data: Set<string>
|
data: string[]
|
||||||
onClick: (name: string) => void
|
onClick: (name: string) => void
|
||||||
select: string
|
select: string
|
||||||
rowHeight: number
|
rowHeight: number
|
||||||
@ -40,8 +40,7 @@ class TagsClass extends React.Component<TagsProps, TagsState> {
|
|||||||
const rowHeight = this.state.expand ? 'auto' : this.props.rowHeight
|
const rowHeight = this.state.expand ? 'auto' : this.props.rowHeight
|
||||||
const handleClick = canClick ? onClick : noop
|
const handleClick = canClick ? onClick : noop
|
||||||
|
|
||||||
const tags = [...data]
|
const tags = data
|
||||||
.sort()
|
|
||||||
.map(t => {
|
.map(t => {
|
||||||
const tagClass = classnames({ 'tags-selected': select === t, 'can-click': canClick })
|
const tagClass = classnames({ 'tags-selected': select === t, 'can-click': canClick })
|
||||||
return (
|
return (
|
||||||
|
@ -21,7 +21,6 @@ export class Group extends React.Component<GroupProps, {}> {
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { config } = this.props
|
const { config } = this.props
|
||||||
const proxies = new Set(config.all)
|
|
||||||
const canClick = config.type === 'Selector'
|
const canClick = config.type === 'Selector'
|
||||||
return (
|
return (
|
||||||
<div className="proxy-group">
|
<div className="proxy-group">
|
||||||
@ -32,7 +31,7 @@ export class Group extends React.Component<GroupProps, {}> {
|
|||||||
<div className="proxy-group-tags-container">
|
<div className="proxy-group-tags-container">
|
||||||
<Tags
|
<Tags
|
||||||
className="proxy-group-tags"
|
className="proxy-group-tags"
|
||||||
data={proxies}
|
data={config.all}
|
||||||
onClick={this.handleChangeProxySelected}
|
onClick={this.handleChangeProxySelected}
|
||||||
select={config.now}
|
select={config.now}
|
||||||
canClick={canClick}
|
canClick={canClick}
|
||||||
|
@ -70,13 +70,13 @@ export class ConfigStore {
|
|||||||
|
|
||||||
const policyGroup = new Set(['Selector', 'URLTest', 'Fallback', 'LoadBalance'])
|
const policyGroup = new Set(['Selector', 'URLTest', 'Fallback', 'LoadBalance'])
|
||||||
const unUsedProxy = new Set(['DIRECT', 'REJECT', 'GLOBAL'])
|
const unUsedProxy = new Set(['DIRECT', 'REJECT', 'GLOBAL'])
|
||||||
const proxies = Object.keys(rawProxies.data.proxies)
|
const proxyList = rawProxies.data.proxies['GLOBAL'] as API.Group
|
||||||
|
const proxies = proxyList.all
|
||||||
.filter(key => !unUsedProxy.has(key))
|
.filter(key => !unUsedProxy.has(key))
|
||||||
.map(key => ({ ...rawProxies.data.proxies[key], name: key }))
|
.map(key => ({ ...rawProxies.data.proxies[key], name: key }))
|
||||||
const [proxy, groups] = partition(proxies, proxy => !policyGroup.has(proxy.type))
|
const [proxy, groups] = partition(proxies, proxy => !policyGroup.has(proxy.type))
|
||||||
this.data.proxy = proxy as API.Proxy[]
|
this.data.proxy = proxy as API.Proxy[]
|
||||||
this.data.proxyGroup = groups as API.Group[]
|
this.data.proxyGroup = groups as API.Group[]
|
||||||
|
|
||||||
this.data.rules = rules.data.rules
|
this.data.rules = rules.data.rules
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user