-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Jira issues to the EmberData store (#652)
* Add EmberData support to JiraIssues * Remove`fade-in` animation * Update types and descriptions
- Loading branch information
Showing
10 changed files
with
122 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import DS from "ember-data"; | ||
import ApplicationAdapter from "./application"; | ||
import RSVP from "rsvp"; | ||
import ModelRegistry from "ember-data/types/registries/model"; | ||
import JiraIssueModel from "hermes/models/jira-issue"; | ||
|
||
export default class JiraIssueAdapter extends ApplicationAdapter { | ||
findRecord<K extends string | number>( | ||
_store: DS.Store, | ||
_type: ModelRegistry[K], | ||
id: string, | ||
_snapshot: DS.Snapshot<K>, | ||
): RSVP.Promise<JiraIssueModel> { | ||
const issue = this.fetchSvc | ||
.fetch(`/api/${this.configSvc.config.api_version}/jira/issues/${id}`) | ||
.then((response) => response?.json()); | ||
|
||
return RSVP.resolve(issue); | ||
} | ||
} |
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
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
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,51 @@ | ||
import Model, { attr } from "@ember-data/model"; | ||
|
||
export default class JiraIssueModel extends Model { | ||
/** | ||
* The Jira issue key, e.g., "PROJ-123". | ||
* Used as the ID for the JiraIssue model. | ||
*/ | ||
@attr declare key: string; | ||
|
||
/** | ||
* The summary of the issue. | ||
*/ | ||
@attr declare summary?: string; | ||
|
||
/** | ||
* The issue permalink. | ||
*/ | ||
@attr declare url: string; | ||
|
||
/** | ||
* The status, e.g., "Open". | ||
*/ | ||
@attr declare status: string; | ||
|
||
/** | ||
* The assignee of the issue. | ||
*/ | ||
@attr declare assignee?: string; | ||
|
||
/** | ||
* The type of issue, e.g., "Bug". | ||
*/ | ||
@attr declare issueType?: string; | ||
|
||
/** | ||
* The URL to the issue type image. | ||
* TODO: Host these ourselves to avoid broken images. | ||
*/ | ||
@attr declare issueTypeImage: string; | ||
|
||
/** | ||
* The issue priority, e.g., "High". | ||
*/ | ||
@attr declare priority?: string; | ||
|
||
/** | ||
* The URL to the priority image. | ||
* TODO: Host these ourselves to avoid broken images. | ||
*/ | ||
@attr declare priorityImage: string; | ||
} |
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,25 @@ | ||
import JSONSerializer from "@ember-data/serializer/json"; | ||
import DS from "ember-data"; | ||
import JiraIssueModel from "hermes/models/jira-issue"; | ||
|
||
export default class JiraIssueSerializer extends JSONSerializer { | ||
/** | ||
* The serializer for the JiraIssue model. | ||
* Formats responses to the JSON spec. | ||
*/ | ||
normalizeResponse( | ||
_store: DS.Store, | ||
_primaryModelClass: any, | ||
payload: JiraIssueModel, | ||
_id: string | number, | ||
_requestType: string, | ||
) { | ||
return { | ||
data: { | ||
id: payload.key, | ||
type: "jira-issue", | ||
attributes: payload, | ||
}, | ||
}; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -7,10 +7,6 @@ | |
} | ||
} | ||
|
||
.fade-in-forwards { | ||
animation: fadeIn 450ms forwards; | ||
} | ||
|
||
@keyframes fadeOut { | ||
from { | ||
opacity: 1; | ||
|
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