Skip to content
Open
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
9 changes: 9 additions & 0 deletions proto/src/ground/v1beta1/job.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion web/src/app/converters/proto-model-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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(),
})
);
}
Expand Down
3 changes: 2 additions & 1 deletion web/src/app/converters/survey-data-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!}]))
);
}

Expand Down
10 changes: 8 additions & 2 deletions web/src/app/models/job.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -24,14 +24,20 @@ 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,
readonly index: number,
readonly color?: string,
readonly name?: string,
readonly tasks?: OrderedMap<string, Task>,
readonly strategy?: DataCollectionStrategy
readonly strategy?: DataCollectionStrategy,
readonly enabledIntegrations: Map<string, Integration> = Map()
) {
super();

Expand Down
Loading