mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
cad670f19c
Co-authored-by: Tom Moor <tom@getoutline.com> closes #6795
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { computed } from "mobx";
|
|
import { IntegrationService, type IntegrationType } from "@shared/types";
|
|
import naturalSort from "@shared/utils/naturalSort";
|
|
import type 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 gitlab(): Integration<IntegrationType.Embed>[] {
|
|
return this.orderedData.filter(
|
|
(integration) => integration.service === IntegrationService.GitLab
|
|
);
|
|
}
|
|
|
|
@computed
|
|
get linear(): Integration<IntegrationType.Embed>[] {
|
|
return this.orderedData.filter(
|
|
(integration) => integration.service === IntegrationService.Linear
|
|
);
|
|
}
|
|
}
|
|
|
|
export default IntegrationsStore;
|