1 // Copyright 2022 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 const process = require('child_process');
11 this.user_ = json.created_by;
12 this.timestamp_ = new Date(json.create_time.seconds * 1000);
13 this.crbug_ = json.job_spec.monorail_issue;
14 this.url_ = undefined;
15 this.project_ = undefined;
18 const project = this.crbug_.project;
19 const num = this.crbug_.issue_id;
21 `https://bugs.chromium.org/p/${project}/issues/detail?id=${num}`;
22 this.project_ = project;
30 return this.timestamp_;
42 ['pinpoint', 'list-jobs', '--json', '--filter', `user=${useremail}`];
43 for (let tries = 0; tries < 3; ++tries) {
45 const stdout = process.execSync(args.join(' ')).toString().trim();
46 const json = JSON.parse(stdout);
48 const jobs = json.map(j => new PinpointJob(j));
58 async function test() {
59 const pinpoint = new Pinpoint();
60 const jobs = pinpoint.listJobs('sadrul@google.com');
61 console.log(jobs.filter(j => j.url)
62 .map(j => `${j.timestamp.toLocaleDateString()},${j.url}`));