-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3635a8f
commit 00ea643
Showing
12 changed files
with
387 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
webapp/app/pods/components/project-settings/integrations/form/azure/component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Args> { | ||
get webhookUrl() { | ||
const host = window.location.origin; | ||
|
||
return `${host}${fmt( | ||
config.API.HOOKS_PATH, | ||
'azure', | ||
this.args.project.id, | ||
'<YOUR_API_TOKEN_HERE>' | ||
)}`; | ||
} | ||
|
||
@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); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
webapp/app/pods/components/project-settings/integrations/form/azure/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
70 changes: 70 additions & 0 deletions
70
webapp/app/pods/components/project-settings/integrations/form/azure/template.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<ProjectSettings::Integrations::Form::DataControlText | ||
@error={{field-error @errors 'data.accountKey'}} | ||
@label={{t 'components.project_settings.integrations.data.account_name'}} | ||
@placeholder='myazureaccount' | ||
@value={{@accountName}} | ||
@onChange={{this.changeAccountName}} | ||
@helpLinkHref='https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html' | ||
@helpLinkTitle={{t 'components.project_settings.integrations.key_pair_how'}} | ||
/> | ||
|
||
<ProjectSettings::Integrations::Form::DataControlText | ||
@error={{field-error @errors 'data.token'}} | ||
@label={{t 'components.project_settings.integrations.data.account_key'}} | ||
@placeholder='Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==' | ||
@value={{@token}} | ||
@onChange={{this.changeSecretKey}} | ||
@helpLinkHref='https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html' | ||
@helpLinkTitle={{t 'components.project_settings.integrations.key_pair_how'}} | ||
/> | ||
|
||
<ProjectSettings::Integrations::Form::DataControlText | ||
@error={{field-error @errors 'data.token'}} | ||
@label={{t 'components.project_settings.integrations.data.account_key'}} | ||
@placeholder='Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==' | ||
@value={{@token}} | ||
@onChange={{this.changeSecretKey}} | ||
@helpLinkHref='https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html' | ||
@helpLinkTitle={{t 'components.project_settings.integrations.key_pair_how'}} | ||
/> | ||
|
||
<ProjectSettings::Integrations::Form::DataControlText | ||
@error={{field-error @errors 'data.token'}} | ||
@label={{t 'components.project_settings.integrations.data.url'}} | ||
@placeholder='https://mystorageaccount.blob.core.windows.net/mycontainer/myblob' | ||
@value={{@token}} | ||
@onChange={{this.changeUrl}} | ||
@helpLinkHref='https://learn.microsoft.com/en-us/rest/api/storageservices/put-blob-from-url?tabs=microsoft-entra-id' | ||
@helpLinkTitle={{t 'components.project_settings.integrations.webhook_url_how'}} | ||
/> | ||
|
||
<ProjectSettings::Integrations::Form::DataControlRadio | ||
@label={{t 'components.project_settings.integrations.target_version.label'}} | ||
@value={{this.targetVersion}} | ||
@onChange={{this.changeTargetVersion}} | ||
@onChangeTargetVersion={{this.changeTargetVersion}} | ||
@onChangeSpecificVersion={{this.changeSpecificVersion}} | ||
/> | ||
|
||
{{#if this.webhookUrl}} | ||
<div local-class='instructions'> | ||
<label local-class='data-title'> | ||
{{t 'components.project_settings.integrations.github_webhook_url'}} | ||
<a local-class='data-title-help' target='_blank' rel='noopener noreferrer' href='https://developer.github.com/webhooks/creating'> | ||
{{t 'components.project_settings.integrations.github_webhook_url_how'}} | ||
</a> | ||
</label> | ||
|
||
<input readonly='' onClick='this.select();' local-class='textInput' value={{this.webhookUrl}} /> | ||
|
||
<div local-class='instructions-text'> | ||
<p> | ||
{{t 'components.project_settings.integrations.github_webhook_accent_cli_1' htmlSafe=true}} | ||
</p> | ||
|
||
<p> | ||
{{t 'components.project_settings.integrations.github_webhook_accent_cli_2' htmlSafe=true}} | ||
</p> | ||
</div> | ||
</div> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...pp/app/pods/components/project-settings/integrations/form/data-control-radio/component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Args> { | ||
@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); | ||
} | ||
} |
Oops, something went wrong.