diff --git a/webapp/app/locales/en-us.json b/webapp/app/locales/en-us.json index 774d370d7..3d9888d57 100644 --- a/webapp/app/locales/en-us.json +++ b/webapp/app/locales/en-us.json @@ -490,12 +490,16 @@ "edit": "Edit", "delete": "Delete", "data": { + "account_name": "Account Name", + "account_key": "Account Key", + "container_name": "Container Name", "default_ref": "Default ref", "repository": "Repository", "token": "Token", "url": "URL" }, "token_how": "How?", + "key_pair_how": "How to obtain a key pair?", "github_webhook_url_how": "How?", "github_webhook_accent_cli_1": "You need to have a valid accent-cli setup for the hook to work.", "github_webhook_accent_cli_2": "The accent.json file at the root of your project will be used.", @@ -508,6 +512,14 @@ "new_conflicts": "New strings to review", "complete_review": "Project is 100% reviewed" } + }, + "target_version": { + "label": "Target Version", + "options": { + "all": "All Versions", + "latest": "Latest Version", + "specific": "Specific Version" + } } } }, @@ -956,7 +968,8 @@ "DISCORD": "Discord", "GITHUB": "GitHub", "SLACK": "Slack", - "MICROSOFT": "Microsoft" + "MICROSOFT": "Microsoft", + "AZURE": "Azure" }, "search_input_placeholder_text": "Search for a string…" }, diff --git a/webapp/app/locales/fr-ca.json b/webapp/app/locales/fr-ca.json index dc03c0605..d69102d51 100644 --- a/webapp/app/locales/fr-ca.json +++ b/webapp/app/locales/fr-ca.json @@ -506,12 +506,15 @@ "edit": "Éditer", "delete": "Supprimer", "data": { + "account_name": "Nom du compte", + "account_key": "Clé du compte", "default_ref": "Réf par défaut", "repository": "Dépôt", "token": "Jeton", "url": "URL" }, "token_how": "Comment?", + "key_pair_how": "Comment obtenir une paire de clés?", "github_webhook_url_how": "Comment?", "github_webhook_accent_cli_1": "Vous devez avoir une configuration accent-cli valide pour le crochet au travail.", "github_webhook_accent_cli_2": "Le accent.json fichier à la racine de votre projet sera utilisé.", @@ -524,6 +527,14 @@ "new_conflicts": "Nouvelles chaîne à réviser", "complete_review": "Le projet est revu à 100%" } + }, + "target_version": { + "label": "Version Cible", + "options": { + "all": "Toutes les versions", + "latest": "Dernière version", + "specific": "Version spécifique" + } } } }, @@ -956,7 +967,8 @@ "DISCORD": "Discord", "GITHUB": "GitHub", "SLACK": "Slack", - "MICROSOFT": "Microsoft" + "MICROSOFT": "Microsoft", + "AZURE": "Azure" }, "search_input_placeholder_text": "Rechercher une chaîne…" }, diff --git a/webapp/app/pods/components/project-settings/integrations/form/azure/component.ts b/webapp/app/pods/components/project-settings/integrations/form/azure/component.ts new file mode 100644 index 000000000..d1fffc691 --- /dev/null +++ b/webapp/app/pods/components/project-settings/integrations/form/azure/component.ts @@ -0,0 +1,68 @@ +import fmt from 'simple-fmt'; +import Component from '@glimmer/component'; +import {action} from '@ember/object'; +import config from 'accent-webapp/config/environment'; + +interface Args { + accessKey: any; + defaultRef: any; + errors: any; + project: any; + secretKey: any; + targetVersion: any; + specificVersion: any; + url: any; + onChangeAccountName: (token: string) => void; + onChangeSecretKey: (defaultRef: string) => void; + onChangeUrl: (url: string) => void; + onChangeTargetVersion: (url: string) => void; + onChangeSpecificVersion: (url: string) => void; +} + +export default class Azure extends Component { + get webhookUrl() { + const host = window.location.origin; + + return `${host}${fmt( + config.API.HOOKS_PATH, + 'azure', + this.args.project.id, + '' + )}`; + } + + @action + changeAccountName(event: Event) { + const target = event.target as HTMLInputElement; + + this.args.onChangeAccountName(target.value); + } + + @action + changeSecretKey(event: Event) { + const target = event.target as HTMLInputElement; + + this.args.onChangeSecretKey(target.value); + } + + @action + changeUrl(event: Event) { + const target = event.target as HTMLInputElement; + + this.args.onChangeUrl(target.value); + } + + @action + changeTargetVersion(event: Event) { + const target = event.target as HTMLInputElement; + + this.args.onChangeTargetVersion(target.value); + } + + @action + changeSpecificVersion(event: Event) { + const target = event.target as HTMLInputElement; + + this.args.onChangeTargetVersion(target.value); + } +} diff --git a/webapp/app/pods/components/project-settings/integrations/form/azure/styles.scss b/webapp/app/pods/components/project-settings/integrations/form/azure/styles.scss new file mode 100644 index 000000000..7ad947c92 --- /dev/null +++ b/webapp/app/pods/components/project-settings/integrations/form/azure/styles.scss @@ -0,0 +1,60 @@ +.instructions { + border-top: 1px solid var(--background-light-highlight); + padding-top: 10px; + margin: 20px 0 10px; +} + +.instructions-text { + margin-top: 7px; + font-style: italic; + color: #555; + + a { + font-family: var(--font-monospace); + color: var(--color-primary); + text-decoration: none; + + &:focus, + &:hover { + text-decoration: underline; + opacity: 0.8; + } + } +} + +.data-control { + margin-bottom: 15px; +} + +.data-title { + display: block; + margin-bottom: 5px; + font-size: 13px; + font-weight: bold; +} + +.data-title-help { + margin-left: 4px; + font-size: 11px; + font-weight: normal; + text-decoration: none; + color: var(--color-primary); + + &:focus, + &:hover { + text-decoration: underline; + } +} + +.textInput { + @extend %textInput; + flex-grow: 1; + flex-shrink: 0; + padding: 8px 10px; + margin-right: 10px; + background: #fafafa; + max-width: 500px; + width: 100%; + font-family: var(--font-monospace); + font-size: 11px; +} diff --git a/webapp/app/pods/components/project-settings/integrations/form/azure/template.hbs b/webapp/app/pods/components/project-settings/integrations/form/azure/template.hbs new file mode 100644 index 000000000..732dc80ff --- /dev/null +++ b/webapp/app/pods/components/project-settings/integrations/form/azure/template.hbs @@ -0,0 +1,70 @@ + + + + + + + + + + +{{#if this.webhookUrl}} + + + {{t 'components.project_settings.integrations.github_webhook_url'}} + + {{t 'components.project_settings.integrations.github_webhook_url_how'}} + + + + + + + + {{t 'components.project_settings.integrations.github_webhook_accent_cli_1' htmlSafe=true}} + + + + {{t 'components.project_settings.integrations.github_webhook_accent_cli_2' htmlSafe=true}} + + + +{{/if}} \ No newline at end of file diff --git a/webapp/app/pods/components/project-settings/integrations/form/component.ts b/webapp/app/pods/components/project-settings/integrations/form/component.ts index dca257cbe..19a1aa2c4 100644 --- a/webapp/app/pods/components/project-settings/integrations/form/component.ts +++ b/webapp/app/pods/components/project-settings/integrations/form/component.ts @@ -6,6 +6,7 @@ import IntlService from 'ember-intl/services/intl'; import {tracked} from '@glimmer/tracking'; const LOGOS = { + AZURE: 'assets/services/azure.svg', DISCORD: 'assets/services/discord.svg', GITHUB: 'assets/services/github.svg', SLACK: 'assets/services/slack.svg', @@ -62,10 +63,17 @@ export default class IntegrationsForm extends Component { @tracked token: string; + @tracked + accountName: string; + + @tracked + targetVersion: string; + @tracked defaultRef = 'main'; - services = ['SLACK', 'GITHUB', 'DISCORD']; + // services = ['SLACK', 'GITHUB', 'DISCORD', 'AZURE']; + services = ['AZURE', 'SLACK', 'GITHUB', 'DISCORD']; @not('url') emptyUrl: boolean; @@ -131,6 +139,7 @@ export default class IntegrationsForm extends Component { @action setUrl(url: string) { + console.log(url) this.url = url; } @@ -154,6 +163,17 @@ export default class IntegrationsForm extends Component { this.defaultRef = defaultRef; } + @action + setAccountName(accountName: string) { + console.log(accountName) + this.accountName = accountName; + } + + @action + setTargetVersion(targetVersion: string) { + this.targetVersion = targetVersion; + } + @action async submit() { this.isSubmiting = true; diff --git a/webapp/app/pods/components/project-settings/integrations/form/data-control-radio/component.ts b/webapp/app/pods/components/project-settings/integrations/form/data-control-radio/component.ts new file mode 100644 index 000000000..331f2a5ac --- /dev/null +++ b/webapp/app/pods/components/project-settings/integrations/form/data-control-radio/component.ts @@ -0,0 +1,60 @@ +import {inject as service} from '@ember/service'; +import Component from '@glimmer/component'; +import {action} from '@ember/object'; +import {tracked} from '@glimmer/tracking'; +import IntlService from 'ember-intl/services/intl'; + +interface Args { + title: string; + events: string[]; + onChangeTargetVersion: (targetVersion: string) => void; + onChangeSpecificVersion: (specificVersion: string) => void; +} + +export default class DataControlRadio extends Component { + @service('intl') + intl: IntlService; + + allTargetVersions = [ + { + value: 'LATEST', + label: 'components.project_settings.integrations.target_version.options.latest', + }, + { + value: 'SPECIFIC', + label: + 'components.project_settings.integrations.target_version.options.specific', + }, + { + value: 'ALL', + label: + 'components.project_settings.integrations.target_version.options.all', + }, + ]; + + @tracked + targetVersion: string = this.allTargetVersions[0].value; + specificVersion: string | null = null; + + // @action + // changeTargetVersion(targetVersion: string) { + // this.targetVersion = targetVersion; + // this.args.onChangeTargetVersion(targetVersion); + // } + + @action + changeTargetVersion(targetVersion: string) { + this.targetVersion = targetVersion; + if (typeof this.args.onChangeTargetVersion === 'function') { + this.args.onChangeTargetVersion(targetVersion); + } + } + + @action + changeSpecificVersion(event: Event) { + const target = event.target as HTMLInputElement; + console.log("Changing specific version") + this.args.onChangeSpecificVersion(target.value); + console.log(this.specificVersion); + } +} diff --git a/webapp/app/pods/components/project-settings/integrations/form/data-control-radio/styles.scss b/webapp/app/pods/components/project-settings/integrations/form/data-control-radio/styles.scss new file mode 100644 index 000000000..75b56cd26 --- /dev/null +++ b/webapp/app/pods/components/project-settings/integrations/form/data-control-radio/styles.scss @@ -0,0 +1,34 @@ +.data-control { + margin-bottom: 15px; + + .radio { + display: inline-flex; + align-items: center; + width: fit-content; + margin-right: 10px; + border: 1px solid var(--background-light-highlight); + padding: 4px 6px; + border-radius: var(--border-radius); + background: var(--input-background); + cursor: pointer; + transition: 0.2s ease-in-out; + transition-property: background; + + &:hover, + &:focus { + background: var(--background-light); + } + + input { + margin-right: 5px; + cursor: pointer; + } + } +} + +.data-title { + display: block; + margin-bottom: 5px; + font-size: 13px; + font-weight: bold; +} diff --git a/webapp/app/pods/components/project-settings/integrations/form/data-control-radio/template.hbs b/webapp/app/pods/components/project-settings/integrations/form/data-control-radio/template.hbs new file mode 100644 index 000000000..04d97a180 --- /dev/null +++ b/webapp/app/pods/components/project-settings/integrations/form/data-control-radio/template.hbs @@ -0,0 +1,20 @@ + + + {{@label}} + + + {{#each this.allTargetVersions as |targetVersion|}} + + + {{t targetVersion.label}} + + {{/each}} + + {{#if (eq this.targetVersion 'SPECIFIC')}} + + {{/if}} + diff --git a/webapp/app/pods/components/project-settings/integrations/form/template.hbs b/webapp/app/pods/components/project-settings/integrations/form/template.hbs index e727bf7d3..57f4b159d 100644 --- a/webapp/app/pods/components/project-settings/integrations/form/template.hbs +++ b/webapp/app/pods/components/project-settings/integrations/form/template.hbs @@ -29,11 +29,14 @@ url=this.url project=@project events=this.events + accountName=this.accountName onChangeUrl=(fn this.setUrl) onChangeEventsChecked=(fn this.setEventsChecked) onChangeRepository=(fn this.setRepository) onChangeToken=(fn this.setToken) onChangeDefaultRef=(fn this.setDefaultRef) + onChangeAccountName=(fn this.setAccountName) + onChangeTargetVersion=(fn this.setTargetVersion) }} diff --git a/webapp/app/pods/components/project-settings/integrations/list/item/component.ts b/webapp/app/pods/components/project-settings/integrations/list/item/component.ts index 84363e67d..7964c5025 100644 --- a/webapp/app/pods/components/project-settings/integrations/list/item/component.ts +++ b/webapp/app/pods/components/project-settings/integrations/list/item/component.ts @@ -3,6 +3,7 @@ import Component from '@glimmer/component'; import {tracked} from '@glimmer/tracking'; const LOGOS = { + AZURE: 'assets/services/azure.svg', DISCORD: 'assets/services/discord.svg', GITHUB: 'assets/services/github.svg', SLACK: 'assets/services/slack.svg', diff --git a/webapp/public/assets/services/azure.svg b/webapp/public/assets/services/azure.svg new file mode 100644 index 000000000..ff5dfa5c1 --- /dev/null +++ b/webapp/public/assets/services/azure.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file
+ {{t 'components.project_settings.integrations.github_webhook_accent_cli_1' htmlSafe=true}} +
+ {{t 'components.project_settings.integrations.github_webhook_accent_cli_2' htmlSafe=true}} +