Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Code 30108491#116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletionREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,6 +10,10 @@ The [Topcoder](https://www.topcoder.com) lib for internal ReactJS projects.

Change the property in `AV_SCAN_SCORER_REVIEW_TYPE_ID` in config.

### Configuration for AV-Scan scorer review type ID

Change the property in `PROVISIONAL_SCORING_COMPLETED_REVIEW_TYPE_ID` in config.

### Development
```shell
# Install dependencies
Expand All@@ -19,7 +23,7 @@ npm install
npm test
npm run build

# Go to other project which depends on the topcoder-react-lib, config its package.json so
# Go to other project which depends on the topcoder-react-lib, config its package.json so
# that the 'topcoder-react-lib' points to the local foler path of topcoder-react-lib:
#
# "dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions__tests__/__snapshots__/index.js.snap
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,8 @@ Object {
"getAllCountriesInit": [Function],
"getCountriesDone": [Function],
"getCountriesInit": [Function],
"getReviewTypesDone": [Function],
"getReviewTypesInit": [Function],
"getSkillTagsDone": [Function],
"getSkillTagsInit": [Function],
},
Expand Down
2 changes: 2 additions & 0 deletions__tests__/actions/__snapshots__/lookup.js.snap
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,8 @@ Object {
"getAllCountriesInit": [Function],
"getCountriesDone": [Function],
"getCountriesInit": [Function],
"getReviewTypesDone": [Function],
"getReviewTypesInit": [Function],
"getSkillTagsDone": [Function],
"getSkillTagsInit": [Function],
},
Expand Down
10 changes: 10 additions & 0 deletions__tests__/reducers/__snapshots__/lookup.js.snap
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,7 @@ Object {
],
"loadingCountriesError": false,
"loadingSkillTagsError": true,
"reviewTypes": Array [],
"skillTags": Array [
Object {
"domain": "SKILLS",
Expand All@@ -33,6 +34,7 @@ Object {
],
"loadingCountriesError": true,
"loadingSkillTagsError": true,
"reviewTypes": Array [],
"skillTags": Array [
Object {
"domain": "SKILLS",
Expand All@@ -49,6 +51,7 @@ Object {
"allCountries": Array [],
"countries": Array [],
"loadingSkillTagsError": false,
"reviewTypes": Array [],
"skillTags": Array [
Object {
"domain": "SKILLS",
Expand All@@ -65,6 +68,7 @@ Object {
"allCountries": Array [],
"countries": Array [],
"loadingSkillTagsError": true,
"reviewTypes": Array [],
"skillTags": Array [
Object {
"domain": "SKILLS",
Expand All@@ -80,6 +84,7 @@ exports[`Default reducer Initial state 1`] = `
Object {
"allCountries": Array [],
"countries": Array [],
"reviewTypes": Array [],
"skillTags": Array [],
}
`;
Expand All@@ -95,6 +100,7 @@ Object {
],
"loadingCountriesError": false,
"loadingSkillTagsError": true,
"reviewTypes": Array [],
"skillTags": Array [
Object {
"domain": "SKILLS",
Expand All@@ -117,6 +123,7 @@ Object {
],
"loadingCountriesError": true,
"loadingSkillTagsError": true,
"reviewTypes": Array [],
"skillTags": Array [
Object {
"domain": "SKILLS",
Expand All@@ -133,6 +140,7 @@ Object {
"allCountries": Array [],
"countries": Array [],
"loadingSkillTagsError": false,
"reviewTypes": Array [],
"skillTags": Array [
Object {
"domain": "SKILLS",
Expand All@@ -149,6 +157,7 @@ Object {
"allCountries": Array [],
"countries": Array [],
"loadingSkillTagsError": true,
"reviewTypes": Array [],
"skillTags": Array [
Object {
"domain": "SKILLS",
Expand All@@ -164,6 +173,7 @@ exports[`Factory without server side rendering Initial state 1`] = `
Object {
"allCountries": Array [],
"countries": Array [],
"reviewTypes": Array [],
"skillTags": Array [],
}
`;
1 change: 1 addition & 0 deletionsconfig/default.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
{
"AV_SCAN_SCORER_REVIEW_TYPE_ID": "",
"PROVISIONAL_SCORING_COMPLETED_REVIEW_TYPE_ID": "",
"PAGE_SIZE": 50,
"REVIEW_OPPORTUNITY_PAGE_SIZE": 1000
}
3 changes: 2 additions & 1 deletionconfig/development.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
{
"AV_SCAN_SCORER_REVIEW_TYPE_ID": "68c5a381-c8ab-48af-92a7-7a869a4ee6c3"
"AV_SCAN_SCORER_REVIEW_TYPE_ID": "68c5a381-c8ab-48af-92a7-7a869a4ee6c3",
"PROVISIONAL_SCORING_COMPLETED_REVIEW_TYPE_ID": "df51ca7d-fb0a-4147-9569-992fcf5aae48"
}
3 changes: 2 additions & 1 deletionconfig/production.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
{
"AV_SCAN_SCORER_REVIEW_TYPE_ID": "55bbb17d-aac2-45a6-89c3-a8d102863d05"
"AV_SCAN_SCORER_REVIEW_TYPE_ID": "55bbb17d-aac2-45a6-89c3-a8d102863d05",
"PROVISIONAL_SCORING_COMPLETED_REVIEW_TYPE_ID": ""
}
114 changes: 57 additions & 57 deletionsdist/dev/index.js
View file
Open in desktop

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletionsdocs/actions.lookup.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,8 @@ Actions related to lookup data.
* [.getCountriesDone()](#module_actions.lookup.getCountriesDone) ⇒ <code>Action</code>
* [.getAllCountriesInit()](#module_actions.lookup.getCountriesInit) ⇒ <code>Action</code>
* [.getAllCountriesDone(tokenV3)](#module_actions.lookup.getCountriesDone) ⇒ <code>Action</code>
* [.getReviewTypesInit()](#module_actions.lookup.getReviewTypesInit) ⇒ <code>Action</code>
* [.getReviewTypesDone(tokenV3)](#module_actions.lookup.ggetReviewTypesDone) ⇒ <code>Action</code>

<a name="module_actions.lookup.getSkillTagsInit"></a>

Expand DownExpand Up@@ -40,3 +42,19 @@ Creates an action that gets all countries new version.
| Param | Type | Description |
| --- | --- | --- |
| tokenV3 | <code>String</code> | Topcoder v3 auth token. |
<a name="module_actions.lookup.getReviewTypesInit"></a>

### actions.lookup.getReviewTypesInit() ⇒ <code>Action</code>
Creates an action that gets all reiview types.

**Kind**: static method of [<code>actions.lookup</code>](#module_actions.lookup)
<a name="module_actions.lookup.getReviewTypesDone"></a>

### actions.lookup.getReviewTypesDone(tokenV3) ⇒ <code>Action</code>
Creates an action that gets all review types.

**Kind**: static method of [<code>actions.lookup</code>](#module_actions.lookup)

| Param | Type | Description |
| --- | --- | --- |
| tokenV3 | <code>String</code> | Topcoder v3 auth token. |
31 changes: 22 additions & 9 deletionsdocs/reducers.lookup.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,35 +18,48 @@ State segment managed by this reducer has the following structure:
* _inner_
* [~onGetSkillTagsDone(state, action)](#module_reducers.lookup..onGetSkillTagsDone) ⇒ <code>Object</code>
* [~onGetCountriesDone(state, action)](#module_reducers.lookup..onGetCountriesDone) ⇒ <code>Object</code>
* [~onGetReviewTypesDone(state, action)](#module_reducers.lookup..onGetReviewTypesDone) ⇒ <code>Object</code>
* [~create(initialState)](#module_reducers.lookup..create) ⇒ <code>function</code>

<a name="module_reducers.lookup.default"></a>

### reducers.lookup.default
Reducer with default initial state.

**Kind**: static property of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Kind**: static property of [<code>reducers.lookup</code>](#module_reducers.lookup)
<a name="module_reducers.lookup.factory"></a>

### reducers.lookup.factory() ⇒ <code>Promise</code>
Factory which creates a new reducer.

**Kind**: static method of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Resolves**: <code>Function(state, action): state</code> New reducer.
**Kind**: static method of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Resolves**: <code>Function(state, action): state</code> New reducer.
<a name="module_reducers.lookup..onGetSkillTagsDone"></a>

### reducers.lookup~onGetSkillTagsDone(state, action) ⇒ <code>Object</code>
Handles LOOKUP/GET_SKILL_TAGS_DONE action.

**Kind**: static method of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Resolves**: <code>Function(state, action): state</code> New reducer.
**Kind**: static method of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Resolves**: <code>Function(state, action): state</code> New reducer.
<a name="module_reducers.lookup..onGetCountriesDone"></a>

### reducers.lookup~onGetCountriesDone(state, action) ⇒ <code>Object</code>
Handles LOOKUP/GET_COUNTRIES_DONE action.

**Kind**: inner method of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Returns**: <code>Object</code> - New state
**Kind**: inner method of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Returns**: <code>Object</code> - New state

| Param | Type | Description |
| --- | --- | --- |
| state | <code>Object</code> | |
| action | <code>Object</code> | Payload will be JSON from api call |
<a name="module_reducers.lookup..onGetReviewTypesDone"></a>

### reducers.lookup~onGetReviewTypesDone(state, action) ⇒ <code>Object</code>
Handles LOOKUP/GET_REVIEW_TYPES_DONE action.

**Kind**: inner method of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Returns**: <code>Object</code> - New state

| Param | Type | Description |
| --- | --- | --- |
Expand All@@ -58,8 +71,8 @@ Handles LOOKUP/GET_COUNTRIES_DONE action.
### reducers.lookup~create(initialState) ⇒ <code>function</code>
Creates a new Lookup reducer with the specified initial state.

**Kind**: inner method of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Returns**: <code>function</code> - Lookup reducer.
**Kind**: inner method of [<code>reducers.lookup</code>](#module_reducers.lookup)
**Returns**: <code>function</code> - Lookup reducer.

| Param | Type | Description |
| --- | --- | --- |
Expand Down
14 changes: 14 additions & 0 deletionsdocs/services.submissions.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@ via API V5.
* [new SubmissionsService(tokenV3)](#new_module_services.submissions..SubmissionsService_new)
* [.getSubmissions(filters, params)](#module_services.submissions..SubmissionsService+getSubmissions) ⇒ <code>Promise</code>
* [.getSubmissionInformation(submissionId)](#module_services.submissions..SubmissionsService+getSubmissionInformation) ⇒ <code>Promise</code>
* [.downloadSubmission(submissionId)](#module_services.submissions..SubmissionsService+downloadSubmission) ⇒ <code>Promise</code>

<a name="module_services.submissions.getService"></a>

Expand All@@ -35,6 +36,7 @@ Returns a new or existing submissions service.
* [new SubmissionsService(tokenV3)](#new_module_services.submissions..SubmissionsService_new)
* [.getSubmissions(filters, params)](#module_services.submissions..SubmissionsService+getSubmissions) ⇒ <code>Promise</code>
* [.getSubmissionInformation(submissionId)](#module_services.submissions..SubmissionsService+getSubmissionInformation) ⇒ <code>Promise</code>
* [.downloadSubmission(submissionId)](#module_services.submissions..SubmissionsService+downloadSubmission) ⇒ <code>Promise</code>

<a name="new_module_services.submissions..SubmissionsService_new"></a>

Expand DownExpand Up@@ -68,3 +70,15 @@ Gets submission information.
| Param | Type | Description |
| --- | --- | --- |
| submissionId | <code>String</code> | The id of submission |

<a name="module_services.submissions..SubmissionsService+downloadSubmission"></a>

#### submissionsService.downloadSubmission(submissionId) ⇒ <code>Promise</code>
Download submission.

**Kind**: instance method of [<code>SubmissionsService</code>](#module_services.submissions..SubmissionsService)
**Returns**: <code>Promise</code> - Resolves to the submission file.

| Param | Type | Description |
| --- | --- | --- |
| submissionId | <code>String</code> | The id of submission |
19 changes: 19 additions & 0 deletionssrc/actions/lookup.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,23 @@ function getCountriesDone() {
return getService().getCountries();
}

/**
* @static
* @desc Creates an action that signals beginning of getting all review types.
* @return {Action}
*/
function getReviewTypesInit() {}

/**
* @static
* @desc Creates an action that gets all review types.
* @param {String} tokenV3 Optional. Auth token for Topcoder API v3.
* @return {Action}
*/
function getReviewTypesDone(tokenV3) {
return getService(tokenV3).getReviewTypes();
}

/**
* @static
* @desc Creates an action that signals beginning of getting all countries api version 5.
Expand All@@ -65,6 +82,8 @@ export default createActions({
GET_SKILL_TAGS_DONE: getSkillTagsDone,
GET_COUNTRIES_INIT: getCountriesInit,
GET_COUNTRIES_DONE: getCountriesDone,
GET_REVIEW_TYPES_INIT: getReviewTypesInit,
GET_REVIEW_TYPES_DONE: getReviewTypesDone,
GET_ALL_COUNTRIES_INIT: getAllCountriesInit,
GET_ALL_COUNTRIES_DONE: getAllCountriesDone,
},
Expand Down
22 changes: 22 additions & 0 deletionssrc/reducers/lookup.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,6 +48,25 @@ function onGetCountriesDone(state, { payload, error }) {
});
}

/**
* Handles LOOKUP/GET_REVIEW_TYPES_DONE action.
* @param {Object} state
* @param {Object} action Payload will be JSON from api call
* @return {Object} New state
*/
function onGetReviewTypesDone(state, { payload, error }) {
if (error) {
logger.error('Failed to get review types', payload);
return { ...state, loadingReviewTypesError: true };
}

return ({
...state,
loadingReviewTypesError: false,
reviewTypes: payload,
});
}

/**
* Handles LOOKUP/GET_ALL_COUNTRIES_DONE action.
* @param {Object} state
Expand DownExpand Up@@ -79,12 +98,15 @@ function create(initialState = {}) {
[a.getSkillTagsDone]: onGetSkillTagsDone,
[a.getCountriesInit]: state => state,
[a.getCountriesDone]: onGetCountriesDone,
[a.getReviewTypesInit]: state => state,
[a.getReviewTypesDone]: onGetReviewTypesDone,
[a.getAllCountriesInit]: state => state,
[a.getAllCountriesDone]: onGetAllCountriesDone,
}, _.defaults(initialState, {
skillTags: [],
countries: [],
allCountries: [],
reviewTypes: [],
}));
}

Expand Down
10 changes: 10 additions & 0 deletionssrc/services/lookup.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,6 +48,16 @@ class LookupService {
const jsonResult = await res.json();
return jsonResult;
}

/**
* Gets all reviewTypes.
* @return {Promise} Resolves to the review types.
*/
async getReviewTypes() {
const res = await this.private.apiV5.get('/reviewTypes');
const jsonResult = await res.json();
return jsonResult;
}
}

let lastInstance = null;
Expand Down
10 changes: 10 additions & 0 deletionssrc/services/submissions.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,6 +50,16 @@ class SubmissionsService {
.then(res => (res.ok ? res.json() : new Error(res.statusText)))
.then(res => res);
}

/**
* Download submission.
* @param {Number|String} submissionId Submission ID.
* @return {Promise} Resolves to the list of submission object.
*/
async downloadSubmission(submissionId) {
return this.private.apiV5.get(`/submissions/${submissionId}/download`)
.then(response => response.blob());
}
}

let lastInstance = null;
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp