Supporting Ariane with launchbugsv2.html

Adding support for Launch Bugs in Ariene (go/launch) and adding Archived launches to the filter in Monorail. After migration to Launch all launch statuses changed to Archived.

BUG=None
TEST=go/launchbugs?
- go/launchbugs?te=new
- go/launchbugs?m=105
- go/launchbugs?m=105&te=dhaddock
- go/launchbugs?team=corex
- go/launchbugs?team=corex&m=105

Change-Id: I0583d0bddf764214e1567388b90332d36b19d8ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crostestutils/+/3976528
Reviewed-by: Hyung Tae Kim <hyungtaekim@chromium.org>
Reviewed-by: David Haddock <dhaddock@chromium.org>
Tested-by: Wendy Aleman Martinez <awendy@chromium.org>
Commit-Queue: Wendy Aleman Martinez <awendy@chromium.org>
diff --git a/provingground/launchbugs/README.md b/provingground/launchbugs/README.md
index 1a182b5..89a93fc 100644
--- a/provingground/launchbugs/README.md
+++ b/provingground/launchbugs/README.md
@@ -1,40 +1,53 @@
 # Launchbugs Redirect
 
-Launchbugs.html is a helper that opens filtered launchbugs based on Milestones, Test Engineers,
-Status, and component IIRC
+## Launchbugs -- Launch
+launchbugs.html is a helper that opens filtered launchbugs based on Milestones
+and Test Engineers on go/launch
+
+## Launchbugs Old -- Monorail
+launchbugsold.html is a helper that opens filtered launchbugs based on
+Milestones, Test Engineers, Status, and Components on Monorail
 
 ## Usage
-Navigate to [go/launchbugs?]
-Filter by Milestone: [go/launchbugs?m=105]
-Filter by Test Engineers: [go/launchbugs?te=dhaddock]
-Filter by Status: [go/launchbugs?m=105&s=Fixed]
-Filter by Component IIRC: [go/launchbugs?c=UI>Shell>StatusArea]
-Filter by Team: [go/launchbugs?team=coreX]
 
-## Filtering by Team
-Team is not an existing Filter in LaunchBugs. The functionality was added to shorten the Tests Engineers required if we want to add all the TEs from CoreX.
-Ex: `go/launchbugs?m=100&team=coreX` will search for all the Launch Bugs in Milestone 100 where the TEs are dhaddock,kyleshima,hyungtaekim, or awendy
+### Launch
+Navigate to go/launchbugs?
+Filter by Milestone: go/launchbugs?m=105
+Filter by Test Engineers: go/launchbugs?te=dhaddock
+Filter by Team: go/launchbugs?team=coreX
 
-## Testing
-After modifying the script, please make sure that the old functionalities are still working, some good urls to test:
-- [go/launchbugs?]
-- [go/launchbugs?te=new]
-- [go/launchbugs?m=105]
-- [go/launchbugs?m=105&te=dhaddock]
-- [go/launchbugs?team=corex]
-- [go/launchbugs?team=corex&m=105]
-- [go/launchbugs?&m=101&te=dhaddock&s=Fixed]
-- [go/launchbugs?team=corex&m=101&te=sdantuluri&status=Fixed&c=OS>Systems>Update]
+### Monorail
+Navigate to go/launchbugsold?
+Filter by Milestone: go/launchbugsold?m=105
+Filter by Test Engineers: go/launchbugsold?te=dhaddock
+Filter by Status: go/launchbugsold?m=105&s=Fixed
+Filter by Component IIRC: go/launchbugsold?c=UI>Shell>StatusArea
+Filter by Team: go/launchbugsold?team=coreX
 
-[//]: # (Reference Links)
-[go/launchbugs?]: go/launchbugs?
-[go/launchbugs?te=new]: go/launchbugs?te=new
-[go/launchbugs?te=dhaddock]: go/launchbugs?te=dhaddock
-[go/launchbugs?m=105&s=Fixed]: go/launchbugs?m=105&s=Fixed
-[go/launchbugs?c=UI>Shell>StatusArea]: go/launchbugs?c=UI>Shell>StatusArea
-[go/launchbugs?m=105]: go/launchbugs?m=105
-[go/launchbugs?m=105&te=dhaddock]: go/launchbugs?m=105&te=dhaddock
-[go/launchbugs?team=corex]: go/launchbugs?team=corex
-[go/launchbugs?team=corex&m=105]: go/launchbugs?team=corex&m=105
-[go/launchbugs?&m=101&te=dhaddock&s=Fixed]: go/launchbugs?&m=101&te=dhaddock&s=Fixed
-[go/launchbugs?team=corex&m=101&te=sdantuluri&status=Fixed&c=OS>Systems>Update]: go/launchbugs?team=corex&m=101&te=sdantuluri&status=Fixed&c=OS>Systems>Update
+### Filtering by Team
+Team is not an existing Filter Attribute. The functionality was added to
+shorten the Tests Engineers required if we want to add all the TEs from CoreX.
+Ex: `go/launchbugs?m=100&team=coreX` will search for all the Launch Bugs in
+Milestone 100 where the TEs are dhaddock,kyleshima,hyungtaekim, or awendy
+
+### Testing
+After modifying the script, please make sure that the old functionalities are
+still working
+
+Some good urls to test in Monorail:
+- go/launchbugsold?
+- go/launchbugsold?te=new
+- go/launchbugsold?m=105
+- go/launchbugsold?m=105&te=dhaddock
+- go/launchbugsold?team=corex
+- go/launchbugsold?team=corex&m=105
+- go/launchbugsold?&m=101&te=dhaddock&s=Fixed
+- go/launchbugsold?team=corex&m=101&te=sdantuluri&status=Fixed&c=OS>Systems>Update
+
+Some good urls to test in Launch:
+- go/launchbugs?
+- go/launchbugs?te=new
+- go/launchbugs?m=105
+- go/launchbugs?m=105&te=dhaddock
+- go/launchbugs?team=corex
+- go/launchbugs?team=corex&m=105
diff --git a/provingground/launchbugs/launchbugs.html b/provingground/launchbugs/launchbugs.html
index 60fc0a0..b5801aa 100644
--- a/provingground/launchbugs/launchbugs.html
+++ b/provingground/launchbugs/launchbugs.html
@@ -17,61 +17,45 @@
                     }
                 }
             }
-            var base_url = 'https://bugs.chromium.org/p/chromium/issues/list?sort=-component te&groupby=&colspec=ID Pri Component Summary TL PM TE ChromeOS-Test stable.M-Target Opened ATFw ChromeOS-Test-approver'
-            //Add milestone and TE to crbug url and redirect to it
-            function UpdateUrlsWithMilestone(milestone, te, s, c) {
-              var src = base_url.concat('&q=(stable.M-Target=<milestone> OR stable-Full.M-Target=<milestone> OR stable-Exp.M-Target=<milestone>) <TE> <COMPONENT> <status>').concat(' OS=Chrome -OS:Mac,IOS,linux,Android,Windows,Fuchsia,All -Status:Duplicate,WontFix,Archived has:ChromeOS-Leadership-Full&can=1')
+            var base_url = 'https://launch.corp.google.com/launches?'
+            //Add milestone and TE to launch url and redirect to it
+            function UpdateUrlsWithMilestone(milestone, te, team) {
+              var src = base_url.concat('&q=calendarId:2197 status:current "Stable Target Milestone":"<milestone>" <TE>')
               src = src.replace(/<milestone>/g, milestone)
-              if (!te) {
-                console.log('No te')
-                src = src.replace(/<TE>/g, "")
+              if (!team){
+                if (!te) {
+                  console.log('No te')
+                  src = src.replace(/<TE>/g, "")
+                }
+                else {
+                  console.log('Replace te')
+                  src = src.replace(/<TE>/g, '"te":"'+te+'"')
+                }
               }
-              else {
-                console.log('replace te')
-                src = src.replace(/<TE>/g, "TE:"+te)
-              }
-              if (!s) {
-                console.log('No status')
-                src = src.replace(/<status>/g, "")
-              }
-              else {
-                console.log('replace status')
-                src = src.replace(/<status>/g, "Status:"+s)
-              }
-              if (!c) {
-                console.log('No component')
-                src = src.replace(/<COMPONENT>/g, "")
-              }
-              else {
-                console.log('replace component')
-                src = src.replace(/<COMPONENT>/g, "component:"+c)
+              else{ 
+                console.log('Team found, overrides TE')
+                src = src.replace(/<TE>/g, team)
               }
               window.location.replace(src);
             }
             var m = GetURLParameter('m')
             var te = GetURLParameter('te')
-            var s = GetURLParameter('status')
-            var c = GetURLParameter('c')
             //Add use of team variables
             var team = GetURLParameter('team')
             if (team && team.toLowerCase() == "corex"){
-                if (!te)
-                    te = 'dhaddock,kyleshima,hyungtaekim,awendy'
-                else if(te != "new"){
-                    te = te.concat(',dhaddock,kyleshima,hyungtaekim,awendy')
-                }
+                team = '\"te\":(\"dhaddock\" OR \"kyleshima\" OR \"hyungtaekim\" OR \"awendy\")'
             }
             if (te == "new") {
               console.log('te = new url')
-              window.location.replace(base_url.concat('&num=100&q=Type=FLT-Launch OS=Chrome -OS:Mac,IOS,linux,Android,Windows,Fuchsia,All -ChromeOS-Test=APPROVED has:ChromeOS-Leadership-Full -has:TE&can=2'))
-             }
+              window.location.replace(base_url.concat('&q=calendarId:2197 status:current te:NULL'))
+            }
             else if (!m) {
               console.log('Error: No milestone supplied.')
-              window.location.replace(base_url.concat('&num=100&q=Type=FLT-Launch OS=Chrome -OS:Mac,IOS,linux,Android,Windows,Fuchsia,All -ChromeOS-Test=APPROVED has:ChromeOS-Leadership-Full&can=2'))
+              window.location.replace(base_url.concat('&q=calendarId:2197 status:current'))
             }
             else {
-              UpdateUrlsWithMilestone(m, te, s, c)
+              UpdateUrlsWithMilestone(m, te, team)
             }
         </script>
     </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/provingground/launchbugs/launchbugsold.html b/provingground/launchbugs/launchbugsold.html
new file mode 100644
index 0000000..dbb2b18
--- /dev/null
+++ b/provingground/launchbugs/launchbugsold.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <title>ChromeOS Launch Bugs go/launchbugsold </title>
+    </head>
+    <body >
+      <script>
+            // Read the parameters passed to the url
+            function GetURLParameter(sParam) {
+                var sPageURL = window.location.search.substring(1);
+                var sURLVariables = sPageURL.split('&');
+                for (var i = 0; i < sURLVariables.length; i++) {
+                    var sParameterName = sURLVariables[i].split('=');
+                    if (sParameterName[0] == sParam) {
+                      return sParameterName[1];
+                    }
+                }
+            }
+            var base_url = 'https://bugs.chromium.org/p/chromium/issues/list?sort=-component te&groupby=&colspec=ID Pri Component Summary TL PM TE ChromeOS-Test stable.M-Target Opened ATFw ChromeOS-Test-approver'
+            //Add milestone and TE to crbug url and redirect to it
+            function UpdateUrlsWithMilestone(milestone, te, s, c) {
+              var src = base_url.concat('&q=(stable.M-Target=<milestone> OR stable-Full.M-Target=<milestone> OR stable-Exp.M-Target=<milestone>) <TE> <COMPONENT> <status>').concat(' OS=Chrome -OS:Mac,IOS,linux,Android,Windows,Fuchsia,All -Status:Duplicate,WontFix has:ChromeOS-Leadership-Full&can=1')
+              src = src.replace(/<milestone>/g, milestone)
+              if (!te) {
+                console.log('No te')
+                src = src.replace(/<TE>/g, "")
+              }
+              else {
+                console.log('replace te')
+                src = src.replace(/<TE>/g, "TE:"+te)
+              }
+              if (!s) {
+                console.log('No status')
+                src = src.replace(/<status>/g, "")
+              }
+              else {
+                console.log('replace status')
+                src = src.replace(/<status>/g, "Status:"+s)
+              }
+              if (!c) {
+                console.log('No component')
+                src = src.replace(/<COMPONENT>/g, "")
+              }
+              else {
+                console.log('replace component')
+                src = src.replace(/<COMPONENT>/g, "component:"+c)
+              }
+              window.location.replace(src);
+            }
+            var m = GetURLParameter('m')
+            var te = GetURLParameter('te')
+            var s = GetURLParameter('status')
+            var c = GetURLParameter('c')
+            //Add use of team variables
+            var team = GetURLParameter('team')
+            if (team && team.toLowerCase() == "corex"){
+                if (!te)
+                    te = 'dhaddock,kyleshima,hyungtaekim,awendy'
+                else if(te != "new"){
+                    te = te.concat(',dhaddock,kyleshima,hyungtaekim,awendy')
+                }
+            }
+            if (te == "new") {
+              console.log('te = new url')
+              window.location.replace(base_url.concat('&num=100&q=Type=FLT-Launch OS=Chrome -OS:Mac,IOS,linux,Android,Windows,Fuchsia,All -ChromeOS-Test=APPROVED has:ChromeOS-Leadership-Full -has:TE&can=2'))
+             }
+            else if (!m) {
+              console.log('Error: No milestone supplied.')
+              window.location.replace(base_url.concat('&num=100&q=Type=FLT-Launch OS=Chrome -OS:Mac,IOS,linux,Android,Windows,Fuchsia,All -ChromeOS-Test=APPROVED has:ChromeOS-Leadership-Full&can=2'))
+            }
+            else {
+              UpdateUrlsWithMilestone(m, te, s, c)
+            }
+        </script>
+    </body>
+</html>