Files
outline/app/stores/FileOperationsStore.ts
Tom Moor f3469d25fe feat: Bulk HTML export (#4620)
* wip

* Working bulk html export

* Refactor

* test

* test
2022-12-30 09:42:20 -08:00

41 lines
1.0 KiB
TypeScript

import { orderBy } from "lodash";
import { computed } from "mobx";
import { FileOperationType } from "@shared/types";
import FileOperation from "~/models/FileOperation";
import BaseStore, { RPCAction } from "./BaseStore";
import RootStore from "./RootStore";
export default class FileOperationsStore extends BaseStore<FileOperation> {
actions = [RPCAction.List, RPCAction.Info, RPCAction.Delete];
constructor(rootStore: RootStore) {
super(rootStore, FileOperation);
}
@computed
get imports(): FileOperation[] {
return orderBy(
Array.from(this.data.values()).reduce(
(acc, fileOp) =>
fileOp.type === FileOperationType.Import ? [...acc, fileOp] : acc,
[]
),
"createdAt",
"desc"
);
}
@computed
get exports(): FileOperation[] {
return orderBy(
Array.from(this.data.values()).reduce(
(acc, fileOp) =>
fileOp.type === FileOperationType.Export ? [...acc, fileOp] : acc,
[]
),
"createdAt",
"desc"
);
}
}