Updated pv view in frontend
Updated CORS settings in createBucket function
This commit is contained in:
parent
fd4610208d
commit
e05c36051b
|
@ -136,21 +136,70 @@ public static class S3
|
|||
}
|
||||
}
|
||||
|
||||
public static async Task<S3Bucket?> PutBucket(this S3Region region, String name)
|
||||
public static async Task<S3Bucket?> PutBucket(this S3Region region, string name)
|
||||
{
|
||||
var request = new PutBucketRequest { BucketName = name };
|
||||
var response = await region.GetS3Client().PutBucketAsync(request);
|
||||
|
||||
var response = await region
|
||||
.GetS3Client()
|
||||
.PutBucketAsync(request);
|
||||
|
||||
return response.HttpStatusCode switch
|
||||
if (response.HttpStatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
HttpStatusCode.OK => region.Bucket(name),
|
||||
_ => null
|
||||
};
|
||||
// Define CORS configuration rules
|
||||
var corsConfiguration = new CORSConfiguration
|
||||
{
|
||||
Rules = new List<CORSRule>
|
||||
{
|
||||
new CORSRule
|
||||
{
|
||||
AllowedHeaders = new List<string> { "*" },
|
||||
AllowedMethods = new List<string> { "GET", "HEAD" },
|
||||
AllowedOrigins = new List<string> { "*" },
|
||||
ExposeHeaders = new List<string>() // Empty list as per your settings
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Create a PutCORSConfigurationRequest
|
||||
var putCorsRequest = new PutCORSConfigurationRequest
|
||||
{
|
||||
BucketName = name,
|
||||
Configuration = corsConfiguration
|
||||
};
|
||||
|
||||
// Set the CORS configuration for the bucket
|
||||
var corsResponse = await region.GetS3Client().PutCORSConfigurationAsync(putCorsRequest);
|
||||
|
||||
if (corsResponse.HttpStatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
return region.Bucket(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Failed to set CORS configuration.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Failed to create bucket.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// public static async Task<S3Bucket?> PutBucket(this S3Region region, String name)
|
||||
// {
|
||||
// var request = new PutBucketRequest { BucketName = name };
|
||||
//
|
||||
// var response = await region
|
||||
// .GetS3Client()
|
||||
// .PutBucketAsync(request);
|
||||
//
|
||||
// return response.HttpStatusCode switch
|
||||
// {
|
||||
// HttpStatusCode.OK => region.Bucket(name),
|
||||
// _ => null
|
||||
// };
|
||||
// }
|
||||
|
||||
|
||||
public static async Task<Boolean> PutCors(this S3Bucket bucket, CORSConfiguration corsConfiguration)
|
||||
{
|
||||
|
|
|
@ -96,7 +96,7 @@ function PvView(props: PvViewProps) {
|
|||
style={{ color: 'black', fontWeight: 'bold' }}
|
||||
mt={2}
|
||||
>
|
||||
Battery service is not available at the moment
|
||||
Pv view is not available at the moment
|
||||
</Typography>
|
||||
<Typography variant="body2" style={{ color: 'black' }}>
|
||||
Please wait or refresh the page
|
||||
|
|
|
@ -92,10 +92,10 @@ function SalidomoInstallationTabs() {
|
|||
/>
|
||||
)
|
||||
},
|
||||
// {
|
||||
// value: 'overview',
|
||||
// label: <FormattedMessage id="overview" defaultMessage="Overview" />
|
||||
// },
|
||||
{
|
||||
value: 'overview',
|
||||
label: <FormattedMessage id="overview" defaultMessage="Overview" />
|
||||
},
|
||||
{
|
||||
value: 'log',
|
||||
label: <FormattedMessage id="log" defaultMessage="Log" />
|
||||
|
|
Loading…
Reference in New Issue