diff --git a/README.md b/README.md index 84f28f9d..c679f53d 100644 --- a/README.md +++ b/README.md @@ -48,5 +48,4 @@ We truly ❤️ pull requests! If you wish to help, you can learn more about how Join our community on [Forum/Chat](https://people.sphinx.chat) to connect with other users and get support. -Feel free to explore the potential of **sphinx-tribes** and contribute to its vibrant ecosystem! 🌟 - +Feel free to explore the potential of **sphinx-tribes** and contribute to its vibrant ecosystem! 🌟 \ No newline at end of file diff --git a/deploy/staging/docker-compose.yml b/deploy/staging/docker-compose.yml new file mode 100644 index 00000000..11b89b9d --- /dev/null +++ b/deploy/staging/docker-compose.yml @@ -0,0 +1,126 @@ +version: "2" + +services: + reverse-proxy: + # The official v2 Traefik docker image + image: traefik:v2.2.1 + # Enables the web UI and tells Traefik to listen to docker + # command: --configFile=/home/ec2-user/sphinx-deploy/traefik.yaml + ports: + # The HTTP port + - 80:80 + # The Web UI (enabled by --api.insecure=true) + - 8080:8080 + # entrypoints + - 443:443 + - 8883:8883 + volumes: + # So that Traefik can listen to the Docker events + - /var/run/docker.sock:/var/run/docker.sock + - /home/ec2-user/sphinx-deploy/traefik.yaml:/etc/traefik/traefik.yaml + - /home/ec2-user/letsencrypt:/letsencrypt + environment: + - AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID + - AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY + - AWS_REGION=$AWS_REGION + logging: + options: + max-size: 10m + ulimits: + nproc: 65535 + nofile: + soft: 1000000 + hard: 1000000 + + auth: + image: sphinx-auth + depends_on: + - reverse-proxy + labels: + - "traefik.enable=true" + - "traefik.http.routers.auth.rule=Host(`auth-test.sphinx.chat`)" + - "traefik.http.services.auth.loadbalancer.server.port=9090" + - "traefik.http.routers.auth.tls=true" + - "traefik.http.routers.auth.tls.certresolver=myresolver" + - "traefik.http.routers.auth.entrypoints=websecure" + restart: on-failure + environment: + - JWT_KEY=$JWT_KEY + - CLIENT_KEYS=$CLIENT_KEYS + - OAUTH_TIMEOUT=$OAUTH_TIMEOUT + - HOST=auth-test.sphinx.chat + + tribes: + image: sphinx-tribes + depends_on: + - auth + - reverse-proxy + labels: + - "traefik.enable=true" + - "traefik.http.routers.tribes.rule=Host(`api.tribes-test.sphinx.chat`) || Host(`api.people-test.sphinx.chat`) || Host(`api.community-test.sphinx.chat`)" + - "traefik.http.services.tribes.loadbalancer.server.port=5002" + - "traefik.http.routers.tribes.tls=true" + - "traefik.http.routers.tribes.tls.certresolver=myresolver" + - "traefik.http.routers.tribes.entrypoints=websecure" + restart: on-failure + environment: + - DATABASE_URL=$DATABASE_URL + - PODCAST_INDEX_SECRET=$PODCAST_INDEX_SECRET + - PODCAST_INDEX_KEY=$PODCAST_INDEX_KEY + - YOUTUBE_KEY=$YOUTUBE_KEY + - GITHUB_TOKEN=$GITHUB_TOKEN + - LN_SERVER_BASE_URL=https://people-test.sphinx.chat + - LN_JWT_KEY=$LN_JWT_KEY + - RELAY_URL=$RELAY_URL + - RELAY_AUTH_KEY=$RELAY_AUTH_KEY + - RELAY_URL_BACKUP=$RELAY_URL_BACKUP + - RELAY_AUTH_KEY_BACKUP=$RELAY_AUTH_KEY_BACKUP + - HOST=people-test.sphinx.chat + - REDIS_URL=$REDIS_URL + - ADMIN_PUBKEYS=$ADMINS + - ADMINS=$ADMINS + - AWS_SECRET_ACCESS=$AWS_SECRET_ACCESS_KEY + - AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID + - AWS_REGION=us-east-1 + - S3_BUCKET_NAME=sphinx-tribes + - S3_FOLDER_NAME=metrics + - S3_URL=https://sphinx-tribes.s3.amazonaws.com + ulimits: + nproc: 65535 + nofile: + soft: 1000000 + hard: 1000000 + + tribes-frontend: + image: sphinxlightning/sphinx-tribes-frontend:latest + depends_on: + - tribes + - reverse-proxy + labels: + - "traefik.enable=true" + - "traefik.http.routers.tribes-frontend.rule=Host(`tribes-test.sphinx.chat`) || Host(`people-test.sphinx.chat`) || Host(`community-test.sphinx.chat`)" + - "traefik.http.services.tribes-frontend.loadbalancer.server.port=80" + - "traefik.http.routers.tribes-frontend.tls=true" + - "traefik.http.routers.tribes-frontend.tls.certresolver=myresolver" + - "traefik.http.routers.tribes-frontend.entrypoints=websecure" + restart: on-failure + + mqtt: + image: sphinx-mqtt + depends_on: + - auth + - reverse-proxy + labels: + - "traefik.enable=true" + - "traefik.tcp.routers.mqtt.rule=HostSNI(`tribes-test.sphinx.chat`)" + - "traefik.tcp.services.mqtt.loadbalancer.server.port=1883" + - "traefik.tcp.routers.mqtt.tls=true" + - "traefik.tcp.routers.mqtt.tls.certresolver=myresolver" + - "traefik.tcp.routers.mqtt.entrypoints=mqttsecure" + - "traefik.tcp.routers.mqtt.service=mqtt" + restart: on-failure + ulimits: + nproc: 65535 + nofile: + soft: 1000000 + hard: 1000000 diff --git a/src/people/main/FocusView.tsx b/src/people/main/FocusView.tsx index a386850d..7cef5bec 100644 --- a/src/people/main/FocusView.tsx +++ b/src/people/main/FocusView.tsx @@ -4,7 +4,6 @@ import { cloneDeep } from 'lodash'; import { observer } from 'mobx-react-lite'; import { FocusViewProps } from 'people/interfaces'; import { EuiGlobalToastList } from '@elastic/eui'; -import { Organization } from 'store/main'; import { Box } from '@mui/system'; import { useStores } from '../../store'; import Form from '../../components/form/bounty'; @@ -17,11 +16,7 @@ import { import WantedSummary from '../widgetViews/summaries/WantedSummary'; import { useIsMobile } from '../../hooks'; import { dynamicSchemasByType } from '../../components/form/schema'; -import { - convertLocaleToNumber, - extractRepoAndIssueFromIssueUrl, - toCapitalize -} from '../../helpers'; +import { convertLocaleToNumber, extractRepoAndIssueFromIssueUrl } from '../../helpers'; import { B, BWrap } from './style'; // selected bounty popup window @@ -60,12 +55,50 @@ function FocusedView(props: FocusViewProps) { const isTorSave = canEdit && main.isTorSave(); - const userOrganizations = main.dropDownOrganizations.length - ? main.dropDownOrganizations.map((org: Organization) => ({ - label: toCapitalize(org.name), - value: org.uuid - })) - : []; + //this code block can be used to get the real org values + // const [userOrganizations,setUserOrganizations] = useState({}); + // const getOrg =async()=>{ + // const response = await main.getOrganizations() + // const mappedResponse = response.map((org: Organization) => ({ + // label: org.name, + // value: org.uuid + // })) + // setUserOrganizations(mappedResponse) + // } + // getOrg() + const urlParts = window.location.href.split('/bounties/'); + const uuid = urlParts.length > 1 ? urlParts[1] : null; + const [orgName, setOrgName] = useState([]); + const getOrganization = async () => { + if (!uuid) { + console.error('No UUID found in the URL'); + return; + } + + try { + const response = await main.getUserOrganizationByUuid(uuid); + console.log(response, 'res'); + + if (response && response.uuid && response.name) { + // Creating an array with an object containing label and value + const orgDetails = [ + { + label: response.name, + value: response.uuid + } + ]; + setOrgName(orgDetails); + } else { + console.error('Response does not have the expected structure'); + } + } catch (error) { + console.error('Error fetching organization:', error); + } + }; + + useEffect(() => { + getOrganization(); + }); function isNotHttps(url: string | undefined) { if (main.isTorSave() || url?.startsWith('http://')) { @@ -192,6 +225,9 @@ function FocusedView(props: FocusViewProps) { // body.description = description; newBody.title = newBody.one_sentence_summary; + + // save repo to cookies for autofill in form + ui.setLastGithubRepo(newBody.ticket_url); } } catch (e) { throw githubError; @@ -263,8 +299,20 @@ function FocusedView(props: FocusViewProps) { props?.ReCallBounties(); } + // set user organizations + if (config?.schema?.[0]?.['defaultSchema']?.[0]?.['options']) { + config.schema[0]['defaultSchema'][0]['options'] = orgName; + } + let initialValues: any = {}; + let altInitialValue = {}; + if (window.location.href.includes('/org')) { + altInitialValue = { + org_uuid: uuid + }; + } + const personInfo = canEdit ? ui.meInfo : person; // set initials here @@ -310,6 +358,8 @@ function FocusedView(props: FocusViewProps) { initialValues[s.name] = wanted[s.name]; }); } + } else { + initialValues = altInitialValue; } } @@ -347,11 +397,6 @@ function FocusedView(props: FocusViewProps) { } } - // set user organizations - if (config?.schema?.[0]?.['defaultSchema']?.[0]?.['options']) { - config.schema[0]['defaultSchema'][0]['options'] = userOrganizations; - } - return (