Skip to content

Commit

Permalink
Merge pull request #552 from Gencaster/537-link-to-listening-from-the…
Browse files Browse the repository at this point in the history
…-editor

added menu buttons for play menu
  • Loading branch information
capital-G authored Sep 8, 2023
2 parents 5a56a03 + e34ca7b commit 326527d
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 2 deletions.
1 change: 1 addition & 0 deletions caster-back/operations.gql
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ mutation deleteScriptCell($scriptCellUuid:UUID!) {
subscription graph($uuid: UUID!) {
graph(graphUuid: $uuid) {
name
slugName
uuid
edges {
uuid
Expand Down
4 changes: 4 additions & 0 deletions caster-editor/Dockerfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ ARG SENTRY_DSN_CASTER_EDITOR
ENV VITE_BACKEND_URL=${BACKEND_URL}
ENV VITE_SENTRY_DSN_CASTER_EDITOR=${SENTRY_DSN_CASTER_EDITOR}

ENV VITE_GENCASTER_FRONT_URL=${GENCASTER_FRONT_URL}
ENV VITE_GENCASTER_EDITOR_URL=${GENCASTER_EDITOR_URL}
ENV VITE_GENCASTER_BACKEND_URL=${GENCASTER_BACKEND_URL}

ADD . .

RUN npm run build
Expand Down
8 changes: 8 additions & 0 deletions caster-editor/src/assets/scss/_elementplus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,22 @@
margin: 0;
color: #{$black};
background-color: transparent;

border: none;
border-left: none !important;
box-shadow: none !important;

&:hover {
color: #{$black};
background-color: $grey;
}
}

&.is-active {
.el-radio-button__inner {
background-color: $grey;
}
}
}
}

Expand Down
10 changes: 8 additions & 2 deletions caster-editor/src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
>
<MenuTabEdit :graph="graph" />
</div>
<div v-if="tab === Tab.Play" />
<div
v-if="tab === Tab.Play"
class="left"
>
<MenuTabPlay :graph="graph" />
</div>
</div>
</div>
<div class="menu-spacer" />
Expand All @@ -50,9 +55,10 @@ import { ref, type Ref } from "vue";
import { Tab, useInterfaceStore } from "@/stores/InterfaceStore";
import MenuTab from "./MenuTabHeader.vue";
import MenuTabEdit from "./MenuTabEdit.vue";
import MenuTabPlay from "./MenuTabPlay.vue";
import DialogExitGraph from "./DialogExitGraph.vue";
export type GraphMenu = Pick<Graph, "name" | "uuid">;
export type GraphMenu = Pick<Graph, "name" | "uuid" | "slugName">;
// Props
defineProps<{
Expand Down
54 changes: 54 additions & 0 deletions caster-editor/src/components/MenuTabPlay.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<template>
<div>
<button
class="unstyled"
@click="directLink()"
>
Public
</button>
<button
class="unstyled"
@click="debug()"
>
Debug
</button>
</div>
</template>

<script setup lang="ts">
import type { Graph } from "@/graphql";
import { ElMessage } from "element-plus";
const props = defineProps<{
graph: Pick<Graph, "uuid" | "slugName">;
}>();
const gencasterFrontUrl = (): string | undefined => {
// see https://github.com/Gencaster/gencaster/pull/552/files#r1315599653
let url: string | undefined = undefined;
if (window.location.hostname === "127.0.0.1") {
url = "http://127.0.0.1:3000";
} else if (import.meta.env.GENCASTER_FRONT_URL) {
url = import.meta.env.GENCASTER_FRONT_URL;
}
return url;
};
const directLink = () => {
const frontUrl = gencasterFrontUrl();
if (frontUrl) {
window.open(`${frontUrl}/listen/${props.graph.slugName}`, "_blank");
} else {
ElMessage.error(`Could not find the URL for the Gencaster frontend`);
}
};
const debug = () => {
const frontUrl = gencasterFrontUrl();
if (frontUrl) {
window.open(`${frontUrl}/debug`, "_blank");
} else {
ElMessage.error(`Could not find the URL for the Gencaster frontend`);
}
};
</script>
2 changes: 2 additions & 0 deletions caster-editor/src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ export type GraphSubscriptionVariables = Exact<{
export type GraphSubscription = {
graph: {
name: string;
slugName: string;
uuid: any;
edges: Array<{ uuid: any; outNode: { uuid: any }; inNode: { uuid: any } }>;
nodes: Array<{
Expand Down Expand Up @@ -1508,6 +1509,7 @@ export const GraphDocument = gql`
subscription graph($uuid: UUID!) {
graph(graphUuid: $uuid) {
name
slugName
uuid
edges {
uuid
Expand Down
4 changes: 4 additions & 0 deletions caster-front/Dockerfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ ENV VITE_BACKEND_URL=${BACKEND_URL}
ENV VITE_JANUS_URL=${JANUS_URL}
ENV VITE_SENTRY_DSN_CASTER_FRONT=${SENTRY_DSN_CASTER_FRONT}

ENV VITE_GENCASTER_FRONT_URL=${GENCASTER_FRONT_URL}
ENV VITE_GENCASTER_EDITOR_URL=${GENCASTER_EDITOR_URL}
ENV VITE_GENCASTER_BACKEND_URL=${GENCASTER_BACKEND_URL}

RUN npm run build

FROM nginx:1.23-alpine
Expand Down
2 changes: 2 additions & 0 deletions caster-front/src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ export type GraphSubscriptionVariables = Exact<{
export type GraphSubscription = {
graph: {
name: string;
slugName: string;
uuid: any;
edges: Array<{ uuid: any; outNode: { uuid: any }; inNode: { uuid: any } }>;
nodes: Array<{
Expand Down Expand Up @@ -1508,6 +1509,7 @@ export const GraphDocument = gql`
subscription graph($uuid: UUID!) {
graph(graphUuid: $uuid) {
name
slugName
uuid
edges {
uuid
Expand Down
4 changes: 4 additions & 0 deletions vars.deploy.dev.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ JANUS_PUBLIC_IP=195.201.163.94

SUPERCOLLIDER_USE_INPUT=1
SUPERCOLLIDER_NUM_STREAMS=15

GENCASTER_FRONT_URL=https://dev.gencaster.org
GENCASTER_EDITOR_URL=https://editor.dev.gencaster.org
GENCASTER_BACKEND_URL=https://backend.dev.gencaster.org
4 changes: 4 additions & 0 deletions vars.env
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ SUPERCOLLIDER_NUM_STREAMS=2

JANUS_PUBLIC_IP=127.0.0.1
BACKEND_URL=http://127.0.0.1:8081

GENCASTER_FRONT_URL=http://127.0.0.1:3000
GENCASTER_EDITOR_URL=http://127.0.0.1:3001
GENCASTER_BACKEND_URL=http://127.0.0.1:8081

0 comments on commit 326527d

Please sign in to comment.