diff --git a/assets/components/entities/entity.vue b/assets/components/entities/entity.vue
index c23d1fc8..a52da49c 100644
--- a/assets/components/entities/entity.vue
+++ b/assets/components/entities/entity.vue
@@ -51,7 +51,7 @@
>{{ tag.name }}
- {{ entity.parent.name }}
-
+
-
-
+
+
+
-
+
-
+
+
+
-
+ class="name"
+ >{{ entity.name }}
+
{{ entity.name }}
+ class="count"
+ >
+ {{ entity.sceneTotal }} scenes
+ {{ entity.childrenTotal }} channels
+
@@ -59,15 +68,27 @@ export default {
height: 100%;
background: var(--tile);
display: flex;
+ flex-direction: column;
flex-shrink: 0;
justify-content: center;
align-items: center;
box-sizing: border-box;
- padding: .5rem 1rem;
border-radius: .25rem;
+ position: relative;
box-shadow: 0 0 3px rgba(0, 0, 0, .25);
text-align: center;
text-decoration: none;
+
+ &:hover .count {
+ color: var(--lighten);
+ }
+}
+
+.tile-logo {
+ display: flex;
+ flex-grow: 1;
+ padding: .5rem 1rem;
+ overflow: hidden;
}
.logo {
@@ -75,6 +96,7 @@ export default {
max-height: 100%;
display: flex;
align-items: center;
+ align-self: center;
}
.name {
@@ -82,4 +104,16 @@ export default {
font-size: 1.25rem;
font-weight: bold;
}
+
+.count {
+ display: flex;
+ justify-content: space-between;
+ width: 100%;
+ box-sizing: border-box;
+ padding: .25rem .5rem;
+ border-top: solid 1px var(--lighten-hint);
+ color: var(--lighten-weak);
+ text-align: center;
+ font-size: .8rem;
+}
diff --git a/assets/components/filters/filter-bar.vue b/assets/components/filters/filter-bar.vue
index 75bf103b..944862d1 100644
--- a/assets/components/filters/filter-bar.vue
+++ b/assets/components/filters/filter-bar.vue
@@ -1,15 +1,20 @@
- {{ section }}
+ >{{ section }}
+
{{ itemsTotal }} scenescenes
+
@@ -351,4 +364,11 @@ export default {
margin: 0 1rem 0 0;
}
}
+
+.total {
+ flex-shrink: 0;
+ padding: 0 1rem;
+ color: var(--shadow);
+ font-size: .8rem;
+}
diff --git a/assets/components/home/home.vue b/assets/components/home/home.vue
index c365f2ce..c4d34f57 100644
--- a/assets/components/home/home.vue
+++ b/assets/components/home/home.vue
@@ -8,6 +8,7 @@
:items-total="totalCount"
:items-per-page="limit"
:content="$refs.content"
+ :show-total="false"
/>
- {{ actor.name }}
+ >{{ actor.name }}
- {{ release.shootId }}
+ >{{ release.shootId }}
- {{ tag.name }}
+ >{{ tag.name }}
diff --git a/assets/js/curate.js b/assets/js/curate.js
index d5b93630..85e4cdde 100644
--- a/assets/js/curate.js
+++ b/assets/js/curate.js
@@ -117,6 +117,10 @@ function curateEntity(entity, parent, releases) {
if (entity.parent || parent) curatedEntity.parent = curateEntity(entity.parent || parent);
if (releases) curatedEntity.releases = releases.map(release => curateRelease(release));
+ if (entity.connection) {
+ curatedEntity.sceneTotal = entity.connection.totalCount;
+ }
+
return curatedEntity;
}
diff --git a/assets/js/entities/actions.js b/assets/js/entities/actions.js
index 391ae3e2..e74a2d47 100644
--- a/assets/js/entities/actions.js
+++ b/assets/js/entities/actions.js
@@ -14,7 +14,7 @@ function initEntitiesActions(store, router) {
}) {
const { before, after, orderBy } = getDateRange(range);
- const { entity, connection: { releases, totalCount } } = await graphql(`
+ const { entity } = await graphql(`
query Entity(
$entitySlug: String!
$entityType: String! = "channel"
@@ -64,6 +64,12 @@ function initEntitiesActions(store, router) {
independent
hasLogo
${campaignsFragment}
+ children: childEntitiesConnection {
+ totalCount
+ }
+ connection: scenesConnection {
+ totalCount
+ }
}
}
${campaignsFragment}
@@ -77,82 +83,45 @@ function initEntitiesActions(store, router) {
hasLogo
${campaignsFragment}
}
- }
- connection: releasesConnection(
- first: $limit
- offset: $offset
- orderBy: $orderBy
- filter: {
- and: [
- {
- entity: {
- or: [
- {
- slug: { equalTo: $entitySlug }
- },
- {
- parent: {
- slug: { equalTo: $entitySlug }
- type: { equalTo: $entityType }
- }
- },
- {
- parent: {
- parent: {
- slug: { equalTo: $entitySlug }
- type: { equalTo: $entityType }
- }
- }
- }
- {
- parent: {
- parent: {
- parent: {
- slug: { equalTo: $entitySlug }
- type: { equalTo: $entityType }
- }
- },
- },
- },
- ]
- }
- }
- {
- or: [
- {
- date: {
- lessThan: $before,
- greaterThan: $after
- }
- },
- {
- date: {
- isNull: true
- },
- createdAt: {
- lessThan: $beforeTime,
- greaterThan: $afterTime,
- }
+ connection: scenesConnection(
+ first: $limit
+ offset: $offset
+ orderBy: $orderBy
+ filter: {
+ or: [
+ {
+ date: {
+ lessThan: $before,
+ greaterThan: $after
}
- ]
- }
- ]
- releasesTagsConnection: {
- none: {
- tag: {
- slug: {
- in: $exclude
+ },
+ {
+ date: {
+ isNull: true
+ },
+ createdAt: {
+ lessThan: $beforeTime,
+ greaterThan: $afterTime,
+ }
+ }
+ ]
+ releasesTagsConnection: {
+ none: {
+ tag: {
+ slug: {
+ in: $exclude
+ }
}
}
}
}
+ ) {
+ releases: nodes {
+ ${releaseFields}
+ }
+ totalCount
}
- ) {
- releases: nodes {
- ${releaseFields}
- }
- totalCount
- }
+ }
}
`, {
entitySlug,
@@ -175,8 +144,8 @@ function initEntitiesActions(store, router) {
}
return {
- entity: curateEntity(entity, null, releases),
- totalCount,
+ entity: curateEntity(entity, null, entity.connection.releases),
+ totalCount: entity.connection.totalCount,
};
}
@@ -233,6 +202,9 @@ function initEntitiesActions(store, router) {
children: childEntitiesConnection {
totalCount
}
+ connection: scenesConnection {
+ totalCount
+ }
}
}
`, {
diff --git a/migrations/20211030162955_entity_scenes.js b/migrations/20211030162955_entity_scenes.js
new file mode 100644
index 00000000..24a82252
--- /dev/null
+++ b/migrations/20211030162955_entity_scenes.js
@@ -0,0 +1,24 @@
+exports.up = async knex => knex.raw(`
+ CREATE FUNCTION entities_scenes(entity entities) RETURNS SETOF releases AS $$
+ WITH RECURSIVE children AS (
+ SELECT entities.id
+ FROM entities
+ WHERE entities.id = entity.id
+
+ UNION ALL
+
+ SELECT entities.id
+ FROM entities
+ INNER JOIN children ON children.id = entities.parent_id
+ )
+
+ SELECT releases FROM releases
+ INNER JOIN children ON children.id = releases.entity_id;
+ $$ LANGUAGE SQL STABLE;
+
+ COMMENT ON FUNCTION entities_scenes IS E'@sortable';
+`);
+
+exports.down = async knex => knex.raw(`
+ DROP FUNCTION IF EXISTS entities_scenes;
+`);