mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-10 09:59:48 +01:00
[SM-645] Use search component in secrets manager (#4991)
* Move search component into the component library * Migrate search fields * Reshuffle imports slightly * Remove export input module --------- Co-authored-by: cd-bitwarden <106776772+cd-bitwarden@users.noreply.github.com>
This commit is contained in:
parent
192bb5a7b3
commit
68b62e73f1
@ -29,12 +29,11 @@
|
|||||||
</bit-toggle>
|
</bit-toggle>
|
||||||
</bit-toggle-group>
|
</bit-toggle-group>
|
||||||
|
|
||||||
<app-search-input
|
<bit-search
|
||||||
class="tw-grow"
|
class="tw-grow"
|
||||||
[(ngModel)]="searchText"
|
[(ngModel)]="searchText"
|
||||||
[placeholder]="'searchMembers' | i18n"
|
[placeholder]="'searchMembers' | i18n"
|
||||||
>
|
></bit-search>
|
||||||
</app-search-input>
|
|
||||||
|
|
||||||
<button type="button" bitButton buttonType="primary" (click)="invite()">
|
<button type="button" bitButton buttonType="primary" (click)="invite()">
|
||||||
<i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i>
|
<i class="bwi bwi-plus bwi-fw" aria-hidden="true"></i>
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
||||||
import { Meta, moduleMetadata, Story } from "@storybook/angular";
|
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
|
||||||
import { InputModule } from "@bitwarden/components/src/input/input.module";
|
|
||||||
|
|
||||||
import { PreloadedEnglishI18nModule } from "../../../../../tests/preloaded-english-i18n.module";
|
|
||||||
|
|
||||||
import { SearchInputComponent } from "./search-input.component";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: "Web/Organizations/Search Input",
|
|
||||||
component: SearchInputComponent,
|
|
||||||
decorators: [
|
|
||||||
moduleMetadata({
|
|
||||||
imports: [
|
|
||||||
InputModule,
|
|
||||||
FormsModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
PreloadedEnglishI18nModule,
|
|
||||||
JslibModule,
|
|
||||||
],
|
|
||||||
providers: [],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
} as Meta;
|
|
||||||
|
|
||||||
const Template: Story<SearchInputComponent> = (args: SearchInputComponent) => ({
|
|
||||||
props: args,
|
|
||||||
template: `
|
|
||||||
<app-search-input [(ngModel)]="searchText" [placeholder]="placeholder" [disabled]="disabled"></app-search-input>
|
|
||||||
`,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const Default = Template.bind({});
|
|
||||||
Default.args = {};
|
|
@ -1,14 +1,15 @@
|
|||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from "@angular/core";
|
||||||
|
|
||||||
|
import { SearchModule } from "@bitwarden/components";
|
||||||
|
|
||||||
import { SharedModule } from "../../../shared/shared.module";
|
import { SharedModule } from "../../../shared/shared.module";
|
||||||
|
|
||||||
import { AccessSelectorModule } from "./components/access-selector/access-selector.module";
|
import { AccessSelectorModule } from "./components/access-selector/access-selector.module";
|
||||||
import { CollectionDialogModule } from "./components/collection-dialog";
|
import { CollectionDialogModule } from "./components/collection-dialog";
|
||||||
import { SearchInputComponent } from "./components/search-input/search-input.component";
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [SharedModule, CollectionDialogModule, AccessSelectorModule],
|
imports: [SharedModule, CollectionDialogModule, AccessSelectorModule, SearchModule],
|
||||||
declarations: [SearchInputComponent],
|
declarations: [],
|
||||||
exports: [SharedModule, CollectionDialogModule, AccessSelectorModule, SearchInputComponent],
|
exports: [SharedModule, CollectionDialogModule, AccessSelectorModule, SearchModule],
|
||||||
})
|
})
|
||||||
export class SharedOrganizationModule {}
|
export class SharedOrganizationModule {}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<sm-header>
|
<sm-header>
|
||||||
<input bitInput [placeholder]="'searchProjects' | i18n" [(ngModel)]="search" class="tw-w-80" />
|
<bit-search
|
||||||
|
[placeholder]="'searchProjects' | i18n"
|
||||||
|
[(ngModel)]="search"
|
||||||
|
class="tw-w-80"
|
||||||
|
></bit-search>
|
||||||
<sm-new-menu></sm-new-menu>
|
<sm-new-menu></sm-new-menu>
|
||||||
</sm-header>
|
</sm-header>
|
||||||
<sm-projects-list
|
<sm-projects-list
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<sm-header>
|
<sm-header>
|
||||||
<input bitInput [placeholder]="'searchSecrets' | i18n" [(ngModel)]="search" class="tw-w-80" />
|
<bit-search
|
||||||
|
[placeholder]="'searchSecrets' | i18n"
|
||||||
|
[(ngModel)]="search"
|
||||||
|
class="tw-w-80"
|
||||||
|
></bit-search>
|
||||||
<sm-new-menu></sm-new-menu>
|
<sm-new-menu></sm-new-menu>
|
||||||
</sm-header>
|
</sm-header>
|
||||||
<sm-secrets-list
|
<sm-secrets-list
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
<sm-header>
|
<sm-header>
|
||||||
<input
|
<bit-search
|
||||||
bitInput
|
|
||||||
[placeholder]="'searchServiceAccounts' | i18n"
|
[placeholder]="'searchServiceAccounts' | i18n"
|
||||||
[(ngModel)]="search"
|
[(ngModel)]="search"
|
||||||
class="tw-w-80"
|
class="tw-w-80"
|
||||||
/>
|
></bit-search>
|
||||||
<sm-new-menu></sm-new-menu>
|
<sm-new-menu></sm-new-menu>
|
||||||
</sm-header>
|
</sm-header>
|
||||||
<sm-service-accounts-list
|
<sm-service-accounts-list
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from "@angular/core";
|
||||||
|
|
||||||
import { MultiSelectModule, NoItemsModule } from "@bitwarden/components";
|
import { MultiSelectModule, SearchModule, NoItemsModule } from "@bitwarden/components";
|
||||||
import { CoreOrganizationModule } from "@bitwarden/web-vault/app/admin-console/organizations/core";
|
import { CoreOrganizationModule } from "@bitwarden/web-vault/app/admin-console/organizations/core";
|
||||||
import { ProductSwitcherModule } from "@bitwarden/web-vault/app/layouts/product-switcher/product-switcher.module";
|
import { ProductSwitcherModule } from "@bitwarden/web-vault/app/layouts/product-switcher/product-switcher.module";
|
||||||
import { SharedModule } from "@bitwarden/web-vault/app/shared";
|
import { SharedModule } from "@bitwarden/web-vault/app/shared";
|
||||||
@ -20,17 +20,20 @@ import { SecretsListComponent } from "./secrets-list.component";
|
|||||||
MultiSelectModule,
|
MultiSelectModule,
|
||||||
CoreOrganizationModule,
|
CoreOrganizationModule,
|
||||||
NoItemsModule,
|
NoItemsModule,
|
||||||
|
SearchModule,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
SharedModule,
|
SharedModule,
|
||||||
NoItemsModule,
|
NoItemsModule,
|
||||||
AccessRemovalDialogComponent,
|
AccessRemovalDialogComponent,
|
||||||
|
AccessSelectorComponent,
|
||||||
BulkStatusDialogComponent,
|
BulkStatusDialogComponent,
|
||||||
HeaderComponent,
|
HeaderComponent,
|
||||||
NewMenuComponent,
|
NewMenuComponent,
|
||||||
ProjectsListComponent,
|
ProjectsListComponent,
|
||||||
|
SearchModule,
|
||||||
SecretsListComponent,
|
SecretsListComponent,
|
||||||
AccessSelectorComponent,
|
SharedModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AccessRemovalDialogComponent,
|
AccessRemovalDialogComponent,
|
||||||
|
@ -19,9 +19,10 @@ export * from "./navigation";
|
|||||||
export * from "./no-items";
|
export * from "./no-items";
|
||||||
export * from "./progress";
|
export * from "./progress";
|
||||||
export * from "./radio-button";
|
export * from "./radio-button";
|
||||||
|
export * from "./search";
|
||||||
|
export * from "./select";
|
||||||
export * from "./table";
|
export * from "./table";
|
||||||
export * from "./tabs";
|
export * from "./tabs";
|
||||||
export * from "./toggle-group";
|
export * from "./toggle-group";
|
||||||
export * from "./select";
|
|
||||||
export * from "./typography";
|
export * from "./typography";
|
||||||
export * from "./utils/i18n-mock.service";
|
export * from "./utils/i18n-mock.service";
|
||||||
|
1
libs/components/src/search/index.ts
Normal file
1
libs/components/src/search/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./search.module";
|
@ -4,17 +4,17 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
|
|||||||
let nextId = 0;
|
let nextId = 0;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-search-input",
|
selector: "bit-search",
|
||||||
templateUrl: "./search-input.component.html",
|
templateUrl: "./search.component.html",
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: NG_VALUE_ACCESSOR,
|
provide: NG_VALUE_ACCESSOR,
|
||||||
multi: true,
|
multi: true,
|
||||||
useExisting: SearchInputComponent,
|
useExisting: SearchComponent,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class SearchInputComponent implements ControlValueAccessor {
|
export class SearchComponent implements ControlValueAccessor {
|
||||||
private notifyOnChange: (v: string) => void;
|
private notifyOnChange: (v: string) => void;
|
||||||
private notifyOnTouch: () => void;
|
private notifyOnTouch: () => void;
|
||||||
|
|
14
libs/components/src/search/search.module.ts
Normal file
14
libs/components/src/search/search.module.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { NgModule } from "@angular/core";
|
||||||
|
import { FormsModule } from "@angular/forms";
|
||||||
|
|
||||||
|
import { InputModule } from "../input/input.module";
|
||||||
|
import { SharedModule } from "../shared";
|
||||||
|
|
||||||
|
import { SearchComponent } from "./search.component";
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [SharedModule, InputModule, FormsModule],
|
||||||
|
declarations: [SearchComponent],
|
||||||
|
exports: [SearchComponent],
|
||||||
|
})
|
||||||
|
export class SearchModule {}
|
40
libs/components/src/search/search.stories.ts
Normal file
40
libs/components/src/search/search.stories.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
||||||
|
import { Meta, moduleMetadata, Story } from "@storybook/angular";
|
||||||
|
|
||||||
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
|
|
||||||
|
import { InputModule } from "../input/input.module";
|
||||||
|
import { I18nMockService } from "../utils/i18n-mock.service";
|
||||||
|
|
||||||
|
import { SearchComponent } from "./search.component";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: "Component Library/Form/Search",
|
||||||
|
component: SearchComponent,
|
||||||
|
decorators: [
|
||||||
|
moduleMetadata({
|
||||||
|
imports: [InputModule, FormsModule, ReactiveFormsModule, JslibModule],
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: I18nService,
|
||||||
|
useFactory: () => {
|
||||||
|
return new I18nMockService({
|
||||||
|
search: "Search",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
} as Meta;
|
||||||
|
|
||||||
|
const Template: Story<SearchComponent> = (args: SearchComponent) => ({
|
||||||
|
props: args,
|
||||||
|
template: `
|
||||||
|
<bit-search [(ngModel)]="searchText" [placeholder]="placeholder" [disabled]="disabled"></bit-search>
|
||||||
|
`,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const Default = Template.bind({});
|
||||||
|
Default.args = {};
|
Loading…
Reference in New Issue
Block a user