mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 05:13:29 +00:00
[PM-25616] Refactor app-table-row-scrollable component to use openApplication (#16523)
This commit is contained in:
@@ -64,33 +64,33 @@
|
||||
</dirt-card>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
<div class="tw-flex tw-mt-8 tw-mb-4 tw-gap-4">
|
||||
<bit-search
|
||||
[placeholder]="'searchApps' | i18n"
|
||||
class="tw-grow"
|
||||
[formControl]="searchControl"
|
||||
></bit-search>
|
||||
<button
|
||||
type="button"
|
||||
[buttonType]="'primary'"
|
||||
bitButton
|
||||
[disabled]="!selectedUrls.size"
|
||||
[loading]="markingAsCritical"
|
||||
(click)="markAppsAsCritical()"
|
||||
>
|
||||
<i class="bwi tw-mr-2" [ngClass]="selectedUrls.size ? 'bwi-star-f' : 'bwi-star'"></i>
|
||||
{{ "markAppAsCritical" | i18n }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="tw-flex tw-mt-8 tw-mb-4 tw-gap-4">
|
||||
<bit-search
|
||||
[placeholder]="'searchApps' | i18n"
|
||||
class="tw-grow"
|
||||
[formControl]="searchControl"
|
||||
></bit-search>
|
||||
<button
|
||||
type="button"
|
||||
[buttonType]="'primary'"
|
||||
bitButton
|
||||
[disabled]="!selectedUrls.size"
|
||||
[loading]="markingAsCritical"
|
||||
(click)="markAppsAsCritical()"
|
||||
>
|
||||
<i class="bwi tw-mr-2" [ngClass]="selectedUrls.size ? 'bwi-star-f' : 'bwi-star'"></i>
|
||||
{{ "markAppAsCritical" | i18n }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<app-table-row-scrollable
|
||||
[dataSource]="dataSource"
|
||||
[showRowCheckBox]="true"
|
||||
[showRowMenuForCriticalApps]="false"
|
||||
[selectedUrls]="selectedUrls"
|
||||
[isDrawerIsOpenForThisRecord]="isDrawerOpenForTableRow"
|
||||
[checkboxChange]="onCheckboxChange"
|
||||
[showAppAtRiskMembers]="showAppAtRiskMembers"
|
||||
></app-table-row-scrollable>
|
||||
<app-table-row-scrollable
|
||||
[dataSource]="dataSource"
|
||||
[showRowCheckBox]="true"
|
||||
[showRowMenuForCriticalApps]="false"
|
||||
[selectedUrls]="selectedUrls"
|
||||
[openApplication]="drawerDetails.invokerId || ''"
|
||||
[checkboxChange]="onCheckboxChange"
|
||||
[showAppAtRiskMembers]="showAppAtRiskMembers"
|
||||
></app-table-row-scrollable>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -218,10 +218,4 @@ export class AllApplicationsComponent implements OnInit {
|
||||
this.selectedUrls.delete(applicationName);
|
||||
}
|
||||
};
|
||||
|
||||
isDrawerOpenForTableRow = (applicationName: string): boolean => {
|
||||
// Note: This function will be replaced by PR #16523 with openApplication binding
|
||||
// Using private access to BehaviorSubject value for backward compatibility
|
||||
return (this.dataService as any).drawerDetailsSubject?.value?.invokerId === applicationName;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<td
|
||||
bitCell
|
||||
*ngIf="showRowCheckBox"
|
||||
[ngClass]="{ 'tw-bg-primary-100': isDrawerIsOpenForThisRecord(row.applicationName) }"
|
||||
[ngClass]="{ 'tw-bg-primary-100': row.applicationName === openApplication }"
|
||||
appStopProp
|
||||
>
|
||||
<input
|
||||
@@ -30,14 +30,14 @@
|
||||
<td
|
||||
bitCell
|
||||
*ngIf="!showRowCheckBox"
|
||||
[ngClass]="{ 'tw-bg-primary-100': isDrawerIsOpenForThisRecord(row.applicationName) }"
|
||||
[ngClass]="{ 'tw-bg-primary-100': row.applicationName === openApplication }"
|
||||
>
|
||||
<i class="bwi bwi-star-f" *ngIf="row.isMarkedAsCritical"></i>
|
||||
</td>
|
||||
<td
|
||||
bitCell
|
||||
class="tw-cursor-pointer"
|
||||
[ngClass]="{ 'tw-bg-primary-100': isDrawerIsOpenForThisRecord(row.applicationName) }"
|
||||
[ngClass]="{ 'tw-bg-primary-100': row.applicationName === openApplication }"
|
||||
(click)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.enter)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.space)="showAppAtRiskMembers(row.applicationName)"
|
||||
@@ -49,18 +49,20 @@
|
||||
</td>
|
||||
<td
|
||||
class="tw-cursor-pointer"
|
||||
[ngClass]="{ 'tw-bg-primary-100': row.applicationName === openApplication }"
|
||||
(click)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.enter)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.space)="showAppAtRiskMembers(row.applicationName)"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
[attr.aria-label]="'viewItem' | i18n"
|
||||
[ngClass]="{ 'tw-bg-primary-100': isDrawerIsOpenForThisRecord(row.applicationName) }"
|
||||
bitCell
|
||||
>
|
||||
<button type="button" tabindex="0" (click)="showAppAtRiskMembers(row.applicationName)">
|
||||
<span>{{ row.applicationName }}</span>
|
||||
</button>
|
||||
<span>{{ row.applicationName }}</span>
|
||||
</td>
|
||||
<td
|
||||
bitCell
|
||||
class="tw-cursor-pointer"
|
||||
[ngClass]="{ 'tw-bg-primary-100': isDrawerIsOpenForThisRecord(row.applicationName) }"
|
||||
[ngClass]="{ 'tw-bg-primary-100': row.applicationName === openApplication }"
|
||||
(click)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.enter)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.space)="showAppAtRiskMembers(row.applicationName)"
|
||||
@@ -75,7 +77,7 @@
|
||||
<td
|
||||
bitCell
|
||||
class="tw-cursor-pointer"
|
||||
[ngClass]="{ 'tw-bg-primary-100': isDrawerIsOpenForThisRecord(row.applicationName) }"
|
||||
[ngClass]="{ 'tw-bg-primary-100': row.applicationName === openApplication }"
|
||||
(click)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.enter)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.space)="showAppAtRiskMembers(row.applicationName)"
|
||||
@@ -90,7 +92,7 @@
|
||||
<td
|
||||
bitCell
|
||||
class="tw-cursor-pointer"
|
||||
[ngClass]="{ 'tw-bg-primary-100': isDrawerIsOpenForThisRecord(row.applicationName) }"
|
||||
[ngClass]="{ 'tw-bg-primary-100': row.applicationName === openApplication }"
|
||||
(click)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.enter)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.space)="showAppAtRiskMembers(row.applicationName)"
|
||||
@@ -106,7 +108,7 @@
|
||||
bitCell
|
||||
data-testid="total-membership"
|
||||
class="tw-cursor-pointer"
|
||||
[ngClass]="{ 'tw-bg-primary-100': isDrawerIsOpenForThisRecord(row.applicationName) }"
|
||||
[ngClass]="{ 'tw-bg-primary-100': row.applicationName === openApplication }"
|
||||
(click)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.enter)="showAppAtRiskMembers(row.applicationName)"
|
||||
(keydown.space)="showAppAtRiskMembers(row.applicationName)"
|
||||
@@ -119,7 +121,7 @@
|
||||
<td
|
||||
bitCell
|
||||
*ngIf="showRowMenuForCriticalApps"
|
||||
[ngClass]="{ 'tw-bg-primary-100': isDrawerIsOpenForThisRecord(row.applicationName) }"
|
||||
[ngClass]="{ 'tw-bg-primary-100': row.applicationName === openApplication }"
|
||||
appStopProp
|
||||
>
|
||||
<button
|
||||
|
||||
@@ -18,7 +18,7 @@ export class AppTableRowScrollableComponent {
|
||||
@Input() showRowMenuForCriticalApps: boolean = false;
|
||||
@Input() showRowCheckBox: boolean = false;
|
||||
@Input() selectedUrls: Set<string> = new Set<string>();
|
||||
@Input() isDrawerIsOpenForThisRecord!: (applicationName: string) => boolean;
|
||||
@Input() openApplication: string = "";
|
||||
@Input() showAppAtRiskMembers!: (applicationName: string) => void;
|
||||
@Input() unmarkAsCritical!: (applicationName: string) => void;
|
||||
@Input() checkboxChange!: (applicationName: string, $event: Event) => void;
|
||||
|
||||
@@ -82,21 +82,21 @@
|
||||
</dirt-card>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
<div class="tw-flex tw-mt-8 tw-mb-4 tw-gap-4">
|
||||
<bit-search
|
||||
[placeholder]="'searchApps' | i18n"
|
||||
class="tw-grow"
|
||||
[formControl]="searchControl"
|
||||
></bit-search>
|
||||
</div>
|
||||
<div class="tw-flex tw-mt-8 tw-mb-4 tw-gap-4">
|
||||
<bit-search
|
||||
[placeholder]="'searchApps' | i18n"
|
||||
class="tw-grow"
|
||||
[formControl]="searchControl"
|
||||
></bit-search>
|
||||
</div>
|
||||
|
||||
<app-table-row-scrollable
|
||||
[dataSource]="dataSource"
|
||||
[showRowCheckBox]="false"
|
||||
[showRowMenuForCriticalApps]="true"
|
||||
[isDrawerIsOpenForThisRecord]="isDrawerOpenForTableRow"
|
||||
[showAppAtRiskMembers]="showAppAtRiskMembers"
|
||||
[unmarkAsCritical]="unmarkAsCritical"
|
||||
></app-table-row-scrollable>
|
||||
<app-table-row-scrollable
|
||||
[dataSource]="dataSource"
|
||||
[showRowCheckBox]="false"
|
||||
[showRowMenuForCriticalApps]="true"
|
||||
[openApplication]="drawerDetails.invokerId || ''"
|
||||
[showAppAtRiskMembers]="showAppAtRiskMembers"
|
||||
[unmarkAsCritical]="unmarkAsCritical"
|
||||
></app-table-row-scrollable>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -201,10 +201,4 @@ export class CriticalApplicationsComponent implements OnInit {
|
||||
const data = this.reportService.generateAtRiskApplicationList(this.dataSource.data);
|
||||
this.dataService.setDrawerForOrgAtRiskApps(data, invokerId);
|
||||
};
|
||||
|
||||
isDrawerOpenForTableRow = (applicationName: string) => {
|
||||
// Note: This function will be replaced by PR #16523 with openApplication binding
|
||||
// Using private access to BehaviorSubject value for backward compatibility
|
||||
return (this.dataService as any).drawerDetailsSubject?.value?.invokerId === applicationName;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user