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

[SM-660] move sm-no-items to CL #5059

Merged
merged 4 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<i class="bwi bwi-spinner bwi-spin bwi-3x"></i>
</div>

<sm-no-items *ngIf="tokens?.length == 0">
<bit-no-items *ngIf="tokens?.length == 0">
<ng-container slot="title">{{ "accessTokensNoItemsTitle" | i18n }}</ng-container>
<ng-container slot="description">{{ "accessTokensNoItemsDesc" | i18n }}</ng-container>
<button
Expand All @@ -15,7 +15,7 @@
<i class="bwi bwi-plus" aria-hidden="true"></i>
{{ "newAccessToken" | i18n }}
</button>
</sm-no-items>
</bit-no-items>

<bit-table *ngIf="tokens?.length >= 1">
<ng-container header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<i class="bwi bwi-spinner bwi-spin bwi-3x"></i>
</div>

<sm-no-items *ngIf="serviceAccounts?.length == 0">
<bit-no-items *ngIf="serviceAccounts?.length == 0">
<ng-container slot="title">{{ "serviceAccountsNoItemsTitle" | i18n }}</ng-container>
<ng-container slot="description">{{ "serviceAccountsNoItemsMessage" | i18n }}</ng-container>
<button
Expand All @@ -15,7 +15,7 @@
<i class="bwi bwi-plus" aria-hidden="true"></i>
{{ "newServiceAccount" | i18n }}
</button>
</sm-no-items>
</bit-no-items>

<bit-table *ngIf="serviceAccounts?.length >= 1" [dataSource]="dataSource">
<ng-container header>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NgModule } from "@angular/core";

import { BreadcrumbsModule } from "@bitwarden/components";
import { BreadcrumbsModule, NoItemsModule } from "@bitwarden/components";

import { SecretsManagerSharedModule } from "../shared/sm-shared.module";

Expand All @@ -19,7 +19,12 @@ import { ServiceAccountsRoutingModule } from "./service-accounts-routing.module"
import { ServiceAccountsComponent } from "./service-accounts.component";

@NgModule({
imports: [SecretsManagerSharedModule, ServiceAccountsRoutingModule, BreadcrumbsModule],
imports: [
SecretsManagerSharedModule,
ServiceAccountsRoutingModule,
BreadcrumbsModule,
NoItemsModule,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we didn't have to import this for any of the other secret modules, is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other components where it is used are declared in the shared SM module. I went ahead and just added NoItemsModule to the shared module's exports, so this is no longer needed.

],
declarations: [
AccessListComponent,
AccessTokenComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<i class="bwi bwi-spinner bwi-spin bwi-3x"></i>
</div>

<sm-no-items *ngIf="projects?.length == 0">
<bit-no-items *ngIf="projects?.length == 0">
<ng-container slot="title">{{ "projectsNoItemsTitle" | i18n }}</ng-container>
<ng-container slot="description">{{ "projectsNoItemsMessage" | i18n }}</ng-container>
<button
Expand All @@ -15,7 +15,7 @@
<i class="bwi bwi-plus" aria-hidden="true"></i>
{{ "newProject" | i18n }}
</button>
</sm-no-items>
</bit-no-items>

<bit-table *ngIf="projects?.length >= 1" [dataSource]="dataSource">
<ng-container header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
</div>

<ng-container *ngIf="secrets?.length == 0">
<sm-no-items *ngIf="trash">
<bit-no-items *ngIf="trash">
<ng-container slot="title">{{ "secretsNoItemsTitle" | i18n }}</ng-container>
<ng-container slot="description">{{ "secretsTrashNoItemsMessage" | i18n }}</ng-container>
</sm-no-items>
<sm-no-items *ngIf="!trash">
</bit-no-items>
<bit-no-items *ngIf="!trash">
<ng-container slot="title">{{ "secretsNoItemsTitle" | i18n }}</ng-container>
<ng-container slot="description">{{ "secretsNoItemsMessage" | i18n }}</ng-container>
<button
Expand All @@ -20,7 +20,7 @@
<i class="bwi bwi-plus" aria-hidden="true"></i>
{{ "newSecret" | i18n }}
</button>
</sm-no-items>
</bit-no-items>
</ng-container>

<bit-table *ngIf="secrets?.length >= 1" [dataSource]="dataSource">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NgModule } from "@angular/core";

import { MultiSelectModule } from "@bitwarden/components";
import { MultiSelectModule, NoItemsModule } from "@bitwarden/components";
import { ProductSwitcherModule } from "@bitwarden/web-vault/app/layouts/product-switcher/product-switcher.module";
import { CoreOrganizationModule } from "@bitwarden/web-vault/app/organizations/core";
import { SharedModule } from "@bitwarden/web-vault/app/shared";
Expand All @@ -10,19 +10,23 @@ import { AccessRemovalDialogComponent } from "./access-policies/dialogs/access-r
import { BulkStatusDialogComponent } from "./dialogs/bulk-status-dialog.component";
import { HeaderComponent } from "./header.component";
import { NewMenuComponent } from "./new-menu.component";
import { NoItemsComponent } from "./no-items.component";
import { ProjectsListComponent } from "./projects-list.component";
import { SecretsListComponent } from "./secrets-list.component";

@NgModule({
imports: [SharedModule, ProductSwitcherModule, MultiSelectModule, CoreOrganizationModule],
imports: [
SharedModule,
ProductSwitcherModule,
MultiSelectModule,
CoreOrganizationModule,
NoItemsModule,
],
exports: [
SharedModule,
AccessRemovalDialogComponent,
BulkStatusDialogComponent,
HeaderComponent,
NewMenuComponent,
NoItemsComponent,
ProjectsListComponent,
SecretsListComponent,
AccessSelectorComponent,
Expand All @@ -32,7 +36,6 @@ import { SecretsListComponent } from "./secrets-list.component";
BulkStatusDialogComponent,
HeaderComponent,
NewMenuComponent,
NoItemsComponent,
ProjectsListComponent,
SecretsListComponent,
AccessSelectorComponent,
Expand Down
1 change: 1 addition & 0 deletions libs/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export * from "./link";
export * from "./menu";
export * from "./multi-select";
export * from "./navigation";
export * from "./no-items";
export * from "./progress";
export * from "./radio-button";
export * from "./table";
Expand Down
2 changes: 2 additions & 0 deletions libs/components/src/no-items/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./no-items.component";
willmartian marked this conversation as resolved.
Show resolved Hide resolved
export * from "./no-items.module";
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Component } from "@angular/core";

import { Icons } from "@bitwarden/components";
import { Icons } from "..";

@Component({
selector: "sm-no-items",
selector: "bit-no-items",
templateUrl: "./no-items.component.html",
})
export class NoItemsComponent {
Expand Down
13 changes: 13 additions & 0 deletions libs/components/src/no-items/no-items.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { CommonModule } from "@angular/common";
import { NgModule } from "@angular/core";

import { IconModule } from "../icon";

import { NoItemsComponent } from "./no-items.component";

@NgModule({
imports: [CommonModule, IconModule],
exports: [NoItemsComponent],
declarations: [NoItemsComponent],
})
export class NoItemsModule {}
35 changes: 35 additions & 0 deletions libs/components/src/no-items/no-items.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Meta, moduleMetadata, Story } from "@storybook/angular";

import { ButtonModule } from "../button";

import { NoItemsModule } from "./no-items.module";

export default {
title: "Component Library/No Items",
decorators: [
moduleMetadata({
imports: [ButtonModule, NoItemsModule],
}),
],
} as Meta;

const Template: Story = (args) => ({
props: args,
template: `
<bit-no-items class="tw-text-main">
<ng-container slot="title">No items found</ng-container>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<ng-container slot="description">Your description here.</ng-container>
<button
slot="button"
type="button"
bitButton
buttonType="secondary"
>
<i class="bwi bwi-plus" aria-hidden="true"></i>
New item
</button>
</bit-no-items>
`,
});

export const Default = Template.bind({});