diff --git a/proto/src/ground/v1beta1/job.proto b/proto/src/ground/v1beta1/job.proto index ee0e12f47..9a1f04b75 100644 --- a/proto/src/ground/v1beta1/job.proto +++ b/proto/src/ground/v1beta1/job.proto @@ -40,6 +40,15 @@ message Job { // One or more data collection tasks to be carried out by the user in order // to collect and submit data. repeated Task tasks = 5; + + // Zero or more integrations enabled for this job. + repeated Integration enabled_integrations = 6; +} + +// Configuration for a single integration associated with a job. +message Integration { + // Required. The system-defined unique identifier of this integration. + string id = 1; } // A style used when rendering geometries and other UI elements associated diff --git a/web/src/app/converters/proto-model-converter.ts b/web/src/app/converters/proto-model-converter.ts index 1098f9cef..974776eab 100644 --- a/web/src/app/converters/proto-model-converter.ts +++ b/web/src/app/converters/proto-model-converter.ts @@ -138,7 +138,7 @@ export function surveyToDocument( * Returns the proto representation of a Job model object. */ export function jobToDocument(job: Job): DocumentData { - const { id, index, name, color, tasks } = job; + const { id, index, name, color, tasks, enabledIntegrations } = job; return toDocumentData( new Pb.Job({ @@ -149,6 +149,10 @@ export function jobToDocument(job: Job): DocumentData { tasks: (tasks?.toList() ?? List()) .map((task: Task) => toTaskMessage(task)) .toArray(), + enabledIntegrations: enabledIntegrations + .valueSeq() + .map(i => new Pb.Integration({ id: i.id })) + .toArray(), }) ); } diff --git a/web/src/app/converters/survey-data-converter.ts b/web/src/app/converters/survey-data-converter.ts index a96921610..16d6d57d3 100644 --- a/web/src/app/converters/survey-data-converter.ts +++ b/web/src/app/converters/survey-data-converter.ts @@ -125,7 +125,8 @@ function jobPbToModel(pb: Pb.IJob): Job { ), pb.tasks!.find(task => task.level === DataCollectionLevel.LOI_METADATA) ? DataCollectionStrategy.MIXED - : DataCollectionStrategy.PREDEFINED + : DataCollectionStrategy.PREDEFINED, + Map((pb.enabledIntegrations ?? []).map(i => [i.id!, {id: i.id!}])) ); } diff --git a/web/src/app/models/job.model.ts b/web/src/app/models/job.model.ts index bc2612c4a..6c203bba6 100644 --- a/web/src/app/models/job.model.ts +++ b/web/src/app/models/job.model.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { List, OrderedMap } from 'immutable'; +import { List, Map, OrderedMap } from 'immutable'; import { Copiable } from './copiable'; import { Task } from './task/task.model'; @@ -24,6 +24,11 @@ export enum DataCollectionStrategy { MIXED = 'MIXED', } +// Configuration for a single integration associated with a job. +export interface Integration { + id: string; +} + export class Job extends Copiable { constructor( readonly id: string, @@ -31,7 +36,8 @@ export class Job extends Copiable { readonly color?: string, readonly name?: string, readonly tasks?: OrderedMap, - readonly strategy?: DataCollectionStrategy + readonly strategy?: DataCollectionStrategy, + readonly enabledIntegrations: Map = Map() ) { super();