Skip to content

Commit

Permalink
support-tool: Set up pages structure and navigation buttons
Browse files Browse the repository at this point in the history
Add different pages to get information on which data to collect on
Support Tool using iron-pages. Add navigation buttons. Add
support_tool_shared.css file to style the common components in these
pages. Update browser tests to test the new structure.

The change is based on mocks here:https://docs.google.com/presentation/d/1XT3CvqqDHy6E0F1_PJwQZMYG_dukKsne1eMQ9E1y-xE/edit?hl=en&forcehl=1#slide=id.8dTFyXz
Screenshot of Support Tool after this change: https://screenshot.googleplex.com/zZgg4tQhk83ptaz.png
More detail about Support Tool on: go/support-tool-v1-design

Bug:b:219730597
Test:Run broweser tests with "autoninja -C out/Default/ browser_tests &&
out/Default/browser_tests --gtest_filter=*SupportToolTest*" command

Change-Id: I889eb84dd3593f5c5bec775386d38eff76198baa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3525379
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Pavol Marko <pmarko@chromium.org>
Commit-Queue: Irem Uguz <iremuguz@google.com>
Cr-Commit-Position: refs/heads/main@{#984260}
  • Loading branch information
Irem Uguz authored and Chromium LUCI CQ committed Mar 23, 2022
1 parent a4a5764 commit 1bc0d96
Show file tree
Hide file tree
Showing 13 changed files with 351 additions and 106 deletions.
13 changes: 8 additions & 5 deletions chrome/browser/resources/support_tool/BUILD.gn
Expand Up @@ -3,6 +3,7 @@
# found in the LICENSE file.

import("//tools/grit/grit_rule.gni")
import("//tools/polymer/html_to_js.gni")
import("//tools/polymer/html_to_wrapper.gni")
import("//tools/typescript/ts_library.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
Expand All @@ -15,10 +16,7 @@ resources_grd_file = "$target_gen_dir/resources.grd"
generate_grd("build_grd") {
grd_prefix = "support_tool"
out_grd = resources_grd_file
input_files = [
"support_tool_container.html",
"support_tool.html",
]
input_files = html_files + [ "support_tool_container.html" ]
input_files_base_dir = rebase_path(".", "//")
deps = [ ":build_ts" ]
manifest_files = [ "$target_gen_dir/tsconfig.manifest" ]
Expand All @@ -42,6 +40,10 @@ copy("copy") {
outputs = [ "$target_gen_dir/{{source_file_part}}" ]
}

html_to_js("css_wrapper_files") {
js_files = css_wrapper_files
}

html_to_wrapper("html_wrapper_files") {
in_files = html_files
}
Expand All @@ -51,13 +53,14 @@ ts_library("build_ts") {
root_dir = target_gen_dir
out_dir = "$target_gen_dir/tsc"
tsconfig_base = "tsconfig_base.json"
in_files = ts_files + html_wrapper_files
in_files = ts_files + css_wrapper_files + html_wrapper_files
deps = [
"//third_party/polymer/v3_0:library",
"//ui/webui/resources:library",
]
extra_deps = [
":copy",
":css_wrapper_files",
":html_wrapper_files",
]
}
8 changes: 8 additions & 0 deletions chrome/browser/resources/support_tool/data_collectors.html
@@ -0,0 +1,8 @@
<!-- Copyright 2022 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<style include="support-tool-shared"></style>

<h2>Collect diagnostics data for support</h2>
<div class="support-tool-title">Select diagnostic data to export</div>
26 changes: 26 additions & 0 deletions chrome/browser/resources/support_tool/data_collectors.ts
@@ -0,0 +1,26 @@
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import './support_tool_shared_css.js';

import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {getTemplate} from './data_collectors.html.js';

export class DataCollectorsElement extends PolymerElement {
static get is() {
return 'data-collectors';
}

static get template() {
return getTemplate();
}
}

declare global {
interface HTMLElementTagNameMap {
'data-collectors': DataCollectorsElement;
}
}

customElements.define(DataCollectorsElement.is, DataCollectorsElement);
54 changes: 54 additions & 0 deletions chrome/browser/resources/support_tool/issue_details.html
@@ -0,0 +1,54 @@
<!-- Copyright 2022 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<style include="md-select cr-input-style support-tool-shared">
#support-case-id {
height: 32px;
width: 248px;
}

.md-select {
height: 32px;
margin-bottom: 30px;
width: 248px;
}

#description {
/*TODO(b/222669536): Style the description better when UX reviewer of mocks
gives their input.*/
background-color: var(--cr-input-background-color);
border: none;
border-radius: var(--cr-input-border-radius, 4px);
caret-color: var(--cr-input-focus-color);
color: var(--cr-input-color);
display: block;
font-family: inherit;
height: 120px;
margin-top: 8px;
outline: none;
padding-bottom: 8px;
padding-inline-start: 10px;
padding-top: 8px;
resize: none;
width: 520px;
}
</style>

<h2>Collect diagnostics data for support</h2>
<div class="support-tool-title">Support Case ID</div>
<cr-input id="support-case-id" value="{{caseId_}}"
spellcheck="false" maxlength="20">
</cr-input>
<div class="support-tool-title">Email</div>
<select class="md-select" value="{{selectedEmail_::change}}">
<option value=""></option>
<template is="dom-repeat" items="[[emails_]]">
<option value="[[item]]">[[item]]</option>
</template>
</select>
<div class="support-tool-title">Describe the issue</div>
<textarea id="description" value="{{issueDescription_::input}}"
spellcheck="true"
placeholder="Provide a clear desciption of the issue and steps to reproduce the issue (if possible)">
</textarea>
67 changes: 67 additions & 0 deletions chrome/browser/resources/support_tool/issue_details.ts
@@ -0,0 +1,67 @@
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import './strings.m.js';
import 'chrome://resources/cr_elements/shared_vars_css.m.js';
import 'chrome://resources/cr_elements/cr_input/cr_input.m.js';
import 'chrome://resources/cr_elements/md_select_css.m.js';
import './support_tool_shared_css.js';

import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {BrowserProxy, BrowserProxyImpl} from './browser_proxy.js';
import {getTemplate} from './issue_details.html.js';

export class IssueDetailsElement extends PolymerElement {
static get is() {
return 'issue-details';
}

static get template() {
return getTemplate();
}

static get properties() {
return {
caseId_: {
type: String,
value: () => loadTimeData.getString('caseId'),
},
emails_: {
type: Array,
value: () => [],
},
issueDescription_: {
type: String,
value: '',
},
selectedEmail_: {
type: String,
value: '',
},
};
}

private caseId_: string;
private emails_: string[];
private issueDescription_: string;
private selectedEmail_: string;
private browserProxy_: BrowserProxy = BrowserProxyImpl.getInstance();

override connectedCallback() {
super.connectedCallback();

this.browserProxy_.getEmailAddresses().then((emails: string[]) => {
this.emails_ = emails;
});
}
}

declare global {
interface HTMLElementTagNameMap {
'issue-details': IssueDetailsElement;
}
}

customElements.define(IssueDetailsElement.is, IssueDetailsElement);
10 changes: 10 additions & 0 deletions chrome/browser/resources/support_tool/spinner_page.html
@@ -0,0 +1,10 @@
<!-- Copyright 2022 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<style include="support-tool-shared"></style>

<h2>Collecting diagnostic data</h2>
<div class="navigation-buttons">
<cr-button on-click="onCancelClick_">Cancel</cr-button>
</div>
32 changes: 32 additions & 0 deletions chrome/browser/resources/support_tool/spinner_page.ts
@@ -0,0 +1,32 @@
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import './support_tool_shared_css.js';
import 'chrome://resources/cr_elements/cr_button/cr_button.m.js';

import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {getTemplate} from './spinner_page.html.js';

export class SpinnerPageElement extends PolymerElement {
static get is() {
return 'spinner-page';
}

static get template() {
return getTemplate();
}

private onCancelClick_() {
// Send cancel signal to Chrome C++ side using BrowserProxy. It will be
// added in follow-up CL.
}
}

declare global {
interface HTMLElementTagNameMap {
'spinner-page': SpinnerPageElement;
}
}

customElements.define(SpinnerPageElement.is, SpinnerPageElement);
9 changes: 8 additions & 1 deletion chrome/browser/resources/support_tool/support_tool.gni
Expand Up @@ -3,7 +3,12 @@
# found in the LICENSE file.

# Files holding a Polymer element definition and have an equivalent .html file.
web_component_files = [ "support_tool.ts" ]
web_component_files = [
"support_tool.ts",
"issue_details.ts",
"data_collectors.ts",
"spinner_page.ts",
]

# Files that are passed as input to html_to_wrapper().
html_files = []
Expand All @@ -18,3 +23,5 @@ foreach(f, html_files) {
}

ts_files = web_component_files + [ "browser_proxy.ts" ]

css_wrapper_files = [ "support_tool_shared_css.ts" ]
94 changes: 30 additions & 64 deletions chrome/browser/resources/support_tool/support_tool.html
Expand Up @@ -2,74 +2,40 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<style include="md-select cr-input-style">
.entry-view {
<style include="support-tool-shared">
:host {
block-size: fit-content;
display: block;
margin-inline-start: 40px;
}

h2 {
color: var(--cr-text-color-primary);
font-size: 20px;
font-weight: normal;
margin-bottom: 18px;
margin-top: 72px;
width: fit-content;
}

.support-tool-title {
color: var(--cr-title-text-color);
font-size: 14px;
margin-bottom: 10px;
margin-top: 10px;
}

#support-case-id {
height: 32px;
width: 248px;
}

.md-select {
height: 32px;
margin-bottom: 30px;
width: 248px;
}

#description {
/*TODO(b/222669536): Style the description better when UX reviewer of mocks
gives their input.*/
background-color: var(--cr-input-background-color);
border: none;
border-radius: var(--cr-input-border-radius, 4px);
caret-color: var(--cr-input-focus-color);
color: var(--cr-input-color);
display: block;
font-family: inherit;
height: 120px;
margin-top: 8px;
outline: none;
padding-bottom: 8px;
padding-inline-start: 10px;
padding-top: 8px;
resize: none;
width: 520px;
cr-button {
margin-inline-start: 12px;
}
</style>

<div class="entry-view">
<h2>Collect diagnostics data for support</h2>
<div class="support-tool-title">Support Case ID</div>
<cr-input id="support-case-id" value="{{caseId_}}"
spellcheck="false" maxlength="20">
</cr-input>
<div class="support-tool-title">Email</div>
<select class="md-select" value="{{selectedEmail_::change}}">
<option value=""></option>
<template is="dom-repeat" items="[[emails_]]">
<option value="[[item]]">[[item]]</option>
</template>
</select>
<div class="support-tool-title">Describe the issue</div>
<textarea id="description" value="{{issueDescription_::input}}"
spellcheck="true"
placeholder="Provide a clear desciption of the issue and steps to reproduce the issue (if possible)">
</textarea>
</div>
<div id="support-tool-pages">
<iron-pages selected="[[selectedPage_]]" attr-for-selected="page-index">
<issue-details id="issueDetails"
page-index="[[supportToolPageIndex_.ISSUE_DETAILS]]">
</issue-details>
<data-collectors id="dataCollectors"
page-index="[[supportToolPageIndex_.DATA_COLLECTOR_SELECTION]]">
</data-collectors>
<spinner-page id="spinnerPage"
page-index="[[supportToolPageIndex_.SPINNER]]">
</spinner-page>
</iron-pages>
</div>
<div class="navigation-buttons" id="continueButtonContainer"
hidden$="[[shouldHideContinueButtonContainer_(selectedPage_)]]">
<cr-button id="backButton" hidden$="[[shouldHideBackButton_(selectedPage_)]]"
on-click="onBackClick_">
Back
</cr-button>
<cr-button on-click="onContinueClick_" class="action-button">
Continue
</cr-button>
</div>

0 comments on commit 1bc0d96

Please sign in to comment.