mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 18:23:31 +00:00
refactor hideIndividualFields to be more generic and hide favorite button
This commit is contained in:
@@ -49,16 +49,16 @@ describe("AdminConsoleCipherFormConfigService", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("buildConfig", () => {
|
describe("buildConfig", () => {
|
||||||
it("sets folder attributes", async () => {
|
it("sets individual attributes", async () => {
|
||||||
adminConsoleConfigService = TestBed.inject(AdminConsoleCipherFormConfigService);
|
adminConsoleConfigService = TestBed.inject(AdminConsoleCipherFormConfigService);
|
||||||
|
|
||||||
const { folders, hideFolderSelection } = await adminConsoleConfigService.buildConfig(
|
const { folders, hideIndividualVaultFields } = await adminConsoleConfigService.buildConfig(
|
||||||
"add",
|
"add",
|
||||||
cipherId,
|
cipherId,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(folders).toEqual([]);
|
expect(folders).toEqual([]);
|
||||||
expect(hideFolderSelection).toBe(true);
|
expect(hideIndividualVaultFields).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sets mode based on passed mode", async () => {
|
it("sets mode based on passed mode", async () => {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export class AdminConsoleCipherFormConfigService implements CipherFormConfigServ
|
|||||||
collections,
|
collections,
|
||||||
organizations: [organization], // only a single org is in context at a time
|
organizations: [organization], // only a single org is in context at a time
|
||||||
folders: [], // folders not applicable in the admin console
|
folders: [], // folders not applicable in the admin console
|
||||||
hideFolderSelection: true,
|
hideIndividualVaultFields: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ type BaseCipherFormConfig = {
|
|||||||
*/
|
*/
|
||||||
organizations?: Organization[];
|
organizations?: Organization[];
|
||||||
|
|
||||||
/** Hides the folder form field, useful in the Admin Console where folders aren't applicable */
|
/** Hides the fields that are only applicable to individuals, useful in the Admin Console where folders aren't applicable */
|
||||||
hideFolderSelection?: true;
|
hideIndividualVaultFields?: true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<bit-section-header>
|
<bit-section-header>
|
||||||
<h2 bitTypography="h6">{{ "itemDetails" | i18n }}</h2>
|
<h2 bitTypography="h6">{{ "itemDetails" | i18n }}</h2>
|
||||||
<button
|
<button
|
||||||
|
*ngIf="!config.hideIndividualVaultFields"
|
||||||
slot="end"
|
slot="end"
|
||||||
type="button"
|
type="button"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
<bit-form-field
|
<bit-form-field
|
||||||
*ngIf="showOwnership"
|
*ngIf="showOwnership"
|
||||||
[disableMargin]="!showCollectionsControl"
|
[disableMargin]="!showCollectionsControl"
|
||||||
[class.tw-col-span-2]="config.hideFolderSelection"
|
[class.tw-col-span-2]="config.hideIndividualVaultFields"
|
||||||
>
|
>
|
||||||
<bit-label>{{ "owner" | i18n }}</bit-label>
|
<bit-label>{{ "owner" | i18n }}</bit-label>
|
||||||
<bit-select formControlName="organizationId">
|
<bit-select formControlName="organizationId">
|
||||||
@@ -40,7 +41,7 @@
|
|||||||
<bit-form-field
|
<bit-form-field
|
||||||
[class.tw-col-span-2]="!showOwnership"
|
[class.tw-col-span-2]="!showOwnership"
|
||||||
[disableMargin]="!showCollectionsControl"
|
[disableMargin]="!showCollectionsControl"
|
||||||
*ngIf="!config.hideFolderSelection"
|
*ngIf="!config.hideIndividualVaultFields"
|
||||||
>
|
>
|
||||||
<bit-label>{{ "folder" | i18n }}</bit-label>
|
<bit-label>{{ "folder" | i18n }}</bit-label>
|
||||||
<bit-select formControlName="folderId">
|
<bit-select formControlName="folderId">
|
||||||
|
|||||||
Reference in New Issue
Block a user