Skip to content

Commit ef20929

Browse files
committed
fix: various things
1 parent 81afaa9 commit ef20929

5 files changed

Lines changed: 14 additions & 9 deletions

File tree

packages/prime-core/src/modules/internal/resolvers/DocumentResolver.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,14 @@ export class DocumentResolver {
262262
nullable: true,
263263
})
264264
public async primary(@Root() document: Document): Promise<any> {
265-
const qb = this.schemaFieldRepository.createQueryBuilder().where('primary = TRUE');
265+
const qb = this.schemaFieldRepository.createQueryBuilder();
266266
qb.cache(1000);
267267
let field = await this.schemaFieldRepository
268-
.getLoader(qb, (b, keys) => b.where({ schemaId: In(keys) }), 'schemaId')
268+
.getLoader(
269+
qb,
270+
(b, keys) => b.where({ schemaId: In(keys) }).andWhere('SchemaField.primary = TRUE'),
271+
'schemaId'
272+
)
269273
.load(document.schemaId);
270274

271275
if (field) {

packages/prime-field-slice/src/ui/InputComponent.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type ISlice = null | {
77
__inputtype: string;
88
id: string;
99
title: string;
10-
schema: any;
10+
fields: any;
1111
};
1212

1313
interface IState {
@@ -54,7 +54,7 @@ export class InputComponent extends React.Component<PrimeFieldProps, IState> {
5454

5555
public async load() {
5656
const { field, stores } = this.props;
57-
const ids = get(field.options, 'contentTypeIds', []);
57+
const ids = get(field.options, 'schemaIds', []);
5858
const initialValue = (this.props.initialValue as any) || [];
5959

6060
this.setState({
@@ -135,6 +135,8 @@ export class InputComponent extends React.Component<PrimeFieldProps, IState> {
135135
}
136136
const { index } = slice as any;
137137

138+
console.log(slice);
139+
138140
return (
139141
<Card key={`${slice.id}_${index}`} className="prime-slice-item">
140142
<div className="prime-slice-item-actions">
@@ -165,7 +167,7 @@ export class InputComponent extends React.Component<PrimeFieldProps, IState> {
165167
{form.getFieldDecorator(`${path}.${index}.__inputname`, {
166168
initialValue: slice.id,
167169
})(<input type="hidden" />)}
168-
{slice.schema.fields.filter(noChildren).map((f: any) => this.renderField(f, index))}
170+
{slice.fields.fields.filter(noChildren).map((f: any) => this.renderField(f, index))}
169171
</Card>
170172
);
171173
})}

packages/prime-field-slice/src/ui/SchemaSettingsComponent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export class SchemaSettingsComponent extends React.PureComponent<PrimeFieldProps
1616
return (
1717
<>
1818
<Form.Item label="Slices" style={{ marginBottom: 8 }}>
19-
{form.getFieldDecorator('options.contentTypeIds')(
19+
{form.getFieldDecorator('options.schemaIds')(
2020
<Select placeholder="Select Slices" mode="multiple">
2121
{stores.ContentTypes.list
22-
.filter((n: IContentType) => n.variant === SchemaVariant.Slice)
22+
.filter((n: any) => n.variant === 'Slice')
2323
.map((contentType: IContentType) => (
2424
<Select.Option value={contentType.id} key={contentType.id}>
2525
{contentType.title}

packages/prime-ui/src/routes/schemas/components/field-row/FieldRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class FieldRow extends React.Component<IProps> {
8787
disabled={starDisabled}
8888
onClick={this.onDisplayClick}
8989
>
90-
<Icon type="star" theme={field.isDisplay ? 'filled' : 'outlined'} />
90+
<Icon type="star" theme={field.primary ? 'filled' : 'outlined'} />
9191
</Button>
9292
</Tooltip>
9393
)}

packages/prime-ui/src/stores/auth.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export const Auth = types
5757
if (data && data.getUser) {
5858
self.isLoggedIn = true;
5959
self.user = data.getUser;
60-
console.log(self.user);
6160
yield ensureFields();
6261
}
6362
if (!self.isLoggedIn) {

0 commit comments

Comments
 (0)