-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge port forwarding fixes to release branch M103
crostini: fix port forwarding toggles to be container aware Mk2 Previous CL went in with commented out lines because I forgot to disable auto-submit. Real test fixes in this CL. Bug: b/234394209 Change-Id: If1749a64ed9d56705d0c412e425621b5bc60b569 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3688770 Auto-Submit: Nicholas Verne <nverne@chromium.org> Commit-Queue: Christopher Lam <calamity@chromium.org> Reviewed-by: Christopher Lam <calamity@chromium.org> Cr-Commit-Position: refs/heads/main@{#1010450} (cherry picked from commit d0c3350) crostini: fix port forwarding toggles to be container aware Bug: b/234394209 Change-Id: I66e2872dc1c807360c9ae2002034fdf29bbc8ac8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3685680 Auto-Submit: Nicholas Verne <nverne@chromium.org> Reviewed-by: Christopher Lam <calamity@chromium.org> Commit-Queue: Christopher Lam <calamity@chromium.org> Cr-Commit-Position: refs/heads/main@{#1010414} (cherry picked from commit a536f5f) crostini: Adds container options for port forwarding New re-usable element <settings-crostini-container-select> is shown only when there is more than one container available. Ports forwarded are grouped by container in the UI. (cherry picked from commit 85bb555) Bug: 1261319 Change-Id: If9171c53bffe68404d21a292f819eda946a067b1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3636504 Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org> Commit-Queue: Nicholas Verne <nverne@chromium.org> Cr-Original-Commit-Position: refs/heads/main@{#1009004} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3688779 Commit-Queue: Christopher Lam <calamity@chromium.org> Reviewed-by: Christopher Lam <calamity@chromium.org> Auto-Submit: Nicholas Verne <nverne@chromium.org> Cr-Commit-Position: refs/branch-heads/5060@{#587} Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
- Loading branch information
Nicholas Verne
authored and
Chromium LUCI CQ
committed
Jun 6, 2022
1 parent
de2ee59
commit 94b9756
Showing
12 changed files
with
608 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
chrome/browser/resources/settings/chromeos/crostini_page/crostini_container_select.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<style include="settings-shared md-select"></style> | ||
<select id="selectContainer" | ||
class="md-select" | ||
value="containerLabel_(containerId)" | ||
on-change="onSelectContainer_"> | ||
<template is="dom-repeat" items="[[containers]]"> | ||
<option value="[[item.id]]"> | ||
[[containerLabel_(item.id)]] | ||
</option> | ||
</template> | ||
</select> |
93 changes: 93 additions & 0 deletions
93
chrome/browser/resources/settings/chromeos/crostini_page/crostini_container_select.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// 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. | ||
|
||
/** | ||
* @fileoverview 'settings-crostini-container-select' is a component enabling a | ||
* user to select a target container from a list stored in prefs. | ||
*/ | ||
import '//resources/cr_elements/md_select_css.m.js'; | ||
import '../../settings_shared_css.js'; | ||
|
||
import {html, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; | ||
|
||
import {ContainerId, ContainerInfo, DEFAULT_CONTAINER_ID, DEFAULT_CROSTINI_VM} from './crostini_browser_proxy.js'; | ||
|
||
/** | ||
* @param {!ContainerId} first | ||
* @param {!ContainerId} second | ||
* @return boolean | ||
*/ | ||
export function equalContainerId(first, second) { | ||
return first.vm_name === second.vm_name && | ||
first.container_name === second.container_name; | ||
} | ||
|
||
/** | ||
* @param {!ContainerId} id | ||
* @return string | ||
*/ | ||
export function containerLabel(id) { | ||
if (id.vm_name === DEFAULT_CROSTINI_VM) { | ||
return id.container_name; | ||
} | ||
return id.vm_name + ':' + id.container_name; | ||
} | ||
|
||
|
||
/** @polymer */ | ||
class ContainerSelectElement extends PolymerElement { | ||
static get is() { | ||
return 'settings-crostini-container-select'; | ||
} | ||
|
||
static get template() { | ||
return html`{__html_template__}`; | ||
} | ||
|
||
static get properties() { | ||
return { | ||
/** | ||
* @type {!ContainerId} | ||
*/ | ||
selectedContainerId: { | ||
type: Object, | ||
notify: true, | ||
}, | ||
|
||
/** | ||
* List of containers that are already stored in the settings. | ||
* @type {!Array<!ContainerInfo>} | ||
*/ | ||
containers: { | ||
type: Array, | ||
value() { | ||
return []; | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
|
||
/** | ||
* @param {!Event} e | ||
* @private | ||
*/ | ||
onSelectContainer_(e) { | ||
const index = e.target.selectedIndex; | ||
if (index >= 0 && index < this.containers.length) { | ||
this.selectedContainerId = this.containers[index].id; | ||
} | ||
} | ||
|
||
/** | ||
* @param {!ContainerId} id | ||
* @return string | ||
* @private | ||
*/ | ||
containerLabel_(id) { | ||
return containerLabel(id); | ||
} | ||
} | ||
|
||
customElements.define(ContainerSelectElement.is, ContainerSelectElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.