Fix aws us-east-1 subdomain and fix slow projects list

This commit is contained in:
Simon Prévost 2024-04-04 13:07:58 -04:00
parent bd4f85520c
commit 210c7d2404
9 changed files with 27 additions and 101 deletions

View File

@ -5,7 +5,14 @@ defmodule Accent.IntegrationManager.Execute.AWSS3 do
def upload_translations(integration, user, params) do
{uploads, version_tag} = Accent.IntegrationManager.Execute.UploadDocuments.all(integration, params)
base_url = "https://s3-#{integration.data.aws_s3_region}.amazonaws.com/#{integration.data.aws_s3_bucket}"
# To support bucket with '.' in the name, we need to use the region subdomain.
# The us-east-1 subdomain is not s3-us-east-1. Its s3 only.
base_url =
case integration.data.aws_s3_region do
"us-east-1" -> "https://s3.amazonaws.com/#{integration.data.aws_s3_bucket}"
region -> "https://s3-#{region}.amazonaws.com/#{integration.data.aws_s3_bucket}"
end
url =
Path.join([

View File

@ -9,9 +9,9 @@ import ApolloMutate from 'accent-webapp/services/apollo-mutate';
import executeIntegration from 'accent-webapp/queries/execute-integration';
const FLASH_MESSAGE_CREATE_SUCCESS =
'pods.versions.new.flash_messages.create_success';
'pods.project.edit.flash_messages.integration_execute_success';
const FLASH_MESSAGE_CREATE_ERROR =
'pods.versions.new.flash_messages.create_error';
'pods.project.edit.flash_messages.integration_execute_error';
interface Args {
close: () => void;

View File

@ -1,50 +1,11 @@
import Component from '@glimmer/component';
import {lt, gte} from '@ember/object/computed';
import percentage from 'accent-webapp/component-helpers/percentage';
const LOW_PERCENTAGE = 50;
const HIGH_PERCENTAGE = 90;
interface Args {
project: any;
}
export default class ProjectsListItem extends Component<Args> {
@lt('correctedKeysPercentage', LOW_PERCENTAGE)
lowPercentage: boolean; // Lower than low percentage
@gte('correctedKeysPercentage', LOW_PERCENTAGE)
mediumPercentage: boolean; // higher or equal than low percentage
@gte('correctedKeysPercentage', HIGH_PERCENTAGE)
highPercentage: boolean; // higher or equal than high percentage
get colors() {
return `
.projectId-${this.args.project.id} {
--color-primary: ${this.args.project.mainColor};
}
`;
}
get totalStrings() {
return this.args.project.translationsCount;
}
get totalConflicts() {
return this.args.project.conflictsCount;
}
get totalReviewed() {
return (
this.args.project.translationsCount - this.args.project.conflictsCount
);
}
get correctedKeysPercentage() {
return percentage(
this.totalStrings - this.totalConflicts,
this.totalStrings
);
get colorPrimary() {
return `--color-primary: ${this.args.project.mainColor}`;
}
}

View File

@ -1151,6 +1151,8 @@
"collaborator_update_success": "The collaborator has been updated with success",
"integration_add_error": "The integration could not be added",
"integration_add_success": "The integration has been added with success",
"integration_execute_error": "The integration could not be executed",
"integration_execute_success": "The integration has been executed with success",
"integration_update_error": "The integration could not be updated",
"integration_update_success": "The integration has been updated with success",
"integration_remove_error": "The integration could not be removed",

View File

@ -35,8 +35,6 @@ export default gql`
lastSyncedAt
mainColor
logo
translationsCount
conflictsCount
}
}
}

View File

@ -44,7 +44,7 @@ export default gql`
id
translations(
query: $query
pageSize: 50
pageSize: 20
page: $page
document: $document
version: $version

View File

@ -8,8 +8,8 @@
}
.item {
flex: 1 1 calc(50% - 10px);
max-width: 50%;
flex: 1 1 calc(33.3% - 10px);
max-width: 33.3%;
}
.item-link {

View File

@ -1,37 +1,7 @@
.projects-list-item.low-percentage {
.language-reviewedPercentage {
color: var(--color-error);
}
.progress {
color: var(--color-error);
}
}
.projects-list-item.medium-percentage {
.language-reviewedPercentage {
color: var(--color-warning);
}
.progress {
color: var(--color-warning);
}
}
.projects-list-item.high-percentage {
.language-reviewedPercentage {
color: var(--color-success);
}
.progress {
color: var(--color-success);
}
}
.projects-list-item {
padding: 12px 15px;
transition: 0.2s ease-in-out;
transition-property: box-shadow;
transition-property: box-shadow, border-color;
border-radius: var(--border-radius);
border: 1px solid var(--content-background-border);
background: var(--content-background);
@ -39,6 +9,14 @@
&:focus,
&:hover {
box-shadow: 0 4px 15px var(--shadow-color);
border-color: color-mix(in srgb, var(--color-primary) 20%, transparent);
border-bottom-color: color-mix(
in srgb,
var(--color-primary) 25%,
transparent
);
.projectName {
color: var(--color-primary);
}
@ -87,12 +65,4 @@
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 6px;
}
.numberStat-totals {
padding: 2px 0 1px 7px;
color: var(--color-black);
font-size: 12px;
font-family: var(--font-monospace);
}

View File

@ -1,4 +1,4 @@
<div local-class='projects-list-item {{if this.lowPercentage "low-percentage"}} {{if this.mediumPercentage "medium-percentage"}} {{if this.highPercentage "high-percentage"}}'>
<div local-class='projects-list-item' style='{{this.colorPrimary}}'>
<div local-class='projectHeader' class='projectId-{{@project.id}}'>
{{#if @project.logo}}
<span local-class='projectLogo'>
@ -9,9 +9,6 @@
<span local-class='projectName' data-test-project-name>
{{@project.name}}
</span>
<style>
{{{this.colors}}}
</style>
</div>
<div local-class='numberStat'>
@ -27,14 +24,5 @@
{{t 'components.projects_list.never_synced'}}
{{/if}}
</span>
<span local-class='numberStat-totals'>
{{this.totalStrings}}
{{t 'components.dashboard_revisions.strings'}}
</span>
</div>
<div local-class='progress'>
<ReviewProgressBar @correctedKeysPercentage={{this.correctedKeysPercentage}} />
</div>
</div>