Compare commits

..

No commits in common. "bb5b91b38037d098537f141d4967c2931bc2a6ac" and "709bbc87955b260068b3fe6da69fe0425ca91232" have entirely different histories.

3 changed files with 15 additions and 64 deletions

View File

@ -135,71 +135,22 @@ public static class S3
yield break; yield break;
} }
} }
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 request = new PutBucketRequest { BucketName = name };
var response = await region.GetS3Client().PutBucketAsync(request);
if (response.HttpStatusCode == HttpStatusCode.OK) var response = await region
.GetS3Client()
.PutBucketAsync(request);
return response.HttpStatusCode switch
{ {
// Define CORS configuration rules HttpStatusCode.OK => region.Bucket(name),
var corsConfiguration = new CORSConfiguration _ => null
{ };
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) public static async Task<Boolean> PutCors(this S3Bucket bucket, CORSConfiguration corsConfiguration)
{ {

View File

@ -96,7 +96,7 @@ function PvView(props: PvViewProps) {
style={{ color: 'black', fontWeight: 'bold' }} style={{ color: 'black', fontWeight: 'bold' }}
mt={2} mt={2}
> >
Pv view is not available at the moment Battery service is not available at the moment
</Typography> </Typography>
<Typography variant="body2" style={{ color: 'black' }}> <Typography variant="body2" style={{ color: 'black' }}>
Please wait or refresh the page Please wait or refresh the page

View File

@ -92,10 +92,10 @@ function SalidomoInstallationTabs() {
/> />
) )
}, },
{ // {
value: 'overview', // value: 'overview',
label: <FormattedMessage id="overview" defaultMessage="Overview" /> // label: <FormattedMessage id="overview" defaultMessage="Overview" />
}, // },
{ {
value: 'log', value: 'log',
label: <FormattedMessage id="log" defaultMessage="Log" /> label: <FormattedMessage id="log" defaultMessage="Log" />