Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove product_colors flag #485

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions web/app/components/doc/thumbnail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ export default class DocThumbnailComponent extends Component<DocThumbnailCompone
return true;
}

if (!this.flags.productColors) {
return false;
}

if (this.productAreas.getAbbreviation(this.args.product)) {
return true;
}
Expand Down
2 changes: 0 additions & 2 deletions web/app/components/product/avatar.gts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default class ProductAvatarComponent extends Component<ProductAvatarCompo
}

private get colorStyles() {
if (!this.flags.productColors) return;
if (this.productID) return;

const bgColor = this.productAreas.getProductColor(this.args.product);
Expand Down Expand Up @@ -72,7 +71,6 @@ export default class ProductAvatarComponent extends Component<ProductAvatarCompo

private get iconIsShown() {
if (this.productID) return true;
if (!this.flags.productColors) return true;
if (this.abbreviation) return false;
return true;
}
Expand Down
6 changes: 1 addition & 5 deletions web/app/components/project/tile.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@
<ul class="flex gap-px">
{{#each @project.products as |product|}}
<li class="flex items-center" data-test-product>
{{#if this.productColorsAreEnabled}}
<Product::Avatar @product={{product}} />
{{else}}
{{product}}
{{/if}}
<Product::Avatar @product={{product}} />
</li>
{{/each}}
</ul>
Expand Down
10 changes: 1 addition & 9 deletions web/app/components/project/tile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { inject as service } from "@ember/service";
import Component from "@glimmer/component";
import FlagsService from "hermes/services/flags";
import { HermesProject } from "hermes/types/project";

interface ProjectTileComponentSignature {
Expand All @@ -10,13 +8,7 @@ interface ProjectTileComponentSignature {
};
}

export default class ProjectTileComponent extends Component<ProjectTileComponentSignature> {
@service declare flags: FlagsService;

protected get productColorsAreEnabled(): boolean {
return this.flags.productColors === true;
}
}
export default class ProjectTileComponent extends Component<ProjectTileComponentSignature> {}

declare module "@glint/environment-ember-loose/registry" {
export default interface Registry {
Expand Down
4 changes: 0 additions & 4 deletions web/app/services/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@ export default class FlagsService extends Service {
get projects() {
return this.configSvc.config.feature_flags?.["projects"];
}

get productColors() {
return this.configSvc.config.feature_flags?.["product_colors"];
}
}
1 change: 0 additions & 1 deletion web/mirage/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ export default function (mirageConfig) {
algolia_internal_index_name: config.algolia.internalIndexName,
feature_flags: {
projects: true,
product_colors: true,
},
google_doc_folders: "",
short_link_base_url: TEST_SHORT_LINK_BASE_URL,
Expand Down
13 changes: 0 additions & 13 deletions web/tests/integration/components/doc/thumbnail-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,6 @@ module("Integration | Component | doc/thumbnail", function (hooks) {
.dom(PRODUCT_BADGE)
.exists("badge is shown for a product with an icon");

setFeatureFlag(this, "product_colors", false);

// If product colors were enabled, this would render a badge
this.set("product", "Labs");

assert
.dom(PRODUCT_BADGE)
.doesNotExist(
"abbreviation not shown if the productColors flag is disabled",
);

setFeatureFlag(this, "product_colors", true);

// Config is not tracked by glimmer, so we force
// a re-compute on the "badgeIsShown" getter
this.set("product", undefined);
Expand Down
32 changes: 0 additions & 32 deletions web/tests/integration/components/product/avatar-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ module("Integration | Component | product/avatar", function (hooks) {

await setupProductIndex(this);

setFeatureFlag(this, "product_colors", true);

await render<ProductAvatarTestContext>(hbs`
<Product::Avatar @product="Labs" />
`);
Expand All @@ -71,8 +69,6 @@ module("Integration | Component | product/avatar", function (hooks) {
});

test("it conditionally shows a product icon", async function (this: ProductAvatarTestContext, assert) {
setFeatureFlag(this, "product_colors", true);

this.server.create("product", {
name: "Vault",
});
Expand All @@ -97,21 +93,6 @@ module("Integration | Component | product/avatar", function (hooks) {
assert
.dom(ICON)
.doesNotExist("it does not render an icon for non-icon products");

setFeatureFlag(this, "product_colors", false);

// Config is not tracked by glimmer, so we force
// a re-compute on the "badgeIsShown" getter
this.set("product", undefined);
this.set("product", "Labs");

assert
.dom(ICON)
.hasAttribute(
"data-test-icon",
"folder",
"it renders a folder icon if productColors is disabled",
);
});

test("it conditionally renders a product abbreviation", async function (this: ProductAvatarTestContext, assert) {
Expand All @@ -127,8 +108,6 @@ module("Integration | Component | product/avatar", function (hooks) {

await setupProductIndex(this);

setFeatureFlag(this, "product_colors", true);

await render<ProductAvatarTestContext>(hbs`
<Product::Avatar @product={{this.product}} />
`);
Expand All @@ -142,15 +121,6 @@ module("Integration | Component | product/avatar", function (hooks) {
this.set("product", "Labs");

assert.dom(ABBREVIATION).exists();

setFeatureFlag(this, "product_colors", false);

// Config is not tracked by glimmer, so we force
// a re-compute on the "badgeIsShown" getter
this.set("product", undefined);
this.set("product", "Labs");

assert.dom(ABBREVIATION).doesNotExist();
});

test("it renders a fallback icon if the product has no ID nor abbreviation", async function (this: ProductAvatarTestContext, assert) {
Expand Down Expand Up @@ -193,8 +163,6 @@ module("Integration | Component | product/avatar", function (hooks) {

await setupProductIndex(this);

setFeatureFlag(this, "product_colors", true);

await render<ProductAvatarTestContext>(hbs`
<Product::Avatar @product={{this.product}} />
`);
Expand Down
11 changes: 0 additions & 11 deletions web/tests/integration/components/project/tile-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,6 @@ module("Integration | Component | project/tile", function (hooks) {
assert.dom(PRODUCT_AVATAR).exists({ count: 2 });
});

test("it renders products in text if the productColors flag is disabled", async function (this: ProjectTileComponentTestContext, assert) {
setFeatureFlag(this, "product_colors", false);

await render<ProjectTileComponentTestContext>(hbs`
<Project::Tile @project={{this.project}} />
`);

assert.dom(PRODUCT).exists({ count: 1 });
assert.dom(PRODUCT_AVATAR).doesNotExist();
});

test('if the status of a jiraIssue is "Done," the key is rendered with a line through it', async function (this: ProjectTileComponentTestContext, assert) {
await render<ProjectTileComponentTestContext>(hbs`
<Project::Tile @project={{this.project}} />
Expand Down