Migrate display page to TrackerPattern GraphQL types
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -68,8 +68,8 @@ export const categorySectionFragment = graphql`
|
|||||||
kind
|
kind
|
||||||
gcmConsentTypes
|
gcmConsentTypes
|
||||||
posthogConsent
|
posthogConsent
|
||||||
cookiePatterns(first: 100, orderBy: { field: CREATED_AT, direction: ASC })
|
trackerPatterns(first: 100, orderBy: { field: CREATED_AT, direction: ASC })
|
||||||
@connection(key: "CategorySection_cookiePatterns", filters: [])
|
@connection(key: "CategorySection_trackerPatterns", filters: [])
|
||||||
@required(action: THROW) {
|
@required(action: THROW) {
|
||||||
__id
|
__id
|
||||||
edges {
|
edges {
|
||||||
@@ -128,11 +128,11 @@ const updateCategoryMutation = graphql`
|
|||||||
|
|
||||||
const createPatternMutation = graphql`
|
const createPatternMutation = graphql`
|
||||||
mutation CategorySectionCreatePatternMutation(
|
mutation CategorySectionCreatePatternMutation(
|
||||||
$input: CreateCookiePatternInput!
|
$input: CreateTrackerPatternInput!
|
||||||
$connections: [ID!]!
|
$connections: [ID!]!
|
||||||
) {
|
) {
|
||||||
createCookiePattern(input: $input) {
|
createTrackerPattern(input: $input) {
|
||||||
cookiePatternEdge @appendEdge(connections: $connections) {
|
trackerPatternEdge @appendEdge(connections: $connections) {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
displayName
|
displayName
|
||||||
@@ -157,10 +157,10 @@ const createPatternMutation = graphql`
|
|||||||
|
|
||||||
const updatePatternMutation = graphql`
|
const updatePatternMutation = graphql`
|
||||||
mutation CategorySectionUpdatePatternMutation(
|
mutation CategorySectionUpdatePatternMutation(
|
||||||
$input: UpdateCookiePatternInput!
|
$input: UpdateTrackerPatternInput!
|
||||||
) {
|
) {
|
||||||
updateCookiePattern(input: $input) {
|
updateTrackerPattern(input: $input) {
|
||||||
cookiePattern {
|
trackerPattern {
|
||||||
id
|
id
|
||||||
displayName
|
displayName
|
||||||
maxAgeSeconds
|
maxAgeSeconds
|
||||||
@@ -182,11 +182,11 @@ const updatePatternMutation = graphql`
|
|||||||
|
|
||||||
const deletePatternMutation = graphql`
|
const deletePatternMutation = graphql`
|
||||||
mutation CategorySectionDeletePatternMutation(
|
mutation CategorySectionDeletePatternMutation(
|
||||||
$input: DeleteCookiePatternInput!
|
$input: DeleteTrackerPatternInput!
|
||||||
$connections: [ID!]!
|
$connections: [ID!]!
|
||||||
) {
|
) {
|
||||||
deleteCookiePattern(input: $input) {
|
deleteTrackerPattern(input: $input) {
|
||||||
deletedCookiePatternId @deleteEdge(connections: $connections)
|
deletedTrackerPatternId @deleteEdge(connections: $connections)
|
||||||
cookieBanner {
|
cookieBanner {
|
||||||
id
|
id
|
||||||
latestVersion {
|
latestVersion {
|
||||||
@@ -201,10 +201,10 @@ const deletePatternMutation = graphql`
|
|||||||
|
|
||||||
const movePatternMutation = graphql`
|
const movePatternMutation = graphql`
|
||||||
mutation CategorySectionMovePatternMutation(
|
mutation CategorySectionMovePatternMutation(
|
||||||
$input: MoveCookiePatternToCategoryInput!
|
$input: MoveTrackerPatternToCategoryInput!
|
||||||
) {
|
) {
|
||||||
moveCookiePatternToCategory(input: $input) {
|
moveTrackerPatternToCategory(input: $input) {
|
||||||
cookiePattern {
|
trackerPattern {
|
||||||
id
|
id
|
||||||
displayName
|
displayName
|
||||||
maxAgeSeconds
|
maxAgeSeconds
|
||||||
@@ -300,8 +300,8 @@ export function CategorySection({ categoryKey, connectionId }: CategorySectionPr
|
|||||||
const [editingCookieId, setEditingCookieId] = useState<string | null>(null);
|
const [editingCookieId, setEditingCookieId] = useState<string | null>(null);
|
||||||
const [isAddingCookie, setIsAddingCookie] = useState(false);
|
const [isAddingCookie, setIsAddingCookie] = useState(false);
|
||||||
|
|
||||||
const patternsConnectionId = category.cookiePatterns.__id;
|
const patternsConnectionId = category.trackerPatterns.__id;
|
||||||
const patterns = category.cookiePatterns.edges.map(e => e.node);
|
const patterns = category.trackerPatterns.edges.map(e => e.node);
|
||||||
const isMutating = isUpdating || isCreating || isUpdatingPattern;
|
const isMutating = isUpdating || isCreating || isUpdatingPattern;
|
||||||
|
|
||||||
const handleSaveCategory = (
|
const handleSaveCategory = (
|
||||||
@@ -401,7 +401,7 @@ export function CategorySection({ categoryKey, connectionId }: CategorySectionPr
|
|||||||
updatePattern({
|
updatePattern({
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
cookiePatternId: patternId,
|
trackerPatternId: patternId,
|
||||||
displayName: cookie.name,
|
displayName: cookie.name,
|
||||||
maxAgeSeconds: cookie.maxAgeSeconds,
|
maxAgeSeconds: cookie.maxAgeSeconds,
|
||||||
description: cookie.description,
|
description: cookie.description,
|
||||||
@@ -446,7 +446,7 @@ export function CategorySection({ categoryKey, connectionId }: CategorySectionPr
|
|||||||
updatePattern({
|
updatePattern({
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
cookiePatternId: patternId,
|
trackerPatternId: patternId,
|
||||||
excluded,
|
excluded,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -479,7 +479,7 @@ export function CategorySection({ categoryKey, connectionId }: CategorySectionPr
|
|||||||
new Promise<void>((resolve) => {
|
new Promise<void>((resolve) => {
|
||||||
deletePattern({
|
deletePattern({
|
||||||
variables: {
|
variables: {
|
||||||
input: { cookiePatternId: patternId },
|
input: { trackerPatternId: patternId },
|
||||||
connections: [patternsConnectionId],
|
connections: [patternsConnectionId],
|
||||||
},
|
},
|
||||||
onCompleted(_response, errors) {
|
onCompleted(_response, errors) {
|
||||||
@@ -593,7 +593,7 @@ export function CategorySection({ categoryKey, connectionId }: CategorySectionPr
|
|||||||
movePattern({
|
movePattern({
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
cookiePatternId: patternId,
|
trackerPatternId: patternId,
|
||||||
targetCookieCategoryId: targetCategoryId,
|
targetCookieCategoryId: targetCategoryId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -602,7 +602,7 @@ export function CategorySection({ categoryKey, connectionId }: CategorySectionPr
|
|||||||
if (sourceCategory) {
|
if (sourceCategory) {
|
||||||
const sourceConn = ConnectionHandler.getConnection(
|
const sourceConn = ConnectionHandler.getConnection(
|
||||||
sourceCategory,
|
sourceCategory,
|
||||||
"CategorySection_cookiePatterns",
|
"CategorySection_trackerPatterns",
|
||||||
);
|
);
|
||||||
if (sourceConn) {
|
if (sourceConn) {
|
||||||
ConnectionHandler.deleteNode(sourceConn, patternId);
|
ConnectionHandler.deleteNode(sourceConn, patternId);
|
||||||
@@ -613,7 +613,7 @@ export function CategorySection({ categoryKey, connectionId }: CategorySectionPr
|
|||||||
if (targetCategory) {
|
if (targetCategory) {
|
||||||
const targetConn = ConnectionHandler.getConnection(
|
const targetConn = ConnectionHandler.getConnection(
|
||||||
targetCategory,
|
targetCategory,
|
||||||
"CategorySection_cookiePatterns",
|
"CategorySection_trackerPatterns",
|
||||||
);
|
);
|
||||||
if (targetConn) {
|
if (targetConn) {
|
||||||
const patternRecord = store.get(patternId);
|
const patternRecord = store.get(patternId);
|
||||||
@@ -622,7 +622,7 @@ export function CategorySection({ categoryKey, connectionId }: CategorySectionPr
|
|||||||
store,
|
store,
|
||||||
targetConn,
|
targetConn,
|
||||||
patternRecord,
|
patternRecord,
|
||||||
"CookiePatternEdge",
|
"TrackerPatternEdge",
|
||||||
);
|
);
|
||||||
ConnectionHandler.insertEdgeAfter(targetConn, newEdge);
|
ConnectionHandler.insertEdgeAfter(targetConn, newEdge);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import type { EditCookieRowFragment$key } from "#/__generated__/core/EditCookieR
|
|||||||
import type { CookieEntry } from "./CategorySection";
|
import type { CookieEntry } from "./CategorySection";
|
||||||
|
|
||||||
export const editCookieRowFragment = graphql`
|
export const editCookieRowFragment = graphql`
|
||||||
fragment EditCookieRowFragment on CookiePattern {
|
fragment EditCookieRowFragment on TrackerPattern {
|
||||||
displayName
|
displayName
|
||||||
maxAgeSeconds
|
maxAgeSeconds
|
||||||
description
|
description
|
||||||
|
|||||||
Reference in New Issue
Block a user