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'
|
||||
|
||||
interface TagsProps extends BaseComponentProps, I18nProps {
|
||||
data: Set<string>
|
||||
data: string[]
|
||||
onClick: (name: string) => void
|
||||
select: string
|
||||
rowHeight: number
|
||||
@ -40,8 +40,7 @@ class TagsClass extends React.Component<TagsProps, TagsState> {
|
||||
const rowHeight = this.state.expand ? 'auto' : this.props.rowHeight
|
||||
const handleClick = canClick ? onClick : noop
|
||||
|
||||
const tags = [...data]
|
||||
.sort()
|
||||
const tags = data
|
||||
.map(t => {
|
||||
const tagClass = classnames({ 'tags-selected': select === t, 'can-click': canClick })
|
||||
return (
|
||||
|
@ -21,7 +21,6 @@ export class Group extends React.Component<GroupProps, {}> {
|
||||
|
||||
render () {
|
||||
const { config } = this.props
|
||||
const proxies = new Set(config.all)
|
||||
const canClick = config.type === 'Selector'
|
||||
return (
|
||||
<div className="proxy-group">
|
||||
@ -32,7 +31,7 @@ export class Group extends React.Component<GroupProps, {}> {
|
||||
<div className="proxy-group-tags-container">
|
||||
<Tags
|
||||
className="proxy-group-tags"
|
||||
data={proxies}
|
||||
data={config.all}
|
||||
onClick={this.handleChangeProxySelected}
|
||||
select={config.now}
|
||||
canClick={canClick}
|
||||
|
@ -70,13 +70,13 @@ export class ConfigStore {
|
||||
|
||||
const policyGroup = new Set(['Selector', 'URLTest', 'Fallback', 'LoadBalance'])
|
||||
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))
|
||||
.map(key => ({ ...rawProxies.data.proxies[key], name: key }))
|
||||
const [proxy, groups] = partition(proxies, proxy => !policyGroup.has(proxy.type))
|
||||
this.data.proxy = proxy as API.Proxy[]
|
||||
this.data.proxyGroup = groups as API.Group[]
|
||||
|
||||
this.data.rules = rules.data.rules
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user