mirror of
https://github.com/outline/outline.git
synced 2026-11-21 21:44:30 +03:00
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { computed } from "mobx";
|
|
import { IntegrationService, IntegrationType } from "@shared/types";
|
|
import naturalSort from "@shared/utils/naturalSort";
|
|
import RootStore from "~/stores/RootStore";
|
|
import Store from "~/stores/base/Store";
|
|
import Integration from "~/models/Integration";
|
|
|
|
class IntegrationsStore extends Store<Integration> {
|
|
constructor(rootStore: RootStore) {
|
|
super(rootStore, Integration);
|
|
}
|
|
|
|
findByService(service: string) {
|
|
return this.orderedData.find(
|
|
(integration) => integration.service === service
|
|
);
|
|
}
|
|
|
|
@computed
|
|
get orderedData(): Integration[] {
|
|
return naturalSort(Array.from(this.data.values()), "name");
|
|
}
|
|
|
|
@computed
|
|
get github(): Integration<IntegrationType.Embed>[] {
|
|
return this.orderedData.filter(
|
|
(integration) => integration.service === IntegrationService.GitHub
|
|
);
|
|
}
|
|
|
|
@computed
|
|
get linear(): Integration<IntegrationType.Embed>[] {
|
|
return this.orderedData.filter(
|
|
(integration) => integration.service === IntegrationService.Linear
|
|
);
|
|
}
|
|
|
|
@computed
|
|
get gitlab(): Integration<IntegrationType.Embed>[] {
|
|
return this.orderedData.filter(
|
|
(integration) => integration.service === IntegrationService.GitLab
|
|
);
|
|
}
|
|
}
|
|
|
|
export default IntegrationsStore;
|