Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
66 changes: 4 additions & 62 deletions modules/ui/src/app/mocks/profile.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import {
FormControlType,
Profile,
Question,
ProfileFormat,
ProfileStatus,
} from '../model/profile';

Expand All @@ -29,51 +29,22 @@ export const PROFILE_MOCK: Profile = {
{
question: 'What is the email of the device owner(s)?',
answer: 'boddey@google.com, cmeredith@google.com',
type: FormControlType.EMAIL_MULTIPLE,
validation: {
required: true,
max: '30',
},
},
{
question: 'What type of device do you need reviewed?',
answer: 'Type',
type: FormControlType.TEXTAREA,
validation: {
required: true,
max: '28',
},
description: 'This tells us about the device',
answer: 'IoT Sensor',
},
{
question: 'Are any of the following statements true about your device?',
answer: 'First',
type: FormControlType.SELECT,
options: ['First', 'Second'],
validation: {
required: true,
},
},
{
question: 'What features does the device have?',
description:
'This tells us about the data your device will collectThis tells us about the data your device will collect',
type: FormControlType.SELECT_MULTIPLE,
answer: [0, 1, 2],
options: ['Wi-fi', 'Bluetooth', 'ZigBee / Z-Wave / Thread / Matter'],
validation: {
required: true,
},
},
{
question: 'Comments',
answer: 'Yes',
type: FormControlType.TEXT,
description: 'Please enter any comments here',
validation: {
max: '28',
required: true,
},
},
],
};
Expand All @@ -90,7 +61,7 @@ export const PROFILE_MOCK_3: Profile = {
questions: [],
};

export const PROFILE_FORM: Question[] = [
export const PROFILE_FORM: ProfileFormat[] = [
{
question: 'Email',
type: FormControlType.EMAIL_MULTIPLE,
Expand Down Expand Up @@ -192,51 +163,22 @@ export const COPY_PROFILE_MOCK: Profile = {
{
question: 'What is the email of the device owner(s)?',
answer: 'boddey@google.com, cmeredith@google.com',
type: FormControlType.EMAIL_MULTIPLE,
validation: {
required: true,
max: '30',
},
},
{
question: 'What type of device do you need reviewed?',
answer: 'Type',
type: FormControlType.TEXTAREA,
validation: {
required: true,
max: '28',
},
description: 'This tells us about the device',
answer: 'IoT Sensor',
},
{
question: 'Are any of the following statements true about your device?',
answer: 'First',
type: FormControlType.SELECT,
options: ['First', 'Second'],
validation: {
required: true,
},
},
{
question: 'What features does the device have?',
description:
'This tells us about the data your device will collectThis tells us about the data your device will collect',
type: FormControlType.SELECT_MULTIPLE,
answer: [0, 1, 2],
options: ['Wi-fi', 'Bluetooth', 'ZigBee / Z-Wave / Thread / Matter'],
validation: {
required: true,
},
},
{
question: 'Comments',
answer: 'Yes',
type: FormControlType.TEXT,
description: 'Please enter any comments here',
validation: {
max: '28',
required: true,
},
},
],
};
8 changes: 6 additions & 2 deletions modules/ui/src/app/model/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ export interface Validation {
max?: string;
}

export interface Question {
export interface ProfileFormat {
question: string;
type?: FormControlType;
type: FormControlType;
description?: string;
options?: string[];
default?: string;
validation?: Validation;
}

export interface Question {
question?: string;
answer?: string | number[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</mat-error>
</mat-form-field>

<ng-container *ngFor="let control of questionnaire; index as i">
<ng-container *ngFor="let control of profileFormat; index as i">
<ng-container
*ngTemplateOutlet="
formField;
Expand Down
Loading