feat: add local file system storage provider (#224)

Signed-off-by: sh1luo <690898835@qq.com>
This commit is contained in:
sh1luo
2021-08-08 14:18:44 +08:00
committed by Yang Luo
parent 44150a6781
commit c55fa4f452
9 changed files with 178 additions and 11 deletions

View File

@ -148,7 +148,8 @@ class ProviderEditPage extends React.Component {
} else if (value === "SMS") {
this.updateProviderField('type', 'Aliyun SMS');
} else if (value === "Storage") {
this.updateProviderField('type', 'Aliyun OSS');
this.updateProviderField('type', 'Local File System');
this.updateProviderField('domain', Setting.getFullServerUrl());
}
})}>
{
@ -167,7 +168,12 @@ class ProviderEditPage extends React.Component {
{Setting.getLabel(i18next.t("provider:Type"), i18next.t("provider:Type - Tooltip"))} :
</Col>
<Col span={22} >
<Select virtual={false} style={{width: '100%'}} value={this.state.provider.type} onChange={(value => {this.updateProviderField('type', value);})}>
<Select virtual={false} style={{width: '100%'}} value={this.state.provider.type} onChange={(value => {
this.updateProviderField('type', value);
if (value === "Local File System") {
this.updateProviderField('domain', Setting.getFullServerUrl());
}
})}>
{
this.getProviderTypeOptions(this.state.provider).map((providerType, index) => <Option key={index} value={providerType.id}>{providerType.name}</Option>)
}

View File

@ -48,6 +48,14 @@ function isLocalhost() {
return hostname === "localhost";
}
export function getFullServerUrl() {
let fullServerUrl = window.location.origin;
if (fullServerUrl === "http://localhost:7001") {
fullServerUrl = "http://localhost:8000";
}
return fullServerUrl;
}
export function isProviderVisible(providerItem) {
if (providerItem.provider === undefined || providerItem.provider === null) {
return false;