({
value,
onChange,
}: {
value?: string
onChange?(value: string): void
})
| 113 | } |
| 114 | |
| 115 | function StorageAndPathInputer({ |
| 116 | value, |
| 117 | onChange, |
| 118 | }: { |
| 119 | value?: string |
| 120 | onChange?(value: string): void |
| 121 | }) { |
| 122 | if (value == undefined) value = '' |
| 123 | if (value.includes(openlistInfo.markInRclone)) { |
| 124 | const tempPath = formatPathRclone(value.substring(value.indexOf(':') + 1)) |
| 125 | if (tempPath.includes('/')) { |
| 126 | value = tempPath.replace('/', ':') |
| 127 | } else { |
| 128 | value = tempPath + ':' |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | const separatorIndex = value.indexOf(':') |
| 133 | let storageName = value.substring(0, separatorIndex) |
| 134 | let path = formatPathRclone(value.substring(separatorIndex + 1)) |
| 135 | |
| 136 | /*const formatPath = (path: string) => { |
| 137 | path = path.replace(/\\/g, '/'); |
| 138 | path = path.replace(/\/+/g, '/'); |
| 139 | |
| 140 | if (path.substring(0, 1) != '/') { |
| 141 | path = '/' + path; |
| 142 | } |
| 143 | |
| 144 | return path |
| 145 | } */ |
| 146 | |
| 147 | const change = () => { |
| 148 | storageName && onChange && onChange(convertStoragePath(storageName, path)!) |
| 149 | } |
| 150 | return ( |
| 151 | <> |
| 152 | <Row> |
| 153 | <Col flex={'7rem'}> |
| 154 | <Select |
| 155 | value={storageName} |
| 156 | placeholder={t('please_select')} |
| 157 | onChange={value => { |
| 158 | storageName = value |
| 159 | change() |
| 160 | }} |
| 161 | > |
| 162 | {filterHideStorage(rcloneInfo.storageList).map(item => ( |
| 163 | <Select.Option key={item.name} value={item.name}> |
| 164 | {item.name} |
| 165 | </Select.Option> |
| 166 | ))} |
| 167 | </Select> |
| 168 | </Col> |
| 169 | <Col flex={'auto'}> |
| 170 | <Input |
| 171 | value={'/' + path} |
| 172 | onChange={value => { |
nothing calls this directly
no test coverage detected