Bug 1895963 - [P3] Implement remove specific logins. r=issammani,mtigley

Depends on D210248

Differential Revision: https://phabricator.services.mozilla.com/D210549
This commit is contained in:
Sidharth Sachdev 2024-05-15 19:34:37 +00:00
parent 7176d9fd89
commit 04c210c5c5
4 changed files with 17 additions and 13 deletions

View file

@ -185,17 +185,22 @@ export class MegalistViewModel {
async receiveCommand({ commandId, snapshotId, value } = {}) {
const dotIndex = commandId?.indexOf(".");
if (dotIndex >= 0) {
const dataSourceName = commandId.substring(0, dotIndex);
const functionName = commandId.substring(dotIndex + 1);
MegalistViewModel.#aggregator.callFunction(dataSourceName, functionName);
return;
}
const index = snapshotId
? snapshotId - this.#firstSnapshotId
: this.#selectedIndex;
const snapshot = this.#snapshots[index];
if (dotIndex >= 0) {
const dataSourceName = commandId.substring(0, dotIndex);
const functionName = commandId.substring(dotIndex + 1);
MegalistViewModel.#aggregator.callFunction(
dataSourceName,
functionName,
snapshot?.record
);
return;
}
if (snapshot) {
const commands = this.#commandsArray(snapshot);
commandId = commandId ?? commands[0]?.id;

View file

@ -60,13 +60,13 @@ export class Aggregator {
this.#sources.push(source);
}
callFunction(dataSource, functionName) {
callFunction(dataSource, functionName, ...params) {
const source = this.#sources.find(
source => source.constructor.name === dataSource
);
if (source && source[functionName]) {
source[functionName]();
source[functionName](params);
}
}

View file

@ -368,10 +368,8 @@ export class LoginDataSource extends DataSourceBase {
this.cancelDialog();
}
confirmRemoveLogin() {
// TODO: Simplify getting record directly.
const login = this.lines?.[0]?.record;
Services.logins.removeLogin(login);
confirmRemoveLogin([record]) {
Services.logins.removeLogin(record);
this.cancelDialog();
}

View file

@ -146,6 +146,7 @@
></button>
</moz-button-group>
</template>
<template id="export-logins-dialog-template">
<h2
class="dialog-title"