

Amazon CodeCatalyst 不再向新客戶開放。現有客戶可以繼續正常使用該服務。如需詳細資訊，請參閱[如何從 CodeCatalyst 遷移](migration.md)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 將問題元件新增至藍圖
<a name="comp-issues-bp"></a>

在 CodeCatalyst 中，您可以監控功能、任務、錯誤，以及專案中涉及的任何其他工作。每個工作都會保留在不同的記錄中，稱為問題。每個問題都可以有一個描述、被指派者、狀態和其他屬性，您可以對其進行搜尋、分組和篩選。您可以使用預設檢視來檢視問題，也可以使用自訂篩選、排序或分組來建立自己的檢視。如需 問題相關概念的詳細資訊，請參閱 [問題概念](issues-concepts.md)和 [CodeCatalyst 中問題的配額](issues-quotas.md)。

問題元件會產生問題的 JSON 表示法。元件會採用 ID 欄位並發出定義做為輸入。

**匯入 Amazon CodeCatalyst 藍圖發行元件**

在您的 `blueprint.ts`檔案中，新增下列項目：

```
import {...} from '@amazon-codecatalyst/blueprint-component.issues'
```

**Topics**
+ [問題元件範例](#comp-issues-examples-bp)

## 問題元件範例
<a name="comp-issues-examples-bp"></a>

### 建立問題
<a name="comp-issues-create-bp"></a>

```
import { Issue } from '@amazon-codecatalyst/blueprint-component.issues';
...
new Issue(this, 'myFirstIssue', {
  title: 'myFirstIssue',
  content: 'This is an example issue.',
});
```

### 建立高優先順序問題
<a name="comp-issues-high-priority-bp"></a>

```
import { Workflow } from '@amazon-codecatalyst/codecatalyst-workflows'
...
const repo = new SourceRepository
const blueprint = this;
const workflowDef = workflowBuilder.getDefinition()

// Creates a workflow.yaml at .aws/workflows/${workflowDef.name}.yaml
new Workflow(blueprint, repo, workflowDef);

// Can also pass in any object and have it rendered as a yaml. This is unsafe and may not produce a valid workflow
new Workflow(blueprint, repo, {... some object ...});
```

### 使用標籤建立低優先順序問題
<a name="comp-issues-low-priority-bp"></a>

```
import { Issue } from '@amazon-codecatalyst/blueprint-component.issues';
...
new Issue(this, 'myThirdIssue', {
  title: 'myThirdIssue',
  content: 'This is an example of a low priority issue with a label.',
  priority: 'LOW',
  labels: ['exampleLabel'],
});
```