Skip to content

Commit

Permalink
Merge branch 'master' into samz/v3-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Amzani authored Nov 8, 2023
2 parents 3590208 + 3af6078 commit 74675d4
Show file tree
Hide file tree
Showing 16 changed files with 248 additions and 129 deletions.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Bug report
about: Report a bug so we can fix and improve
labels: bug
---

#### Describe the bug
A clear and concise description of what the bug is.

#### How to Reproduce
Steps to reproduce the issue. Attach all resources that can help us understand the issue:

- Screenshots
- Link to GitHub repository with project that has issues
- Files that can help reproduce the issue, like your AsyncAPI file, either paste inside the issue in a code block or in a sharable [gist](https://gist.github.com/)

#### Expected behavior
A clear and concise description of what you expected to happen.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: true
contact_links:
- name: Project Communication
url: https://github.com/asyncapi/asyncapi/issues/115
about: Check out all the options to communicate with AsyncAPI community.
- name: Slack
url: https://www.asyncapi.com/slack-invite/
about: Don't open issues for questions or support, better talk to us on Slack first.
- name: AsyncAPI Website
url: https://www.asyncapi.com/
about: For more information about AsyncAPI visit our website.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest how we can improve
labels: enhancement
---

#### Reason/Context
Please try answering few of those questions
- Why we need this improvement?
- How will this change help?
- What is the motivation?


#### Description
Please try answering few of those questions
- What changes have to be introduced?
- Will this be a breaking change?
- How could it be implemented/designed?
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/pitch.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Pitch
description: 'Do you have an idea and a product enhancement? Time to pitch!'
title: '[PITCH]:'
labels: ['Pitch']
labels: ['pitch']
body:
- type: markdown
attributes:
Expand Down
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Thank you for your contribution. Before you submit the pull request:
1. Follow our contribution guidelines
2. Test your changes and attach their results to the pull request.
3. Update the relevant documentation.
-->

**Description**

- ...
- ...
- ...

**Related issue(s)**
<!-- If you refer to a particular issue, provide its number, otherwise, remove this section.
For example, `Resolves #123`, `Fixes #43`, or `See also #33`. The `See also #33` option will not automatically close the issue after the PR merge. -->
2 changes: 1 addition & 1 deletion .github/workflows/issues-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: github/issue-metrics@v2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: 'repo:shapeitapp/shapeitapp created:${{ env.last_month }}'
SEARCH_QUERY: 'repo:asyncapi/studio created:${{ env.last_month }}'

- name: Create issue
uses: peter-evans/create-issue-from-file@v4
Expand Down
4 changes: 2 additions & 2 deletions apps/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"dependencies": {
"@asyncapi/avro-schema-parser": "^3.0.2",
"@asyncapi/converter": "^1.3.1",
"@asyncapi/converter": "^1.4.1",
"@asyncapi/openapi-schema-parser": "^3.0.4",
"@asyncapi/parser": "^3.0.0-next-major-spec.3",
"@asyncapi/react-component": "^1.0.2",
Expand Down Expand Up @@ -75,7 +75,7 @@
},
"devDependencies": {
"@asyncapi/dotnet-nats-template": "^0.12.1",
"@asyncapi/go-watermill-template": "^0.2.43",
"@asyncapi/go-watermill-template": "^0.2.44",
"@asyncapi/html-template": "^0.28.4",
"@asyncapi/java-spring-cloud-stream-template": "^0.13.4",
"@asyncapi/java-spring-template": "^1.4.0",
Expand Down
5 changes: 2 additions & 3 deletions apps/studio/src/components/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Template } from './Template';
import { VisualiserTemplate } from './Visualiser';

import { debounce } from '../helpers';
import { usePanelsState, useDocumentsState, useSettingsState } from '../state';
import { usePanelsState, useDocumentsState } from '../state';

import type { FunctionComponent } from 'react';

Expand All @@ -15,8 +15,7 @@ interface ContentProps {}
export const Content: FunctionComponent<ContentProps> = () => { // eslint-disable-line sonarjs/cognitive-complexity
const { show, secondaryPanelType } = usePanelsState();
const document = useDocumentsState(state => state.documents['asyncapi']?.document) || null;
const v3Enabled = useSettingsState(state => state.editor.v3support) || false;
const isV3 = document?.version() === '3.0.0' && v3Enabled;
const isV3 = document?.version() === '3.0.0';
const navigationEnabled = show.primarySidebar;
const editorEnabled = show.primaryPanel;
const viewEnabled = show.secondaryPanel;
Expand Down
18 changes: 1 addition & 17 deletions apps/studio/src/components/Modals/Settings/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,12 @@ export const SettingsModal = create<SettingsModalProps>(({ activeTab = 'editor'
const [governanceHints, setGovernanceHints] = useState(settings.governance.show.hints);
const [autoRendering, setAutoRendering] = useState(settings.templates.autoRendering);
const [confirmDisabled, setConfirmDisabled] = useState(true);
const [v3support, setV3support] = useState(settings.editor.v3support);

const createNewState = (): SettingsState => {
return {
editor: {
autoSaving,
savingDelay,
v3support
},
governance: {
show: {
Expand All @@ -88,7 +86,7 @@ export const SettingsModal = create<SettingsModalProps>(({ activeTab = 'editor'
const newState = createNewState();
const isThisSameObjects = settingsSvc.isEqual(newState);
setConfirmDisabled(isThisSameObjects);
}, [autoSaving, savingDelay, autoRendering, governanceWarnings, governanceInformations, governanceHints, v3support]);
}, [autoSaving, savingDelay, autoRendering, governanceWarnings, governanceInformations, governanceHints]);

const onCancel = useCallback(() => {
modal.hide();
Expand Down Expand Up @@ -131,20 +129,6 @@ export const SettingsModal = create<SettingsModalProps>(({ activeTab = 'editor'
Save automatically after each change in the document or manually.
</div>
</div>
<div className="flex flex-col mt-4 text-sm">
<div className="flex flex-row content-center justify-between">
<label
htmlFor="settings-auto-saving"
className="flex justify-right items-center w-1/2 content-center font-medium text-gray-700"
>
Enable v3 support
</label>
<Switch
toggle={v3support}
onChange={(v) => setV3support(v)}
/>
</div>
</div>
<div className="flex flex-col mt-4 text-sm">
<div className="flex flex-row content-center justify-between">
<label
Expand Down
5 changes: 2 additions & 3 deletions apps/studio/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { show as showModal } from '@ebay/nice-modal-react';
import { Tooltip } from './common';
import { SettingsModal, NewFileModal } from './Modals';

import { usePanelsState, panelsState, useDocumentsState, useSettingsState } from '../state';
import { usePanelsState, panelsState, useDocumentsState } from '../state';

import type { FunctionComponent, ReactNode } from 'react';
import type { PanelsState } from '../state/panels.state';
Expand Down Expand Up @@ -53,8 +53,7 @@ interface SidebarProps {}
export const Sidebar: FunctionComponent<SidebarProps> = () => {
const { show, secondaryPanelType } = usePanelsState();
const document = useDocumentsState(state => state.documents['asyncapi']?.document) || null;
const v3Enabled = useSettingsState(state => state.editor.v3support) || false;
const isV3 = document?.version() === '3.0.0' && v3Enabled;
const isV3 = document?.version() === '3.0.0';

if (show.activityBar === false) {
return null;
Expand Down
5 changes: 2 additions & 3 deletions apps/studio/src/components/Terminal/TerminalTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';

import { TerminalInfo } from './TerminalInfo';
import { otherState, useSettingsState, useDocumentsState } from '../../state';
import { otherState, useDocumentsState } from '../../state';

export interface TerminalTab {
name: string;
Expand All @@ -20,8 +20,7 @@ export const TerminalTabs: React.FunctionComponent<TerminalTabsProps> = ({
}) => {
const [activeTab, setActiveTab] = useState(active);
const document = useDocumentsState(state => state.documents['asyncapi']?.document) || null;
const v3Enabled = useSettingsState(state => state.editor.v3support) || false;
const isV3 = document?.version() === '3.0.0' && v3Enabled;
const isV3 = document?.version() === '3.0.0';
if (tabs.length === 0) {
return null;
}
Expand Down
8 changes: 2 additions & 6 deletions apps/studio/src/services/specification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ export class SpecificationService extends AbstractService {
}

get latestVersion(): SpecVersions {
const { editor: { v3support } } = settingsState.getState();
return v3support ?
Object.keys(this.specs).pop() as SpecVersions :
Object.keys(this.specs).at(-2) as SpecVersions;
return Object.keys(this.specs).pop() as SpecVersions;
}

getSpec(version: SpecVersions) {
Expand All @@ -48,8 +45,7 @@ export class SpecificationService extends AbstractService {
}

private subscribeToSettings() {
settingsState.subscribe((state, prevState) => {
if (state.editor.v3support === prevState.editor.v3support) return;
settingsState.subscribe(() => {
sessionStorage.removeItem(this.keySessionStorage);
});
}
Expand Down
Loading

0 comments on commit 74675d4

Please sign in to comment.