2020-07-07 10:14:12 +00:00
|
|
|
import {
|
2021-07-09 08:04:33 +00:00
|
|
|
pluginBaseFragment,
|
|
|
|
pluginsDetailsFragment
|
2020-07-07 10:14:12 +00:00
|
|
|
} from "@saleor/fragments/plugins";
|
2020-05-14 09:30:32 +00:00
|
|
|
import makeQuery from "@saleor/hooks/makeQuery";
|
2019-08-21 14:30:56 +00:00
|
|
|
import gql from "graphql-tag";
|
|
|
|
|
2019-08-28 14:53:57 +00:00
|
|
|
import { Plugin, PluginVariables } from "./types/Plugin";
|
|
|
|
import { Plugins, PluginsVariables } from "./types/Plugins";
|
2019-08-21 14:30:56 +00:00
|
|
|
|
|
|
|
const pluginsList = gql`
|
2021-07-09 08:04:33 +00:00
|
|
|
${pluginBaseFragment}
|
2019-12-17 17:13:56 +00:00
|
|
|
query Plugins(
|
|
|
|
$first: Int
|
|
|
|
$after: String
|
|
|
|
$last: Int
|
|
|
|
$before: String
|
2020-01-10 16:30:42 +00:00
|
|
|
$filter: PluginFilterInput
|
2019-12-17 17:13:56 +00:00
|
|
|
$sort: PluginSortingInput
|
|
|
|
) {
|
|
|
|
plugins(
|
|
|
|
before: $before
|
|
|
|
after: $after
|
|
|
|
first: $first
|
|
|
|
last: $last
|
2020-01-10 16:30:42 +00:00
|
|
|
filter: $filter
|
2019-12-17 17:13:56 +00:00
|
|
|
sortBy: $sort
|
|
|
|
) {
|
2019-08-21 14:30:56 +00:00
|
|
|
edges {
|
|
|
|
node {
|
2021-07-09 08:04:33 +00:00
|
|
|
...PluginBaseFragment
|
2019-08-21 14:30:56 +00:00
|
|
|
}
|
|
|
|
}
|
2019-08-27 12:36:19 +00:00
|
|
|
pageInfo {
|
|
|
|
hasPreviousPage
|
|
|
|
hasNextPage
|
|
|
|
startCursor
|
|
|
|
endCursor
|
|
|
|
}
|
2019-08-21 14:30:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2019-12-17 17:13:56 +00:00
|
|
|
export const usePluginsListQuery = makeQuery<Plugins, PluginsVariables>(
|
2019-08-28 14:53:57 +00:00
|
|
|
pluginsList
|
|
|
|
);
|
2019-08-21 14:30:56 +00:00
|
|
|
|
2019-08-26 17:08:32 +00:00
|
|
|
const pluginsDetails = gql`
|
|
|
|
${pluginsDetailsFragment}
|
2019-08-28 14:53:57 +00:00
|
|
|
query Plugin($id: ID!) {
|
|
|
|
plugin(id: $id) {
|
2019-08-30 11:46:50 +00:00
|
|
|
...PluginsDetailsFragment
|
2019-08-26 17:08:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
Feature - channels per plugin (#1093)
* Update schema
* Update queries, mutations, and types
* Add render with dividers util function
* Add plugin details channels card component
* Update plugin details to use channels
* Update stories
* Update plugin configuration type across the app, fix some other types, temporarily comment some things out in plugins list so types match"
* Update schema
* Update types
* Update plugins list to show channels and global statuses, add plugin channel status, update status label component
* Add render with dividers util function
* Comment out some stuff for types to match - temporary
* Add useChannelsSearchWithLoadMore util to imitate loading more from backend for channels list with load more
* Change filters logic to be able to display multiple fields in a field section and add it to plugins view
* Add scroll option to plugin availability popup on plugin list
* Fix plugin list page story
* Temporarily comment some stuff out, fix some types
* Add filters errors WIP
* Fix filters not updating list
* Add error handling to plugins list filters and filters in general
* Rename some components according to review
* Move useChannelsSearch and useChannelsSearchWithLoadMore to hooks, change some imports accordingly
* Fix imports
* Move render collection with dividers to a component, fix usages
* Replace channels with load more and search query to base channels query
* Change render with dividers function to take in a component instead of render function
* Update tests
* Extract messages
* Remove unnecessary imports
* Fix filters - autocomplete messing items order sometimes & some fields not working
* Update plugin update mutation variables - change channelId to channel
* fix failing tests
* Add test ids
* fix failing tests
* fix failing tests
* Rename misc.tsx to ts
* Remove usage of render collection with diviers, change it to CollectionWithDividers component
* Remove unnecessary imports
* Update messages ids
* Update snapshots
Co-authored-by: Karolina Rakoczy <rakoczy.karolina@gmail.com>
2021-05-11 13:58:09 +00:00
|
|
|
|
|
|
|
export const usePluginDetails = makeQuery<Plugin, PluginVariables>(
|
2019-08-28 14:53:57 +00:00
|
|
|
pluginsDetails
|
|
|
|
);
|