From 210c7d2404ee29e4ec3cfc7e847d72aaa69b2cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Pr=C3=A9vost?= Date: Thu, 4 Apr 2024 13:07:58 -0400 Subject: [PATCH] Fix aws us-east-1 subdomain and fix slow projects list --- lib/accent/integrations/execute/aws_s3.ex | 9 +++- .../list/item/execute/aws-s3/component.ts | 4 +- .../projects-list/item/component.ts | 43 +---------------- webapp/app/locales/en-us.json | 2 + webapp/app/queries/projects.ts | 2 - webapp/app/queries/translations.ts | 2 +- .../app/styles/components/projects-list.scss | 4 +- .../styles/components/projects-list/item.scss | 48 ++++--------------- .../components/projects-list/item.hbs | 14 +----- 9 files changed, 27 insertions(+), 101 deletions(-) diff --git a/lib/accent/integrations/execute/aws_s3.ex b/lib/accent/integrations/execute/aws_s3.ex index 94529621e..edde9aa0f 100644 --- a/lib/accent/integrations/execute/aws_s3.ex +++ b/lib/accent/integrations/execute/aws_s3.ex @@ -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. It’s 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([ diff --git a/webapp/app/components/project-settings/integrations/list/item/execute/aws-s3/component.ts b/webapp/app/components/project-settings/integrations/list/item/execute/aws-s3/component.ts index 01e907c4f..141ff28f0 100644 --- a/webapp/app/components/project-settings/integrations/list/item/execute/aws-s3/component.ts +++ b/webapp/app/components/project-settings/integrations/list/item/execute/aws-s3/component.ts @@ -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; diff --git a/webapp/app/components/projects-list/item/component.ts b/webapp/app/components/projects-list/item/component.ts index 46563da74..d8ac6a656 100644 --- a/webapp/app/components/projects-list/item/component.ts +++ b/webapp/app/components/projects-list/item/component.ts @@ -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 { - @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}`; } } diff --git a/webapp/app/locales/en-us.json b/webapp/app/locales/en-us.json index f693ca475..cbe08d881 100644 --- a/webapp/app/locales/en-us.json +++ b/webapp/app/locales/en-us.json @@ -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", diff --git a/webapp/app/queries/projects.ts b/webapp/app/queries/projects.ts index c190fe386..40530b964 100644 --- a/webapp/app/queries/projects.ts +++ b/webapp/app/queries/projects.ts @@ -35,8 +35,6 @@ export default gql` lastSyncedAt mainColor logo - translationsCount - conflictsCount } } } diff --git a/webapp/app/queries/translations.ts b/webapp/app/queries/translations.ts index 2a55e1c7a..72aedbdf3 100644 --- a/webapp/app/queries/translations.ts +++ b/webapp/app/queries/translations.ts @@ -44,7 +44,7 @@ export default gql` id translations( query: $query - pageSize: 50 + pageSize: 20 page: $page document: $document version: $version diff --git a/webapp/app/styles/components/projects-list.scss b/webapp/app/styles/components/projects-list.scss index 2c924a8b9..025a0c18d 100644 --- a/webapp/app/styles/components/projects-list.scss +++ b/webapp/app/styles/components/projects-list.scss @@ -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 { diff --git a/webapp/app/styles/components/projects-list/item.scss b/webapp/app/styles/components/projects-list/item.scss index b6599678e..4a2b93c67 100644 --- a/webapp/app/styles/components/projects-list/item.scss +++ b/webapp/app/styles/components/projects-list/item.scss @@ -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); } diff --git a/webapp/app/templates/components/projects-list/item.hbs b/webapp/app/templates/components/projects-list/item.hbs index 770354814..100ed9ee9 100644 --- a/webapp/app/templates/components/projects-list/item.hbs +++ b/webapp/app/templates/components/projects-list/item.hbs @@ -1,4 +1,4 @@ -
+
{{#if @project.logo}} @@ -9,9 +9,6 @@ {{@project.name}} -
@@ -27,14 +24,5 @@ {{t 'components.projects_list.never_synced'}} {{/if}} - - - {{this.totalStrings}} - {{t 'components.dashboard_revisions.strings'}} - -
- -
-
\ No newline at end of file