Skip to content

Commit f0ec46e

Browse files
committed
未病データベース-カタログ登録機能追加
1 parent 7de7eb2 commit f0ec46e

File tree

59 files changed

+1245
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1245
-79
lines changed

app/models/registration-schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface Page {
3131
questions: Question[];
3232
type?: 'object';
3333
description?: string;
34+
clipboardCopyPaste: boolean;
3435
}
3536

3637
export interface Schema {

app/models/schema-block.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ export default class SchemaBlockModel extends OsfModel implements SchemaBlock {
2222
@attr('number') index?: number;
2323
@attr('string') pattern?: string;
2424
@attr('boolean') spaceNormalization?: boolean;
25-
@attr('boolean') autoDate?: boolean;
26-
@attr('boolean') autoTitle?: boolean;
27-
@attr('boolean') hideProjectmetadata?: boolean;
25+
@attr('string') getRetrievalTitle?: string;
26+
@attr('string') getRetrievalDate?: string;
27+
@attr('boolean') concealmentPageNavigator?: boolean;
28+
@attr('string') requiredAllCheck?: string;
29+
@attr('boolean') multiLanguage?: boolean;
30+
@attr('string') getRetrievalVersion?: string;
31+
@attr('boolean') getEdit?: boolean;
32+
@attr('boolean') sentence?: boolean;
33+
@attr('string') rowAdditionCaption?: string;
2834

2935
@belongsTo('registration-schema', { inverse: 'schemaBlocks', async: false })
3036
schema?: RegistrationSchemaModel;

app/packages/registration-schema/get-pages.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ import { SchemaBlock } from 'ember-osf-web/packages/registration-schema';
33
export function getPages(blocks: SchemaBlock[]) {
44
const pageArray = blocks.reduce(
55
(pages, block) => {
6+
// instantiate first page if the schema doesn't start with a page-heading
67
if (pages.length === 0 && block.blockType !== 'page-heading'
7-
&& (block.hideProjectmetadata === true || block.hideProjectmetadata === undefined)) {
8+
&& (block.concealmentPageNavigator === true || block.concealmentPageNavigator === undefined)) {
89
const blankPage: SchemaBlock[] = [];
910
pages.push(blankPage);
1011
}
1112

12-
const lastPage: SchemaBlock[] = pages.slice(-1)[0] || [];
13+
const lastPage: SchemaBlock[] = pages.slice(-1)[0];
1314
if (block.blockType === 'page-heading'
14-
&& (block.hideProjectmetadata === false || block.hideProjectmetadata === undefined)) {
15+
&& (block.concealmentPageNavigator === false || block.concealmentPageNavigator === undefined)) {
1516
pages.push([block]);
1617
} else {
1718
lastPage.push(block);

app/packages/registration-schema/get-schema-block-group.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export function getSchemaBlockGroups(blocks: SchemaBlock[] | undefined) {
4343
case 'jgn-program-name-ja-input':
4444
case 'jgn-program-name-en-input':
4545
case 'e-rad-award-funder-input':
46+
case 'single-select-pulldown-input':
4647
case 'pulldown-input':
4748
case 'e-rad-award-number-input':
4849
case 'e-rad-award-title-ja-input':
@@ -53,6 +54,7 @@ export function getSchemaBlockGroups(blocks: SchemaBlock[] | undefined) {
5354
case 'e-rad-researcher-name-en-input':
5455
case 'e-rad-bunnya-input':
5556
case 'file-metadata-input':
57+
case 'ad-metadata-input':
5658
case 'date-input':
5759
case 'section-heading':
5860
case 'subsection-heading':

app/packages/registration-schema/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ export { getPages } from './get-pages';
22
export { getSchemaBlockGroups } from './get-schema-block-group';
33
export { SchemaBlock, SchemaBlockType } from './schema-block';
44
export { SchemaBlockGroup } from './schema-block-group';
5-
export { buildValidation, buildMetadataValidations, setupEventForSyncValidation } from './validations';
5+
export {
6+
buildValidation,
7+
buildMetadataValidations,
8+
setupEventForSyncValidation,
9+
setupEventForSyncValidation2,
10+
} from './validations';
611
export {
712
FileReference,
813
RegistrationResponse,

app/packages/registration-schema/page-manager.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,22 @@ import {
1010
SchemaBlock,
1111
SchemaBlockGroup,
1212
setupEventForSyncValidation,
13+
setupEventForSyncValidation2,
1314
} from 'ember-osf-web/packages/registration-schema';
1415
import { RegistrationResponse } from 'ember-osf-web/packages/registration-schema/registration-response';
1516

1617
export class PageManager {
1718
changeset?: ChangesetDef;
1819
schemaBlockGroups?: SchemaBlockGroup[];
1920
pageHeadingText?: string;
20-
hideProjectmetadata?: boolean;
21+
concealmentPageNavigator?: boolean;
2122
isVisited?: boolean;
2223

2324
constructor(pageSchemaBlocks: SchemaBlock[], registrationResponses: RegistrationResponse, node?: NodeModel) {
2425
this.schemaBlockGroups = getSchemaBlockGroups(pageSchemaBlocks);
2526
if (this.schemaBlockGroups) {
2627
this.pageHeadingText = this.schemaBlockGroups[0].labelBlock!.displayText!;
27-
this.hideProjectmetadata = this.schemaBlockGroups[0].labelBlock!.hideProjectmetadata!;
28+
this.concealmentPageNavigator = this.schemaBlockGroups[0].labelBlock!.concealmentPageNavigator!;
2829

2930
this.isVisited = this.schemaBlockGroups.some(
3031
({ registrationResponseKey: key }) => Boolean(key && (key in registrationResponses)),
@@ -36,8 +37,11 @@ export class PageManager {
3637
lookupValidator(validations),
3738
validations,
3839
) as ChangesetDef;
40+
3941
setupEventForSyncValidation(this.changeset, this.schemaBlockGroups);
4042

43+
setupEventForSyncValidation2(this.changeset, this.schemaBlockGroups);
44+
4145
if (this.isVisited) {
4246
this.changeset.validate();
4347
}

app/packages/registration-schema/schema-block.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type SchemaBlockType =
1717
'jgn-program-name-ja-input' |
1818
'jgn-program-name-en-input' |
1919
'e-rad-award-funder-input' |
20+
'single-select-pulldown-input' |
2021
'pulldown-input' |
2122
'e-rad-award-number-input' |
2223
'e-rad-award-title-ja-input' |
@@ -27,6 +28,7 @@ export type SchemaBlockType =
2728
'e-rad-researcher-name-en-input' |
2829
'e-rad-bunnya-input' |
2930
'file-metadata-input' |
31+
'ad-metadata-input' |
3032
'date-input' |
3133
'array-input';
3234

@@ -44,7 +46,12 @@ export interface SchemaBlock {
4446
index?: number;
4547
pattern?: string;
4648
spaceNormalization?: boolean;
47-
autoDate?: boolean;
48-
autoTitle?: boolean;
4949
hideProjectmetadata?: boolean;
50+
getRetrievalTitle?: string;
51+
getRetrievalDate?: string;
52+
concealmentPageNavigator?: boolean;
53+
requiredAllCheck?: string;
54+
multiLanguage?: boolean;
55+
getRetrievalVersion?: string;
56+
rowAdditionCaption?: string;
5057
}

app/packages/registration-schema/validations.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,47 @@ export function setupEventForSyncValidation(changeset: ChangesetDef, groups: Sch
161161
});
162162
}
163163

164+
export function setupEventForSyncValidation2(changeset: ChangesetDef, groups: SchemaBlockGroup[]) {
165+
const requiredAllCheckGroups = groups
166+
// ignore GRDM file specific fields
167+
.filter((group: SchemaBlockGroup) => !group.registrationResponseKey
168+
|| !group.registrationResponseKey.match(/^__responseKey_grdm-file:.+$/))
169+
.filter((group: SchemaBlockGroup) => group.inputBlock && group.inputBlock.requiredAllCheck);
170+
171+
let isProcesing = false;
172+
173+
changeset.on('afterValidation', () => {
174+
if (isProcesing) {
175+
return;
176+
}
177+
isProcesing = true;
178+
179+
try {
180+
const checkboxList = requiredAllCheckGroups.map(group => {
181+
const registrationResponseKey: string = group.registrationResponseKey || '';
182+
const value = changeset.get(registrationResponseKey);
183+
return Array.isArray(value) && value.length === 1;
184+
});
185+
186+
requiredAllCheckGroups
187+
.forEach(group => {
188+
if (!checkboxList.includes(false)) {
189+
const todayDate = `${new Date().getFullYear()}/${
190+
String(new Date().getMonth() + 1).padStart(2, '0')
191+
}/${
192+
String(new Date().getDate()).padStart(2, '0')
193+
}`;
194+
changeset.set(`__responseKey_${group.inputBlock!.requiredAllCheck}`, todayDate);
195+
} else {
196+
changeset.set(`__responseKey_${group.inputBlock!.requiredAllCheck}`, '');
197+
}
198+
});
199+
} finally {
200+
isProcesing = false;
201+
}
202+
});
203+
}
204+
164205
export function validateNodeLicense() {
165206
return async (_: unknown, __: unknown, ___: unknown, changes: DraftRegistration, content: DraftRegistration) => {
166207
let validateLicenseTarget = await content.license;

lib/osf-components/addon/components/contributor-list/component.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,15 @@ export default class ContributorList extends Component {
6060
this.set('totalContributors', nextPage.meta.total);
6161
} else {
6262
this.set('page', 1);
63-
const firstPage = yield this.node.bibliographicContributors;
63+
const firstPage = yield this.node.queryHasMany(
64+
'bibliographicContributors',
65+
{
66+
fields: {
67+
users: 'full_name,given_name,family_name,id,links',
68+
},
69+
page: { size: 10 },
70+
},
71+
);
6472
this.setProperties({
6573
displayedContributors: firstPage.toArray(),
6674
totalContributors: firstPage.meta.total,

lib/osf-components/addon/components/form-controls/template.hbs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@
1414
shouldShowMessages=this.shouldShowMessages
1515
disabled=this.disabled
1616
)
17-
autodate=(
18-
component
19-
'validated-input/autodate'
20-
changeset=@changeset
21-
shouldShowMessages=this.shouldShowMessages
22-
disabled=this.disabled
23-
)
2417
recaptcha=(
2518
component
2619
'validated-input/recaptcha'

0 commit comments

Comments
 (0)