From 61e68854733f5b96adb0ec4cce74a019df393a9c Mon Sep 17 00:00:00 2001 From: Yann Dago Date: Thu, 9 Mar 2023 16:18:20 -0500 Subject: [PATCH] Add Enterprise feature flow UI/UX changes (#2802) * Hide edit button on feature page for enterprises * After creating an enterprise feature go to the edit all page at the first rollout section * Open all section on the feature page for enterprise by default * Adding stage for enterprise features only adds rollout feature * Remove the action of setting a stage in enterprise features * Update scrolling behavior to scroll to the element from the hash if no form field is found * Remove the edit icon from the feature page that navigates to the edit page * Add an id to the "edit all" section headers to serve as an anchor for navigations --- .../elements/chromedash-add-stage-dialog.js | 10 +++++++-- .../elements/chromedash-feature-detail.js | 9 +++++--- .../elements/chromedash-feature-page.js | 6 ++--- .../elements/chromedash-guide-editall-page.js | 21 ++++++++++++++---- .../elements/chromedash-guide-metadata.js | 12 +++++----- .../chromedash-guide-metadata_test.js | 2 +- .../elements/chromedash-guide-stage-page.js | 22 ++++++++++--------- .../elements/chromedash-process-overview.js | 4 +++- client-src/elements/form-definition.js | 1 - client-src/elements/utils.js | 10 +++++++++ pages/guide.py | 2 +- 11 files changed, 68 insertions(+), 31 deletions(-) diff --git a/client-src/elements/chromedash-add-stage-dialog.js b/client-src/elements/chromedash-add-stage-dialog.js index 1a746d61..876b141f 100644 --- a/client-src/elements/chromedash-add-stage-dialog.js +++ b/client-src/elements/chromedash-add-stage-dialog.js @@ -1,6 +1,7 @@ import {LitElement, css, html} from 'lit'; import {SHARED_STYLES} from '../sass/shared-css.js'; import {CREATEABLE_STAGES, FORMS_BY_STAGE_TYPE} from './form-definition.js'; +import {renderHTMLIf} from './utils.js'; let addStageDialogEl; @@ -90,17 +91,22 @@ class ChromedashAddStageDialog extends LitElement { } renderStageSelect() { + const offerChoice = CREATEABLE_STAGES[this.featureType].length > 1; + const initialValue = offerChoice ? 0 : CREATEABLE_STAGES[this.featureType][0]; + this.canSubmit = !offerChoice; return html`
- Select a stage to create + ${renderHTMLIf( + offerChoice, + html`Select a stage to create`)} ${this.renderSelectMenuItems()} `; - return this.renderSection('Metadata', content); + return this.renderSection( + 'Metadata', + content, + /* isActive=*/false, + /* defaultOpen=*/this.feature.is_enterprise_feature); } renderGateChip(feStage, gate) { @@ -593,8 +597,7 @@ class ChromedashFeatureDetail extends LitElement { ${this.renderSectionFields(fields, feStage)} `; - - const defaultOpen = (feStage.id == this.openStage); + const defaultOpen = this.feature.is_enterprise_feature || (feStage.id == this.openStage); return this.renderSection(name, content, isActive, defaultOpen); } diff --git a/client-src/elements/chromedash-feature-page.js b/client-src/elements/chromedash-feature-page.js index 94a406ea..abce46a6 100644 --- a/client-src/elements/chromedash-feature-page.js +++ b/client-src/elements/chromedash-feature-page.js @@ -2,7 +2,7 @@ import {LitElement, css, html, nothing} from 'lit'; import './chromedash-feature-detail'; import './chromedash-gantt'; import {openApprovalsDialog} from './chromedash-approvals-dialog'; -import {autolink, showToastMessage} from './utils.js'; +import {autolink, renderHTMLIf, showToastMessage} from './utils.js'; import {SHARED_STYLES} from '../sass/shared-css.js'; const INACTIVE_STATES = [ @@ -288,13 +288,13 @@ export class ChromedashFeaturePage extends LitElement { - ${canEdit ? html` + ${renderHTMLIf(canEdit && !this.feature.is_enterprise_feature, html` - `: nothing} + `)}