mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
Update workpsace settings modal for environment settings (#7585)
This commit is contained in:
parent
b9883fdd14
commit
8320c4c626
@ -1,9 +1,18 @@
|
|||||||
import { isDesign, isMockServer, Workspace } from '../models/workspace';
|
import { isDesign, isEnvironment, isMockServer, Workspace } from '../models/workspace';
|
||||||
import { strings } from './strings';
|
import { strings } from './strings';
|
||||||
|
|
||||||
export const getWorkspaceLabel = (workspace: Workspace) =>
|
export const getWorkspaceLabel = (workspace: Workspace) => {
|
||||||
isDesign(workspace)
|
if (isDesign(workspace)) {
|
||||||
? strings.document
|
return strings.document;
|
||||||
: isMockServer(workspace)
|
}
|
||||||
? strings.mock
|
|
||||||
: strings.collection;
|
if (isMockServer(workspace)) {
|
||||||
|
return strings.mock;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEnvironment(workspace)) {
|
||||||
|
return strings.environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.collection;
|
||||||
|
};
|
||||||
|
@ -12,6 +12,7 @@ type StringId =
|
|||||||
| 'defaultProject'
|
| 'defaultProject'
|
||||||
| 'localProject'
|
| 'localProject'
|
||||||
| 'remoteProject'
|
| 'remoteProject'
|
||||||
|
| 'environment'
|
||||||
;
|
;
|
||||||
|
|
||||||
export const strings: Record<StringId, StringInfo> = {
|
export const strings: Record<StringId, StringInfo> = {
|
||||||
@ -47,4 +48,8 @@ export const strings: Record<StringId, StringInfo> = {
|
|||||||
singular: 'Remote',
|
singular: 'Remote',
|
||||||
plural: 'Remote',
|
plural: 'Remote',
|
||||||
},
|
},
|
||||||
|
environment: {
|
||||||
|
singular: 'Environment',
|
||||||
|
plural: 'Environments',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ import { getWorkspaceLabel } from '../../../common/get-workspace-label';
|
|||||||
import * as models from '../../../models/index';
|
import * as models from '../../../models/index';
|
||||||
import { MockServer } from '../../../models/mock-server';
|
import { MockServer } from '../../../models/mock-server';
|
||||||
import { isRequest } from '../../../models/request';
|
import { isRequest } from '../../../models/request';
|
||||||
import { isScratchpad, Workspace } from '../../../models/workspace';
|
import { isEnvironment, isMockServer, isScratchpad, Workspace } from '../../../models/workspace';
|
||||||
import { OrganizationLoaderData } from '../../routes/organization';
|
import { OrganizationLoaderData } from '../../routes/organization';
|
||||||
import { Link } from '../base/link';
|
import { Link } from '../base/link';
|
||||||
import { PromptButton } from '../base/prompt-button';
|
import { PromptButton } from '../base/prompt-button';
|
||||||
@ -90,7 +90,7 @@ export const WorkspaceSettingsModal = ({ workspace, mockServer, onClose }: Props
|
|||||||
className='p-2 w-full rounded-sm border border-solid border-[--hl-sm] bg-[--color-bg] text-[--color-font] focus:outline-none focus:ring-1 focus:ring-[--hl-md] transition-colors'
|
className='p-2 w-full rounded-sm border border-solid border-[--hl-sm] bg-[--color-bg] text-[--color-font] focus:outline-none focus:ring-1 focus:ring-[--hl-md] transition-colors'
|
||||||
onChange={event => workspacePatcher(workspace._id, { name: event.target.value })}
|
onChange={event => workspacePatcher(workspace._id, { name: event.target.value })}
|
||||||
/>
|
/>
|
||||||
{workspace.scope !== 'mock-server' && (
|
{!isMockServer(workspace) && (
|
||||||
<>
|
<>
|
||||||
<Label className='text-sm text-[--hl]' aria-label='Description'>
|
<Label className='text-sm text-[--hl]' aria-label='Description'>
|
||||||
Description
|
Description
|
||||||
@ -102,6 +102,8 @@ export const WorkspaceSettingsModal = ({ workspace, mockServer, onClose }: Props
|
|||||||
workspacePatcher(workspace._id, { description });
|
workspacePatcher(workspace._id, { description });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{!isEnvironment(workspace) && (
|
||||||
|
<>
|
||||||
<Heading>Actions</Heading>
|
<Heading>Actions</Heading>
|
||||||
<PromptButton
|
<PromptButton
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
@ -116,8 +118,11 @@ export const WorkspaceSettingsModal = ({ workspace, mockServer, onClose }: Props
|
|||||||
>
|
>
|
||||||
<i className="fa fa-trash-o" /> Clear All Responses
|
<i className="fa fa-trash-o" /> Clear All Responses
|
||||||
</PromptButton>
|
</PromptButton>
|
||||||
</>)}
|
</>
|
||||||
{Boolean(workspace.scope === 'mock-server' && mockServer) && (
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{Boolean(isMockServer(workspace) && mockServer) && (
|
||||||
<>
|
<>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
name="mockServerType"
|
name="mockServerType"
|
||||||
|
Loading…
Reference in New Issue
Block a user