diff --git a/app/store/database/label_pullreq.go b/app/store/database/label_pullreq.go index 0b15136e0..f890e8a9f 100644 --- a/app/store/database/label_pullreq.go +++ b/app/store/database/label_pullreq.go @@ -24,6 +24,7 @@ import ( "github.com/harness/gitness/types/enum" "github.com/Masterminds/squirrel" + "github.com/gotidy/ptr" "github.com/guregu/null" "github.com/jmoiron/sqlx" "github.com/pkg/errors" @@ -56,9 +57,11 @@ type pullReqAssignmentInfo struct { LabelID int64 `db:"label_id"` LabelKey string `db:"label_key"` LabelColor enum.LabelColor `db:"label_color"` + LabelScope int64 `db:"label_scope"` ValueCount int64 `db:"label_value_count"` + ValueID null.Int `db:"label_value_id"` Value null.String `db:"label_value_value"` - ValueColor null.String `db:"label_value_color"` + ValueColor null.String `db:"label_value_color"` // get's converted to *enum.LabelColor } const ( @@ -193,7 +196,9 @@ func (s *pullReqLabelStore) ListAssignedByPullreqIDs( ,label_id ,label_key ,label_color + ,label_scope ,label_value_count + ,label_value_id ,label_value_value ,label_value_color `). @@ -261,14 +266,20 @@ func mapPullReqLabel(lbl *pullReqLabel) *types.PullReqLabel { } func mapPullReqAssignmentInfo(lbl *pullReqAssignmentInfo) *types.LabelPullReqAssignmentInfo { + var valueColor *enum.LabelColor + if lbl.ValueColor.Valid { + valueColor = ptr.Of(enum.LabelColor(lbl.ValueColor.String)) + } return &types.LabelPullReqAssignmentInfo{ PullReqID: lbl.PullReqID, LabelID: lbl.LabelID, LabelKey: lbl.LabelKey, LabelColor: lbl.LabelColor, + LabelScope: lbl.LabelScope, ValueCount: lbl.ValueCount, + ValueID: lbl.ValueID.Ptr(), Value: lbl.Value.Ptr(), - ValueColor: lbl.ValueColor.Ptr(), + ValueColor: valueColor, } } diff --git a/types/label.go b/types/label.go index 1aa3e0845..445ea0fd6 100644 --- a/types/label.go +++ b/types/label.go @@ -95,13 +95,15 @@ type LabelAssignment struct { } type LabelPullReqAssignmentInfo struct { - PullReqID int64 `json:"-"` - LabelID int64 `json:"id"` - LabelKey string `json:"key"` - LabelColor enum.LabelColor `json:"color,omitempty"` - ValueCount int64 `json:"value_count"` - Value *string `json:"value,omitempty"` - ValueColor *string `json:"value_color,omitempty"` + PullReqID int64 `json:"-"` + LabelID int64 `json:"id"` + LabelKey string `json:"key"` + LabelColor enum.LabelColor `json:"color,omitempty"` + LabelScope int64 `json:"scope"` + ValueCount int64 `json:"value_count"` + ValueID *int64 `json:"value_id,omitempty"` + Value *string `json:"value,omitempty"` + ValueColor *enum.LabelColor `json:"value_color,omitempty"` } type ScopeData struct { diff --git a/web/config/moduleFederation.config.js b/web/config/moduleFederation.config.js index 8ed96b6d1..ab03697f3 100644 --- a/web/config/moduleFederation.config.js +++ b/web/config/moduleFederation.config.js @@ -52,6 +52,7 @@ module.exports = { './Webhooks': './src/pages/Webhooks/Webhooks.tsx', './WebhookNew': './src/pages/WebhookNew/WebhookNew.tsx', './Search': './src/pages/Search/CodeSearchPage.tsx', + './Labels': './src/pages/ManageSpace/ManageLabels/ManageLabels.tsx', './WebhookDetails': './src/pages/WebhookDetails/WebhookDetails.tsx', './NewRepoModalButton': './src/components/NewRepoModalButton/NewRepoModalButton.tsx' }, diff --git a/web/src/RouteDefinitions.ts b/web/src/RouteDefinitions.ts index e382b1d90..ff00da850 100644 --- a/web/src/RouteDefinitions.ts +++ b/web/src/RouteDefinitions.ts @@ -70,7 +70,7 @@ export interface CODERoutes extends CDERoutes { toCODEHome: () => string toCODESpaceAccessControl: (args: Required>) => string - toCODESpaceSettings: (args: Required>) => string + toCODESpaceSettings: (args: RequiredField, 'space'>) => string toCODEPipelines: (args: Required>) => string toCODEPipelineEdit: (args: Required>) => string toCODEPipelineSettings: (args: Required>) => string @@ -103,6 +103,7 @@ export interface CODERoutes extends CDERoutes { args: RequiredField, 'repoPath'> ) => string toCODESpaceSearch: (args: Required>) => string + toCODESpaceLabels: (args: Required>) => string toCODERepositorySearch: (args: Required>) => string toCODESemanticSearch: (args: Required>) => string toCODEExecutions: (args: Required>) => string @@ -126,7 +127,8 @@ export const routes: CODERoutes = { toCODEHome: () => `/`, toCODESpaceAccessControl: ({ space }) => `/access-control/${space}`, - toCODESpaceSettings: ({ space }) => `/settings/${space}`, + toCODESpaceSettings: ({ space, settingSection }) => + `/settings/${space}/project${settingSection ? '/' + settingSection : ''}`, toCODEPipelines: ({ repoPath }) => `/${repoPath}/pipelines`, toCODEPipelineEdit: ({ repoPath, pipeline }) => `/${repoPath}/pipelines/${pipeline}/edit`, toCODEPipelineSettings: ({ repoPath, pipeline }) => `/${repoPath}/pipelines/${pipeline}/triggers`, @@ -157,6 +159,7 @@ export const routes: CODERoutes = { toCODECompare: ({ repoPath, diffRefs }) => `/${repoPath}/pulls/compare/${diffRefs}`, toCODEBranches: ({ repoPath }) => `/${repoPath}/branches`, toCODETags: ({ repoPath }) => `/${repoPath}/tags`, + toCODESpaceLabels: ({ space }) => `/${space}/labels`, toCODESettings: ({ repoPath, settingSection, ruleId, settingSectionMode }) => `/${repoPath}/settings${settingSection ? '/' + settingSection : ''}${ruleId ? '/' + ruleId : ''}${ settingSectionMode ? '/' + settingSectionMode : '' diff --git a/web/src/RouteDestinations.tsx b/web/src/RouteDestinations.tsx index 141c54ebb..a38b3ac0b 100644 --- a/web/src/RouteDestinations.tsx +++ b/web/src/RouteDestinations.tsx @@ -54,6 +54,7 @@ import PipelineSettings from 'components/PipelineSettings/PipelineSettings' import GitspaceDetails from 'cde-gitness/pages/GitspaceDetails/GitspaceDetails' import GitspaceListing from 'cde-gitness/pages/GitspaceListing/GitspaceListing' import GitspaceCreate from 'cde-gitness/pages/GitspaceCreate/GitspaceCreate' +import ManageLabels from 'pages/ManageSpace/ManageLabels/ManageLabels' export const RouteDestinations: React.FC = React.memo(function RouteDestinations() { const { getString } = useStrings() @@ -81,7 +82,12 @@ export const RouteDestinations: React.FC = React.memo(function RouteDestinations - + @@ -375,6 +381,12 @@ export const RouteDestinations: React.FC = React.memo(function RouteDestinations + + + + + + diff --git a/web/src/components/DiffViewer/DiffViewerUtils.tsx b/web/src/components/DiffViewer/DiffViewerUtils.tsx index 502c156ef..f64fb328c 100644 --- a/web/src/components/DiffViewer/DiffViewerUtils.tsx +++ b/web/src/components/DiffViewer/DiffViewerUtils.tsx @@ -34,7 +34,14 @@ export enum CommentType { MERGE = 'merge', BRANCH_UPDATE = 'branch-update', BRANCH_DELETE = 'branch-delete', - STATE_CHANGE = 'state-change' + STATE_CHANGE = 'state-change', + LABEL_MODIFY = 'label-modify' +} + +export enum LabelActivity { + ASSIGN = 'assign', + UN_ASSIGN = 'unassign', + RE_ASSIGN = 'reassign' } /** diff --git a/web/src/components/Label/Label.module.scss b/web/src/components/Label/Label.module.scss new file mode 100644 index 000000000..d2fe2177b --- /dev/null +++ b/web/src/components/Label/Label.module.scss @@ -0,0 +1,98 @@ +/* + * Copyright 2023 Harness, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.labelTag { + border: none !important; + padding: 0px !important; + + .labelKey { + padding-left: 7px !important; + padding-right: 7px !important; + border-radius: 4px 0 0 4px !important; + background-color: inherit !important; + display: flex !important; + align-items: center; + gap: 4px; + } + + .labelValue { + padding: 1px 7px !important; + border: 1px transparent !important; + border-radius: 0 4px 4px 0 !important; + gap: 4px; + white-space: nowrap !important; + + .labelValueTxt { + max-width: 150px !important; + } + } + .standaloneKey { + padding-left: 7px !important; + padding-right: 7px !important; + border-radius: 4px !important; + background-color: var(--grey-0) !important; + gap: 4px; + } +} + +.removeBtnTag { + :global { + .bp3-button { + cursor: pointer !important; + --button-height: 15px !important; + min-width: 16px !important ; + } + } +} + +.labelKey :global { + .bp3-tag { + background-color: inherit !important; + } +} + +.popover { + border-radius: 8px !important; +} + +.danger { + &:not(.isDark) { + * { + color: var(--red-500) !important; + } + } + + &:hover { + background-color: var(--red-500) !important; + + * { + color: var(--white) !important; + } + } +} + +.isDark { + .icon { + svg path { + fill: var(--white) !important; + } + } +} +.valuesList { + flex-wrap: wrap; + gap: 7px; + width: 100%; +} diff --git a/web/src/components/Label/Label.module.scss.d.ts b/web/src/components/Label/Label.module.scss.d.ts new file mode 100644 index 000000000..9b0cc4e80 --- /dev/null +++ b/web/src/components/Label/Label.module.scss.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2023 Harness, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* eslint-disable */ +// This is an auto-generated file +export declare const danger: string +export declare const icon: string +export declare const isDark: string +export declare const labelKey: string +export declare const labelTag: string +export declare const labelValue: string +export declare const labelValueTxt: string +export declare const popover: string +export declare const removeBtnTag: string +export declare const standaloneKey: string +export declare const valuesList: string diff --git a/web/src/components/Label/Label.tsx b/web/src/components/Label/Label.tsx new file mode 100644 index 000000000..59e9d9898 --- /dev/null +++ b/web/src/components/Label/Label.tsx @@ -0,0 +1,336 @@ +/* + * Copyright 2023 Harness, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React, { useEffect } from 'react' +import cx from 'classnames' +import { Button, ButtonSize, ButtonVariation, Container, Layout, Tag, Text } from '@harnessio/uicore' +import { FontVariation } from '@harnessio/design-system' +import { useGet } from 'restful-react' +import { Menu } from '@blueprintjs/core' +import { Icon } from '@harnessio/icons' +import { isEmpty } from 'lodash-es' +import { ColorName, LabelType, getColorsObj, getScopeData, getScopeIcon } from 'utils/Utils' +import type { RepoRepositoryOutput, TypesLabelValue } from 'services/code' +import { useStrings } from 'framework/strings' +import { useAppContext } from 'AppContext' +import { getConfig } from 'services/config' +import css from './Label.module.scss' + +interface Label { + name: string + scope?: number + label_color?: ColorName +} + +interface LabelTitleProps extends Label { + labelType?: LabelType + value_count?: number +} + +interface LabelProps extends Label { + label_value?: { + name?: string + color?: ColorName + } + className?: string + removeLabelBtn?: boolean + handleRemoveClick?: () => void + onClick?: () => void + disableRemoveBtnTooltip?: boolean +} + +export const Label: React.FC = props => { + const { + name, + scope, + label_value: { name: valueName, color: valueColor } = {}, + label_color, + className, + removeLabelBtn, + handleRemoveClick, + onClick, + disableRemoveBtnTooltip = false + } = props + const { getString } = useStrings() + const { standalone } = useAppContext() + const scopeIcon = getScopeIcon(scope, standalone) + if (valueName) { + const colorObj = getColorsObj(valueColor ?? label_color ?? ColorName.Blue) + + return ( + { + if (onClick) { + onClick() + e.stopPropagation() + } + }} + className={cx(css.labelTag, className, { [css.removeBtnTag]: removeLabelBtn })}> + + + {scopeIcon && ( + + )} + + {name} + + + + + {valueName} + + {removeLabelBtn && ( + + + + + + {currentLabel && query && ( + + + + + ) + } +} diff --git a/web/src/components/NoResultCard/NoResultCard.tsx b/web/src/components/NoResultCard/NoResultCard.tsx index 414e0732c..4827473cb 100644 --- a/web/src/components/NoResultCard/NoResultCard.tsx +++ b/web/src/components/NoResultCard/NoResultCard.tsx @@ -34,14 +34,18 @@ interface NoResultCardProps { onButtonClick?: () => void permissionProp?: { disabled: boolean; tooltip: JSX.Element | string } | undefined standalone?: boolean + forFilter?: boolean + emptyFilterMessage?: string } export const NoResultCard: React.FC = ({ showWhen = () => true, forSearch, + forFilter = false, title, message, emptySearchMessage, + emptyFilterMessage, buttonText = '', buttonIcon = CodeIcon.Add, onButtonClick = noop, @@ -57,12 +61,16 @@ export const NoResultCard: React.FC = ({ () + if (standalone) return LabelsPageScope.SPACE + else if (projectIdentifier) return LabelsPageScope.PROJECT + else { + if (orgIdentifier) return LabelsPageScope.ORG + else if (accountIdentifier) LabelsPageScope.ACCOUNT + } + return LabelsPageScope.ACCOUNT +} diff --git a/web/src/i18n/strings.en.yaml b/web/src/i18n/strings.en.yaml index 9d669277b..021877e31 100644 --- a/web/src/i18n/strings.en.yaml +++ b/web/src/i18n/strings.en.yaml @@ -30,6 +30,7 @@ commits: Commits commitChanges: Commit changes pullRequests: Pull Requests settings: Settings +manageRepository: Manage Repository newFile: New File editFile: Edit File prev: Prev @@ -90,6 +91,7 @@ cloneHTTPS: Git clone URL nameYourFile: Name your file... noResultTitle: Sorry, no result found noResultMessage: What you searched was unfortunately not found or doesn’t exist +noFilterResultMessage: No results were found based on the applied filters pageTitle: signin: Sign In register: Register a new account @@ -216,6 +218,7 @@ newFileNotAllowed: You must be on a branch to create a new file fileDeleted: '__path__ successfully deleted.' newPullRequest: New Pull Request pullRequestEmpty: There are no pull requests in your repo. Click the button below to create a pull request. +pullRequestNotFoundforFilter: No pull requests match the applied filters comparingChanges: Comparing Changes selectToViewMore: Select branch to view more here. createPullRequest: Create pull request @@ -1293,3 +1296,58 @@ regex: enabled: enabled disabled: disabled string: RegEx +labels: + labels: Labels + newLabel: New Label + labelName: Label Name + labelValue: Label Value + labelNotFound: ' label not found' + allowDynamic: Allow users to add values + addNewValue: 'Add new value ' + addValue: 'Add value' + removeLabel: Remove Label + deleteLabel: Delete Label + provideLabelName: Provide Label name + labelCreated: Label created + labelUpdated: Label updated + labelNameReq: Label Name is required + labelValueReq: Label Value is required + noLabels: No Labels + updated: 'updated ' + applied: 'applied ' + label: ' label' + labelTo: ' label to ' + removed: 'removed ' + anyValue: 'anyvalue' + anyValueOption: '(any value)' + failedToDeleteLabel: Failed to delete Label + findALabel: Find a label + canbeAddedByUsers: '*can be added by users*' + removedLabel: Removed '{label}' label + showLabelsScope: Show labels from parent scopes + createLabel: Create Label + updateLabel: Update Label + appliedLabel: Create a new branch for this commit and start a pull request + labelsApplied: '{labelCount|1:Label,Labels} Applied' + createdIn: Created In + labelCreationFailed: Failed to create label + labelUpdateFailed: Failed to update label + noLabelsFound: No Labels found. Click on the button below to create a Label. + noRepoLabelsFound: There are no Labels in your repo. Click the button below to create a Label. + noScopeLabelsFound: There are no Labels present in current scope. Click the button below to create a Label. + scopeMessage: (Showing labels created at current scope or higher) + deleteLabelConfirm: Are you sure you want to delete label {{name}}? You can't undo this action. + intentText: Editing/deleting a label or its values will impact all the areas it has been used. + prCount: 'Showing {count} {count|1:result,results}' + noResults: No results found + labelPreview: Label Preview + filterByLabels: Filter by Label/s + provideLabelValue: 'Provide label value' + findaValue: Find a value + findOrAdd: Find or add a new value + labelValuesOptional: 'Label Value/s (Optional)' + descriptionOptional: 'Description (Optional)' + placeholderDescription: Enter a short description for the label + addaValue: Add a value + stringMax: '{entity} must be 50 characters or less' + noNewLine: '{entity} cannot contain new lines' diff --git a/web/src/layouts/menu/DefaultMenu.tsx b/web/src/layouts/menu/DefaultMenu.tsx index 0f73260d6..f9c0af649 100644 --- a/web/src/layouts/menu/DefaultMenu.tsx +++ b/web/src/layouts/menu/DefaultMenu.tsx @@ -155,7 +155,7 @@ export const DefaultMenu: React.FC = () => { Promise +} + +interface LabelFormData extends TypesLabel { + labelName: string + allowDynamicValues: boolean + color: ColorName + labelValues: ExtendedTypesLabelValue[] +} + +const ColorSelectorDropdown = (props: { + onClick: (color: ColorName) => void + currentColorName: ColorName | undefined | false + disabled?: boolean +}) => { + const { currentColorName, onClick: onClickColorOption, disabled: disabledPopover } = props + + const colorNames: ColorName[] = Object.keys(colorsPanel) as ColorName[] + const getColorsObj = (colorKey: ColorName): ColorDetails => { + return colorsPanel[colorKey] + } + + const currentColorObj = getColorsObj(currentColorName ? currentColorName : ColorName.Blue) + + return ( + + {colorNames?.map(colorName => { + const colorObj = getColorsObj(colorName) + return ( + + {colorName} + + } + onClick={() => onClickColorOption(colorName)} + /> + ) + })} + + }> + + + + + + + ) + }} + + + + + ) +} diff --git a/web/src/pages/SpaceSettings/SpaceSettings.module.scss b/web/src/pages/SpaceSettings/SpaceSettings.module.scss index 86f877392..13e9a5712 100644 --- a/web/src/pages/SpaceSettings/SpaceSettings.module.scss +++ b/web/src/pages/SpaceSettings/SpaceSettings.module.scss @@ -14,20 +14,95 @@ * limitations under the License. */ -.mainCtn { - height: var(--page-height); +.main { + min-height: calc(var(--page-height) - 160px); background-color: var(--primary-bg) !important; + width: 100%; + margin: var(--spacing-small); + :global { + .bp3-tab { + width: fit-content !important; + height: 34px; + } - .roleBadge { - text-transform: capitalize; - padding: var(--spacing-xsmall) 6px; - border-radius: 4px; - border: 1px solid var(--grey-200); - background: var(--grey-50); - width: max-content; + .bp3-tab-panel { + width: 100%; + } + + .bp3-tab { + margin-top: 20px; + margin-bottom: unset !important; + } + + .bp3-tab-list .bp3-tab[aria-selected='true'] { + background-color: var(--grey-0); + -webkit-box-shadow: none; + box-shadow: none; + border-bottom: 2px solid var(--primary-7); + border-bottom-left-radius: 0px !important; + border-bottom-right-radius: 0px !important; + } } } +.webhooksContent { + width: 100%; +} + +.btn { + margin-top: 5px; +} + +.webhookHeader { + padding-left: 0 !important; + margin-left: 0 !important; +} + +.contentContainer { + margin: 20px !important; +} + +.generalContainer { + width: 100%; + background: var(--grey-0) !important; + box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16); + border-radius: 4px; +} + +.label { + padding-top: var(--spacing-xsmall); + width: 220px; + padding-right: var(--spacing-medium); +} + +.descText { + align-self: center !important; +} + +.radioContainer { + :global([class*='RadioButton--radio']) { + align-items: center; + } +} + +.iconContainer { + display: flex; + align-items: center; +} + +.content { + width: 80%; +} + +.deleteContainer { + display: flex; + justify-content: space-between; +} + +.text { + text-transform: capitalize; +} + .dividerContainer { opacity: 0.2; height: 1px; @@ -35,23 +110,10 @@ margin: 20px 0; } -.label { - width: 100px; - padding-right: var(--spacing-medium); -} - -.content { - width: 93%; -} - -.deleteContainer { - display: flex; - justify-content: space-between; -} - -.deleteBtn { - white-space: nowrap !important; - min-width: auto !important; +.dialogContainer { + :global(.bp3-dialog-header) { + margin-bottom: var(--spacing-medium) !important; + } } .saveBtn { @@ -59,153 +121,87 @@ } .textContainer { - width: 80%; + width: 100%; +} + +.editContainer { + width: 60% !important; + textarea { + min-height: 100px !important; + } } .buttonContainer { width: 20%; padding-top: var(--spacing-xsmall) !important; -} - -.generalContainer { - width: 100%; - background: var(--grey-0) !important; - box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16); - border-radius: 4px; - overflow: hidden !important; - position: relative !important; -} - -.yellowContainer { - background: var(--orange-50) !important; - padding: var(--spacing-medium) var(--spacing-small); - margin: 0 var(--spacing-large) 0 0 !important; - border-radius: 4px; -} - -.verticalContainer { - width: 100% !important; -} - -.upgradeContainer { - align-items: center; - overflow: hidden !important; - position: relative !important; - .button { - --background-color: var(--green-700) !important; - --background-color-hover: var(--green-800) !important; - --background-color-active: var(--green-700) !important; - z-index: 2; - .buttonText { - font-size: 13px !important; - } - } -} - -.harnessWatermark { - position: absolute; - right: -2.81%; - top: 6%; - bottom: -17%; - z-index: 1; - opacity: 0.1 !important; - svg { - opacity: 0.1; - } -} - -.upgradeHeader { - align-items: center; -} - -.importContainer { - background: var(--grey-50) !important; - border: 1px solid var(--grey-200) !important; - border-radius: 4px; - - :global { - .bp3-form-group { - margin: unset !important; - } - } -} - -.detailsLabel { - white-space: nowrap !important; - max-width: 155px !important; - color: var(--grey-600) !important; -} - -.icon { - > svg { - fill: var(--primary-7) !important; - - > path { - fill: var(--primary-7) !important; - } - } -} - -.checkbox { - :global { - [class*='Tooltip--acenter'] { - opacity: 0.7 !important; - } - .bp3-control-indicator { - background: var(--primary-7) !important; - opacity: 0.7; - } - } -} - -.repoInfo { - border-radius: 4px; - border: 1px solid var(--grey-100); - background: var(--grey-50) !important; -} - -.upgradeButton { - --background-color: var(--green-700) !important; - --background-color-hover: var(--green-800) !important; - --background-color-active: var(--green-700) !important; - z-index: 2; - .buttonText { - font-size: 13px !important; - } -} - -.progressBar { - width: 461px; -} - -.harnessUpgradeWatermark { - position: absolute; - right: 2%; - top: 6%; - bottom: -17%; - z-index: 1; - opacity: 0.1 !important; - svg { - opacity: 0.1; - } -} - -.mainContainer { - :global { - --bp3-intent-color: unset !important; - - .bp3-intent-danger { - --bp3-intent-color: unset !important; - } - .bp3-form-helper-text { - margin-top: unset !important; - } - [class*='FormError--errorDiv'] { - display: none !important; - } - } + gap: 10px; + margin-left: auto !important; } .textSize { font-size: 13px !important; } + +.description { + width: 80%; + word-wrap: break-word; + word-break: break-all; + white-space: normal; + margin: 0 auto; +} + +.tabsContainer { + flex-grow: 1; + display: flex; + background-color: var(--primary-bg) !important; + + > div { + flex-grow: 1; + display: flex; + flex-direction: column; + } + + > div > div[role='tablist'] { + background-color: var(--white) !important; + padding-left: var(--spacing-large) !important; + padding-right: var(--spacing-xlarge) !important; + border-bottom: 1px solid var(--grey-200) !important; + } + + > div > div[role='tabpanel'] { + margin-top: 0; + flex-grow: 1; + display: flex; + flex-direction: column; + } + + [aria-selected='true'] { + .tabTitle, + .tabTitle:hover { + color: var(--grey-900) !important; + font-weight: 600 !important; + } + } + + .tabTitle { + font-weight: 500; + color: var(--grey-700); + display: flex; + align-items: center; + height: 24px; + margin-top: var(--spacing-8); + + > svg { + display: inline-block; + margin-right: 5px; + } + } + + .tabTitle:not:first-child { + margin-left: var(--spacing-8) !important; + } +} + +.headerContainer { + border-bottom: unset !important; +} diff --git a/web/src/pages/SpaceSettings/SpaceSettings.module.scss.d.ts b/web/src/pages/SpaceSettings/SpaceSettings.module.scss.d.ts index 65e7973e4..b610d0956 100644 --- a/web/src/pages/SpaceSettings/SpaceSettings.module.scss.d.ts +++ b/web/src/pages/SpaceSettings/SpaceSettings.module.scss.d.ts @@ -16,31 +16,27 @@ /* eslint-disable */ // This is an auto-generated file -export declare const button: string +export declare const btn: string export declare const buttonContainer: string -export declare const buttonText: string -export declare const checkbox: string export declare const content: string -export declare const deleteBtn: string +export declare const contentContainer: string export declare const deleteContainer: string -export declare const detailsLabel: string +export declare const description: string +export declare const descText: string +export declare const dialogContainer: string export declare const dividerContainer: string +export declare const editContainer: string export declare const generalContainer: string -export declare const harnessUpgradeWatermark: string -export declare const harnessWatermark: string -export declare const icon: string -export declare const importContainer: string +export declare const headerContainer: string +export declare const iconContainer: string export declare const label: string -export declare const mainContainer: string -export declare const mainCtn: string -export declare const progressBar: string -export declare const repoInfo: string -export declare const roleBadge: string +export declare const main: string +export declare const radioContainer: string export declare const saveBtn: string +export declare const tabsContainer: string +export declare const tabTitle: string +export declare const text: string export declare const textContainer: string export declare const textSize: string -export declare const upgradeButton: string -export declare const upgradeContainer: string -export declare const upgradeHeader: string -export declare const verticalContainer: string -export declare const yellowContainer: string +export declare const webhookHeader: string +export declare const webhooksContent: string diff --git a/web/src/pages/SpaceSettings/SpaceSettings.tsx b/web/src/pages/SpaceSettings/SpaceSettings.tsx index 2d146d086..2aca19966 100644 --- a/web/src/pages/SpaceSettings/SpaceSettings.tsx +++ b/web/src/pages/SpaceSettings/SpaceSettings.tsx @@ -14,507 +14,67 @@ * limitations under the License. */ -import React, { useEffect, useMemo, useState } from 'react' -import { - Button, - Text, - Container, - Formik, - Layout, - Page, - ButtonVariation, - ButtonSize, - FlexExpander, - useToaster, - Heading, - TextInput, - stringSubstitute -} from '@harnessio/uicore' +import React from 'react' import cx from 'classnames' -import { noop } from 'lodash-es' -import { useMutate, useGet } from 'restful-react' -import { Intent, Color, FontVariation } from '@harnessio/design-system' + +import { PageBody, Container, Tabs, Page } from '@harnessio/uicore' import { useHistory } from 'react-router-dom' -import { Dialog } from '@blueprintjs/core' -import { ProgressBar, Intent as IntentCore } from '@blueprintjs/core' -import { Icon } from '@harnessio/icons' import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata' -import { JobProgress, useGetSpace } from 'services/code' -import { useAppContext } from 'AppContext' import { useStrings } from 'framework/strings' -import { getErrorMessage } from 'utils/Utils' -import { ACCESS_MODES, permissionProps, voidFn } from 'utils/Utils' -import type { ExportFormDataExtended } from 'utils/GitUtils' -import { useModalHook } from 'hooks/useModalHook' -import useSpaceSSE from 'hooks/useSpaceSSE' -import Harness from '../../icons/Harness.svg?url' -import Upgrade from '../../icons/Upgrade.svg?url' -import useDeleteSpaceModal from './DeleteSpaceModal/DeleteSpaceModal' -import ExportForm from './ExportForm/ExportForm' +import { useAppContext } from 'AppContext' +import { SettingsTab, SpaceSettingsTab } from 'utils/GitUtils' +import { useGetSpaceParam } from 'hooks/useGetSpaceParam' +import LabelsListing from 'pages/Labels/LabelsListing' +import { LabelsPageScope } from 'utils/Utils' +import GeneralSpaceSettings from './GeneralSettings/GeneralSpaceSettings' import css from './SpaceSettings.module.scss' export default function SpaceSettings() { - const { space } = useGetRepositoryMetadata() - const { openModal: openDeleteSpaceModal } = useDeleteSpaceModal() - const { data, refetch } = useGetSpace({ space_ref: encodeURIComponent(space), lazy: !space }) - const [editName, setEditName] = useState(ACCESS_MODES.VIEW) + const { settingSection } = useGetRepositoryMetadata() const history = useHistory() - const { routes, standalone, hooks } = useAppContext() - //check upgrading for space - const [upgrading, setUpgrading] = useState(false) - const [editDesc, setEditDesc] = useState(ACCESS_MODES.VIEW) - const [repoCount, setRepoCount] = useState(0) - const [exportDone, setExportDone] = useState(false) - const { showError, showSuccess } = useToaster() - + const { routes } = useAppContext() + const space = useGetSpaceParam() + const [activeTab, setActiveTab] = React.useState(settingSection || SpaceSettingsTab.general) const { getString } = useStrings() - const { mutate: patchSpace } = useMutate({ - verb: 'PATCH', - path: `/api/v1/spaces/${space}` - }) - const { mutate: updateName } = useMutate({ - verb: 'POST', - path: `/api/v1/spaces/${space}/move` - }) - const { data: exportProgressSpace, refetch: refetchExport } = useGet({ - path: `/api/v1/spaces/${space}/export-progress` - }) - const countFinishedRepos = (): number => { - return exportProgressSpace?.repos.filter((repo: JobProgress) => repo.state === 'finished').length - } - const checkReposState = () => { - return exportProgressSpace?.repos.every( - (repo: JobProgress) => repo.state === 'finished' || repo.state === 'failed' || repo.state === 'canceled' - ) - } - - const checkExportIsRunning = () => { - return exportProgressSpace?.repos.every( - (repo: JobProgress) => repo.state === 'running' || repo.state === 'scheduled' - ) - } - - useEffect(() => { - if (exportProgressSpace?.repos && checkExportIsRunning()) { - setUpgrading(true) - setRepoCount(exportProgressSpace?.repos.length) - setExportDone(false) - } else if (exportProgressSpace?.repos && checkReposState()) { - setRepoCount(countFinishedRepos) - setExportDone(true) - } - }, [exportProgressSpace]) // eslint-disable-line react-hooks/exhaustive-deps - - const events = useMemo(() => ['repository_export_completed'], []) - - useSpaceSSE({ - space, - events, - onEvent: () => { - refetchExport() - - if (exportProgressSpace && checkReposState()) { - setRepoCount(countFinishedRepos) - setExportDone(true) - } else if (exportProgressSpace?.repos && checkExportIsRunning()) { - setUpgrading(true) - setRepoCount(exportProgressSpace?.repos.length) - setExportDone(false) - } - } - }) - - const ExportModal = () => { - const [step, setStep] = useState(0) - - const { mutate: exportSpace } = useMutate({ - verb: 'POST', - path: `/api/v1/spaces/${space}/export` - }) - - const handleExportSubmit = (formData: ExportFormDataExtended) => { - try { - setRepoCount(formData.repoCount) - const exportPayload = { - account_id: formData.accountId || '', - org_identifier: formData.organization, - project_identifier: formData.name, - token: formData.token - } - exportSpace(exportPayload) - .then(_ => { - hideModal() - setUpgrading(true) - refetchExport() - }) - .catch(_error => { - showError(getErrorMessage(_error), 0, getString('failedToImportSpace')) - }) - } catch (exception) { - showError(getErrorMessage(exception), 0, getString('failedToImportSpace')) - } - } - - return ( - - - - - - - {step === 0 && <>{getString('exportSpace.upgradeHarness')}} - {step === 1 && <>{getString('exportSpace.newProject')}} - {step === 2 && <>{getString('exportSpace.upgradeConfirmation')}} - - - - - - - - - ) - } - const [openModal, hideModal] = useModalHook(ExportModal, [noop, space]) - const permEditResult = hooks?.usePermissionTranslate?.( + const tabListArray = [ { - resource: { - resourceType: 'CODE_REPOSITORY' - }, - permissions: ['code_repo_edit'] + id: SettingsTab.general, + title: 'General', + panel: ( + + + + ) }, - [space] - ) - const permDeleteResult = hooks?.usePermissionTranslate?.( { - resource: { - resourceType: 'CODE_REPOSITORY' - }, - permissions: ['code_repo_delete'] - }, - [space] - ) + id: SettingsTab.labels, + title: getString('labels.labels'), + panel: + } + ] return ( - + - - - { - // @typescript-eslint/no-empty-function - })}> - {formik => { - return ( - - {upgrading ? ( - - - - - - - {exportDone - ? repoCount - ? getString('exportSpace.exportCompleted') - : getString('exportSpace.exportFailed') - : getString('exportSpace.upgradeProgress')} - - - - - {exportDone ? null : } - - {exportDone ? ( - - - {repoCount - ? (stringSubstitute(getString('exportSpace.exportRepoCompleted'), { - repoCount - }) as string) - : getString('exportSpace.upgradeFailed')} - {!repoCount && ( - - - - )} - - - ) : ( - - - { - stringSubstitute(getString('exportSpace.exportRepo'), { - repoCount - }) as string - } - - - )} - - - - - ) : ( - - - - - - - {getString('exportSpace.upgradeTitle')} - - - - - - - - + + + { + setActiveTab(id) + history.replace( + routes.toCODESpaceSettings({ + space: space as string, + settingSection: id !== SpaceSettingsTab.general ? (id as string) : '' + }) ) }} - + tabList={tabListArray}> - + ) } diff --git a/web/src/services/code/index.tsx b/web/src/services/code/index.tsx index 39df460f1..b735e1cdb 100644 --- a/web/src/services/code/index.tsx +++ b/web/src/services/code/index.tsx @@ -10,20 +10,94 @@ export interface ApiFileDiffRequest { start_line?: number } -export type EnumCIStatus = string - export type EnumCheckPayloadKind = '' | 'markdown' | 'pipeline' | 'raw' export type EnumCheckStatus = 'error' | 'failure' | 'pending' | 'running' | 'success' export type EnumContentEncodingType = 'base64' | 'utf8' -export type EnumFileDiffStatus = string +export type EnumGitspaceAccessType = 'jwt_token' | 'user_credentials' | 'ssh_key' + +export type EnumGitspaceActionType = 'start' | 'stop' + +export type EnumGitspaceCodeRepoType = 'github' | 'gitlab' | 'harness_code' | 'bitbucket' | 'unknown' | 'gitness' + +export type EnumGitspaceEntityType = 'gitspace_config' | 'gitspace_instance' + +export type EnumGitspaceEventType = + | 'gitspace_action_start' + | 'gitspace_action_start_completed' + | 'gitspace_action_start_failed' + | 'gitspace_action_stop' + | 'gitspace_action_stop_completed' + | 'gitspace_action_stop_failed' + | 'fetch_devcontainer_start' + | 'fetch_devcontainer_completed' + | 'fetch_devcontainer_failed' + | 'infra_provisioning_start' + | 'infra_provisioning_completed' + | 'infra_provisioning_failed' + | 'infra_stop_start' + | 'infra_stop_completed' + | 'infra_stop_failed' + | 'infra_deprovisioning_start' + | 'infra_deprovisioning_completed' + | 'infra_deprovisioning_failed' + | 'agent_connect_start' + | 'agent_connect_completed' + | 'agent_connect_failed' + | 'agent_gitspace_creation_start' + | 'agent_gitspace_creation_completed' + | 'agent_gitspace_creation_failed' + | 'agent_gitspace_stop_start' + | 'agent_gitspace_stop_completed' + | 'agent_gitspace_stop_failed' + | 'agent_gitspace_deletion_start' + | 'agent_gitspace_deletion_completed' + | 'agent_gitspace_deletion_failed' + | 'agent_gitspace_state_report_running' + | 'agent_gitspace_state_report_error' + | 'agent_gitspace_state_report_stopped' + | 'agent_gitspace_state_report_unknown' + +export type EnumGitspaceInstanceStateType = + | 'running' + | 'uninitialized' + | 'unknown' + | 'error' + | 'deleted' + | 'starting' + | 'stopping' + +export type EnumGitspaceStateType = 'running' | 'stopped' | 'error' | 'uninitialized' | 'starting' | 'stopping' + +export type EnumIDEType = 'vs_code' | 'vs_code_web' + +export type EnumInfraProviderType = 'docker' | 'harness_gcp' | 'harness_cloud' + +export type EnumLabelColor = + | 'accent' + | 'background' + | 'blue' + | 'brown' + | 'cyan' + | 'green' + | 'indigo' + | 'lime' + | 'mint' + | 'orange' + | 'pink' + | 'purple' + | 'red' + | 'stroke' + | 'text' + | 'violet' + | 'yellow' + +export type EnumLabelType = 'dynamic' | 'static' export type EnumMembershipRole = 'contributor' | 'executor' | 'reader' | 'space_owner' -export type EnumMergeCheckStatus = string - export type EnumMergeMethod = 'merge' | 'rebase' | 'squash' export type EnumParentResourceType = 'space' | 'repo' @@ -39,8 +113,10 @@ export type EnumPullReqActivityType = | 'branch-update' | 'code-comment' | 'comment' + | 'label-modify' | 'merge' | 'review-submit' + | 'reviewer-delete' | 'state-change' | 'title-change' @@ -52,12 +128,8 @@ export type EnumPullReqReviewerType = 'assigned' | 'requested' | 'self_assigned' export type EnumPullReqState = 'closed' | 'merged' | 'open' -export type EnumResolverType = string - export type EnumRuleState = 'active' | 'disabled' | 'monitor' | null -export type EnumTokenType = string - export type EnumTriggerAction = | 'branch_created' | 'branch_updated' @@ -81,9 +153,9 @@ export type EnumWebhookTrigger = | 'pullreq_closed' | 'pullreq_comment_created' | 'pullreq_created' - | 'pullreq_updated' | 'pullreq_merged' | 'pullreq_reopened' + | 'pullreq_updated' | 'tag_created' | 'tag_deleted' | 'tag_updated' @@ -98,8 +170,11 @@ export interface GitCommit { committer?: GitSignature file_stats?: GitCommitFileStats[] message?: string - parent_shas?: ShaSHA[] - sha?: ShaSHA + parent_shas?: string[] + /** + * Git object hash + */ + sha?: string title?: string } @@ -117,10 +192,10 @@ export interface GitFileDiff { is_submodule?: boolean old_path?: string old_sha?: string - patch?: number[] + patch?: string path?: string sha?: string - status?: EnumFileDiffStatus + status?: string } export interface GitIdentity { @@ -149,6 +224,23 @@ export interface ImporterProvider { export type ImporterProviderType = 'github' | 'gitlab' | 'bitbucket' | 'stash' | 'gitea' | 'gogs' | 'azure' +export interface InfraproviderResourceInput { + cpu?: string | null + disk?: string | null + gateway_host?: string | null + gateway_port?: string | null + identifier?: string + infra_provider_type?: EnumInfraProviderType + memory?: string | null + metadata?: { + [key: string]: string + } | null + name?: string + network?: string | null + region?: string[] | null + template_identifier?: string | null +} + export interface JobProgress { failure?: string progress?: number @@ -164,6 +256,10 @@ export interface LivelogLine { time?: number } +export interface OpenapiActionGitspaceRequest { + action?: EnumGitspaceActionType +} + export interface OpenapiAdminUsersCreateRequest { display_name?: string email?: string @@ -247,6 +343,34 @@ export interface OpenapiCreateConnectorRequest { uid?: string } +export interface OpenapiCreateGitspaceRequest { + branch?: string + code_repo_ref?: string | null + code_repo_type?: EnumGitspaceCodeRepoType + code_repo_url?: string + devcontainer_path?: string | null + ide?: EnumIDEType + identifier?: string + metadata?: { + [key: string]: string + } | null + name?: string + resource_identifier?: string + resource_space_ref?: string + space_ref?: string +} + +export interface OpenapiCreateInfraProviderConfigRequest { + identifier?: string + metadata?: { + [key: string]: string + } | null + name?: string + resources?: InfraproviderResourceInput[] | null + space_ref?: string + type?: EnumInfraProviderType +} + export interface OpenapiCreatePipelineRequest { config_path?: string default_branch?: string @@ -311,7 +435,7 @@ export interface OpenapiCreateTemplateRequest { export interface OpenapiCreateTokenRequest { identifier?: string - lifetime?: TimeDuration + lifetime?: number | null uid?: string } @@ -370,6 +494,11 @@ export interface OpenapiLoginRequest { password?: string } +export interface OpenapiLookupRepoGitspaceRequest { + space_ref?: string + url?: string +} + export interface OpenapiMergePullReq { bypass_rules?: boolean dry_run?: boolean @@ -397,6 +526,12 @@ export type OpenapiPostRawDiffRequest = ApiFileDiffRequest[] | null export type OpenapiPostRawPRDiffRequest = ApiFileDiffRequest[] | null +export interface OpenapiPullReqAssignLabelInput { + label_id?: number + value?: string + value_id?: number | null +} + export interface OpenapiRegisterRequest { display_name?: string email?: string @@ -589,11 +724,11 @@ export interface ProtectionDefStatusChecks { require_identifiers?: string[] } -export type ProtectionPattern = { +export interface ProtectionPattern { default?: boolean exclude?: string[] include?: string[] -} | null +} export interface PullreqCommentApplySuggestionsOutput { commit_id?: string @@ -627,7 +762,10 @@ export interface RepoCommitFileAction { encoding?: EnumContentEncodingType path?: string payload?: string - sha?: ShaSHA + /** + * Git object hash + */ + sha?: string } export interface RepoCommitTag { @@ -648,11 +786,9 @@ export interface RepoContentInfo { name?: string path?: string sha?: string - type?: RepoContentType + type?: string } -export type RepoContentType = string - export interface RepoFileContent { data?: string data_size?: number @@ -697,6 +833,7 @@ export interface RepoRepositoryOutput { path?: string size?: number size_updated?: number + state?: number updated?: number } @@ -722,10 +859,11 @@ export interface ReposettingsSecuritySettings { secret_scanning_enabled?: boolean | null } -/** - * Git object hash - */ -export type ShaSHA = string +export interface ScmCodeRepositoryResponse { + branch?: string + is_private?: boolean + url?: string +} export interface SpaceExportProgressOutput { repos?: JobProgress[] | null @@ -754,13 +892,12 @@ export interface SpaceSpaceOutput { } export interface SystemConfigOutput { + gitspace_enabled?: boolean public_resource_creation_enabled?: boolean ssh_enabled?: boolean user_signup_allowed?: boolean } -export type TimeDuration = number | null - export interface TypesChangeStats { changes?: number deletions?: number @@ -827,7 +964,7 @@ export interface TypesCommitFileStats { insertions?: number old_path?: string path?: string - status?: EnumFileDiffStatus + status?: string } export interface TypesCommitFilesResponse { @@ -852,7 +989,9 @@ export interface TypesConnector { } export interface TypesDiffStats { + additions?: number | null commits?: number | null + deletions?: number | null files_changed?: number | null } @@ -888,7 +1027,7 @@ export interface TypesExecution { source_repo?: string stages?: TypesStage[] started?: number - status?: EnumCIStatus + status?: string target?: string timestamp?: number title?: string @@ -896,11 +1035,149 @@ export interface TypesExecution { updated?: number } +export interface TypesGitspaceConfig { + branch?: string + code_repo_ref?: string | null + code_repo_type?: EnumGitspaceCodeRepoType + code_repo_url?: string + created?: number + devcontainer_path?: string | null + ide?: EnumIDEType + identifier?: string + instance?: TypesGitspaceInstance + name?: string + resource_identifier?: string + space_path?: string + state?: EnumGitspaceStateType + updated?: number + user_id?: string +} + +export interface TypesGitspaceEventResponse { + created?: number + entity_type?: EnumGitspaceEntityType + event?: EnumGitspaceEventType + event_time?: string + message?: string + query_key?: string + timestamp?: number +} + +export interface TypesGitspaceInstance { + access_key?: string | null + access_type?: EnumGitspaceAccessType + created?: number + identifier?: string + last_used?: number + machine_user?: string | null + resource_usage?: string | null + space_path?: string + state?: EnumGitspaceInstanceStateType + total_time_used?: number + tracked_changes?: string | null + updated?: number + url?: string | null +} + export interface TypesIdentity { email?: string name?: string } +export interface TypesInfraProviderConfig { + created?: number + identifier?: string + metadata?: { + [key: string]: string + } | null + name?: string + resources?: TypesInfraProviderResource[] | null + space_path?: string + type?: EnumInfraProviderType + updated?: number +} + +export interface TypesInfraProviderResource { + config_identifier?: string + cpu?: string | null + created?: number + disk?: string | null + gateway_host?: string | null + gateway_port?: string | null + identifier?: string + infra_provider_type?: EnumInfraProviderType + memory?: string | null + metadata?: { + [key: string]: string + } | null + name?: string + network?: string | null + region?: string + space_path?: string + template_identifier?: string | null + updated?: number +} + +export interface TypesLabel { + color?: EnumLabelColor + created?: number + created_by?: number + description?: string + id?: number + key?: string + repo_id?: number | null + scope?: number + space_id?: number | null + type?: EnumLabelType + updated?: number + updated_by?: number + value_count?: number +} + +export interface TypesLabelAssignment { + assigned?: boolean | null + assigned_value?: TypesLabelValueInfo + color?: EnumLabelColor + id?: number + key?: string + scope?: number + type?: EnumLabelType + values?: TypesLabelValueInfo[] +} + +export interface TypesLabelPullReqAssignmentInfo { + color?: EnumLabelColor + id?: number + key?: string + scope?: number + value?: string | null + value_color?: EnumLabelColor + value_count?: number + value_id?: number | null +} + +export interface TypesLabelValue { + color?: EnumLabelColor + created?: number + created_by?: number + id?: number + label_id?: number + updated?: number + updated_by?: number + value?: string +} + +export interface TypesLabelValueInfo { + color?: string | null + id?: number | null + value?: string | null +} + +export interface TypesLabelWithValues { + label?: TypesLabel + values?: TypesLabelValue[] | null +} + export interface TypesListCommitResponse { commits?: TypesCommit[] | null rename_details?: TypesRenameDetails[] | null @@ -1000,8 +1277,9 @@ export interface TypesPullReq { description?: string edited?: number is_draft?: boolean + labels?: TypesLabelPullReqAssignmentInfo[] merge_base_sha?: string - merge_check_status?: EnumMergeCheckStatus + merge_check_status?: string merge_conflicts?: string[] merge_method?: EnumMergeMethod merge_target_sha?: string | null @@ -1075,6 +1353,16 @@ export interface TypesPullReqFileView { sha?: string } +export interface TypesPullReqLabel { + created?: number + created_by?: number + label_id?: number + pullreq_id?: number + updated?: number + updated_by?: number + value_id?: number | null +} + export interface TypesPullReqReviewer { added_by?: TypesPrincipalInfo created?: number @@ -1087,8 +1375,10 @@ export interface TypesPullReqReviewer { } export interface TypesPullReqStats { + additions?: number | null commits?: number | null conversations?: number + deletions?: number | null files_changed?: number | null unresolved_count?: number } @@ -1111,7 +1401,6 @@ export interface TypesRepository { git_url?: string id?: number identifier?: string - importing?: boolean is_empty?: boolean num_closed_pulls?: number num_forks?: number @@ -1122,6 +1411,7 @@ export interface TypesRepository { path?: string size?: number size_updated?: number + state?: number updated?: number } @@ -1143,11 +1433,9 @@ export interface TypesRuleInfo { repo_path?: string space_path?: string state?: EnumRuleState - type?: TypesRuleType + type?: string } -export type TypesRuleType = string - export interface TypesRuleViolations { bypassable?: boolean bypassed?: boolean @@ -1159,6 +1447,31 @@ export interface TypesRulesViolations { violations?: TypesRuleViolations[] | null } +export interface TypesSaveLabelInput { + color?: EnumLabelColor + description?: string + id?: number + key?: string + type?: EnumLabelType +} + +export interface TypesSaveLabelValueInput { + color?: EnumLabelColor + id?: number + value?: string +} + +export interface TypesScopeData { + repository?: TypesRepository + scope?: number + space?: TypesSpace +} + +export interface TypesScopesLabels { + label_data?: TypesLabelAssignment[] | null + scope_data?: TypesScopeData[] | null +} + export interface TypesSecret { created?: number created_by?: number @@ -1218,7 +1531,7 @@ export interface TypesStage { os?: string repo_id?: number started?: number - status?: EnumCIStatus + status?: string steps?: TypesStep[] stopped?: number throttle?: number @@ -1237,7 +1550,7 @@ export interface TypesStep { number?: number schema?: string started?: number - status?: EnumCIStatus + status?: string stopped?: number } @@ -1247,7 +1560,7 @@ export interface TypesTemplate { description?: string identifier?: string space_id?: number - type?: EnumResolverType + type?: string updated?: number } @@ -1257,7 +1570,7 @@ export interface TypesToken { identifier?: string issued_at?: number principal_id?: number - type?: EnumTokenType + type?: string } export interface TypesTokenResponse { @@ -1611,6 +1924,352 @@ export const useUpdateConnector = ({ connector_ref, ...props }: UseUpdateConnect { base: getConfig('code/api/v1'), pathParams: { connector_ref }, ...props } ) +export interface ListGitspacesQueryParams { + sort?: 'id' | 'created' | 'updated' + order?: 'asc' | 'desc' + page?: number + limit?: number +} + +export type ListGitspacesProps = Omit< + GetProps, + 'path' +> + +/** + * List gitspaces + */ +export const ListGitspaces = (props: ListGitspacesProps) => ( + + path={`/gitspaces`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseListGitspacesProps = Omit< + UseGetProps, + 'path' +> + +/** + * List gitspaces + */ +export const useListGitspaces = (props: UseListGitspacesProps) => + useGet(`/gitspaces`, { + base: getConfig('code/api/v1'), + ...props + }) + +export type CreateGitspaceProps = Omit< + MutateProps, + 'path' | 'verb' +> + +/** + * Create gitspace config + */ +export const CreateGitspace = (props: CreateGitspaceProps) => ( + + verb="POST" + path={`/gitspaces`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseCreateGitspaceProps = Omit< + UseMutateProps, + 'path' | 'verb' +> + +/** + * Create gitspace config + */ +export const useCreateGitspace = (props: UseCreateGitspaceProps) => + useMutate('POST', `/gitspaces`, { + base: getConfig('code/api/v1'), + ...props + }) + +export type DeleteGitspaceProps = Omit, 'path' | 'verb'> + +/** + * Delete gitspace config + */ +export const DeleteGitspace = (props: DeleteGitspaceProps) => ( + + verb="DELETE" + path={`/gitspaces`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDeleteGitspaceProps = Omit, 'path' | 'verb'> + +/** + * Delete gitspace config + */ +export const useDeleteGitspace = (props: UseDeleteGitspaceProps) => + useMutate('DELETE', `/gitspaces`, { + base: getConfig('code/api/v1'), + ...props + }) + +export interface FindGitspacePathParams { + gitspace_identifier: string +} + +export type FindGitspaceProps = Omit< + GetProps, + 'path' +> & + FindGitspacePathParams + +/** + * Get gitspace + */ +export const FindGitspace = ({ gitspace_identifier, ...props }: FindGitspaceProps) => ( + + path={`/gitspaces/${gitspace_identifier}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseFindGitspaceProps = Omit< + UseGetProps, + 'path' +> & + FindGitspacePathParams + +/** + * Get gitspace + */ +export const useFindGitspace = ({ gitspace_identifier, ...props }: UseFindGitspaceProps) => + useGet( + (paramsInPath: FindGitspacePathParams) => `/gitspaces/${paramsInPath.gitspace_identifier}`, + { base: getConfig('code/api/v1'), pathParams: { gitspace_identifier }, ...props } + ) + +export interface ActionOnGitspacePathParams { + gitspace_identifier: string +} + +export type ActionOnGitspaceProps = Omit< + MutateProps, + 'path' | 'verb' +> & + ActionOnGitspacePathParams + +/** + * Perform action on a gitspace + */ +export const ActionOnGitspace = ({ gitspace_identifier, ...props }: ActionOnGitspaceProps) => ( + + verb="POST" + path={`/gitspaces/${gitspace_identifier}/action`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseActionOnGitspaceProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + ActionOnGitspacePathParams + +/** + * Perform action on a gitspace + */ +export const useActionOnGitspace = ({ gitspace_identifier, ...props }: UseActionOnGitspaceProps) => + useMutate( + 'POST', + (paramsInPath: ActionOnGitspacePathParams) => `/gitspaces/${paramsInPath.gitspace_identifier}/action`, + { base: getConfig('code/api/v1'), pathParams: { gitspace_identifier }, ...props } + ) + +export interface ListGitspaceEventsQueryParams { + page?: number + limit?: number +} + +export interface ListGitspaceEventsPathParams { + gitspace_identifier: string +} + +export type ListGitspaceEventsProps = Omit< + GetProps, + 'path' +> & + ListGitspaceEventsPathParams + +/** + * List gitspace events + */ +export const ListGitspaceEvents = ({ gitspace_identifier, ...props }: ListGitspaceEventsProps) => ( + + path={`/gitspaces/${gitspace_identifier}/events`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseListGitspaceEventsProps = Omit< + UseGetProps< + TypesGitspaceEventResponse[], + UsererrorError, + ListGitspaceEventsQueryParams, + ListGitspaceEventsPathParams + >, + 'path' +> & + ListGitspaceEventsPathParams + +/** + * List gitspace events + */ +export const useListGitspaceEvents = ({ gitspace_identifier, ...props }: UseListGitspaceEventsProps) => + useGet( + (paramsInPath: ListGitspaceEventsPathParams) => `/gitspaces/${paramsInPath.gitspace_identifier}/events`, + { base: getConfig('code/api/v1'), pathParams: { gitspace_identifier }, ...props } + ) + +export interface OpStreamLogsPathParams { + gitspace_identifier: string +} + +export type OpStreamLogsProps = Omit, 'path'> & + OpStreamLogsPathParams + +/** + * Stream gitspace logs + */ +export const OpStreamLogs = ({ gitspace_identifier, ...props }: OpStreamLogsProps) => ( + + path={`/gitspaces/${gitspace_identifier}/logs/stream`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseOpStreamLogsProps = Omit< + UseGetProps, + 'path' +> & + OpStreamLogsPathParams + +/** + * Stream gitspace logs + */ +export const useOpStreamLogs = ({ gitspace_identifier, ...props }: UseOpStreamLogsProps) => + useGet( + (paramsInPath: OpStreamLogsPathParams) => `/gitspaces/${paramsInPath.gitspace_identifier}/logs/stream`, + { base: getConfig('code/api/v1'), pathParams: { gitspace_identifier }, ...props } + ) + +export type RepoLookupForGitspaceProps = Omit< + MutateProps, + 'path' | 'verb' +> + +/** + * Validate git repo for gitspaces + */ +export const RepoLookupForGitspace = (props: RepoLookupForGitspaceProps) => ( + + verb="POST" + path={`/gitspaces/lookup-repo`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseRepoLookupForGitspaceProps = Omit< + UseMutateProps, + 'path' | 'verb' +> + +/** + * Validate git repo for gitspaces + */ +export const useRepoLookupForGitspace = (props: UseRepoLookupForGitspaceProps) => + useMutate( + 'POST', + `/gitspaces/lookup-repo`, + { base: getConfig('code/api/v1'), ...props } + ) + +export type CreateInfraProviderProps = Omit< + MutateProps, + 'path' | 'verb' +> + +/** + * Create infraProvider config + */ +export const CreateInfraProvider = (props: CreateInfraProviderProps) => ( + + verb="POST" + path={`/infraproviders`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseCreateInfraProviderProps = Omit< + UseMutateProps, + 'path' | 'verb' +> + +/** + * Create infraProvider config + */ +export const useCreateInfraProvider = (props: UseCreateInfraProviderProps) => + useMutate( + 'POST', + `/infraproviders`, + { base: getConfig('code/api/v1'), ...props } + ) + +export interface GetInfraProviderPathParams { + infraprovider_identifier: string +} + +export type GetInfraProviderProps = Omit< + GetProps, + 'path' +> & + GetInfraProviderPathParams + +/** + * Get infraProviderConfig + */ +export const GetInfraProvider = ({ infraprovider_identifier, ...props }: GetInfraProviderProps) => ( + + path={`/infraproviders/${infraprovider_identifier}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseGetInfraProviderProps = Omit< + UseGetProps, + 'path' +> & + GetInfraProviderPathParams + +/** + * Get infraProviderConfig + */ +export const useGetInfraProvider = ({ infraprovider_identifier, ...props }: UseGetInfraProviderProps) => + useGet( + (paramsInPath: GetInfraProviderPathParams) => `/infraproviders/${paramsInPath.infraprovider_identifier}`, + { base: getConfig('code/api/v1'), pathParams: { infraprovider_identifier }, ...props } + ) + export interface OnLoginQueryParams { /** * If set to true the token is also returned as a cookie. @@ -2727,6 +3386,360 @@ export const useRawDiffPost = ({ repo_ref, range, ...props }: UseRawDiffPostProp { base: getConfig('code/api/v1'), pathParams: { repo_ref, range }, ...props } ) +export interface ListRepoLabelsQueryParams { + /** + * The page to return. + */ + page?: number + /** + * The maximum number of results to return. + */ + limit?: number + /** + * The result should inherit labels from parent parent spaces. + */ + inherited?: boolean + /** + * The substring which is used to filter the labels by their key. + */ + query?: string +} + +export interface ListRepoLabelsPathParams { + repo_ref: string +} + +export type ListRepoLabelsProps = Omit< + GetProps, + 'path' +> & + ListRepoLabelsPathParams + +export const ListRepoLabels = ({ repo_ref, ...props }: ListRepoLabelsProps) => ( + + path={`/repos/${repo_ref}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseListRepoLabelsProps = Omit< + UseGetProps, + 'path' +> & + ListRepoLabelsPathParams + +export const useListRepoLabels = ({ repo_ref, ...props }: UseListRepoLabelsProps) => + useGet( + (paramsInPath: ListRepoLabelsPathParams) => `/repos/${paramsInPath.repo_ref}/labels`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref }, ...props } + ) + +export interface DefineRepoLabelPathParams { + repo_ref: string +} + +export interface DefineRepoLabelRequestBody { + color?: EnumLabelColor + description?: string + key?: string + type?: EnumLabelType +} + +export type DefineRepoLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + DefineRepoLabelPathParams + +export const DefineRepoLabel = ({ repo_ref, ...props }: DefineRepoLabelProps) => ( + + verb="POST" + path={`/repos/${repo_ref}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDefineRepoLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + DefineRepoLabelPathParams + +export const useDefineRepoLabel = ({ repo_ref, ...props }: UseDefineRepoLabelProps) => + useMutate( + 'POST', + (paramsInPath: DefineRepoLabelPathParams) => `/repos/${paramsInPath.repo_ref}/labels`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref }, ...props } + ) + +export interface SaveRepoLabelPathParams { + repo_ref: string +} + +export interface SaveRepoLabelRequestBody { + label?: TypesSaveLabelInput + values?: TypesSaveLabelValueInput[] +} + +export type SaveRepoLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + SaveRepoLabelPathParams + +export const SaveRepoLabel = ({ repo_ref, ...props }: SaveRepoLabelProps) => ( + + verb="PUT" + path={`/repos/${repo_ref}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseSaveRepoLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + SaveRepoLabelPathParams + +export const useSaveRepoLabel = ({ repo_ref, ...props }: UseSaveRepoLabelProps) => + useMutate( + 'PUT', + (paramsInPath: SaveRepoLabelPathParams) => `/repos/${paramsInPath.repo_ref}/labels`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref }, ...props } + ) + +export interface DeleteRepoLabelPathParams { + repo_ref: string +} + +export type DeleteRepoLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + DeleteRepoLabelPathParams + +export const DeleteRepoLabel = ({ repo_ref, ...props }: DeleteRepoLabelProps) => ( + + verb="DELETE" + path={`/repos/${repo_ref}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDeleteRepoLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + DeleteRepoLabelPathParams + +export const useDeleteRepoLabel = ({ repo_ref, ...props }: UseDeleteRepoLabelProps) => + useMutate( + 'DELETE', + (paramsInPath: DeleteRepoLabelPathParams) => `/repos/${paramsInPath.repo_ref}/labels`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref }, ...props } + ) + +export interface UpdateRepoLabelPathParams { + repo_ref: string + key: string +} + +export interface UpdateRepoLabelRequestBody { + color?: EnumLabelColor + description?: string + key?: string + type?: EnumLabelType +} + +export type UpdateRepoLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + UpdateRepoLabelPathParams + +export const UpdateRepoLabel = ({ repo_ref, key, ...props }: UpdateRepoLabelProps) => ( + + verb="PATCH" + path={`/repos/${repo_ref}/labels/${key}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseUpdateRepoLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + UpdateRepoLabelPathParams + +export const useUpdateRepoLabel = ({ repo_ref, key, ...props }: UseUpdateRepoLabelProps) => + useMutate( + 'PATCH', + (paramsInPath: UpdateRepoLabelPathParams) => `/repos/${paramsInPath.repo_ref}/labels/${paramsInPath.key}`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, key }, ...props } + ) + +export interface ListRepoLabelValuesPathParams { + repo_ref: string + key: string +} + +export type ListRepoLabelValuesProps = Omit< + GetProps, + 'path' +> & + ListRepoLabelValuesPathParams + +export const ListRepoLabelValues = ({ repo_ref, key, ...props }: ListRepoLabelValuesProps) => ( + + path={`/repos/${repo_ref}/labels/${key}/values`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseListRepoLabelValuesProps = Omit< + UseGetProps, + 'path' +> & + ListRepoLabelValuesPathParams + +export const useListRepoLabelValues = ({ repo_ref, key, ...props }: UseListRepoLabelValuesProps) => + useGet( + (paramsInPath: ListRepoLabelValuesPathParams) => + `/repos/${paramsInPath.repo_ref}/labels/${paramsInPath.key}/values`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, key }, ...props } + ) + +export interface DefineRepoLabelValuePathParams { + repo_ref: string + key: string +} + +export interface DefineRepoLabelValueRequestBody { + color?: EnumLabelColor + value?: string +} + +export type DefineRepoLabelValueProps = Omit< + MutateProps, + 'path' | 'verb' +> & + DefineRepoLabelValuePathParams + +export const DefineRepoLabelValue = ({ repo_ref, key, ...props }: DefineRepoLabelValueProps) => ( + + verb="POST" + path={`/repos/${repo_ref}/labels/${key}/values`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDefineRepoLabelValueProps = Omit< + UseMutateProps< + TypesLabelValue, + UsererrorError, + void, + DefineRepoLabelValueRequestBody, + DefineRepoLabelValuePathParams + >, + 'path' | 'verb' +> & + DefineRepoLabelValuePathParams + +export const useDefineRepoLabelValue = ({ repo_ref, key, ...props }: UseDefineRepoLabelValueProps) => + useMutate( + 'POST', + (paramsInPath: DefineRepoLabelValuePathParams) => + `/repos/${paramsInPath.repo_ref}/labels/${paramsInPath.key}/values`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, key }, ...props } + ) + +export interface DeleteRepoLabelValuePathParams { + repo_ref: string + key: string +} + +export type DeleteRepoLabelValueProps = Omit< + MutateProps, + 'path' | 'verb' +> & + DeleteRepoLabelValuePathParams + +export const DeleteRepoLabelValue = ({ repo_ref, key, ...props }: DeleteRepoLabelValueProps) => ( + + verb="DELETE" + path={`/repos/${repo_ref}/labels/${key}/values`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDeleteRepoLabelValueProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + DeleteRepoLabelValuePathParams + +export const useDeleteRepoLabelValue = ({ repo_ref, key, ...props }: UseDeleteRepoLabelValueProps) => + useMutate( + 'DELETE', + (paramsInPath: DeleteRepoLabelValuePathParams) => + `/repos/${paramsInPath.repo_ref}/labels/${paramsInPath.key}/values`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, key }, ...props } + ) + +export interface UpdateRepoLabelValuePathParams { + repo_ref: string + key: string + value: string +} + +export interface UpdateRepoLabelValueRequestBody { + color?: EnumLabelColor + value?: string +} + +export type UpdateRepoLabelValueProps = Omit< + MutateProps, + 'path' | 'verb' +> & + UpdateRepoLabelValuePathParams + +export const UpdateRepoLabelValue = ({ repo_ref, key, value, ...props }: UpdateRepoLabelValueProps) => ( + + verb="PATCH" + path={`/repos/${repo_ref}/labels/${key}/values/${value}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseUpdateRepoLabelValueProps = Omit< + UseMutateProps< + TypesLabelValue, + UsererrorError, + void, + UpdateRepoLabelValueRequestBody, + UpdateRepoLabelValuePathParams + >, + 'path' | 'verb' +> & + UpdateRepoLabelValuePathParams + +export const useUpdateRepoLabelValue = ({ repo_ref, key, value, ...props }: UseUpdateRepoLabelValueProps) => + useMutate( + 'PATCH', + (paramsInPath: UpdateRepoLabelValuePathParams) => + `/repos/${paramsInPath.repo_ref}/labels/${paramsInPath.key}/values/${paramsInPath.value}`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, key, value }, ...props } + ) + export interface MergeCheckQueryParams { /** * provide path for diff operation @@ -3611,6 +4624,14 @@ export interface ListPullReqQueryParams { * The maximum number of results to return. */ limit?: number + /** + * List of label ids used to filter pull requests. + */ + label_id?: number[] + /** + * List of label value ids used to filter pull requests. + */ + value_id?: number[] } export interface ListPullReqPathParams { @@ -3746,8 +4767,10 @@ export interface ListPullReqActivitiesQueryParams { | 'branch-update' | 'code-comment' | 'comment' + | 'label-modify' | 'merge' | 'review-submit' + | 'reviewer-delete' | 'state-change' | 'title-change' )[] @@ -4382,6 +5405,125 @@ export const useFileViewDeletePullReq = ({ repo_ref, pullreq_number, ...props }: { base: getConfig('code/api/v1'), pathParams: { repo_ref, pullreq_number }, ...props } ) +export interface ListLabelsQueryParams { + /** + * The page to return. + */ + page?: number + /** + * The maximum number of results to return. + */ + limit?: number + /** + * The result should contain all labels assignable to the pullreq. + */ + assignable?: boolean + /** + * The substring which is used to filter the labels by their key. + */ + query?: string +} + +export interface ListLabelsPathParams { + repo_ref: string + pullreq_number: number +} + +export type ListLabelsProps = Omit< + GetProps, + 'path' +> & + ListLabelsPathParams + +export const ListLabels = ({ repo_ref, pullreq_number, ...props }: ListLabelsProps) => ( + + path={`/repos/${repo_ref}/pullreq/${pullreq_number}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseListLabelsProps = Omit< + UseGetProps, + 'path' +> & + ListLabelsPathParams + +export const useListLabels = ({ repo_ref, pullreq_number, ...props }: UseListLabelsProps) => + useGet( + (paramsInPath: ListLabelsPathParams) => + `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/labels`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, pullreq_number }, ...props } + ) + +export interface AssignLabelPathParams { + repo_ref: string + pullreq_number: number +} + +export type AssignLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + AssignLabelPathParams + +export const AssignLabel = ({ repo_ref, pullreq_number, ...props }: AssignLabelProps) => ( + + verb="PUT" + path={`/repos/${repo_ref}/pullreq/${pullreq_number}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseAssignLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + AssignLabelPathParams + +export const useAssignLabel = ({ repo_ref, pullreq_number, ...props }: UseAssignLabelProps) => + useMutate( + 'PUT', + (paramsInPath: AssignLabelPathParams) => + `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/labels`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, pullreq_number }, ...props } + ) + +export interface UnassignLabelPathParams { + repo_ref: string + pullreq_number: number +} + +export type UnassignLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + UnassignLabelPathParams + +export const UnassignLabel = ({ repo_ref, pullreq_number, ...props }: UnassignLabelProps) => ( + + verb="DELETE" + path={`/repos/${repo_ref}/pullreq/${pullreq_number}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseUnassignLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + UnassignLabelPathParams + +export const useUnassignLabel = ({ repo_ref, pullreq_number, ...props }: UseUnassignLabelProps) => + useMutate( + 'DELETE', + (paramsInPath: UnassignLabelPathParams) => + `/repos/${paramsInPath.repo_ref}/pullreq/${paramsInPath.pullreq_number}/labels`, + { base: getConfig('code/api/v1'), pathParams: { repo_ref, pullreq_number }, ...props } + ) + export interface MergePullReqOpPathParams { repo_ref: string pullreq_number: number @@ -6081,6 +7223,360 @@ export const useExportProgressSpace = ({ space_ref, ...props }: UseExportProgres { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } ) +export interface ListSpaceLabelsQueryParams { + /** + * The page to return. + */ + page?: number + /** + * The maximum number of results to return. + */ + limit?: number + /** + * The result should inherit labels from parent parent spaces. + */ + inherited?: boolean + /** + * The substring which is used to filter the labels by their key. + */ + query?: string +} + +export interface ListSpaceLabelsPathParams { + space_ref: string +} + +export type ListSpaceLabelsProps = Omit< + GetProps, + 'path' +> & + ListSpaceLabelsPathParams + +export const ListSpaceLabels = ({ space_ref, ...props }: ListSpaceLabelsProps) => ( + + path={`/spaces/${space_ref}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseListSpaceLabelsProps = Omit< + UseGetProps, + 'path' +> & + ListSpaceLabelsPathParams + +export const useListSpaceLabels = ({ space_ref, ...props }: UseListSpaceLabelsProps) => + useGet( + (paramsInPath: ListSpaceLabelsPathParams) => `/spaces/${paramsInPath.space_ref}/labels`, + { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } + ) + +export interface DefineSpaceLabelPathParams { + space_ref: string +} + +export interface DefineSpaceLabelRequestBody { + color?: EnumLabelColor + description?: string + key?: string + type?: EnumLabelType +} + +export type DefineSpaceLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + DefineSpaceLabelPathParams + +export const DefineSpaceLabel = ({ space_ref, ...props }: DefineSpaceLabelProps) => ( + + verb="POST" + path={`/spaces/${space_ref}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDefineSpaceLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + DefineSpaceLabelPathParams + +export const useDefineSpaceLabel = ({ space_ref, ...props }: UseDefineSpaceLabelProps) => + useMutate( + 'POST', + (paramsInPath: DefineSpaceLabelPathParams) => `/spaces/${paramsInPath.space_ref}/labels`, + { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } + ) + +export interface SaveSpaceLabelPathParams { + space_ref: string +} + +export interface SaveSpaceLabelRequestBody { + label?: TypesSaveLabelInput + values?: TypesSaveLabelValueInput[] +} + +export type SaveSpaceLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + SaveSpaceLabelPathParams + +export const SaveSpaceLabel = ({ space_ref, ...props }: SaveSpaceLabelProps) => ( + + verb="PUT" + path={`/spaces/${space_ref}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseSaveSpaceLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + SaveSpaceLabelPathParams + +export const useSaveSpaceLabel = ({ space_ref, ...props }: UseSaveSpaceLabelProps) => + useMutate( + 'PUT', + (paramsInPath: SaveSpaceLabelPathParams) => `/spaces/${paramsInPath.space_ref}/labels`, + { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } + ) + +export interface DeleteSpaceLabelPathParams { + space_ref: string +} + +export type DeleteSpaceLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + DeleteSpaceLabelPathParams + +export const DeleteSpaceLabel = ({ space_ref, ...props }: DeleteSpaceLabelProps) => ( + + verb="DELETE" + path={`/spaces/${space_ref}/labels`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDeleteSpaceLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + DeleteSpaceLabelPathParams + +export const useDeleteSpaceLabel = ({ space_ref, ...props }: UseDeleteSpaceLabelProps) => + useMutate( + 'DELETE', + (paramsInPath: DeleteSpaceLabelPathParams) => `/spaces/${paramsInPath.space_ref}/labels`, + { base: getConfig('code/api/v1'), pathParams: { space_ref }, ...props } + ) + +export interface UpdateSpaceLabelPathParams { + space_ref: string + key: string +} + +export interface UpdateSpaceLabelRequestBody { + color?: EnumLabelColor + description?: string + key?: string + type?: EnumLabelType +} + +export type UpdateSpaceLabelProps = Omit< + MutateProps, + 'path' | 'verb' +> & + UpdateSpaceLabelPathParams + +export const UpdateSpaceLabel = ({ space_ref, key, ...props }: UpdateSpaceLabelProps) => ( + + verb="PATCH" + path={`/spaces/${space_ref}/labels/${key}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseUpdateSpaceLabelProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + UpdateSpaceLabelPathParams + +export const useUpdateSpaceLabel = ({ space_ref, key, ...props }: UseUpdateSpaceLabelProps) => + useMutate( + 'PATCH', + (paramsInPath: UpdateSpaceLabelPathParams) => `/spaces/${paramsInPath.space_ref}/labels/${paramsInPath.key}`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, key }, ...props } + ) + +export interface ListSpaceLabelValuesPathParams { + space_ref: string + key: string +} + +export type ListSpaceLabelValuesProps = Omit< + GetProps, + 'path' +> & + ListSpaceLabelValuesPathParams + +export const ListSpaceLabelValues = ({ space_ref, key, ...props }: ListSpaceLabelValuesProps) => ( + + path={`/spaces/${space_ref}/labels/${key}/values`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseListSpaceLabelValuesProps = Omit< + UseGetProps, + 'path' +> & + ListSpaceLabelValuesPathParams + +export const useListSpaceLabelValues = ({ space_ref, key, ...props }: UseListSpaceLabelValuesProps) => + useGet( + (paramsInPath: ListSpaceLabelValuesPathParams) => + `/spaces/${paramsInPath.space_ref}/labels/${paramsInPath.key}/values`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, key }, ...props } + ) + +export interface DefineSpaceLabelValuePathParams { + space_ref: string + key: string +} + +export interface DefineSpaceLabelValueRequestBody { + color?: EnumLabelColor + value?: string +} + +export type DefineSpaceLabelValueProps = Omit< + MutateProps, + 'path' | 'verb' +> & + DefineSpaceLabelValuePathParams + +export const DefineSpaceLabelValue = ({ space_ref, key, ...props }: DefineSpaceLabelValueProps) => ( + + verb="POST" + path={`/spaces/${space_ref}/labels/${key}/values`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDefineSpaceLabelValueProps = Omit< + UseMutateProps< + TypesLabelValue, + UsererrorError, + void, + DefineSpaceLabelValueRequestBody, + DefineSpaceLabelValuePathParams + >, + 'path' | 'verb' +> & + DefineSpaceLabelValuePathParams + +export const useDefineSpaceLabelValue = ({ space_ref, key, ...props }: UseDefineSpaceLabelValueProps) => + useMutate( + 'POST', + (paramsInPath: DefineSpaceLabelValuePathParams) => + `/spaces/${paramsInPath.space_ref}/labels/${paramsInPath.key}/values`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, key }, ...props } + ) + +export interface DeleteSpaceLabelValuePathParams { + space_ref: string + key: string +} + +export type DeleteSpaceLabelValueProps = Omit< + MutateProps, + 'path' | 'verb' +> & + DeleteSpaceLabelValuePathParams + +export const DeleteSpaceLabelValue = ({ space_ref, key, ...props }: DeleteSpaceLabelValueProps) => ( + + verb="DELETE" + path={`/spaces/${space_ref}/labels/${key}/values`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseDeleteSpaceLabelValueProps = Omit< + UseMutateProps, + 'path' | 'verb' +> & + DeleteSpaceLabelValuePathParams + +export const useDeleteSpaceLabelValue = ({ space_ref, key, ...props }: UseDeleteSpaceLabelValueProps) => + useMutate( + 'DELETE', + (paramsInPath: DeleteSpaceLabelValuePathParams) => + `/spaces/${paramsInPath.space_ref}/labels/${paramsInPath.key}/values`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, key }, ...props } + ) + +export interface UpdateSpaceLabelValuePathParams { + space_ref: string + key: string + value: string +} + +export interface UpdateSpaceLabelValueRequestBody { + color?: EnumLabelColor + value?: string +} + +export type UpdateSpaceLabelValueProps = Omit< + MutateProps, + 'path' | 'verb' +> & + UpdateSpaceLabelValuePathParams + +export const UpdateSpaceLabelValue = ({ space_ref, key, value, ...props }: UpdateSpaceLabelValueProps) => ( + + verb="PATCH" + path={`/spaces/${space_ref}/labels/${key}/values/${value}`} + base={getConfig('code/api/v1')} + {...props} + /> +) + +export type UseUpdateSpaceLabelValueProps = Omit< + UseMutateProps< + TypesLabelValue, + UsererrorError, + void, + UpdateSpaceLabelValueRequestBody, + UpdateSpaceLabelValuePathParams + >, + 'path' | 'verb' +> & + UpdateSpaceLabelValuePathParams + +export const useUpdateSpaceLabelValue = ({ space_ref, key, value, ...props }: UseUpdateSpaceLabelValueProps) => + useMutate( + 'PATCH', + (paramsInPath: UpdateSpaceLabelValuePathParams) => + `/spaces/${paramsInPath.space_ref}/labels/${paramsInPath.key}/values/${paramsInPath.value}`, + { base: getConfig('code/api/v1'), pathParams: { space_ref, key, value }, ...props } + ) + export interface MembershipListQueryParams { /** * The substring by which the space members are filtered. diff --git a/web/src/services/code/swagger.yaml b/web/src/services/code/swagger.yaml index 44eff3ab9..d58f5bbf5 100644 --- a/web/src/services/code/swagger.yaml +++ b/web/src/services/code/swagger.yaml @@ -408,6 +408,441 @@ paths: description: Internal Server Error tags: - connector + /gitspaces: + get: + operationId: listGitspaces + parameters: + - in: query + name: sort + schema: + enum: + - id + - created + - updated + type: string + - in: query + name: order + schema: + enum: + - asc + - desc + type: string + - in: query + name: page + schema: + default: 1 + type: integer + - in: query + name: limit + schema: + default: 30 + type: integer + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TypesGitspaceConfig' + type: array + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: List gitspaces + tags: + - gitspaces + post: + operationId: createGitspace + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiCreateGitspaceRequest' + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesGitspaceConfig' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: Create gitspace config + tags: + - gitspaces + /gitspaces/{gitspace_identifier}: + delete: + operationId: deleteGitspace + parameters: + - in: path + name: gitspace_identifier + required: true + schema: + type: string + responses: + '204': + description: No Content + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: Delete gitspace config + tags: + - gitspaces + get: + operationId: findGitspace + parameters: + - in: path + name: gitspace_identifier + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesGitspaceConfig' + description: OK + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: Get gitspace + tags: + - gitspaces + /gitspaces/{gitspace_identifier}/action: + post: + operationId: actionOnGitspace + parameters: + - in: path + name: gitspace_identifier + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiActionGitspaceRequest' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesGitspaceConfig' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: Perform action on a gitspace + tags: + - gitspaces + /gitspaces/{gitspace_identifier}/events: + get: + operationId: listGitspaceEvents + parameters: + - in: query + name: page + schema: + default: 1 + type: integer + - in: query + name: limit + schema: + default: 30 + type: integer + - in: path + name: gitspace_identifier + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TypesGitspaceEventResponse' + type: array + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: List gitspace events + tags: + - gitspaces + /gitspaces/{gitspace_identifier}/logs/stream: + get: + operationId: opStreamLogs + parameters: + - in: path + name: gitspace_identifier + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/LivelogLine' + type: array + text/event-stream: + schema: + type: string + description: OK + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: Stream gitspace logs + tags: + - gitspaces + /gitspaces/lookup-repo: + post: + operationId: repoLookupForGitspace + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiLookupRepoGitspaceRequest' + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ScmCodeRepositoryResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: Validate git repo for gitspaces + tags: + - gitspaces + /infraproviders: + post: + operationId: createInfraProvider + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiCreateInfraProviderConfigRequest' + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesInfraProviderConfig' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: Create infraProvider config + tags: + - infraproviders + /infraproviders/{infraprovider_identifier}: + get: + operationId: getInfraProvider + parameters: + - in: path + name: infraprovider_identifier + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesInfraProviderConfig' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + summary: Get infraProviderConfig + tags: + - infraproviders /login: post: operationId: onLogin @@ -2040,6 +2475,559 @@ paths: description: Internal Server Error tags: - repository + /repos/{repo_ref}/labels: + get: + operationId: listRepoLabels + parameters: + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The maximum number of results to return. + in: query + name: limit + required: false + schema: + default: 30 + maximum: 100 + minimum: 1 + type: integer + - description: The result should inherit labels from parent parent spaces. + in: query + name: inherited + required: false + schema: + default: false + type: boolean + - description: The substring which is used to filter the labels by their key. + in: query + name: query + required: false + schema: + type: string + - in: path + name: repo_ref + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TypesLabel' + type: array + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository + post: + operationId: defineRepoLabel + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + description: + type: string + key: + type: string + type: + $ref: '#/components/schemas/EnumLabelType' + type: object + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabel' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository + put: + operationId: saveRepoLabel + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + label: + $ref: '#/components/schemas/TypesSaveLabelInput' + values: + items: + $ref: '#/components/schemas/TypesSaveLabelValueInput' + type: array + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabelWithValues' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository + /repos/{repo_ref}/labels/{key}: + delete: + operationId: deleteRepoLabel + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository + patch: + operationId: updateRepoLabel + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + description: + type: string + key: + type: string + type: + $ref: '#/components/schemas/EnumLabelType' + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabel' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository + /repos/{repo_ref}/labels/{key}/values: + get: + operationId: listRepoLabelValues + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TypesLabelValue' + type: array + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository + post: + operationId: defineRepoLabelValue + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + value: + type: string + type: object + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabelValue' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository + /repos/{repo_ref}/labels/{key}/values/{value}: + delete: + operationId: deleteRepoLabelValue + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + - in: path + name: value + required: true + schema: + type: string + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository + patch: + operationId: updateRepoLabelValue + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + - in: path + name: value + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + value: + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabelValue' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - repository /repos/{repo_ref}/merge-check/{range}: post: operationId: mergeCheck @@ -3297,6 +4285,26 @@ paths: maximum: 100 minimum: 1 type: integer + - description: List of label ids used to filter pull requests. + explode: true + in: query + name: label_id + required: false + schema: + items: + type: integer + type: array + style: form + - description: List of label value ids used to filter pull requests. + explode: true + in: query + name: value_id + required: false + schema: + items: + type: integer + type: array + style: form - in: path name: repo_ref required: true @@ -3508,8 +4516,10 @@ paths: - branch-update - code-comment - comment + - label-modify - merge - review-submit + - reviewer-delete - state-change - title-change type: string @@ -4293,6 +5303,182 @@ paths: description: Internal Server Error tags: - pullreq + /repos/{repo_ref}/pullreq/{pullreq_number}/labels: + get: + operationId: listLabels + parameters: + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The maximum number of results to return. + in: query + name: limit + required: false + schema: + default: 30 + maximum: 100 + minimum: 1 + type: integer + - description: The result should contain all labels assignable to the pullreq. + in: query + name: assignable + required: false + schema: + default: false + type: boolean + - description: The substring which is used to filter the labels by their key. + in: query + name: query + required: false + schema: + type: string + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: pullreq_number + required: true + schema: + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesScopesLabels' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - pullreq + put: + operationId: assignLabel + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: pullreq_number + required: true + schema: + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenapiPullReqAssignLabelInput' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesPullReqLabel' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - pullreq + /repos/{repo_ref}/pullreq/{pullreq_number}/labels/{label_id}: + delete: + operationId: unassignLabel + parameters: + - in: path + name: repo_ref + required: true + schema: + type: string + - in: path + name: pullreq_number + required: true + schema: + type: integer + - in: path + name: label_id + required: true + schema: + type: integer + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - pullreq /repos/{repo_ref}/pullreq/{pullreq_number}/merge: post: operationId: mergePullReqOp @@ -6773,6 +7959,559 @@ paths: description: Internal Server Error tags: - space + /spaces/{space_ref}/labels: + get: + operationId: listSpaceLabels + parameters: + - description: The page to return. + in: query + name: page + required: false + schema: + default: 1 + minimum: 1 + type: integer + - description: The maximum number of results to return. + in: query + name: limit + required: false + schema: + default: 30 + maximum: 100 + minimum: 1 + type: integer + - description: The result should inherit labels from parent parent spaces. + in: query + name: inherited + required: false + schema: + default: false + type: boolean + - description: The substring which is used to filter the labels by their key. + in: query + name: query + required: false + schema: + type: string + - in: path + name: space_ref + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TypesLabel' + type: array + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - space + post: + operationId: defineSpaceLabel + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + description: + type: string + key: + type: string + type: + $ref: '#/components/schemas/EnumLabelType' + type: object + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabel' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - space + put: + operationId: saveSpaceLabel + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + label: + $ref: '#/components/schemas/TypesSaveLabelInput' + values: + items: + $ref: '#/components/schemas/TypesSaveLabelValueInput' + type: array + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabelWithValues' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - space + /spaces/{space_ref}/labels/{key}: + delete: + operationId: deleteSpaceLabel + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - space + patch: + operationId: updateSpaceLabel + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + description: + type: string + key: + type: string + type: + $ref: '#/components/schemas/EnumLabelType' + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabel' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - space + /spaces/{space_ref}/labels/{key}/values: + get: + operationId: listSpaceLabelValues + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TypesLabelValue' + type: array + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - space + post: + operationId: defineSpaceLabelValue + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + value: + type: string + type: object + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabelValue' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - space + /spaces/{space_ref}/labels/{key}/values/{value}: + delete: + operationId: deleteSpaceLabelValue + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + - in: path + name: value + required: true + schema: + type: string + responses: + '204': + description: No Content + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - space + patch: + operationId: updateSpaceLabelValue + parameters: + - in: path + name: space_ref + required: true + schema: + type: string + - in: path + name: key + required: true + schema: + type: string + - in: path + name: value + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + value: + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypesLabelValue' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Bad Request + '401': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Unauthorized + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Not Found + '500': + content: + application/json: + schema: + $ref: '#/components/schemas/UsererrorError' + description: Internal Server Error + tags: + - space /spaces/{space_ref}/members: get: operationId: membershipList @@ -7998,8 +9737,6 @@ components: start_line: type: integer type: object - EnumCIStatus: - type: string EnumCheckPayloadKind: enum: - '' @@ -8020,7 +9757,122 @@ components: - base64 - utf8 type: string - EnumFileDiffStatus: + EnumGitspaceAccessType: + enum: + - jwt_token + - user_credentials + - ssh_key + type: string + EnumGitspaceActionType: + enum: + - start + - stop + type: string + EnumGitspaceCodeRepoType: + enum: + - github + - gitlab + - harness_code + - bitbucket + - unknown + - gitness + type: string + EnumGitspaceEntityType: + enum: + - gitspace_config + - gitspace_instance + type: string + EnumGitspaceEventType: + enum: + - gitspace_action_start + - gitspace_action_start_completed + - gitspace_action_start_failed + - gitspace_action_stop + - gitspace_action_stop_completed + - gitspace_action_stop_failed + - fetch_devcontainer_start + - fetch_devcontainer_completed + - fetch_devcontainer_failed + - infra_provisioning_start + - infra_provisioning_completed + - infra_provisioning_failed + - infra_stop_start + - infra_stop_completed + - infra_stop_failed + - infra_deprovisioning_start + - infra_deprovisioning_completed + - infra_deprovisioning_failed + - agent_connect_start + - agent_connect_completed + - agent_connect_failed + - agent_gitspace_creation_start + - agent_gitspace_creation_completed + - agent_gitspace_creation_failed + - agent_gitspace_stop_start + - agent_gitspace_stop_completed + - agent_gitspace_stop_failed + - agent_gitspace_deletion_start + - agent_gitspace_deletion_completed + - agent_gitspace_deletion_failed + - agent_gitspace_state_report_running + - agent_gitspace_state_report_error + - agent_gitspace_state_report_stopped + - agent_gitspace_state_report_unknown + type: string + EnumGitspaceInstanceStateType: + enum: + - running + - uninitialized + - unknown + - error + - deleted + - starting + - stopping + type: string + EnumGitspaceStateType: + enum: + - running + - stopped + - error + - uninitialized + - starting + - stopping + type: string + EnumIDEType: + enum: + - vs_code + - vs_code_web + type: string + EnumInfraProviderType: + enum: + - docker + - harness_gcp + - harness_cloud + type: string + EnumLabelColor: + enum: + - accent + - background + - blue + - brown + - cyan + - green + - indigo + - lime + - mint + - orange + - pink + - purple + - red + - stroke + - text + - violet + - yellow + type: string + EnumLabelType: + enum: + - dynamic + - static type: string EnumMembershipRole: enum: @@ -8029,8 +9881,6 @@ components: - reader - space_owner type: string - EnumMergeCheckStatus: - type: string EnumMergeMethod: enum: - merge @@ -8064,8 +9914,10 @@ components: - branch-update - code-comment - comment + - label-modify - merge - review-submit + - reviewer-delete - state-change - title-change type: string @@ -8093,8 +9945,6 @@ components: - merged - open type: string - EnumResolverType: - type: string EnumRuleState: enum: - active @@ -8102,8 +9952,6 @@ components: - monitor nullable: true type: string - EnumTokenType: - type: string EnumTriggerAction: enum: - branch_created @@ -8139,6 +9987,7 @@ components: - pullreq_created - pullreq_merged - pullreq_reopened + - pullreq_updated - tag_created - tag_deleted - tag_updated @@ -8167,10 +10016,12 @@ components: type: string parent_shas: items: - $ref: '#/components/schemas/ShaSHA' + description: Git object hash + type: string type: array sha: - $ref: '#/components/schemas/ShaSHA' + description: Git object hash + type: string title: type: string type: object @@ -8201,16 +10052,14 @@ components: old_sha: type: string patch: - items: - minimum: 0 - type: integer - type: array + format: base64 + type: string path: type: string sha: type: string status: - $ref: '#/components/schemas/EnumFileDiffStatus' + type: string type: object GitIdentity: properties: @@ -8260,6 +10109,46 @@ components: - gogs - azure type: string + InfraproviderResourceInput: + properties: + cpu: + nullable: true + type: string + disk: + nullable: true + type: string + gateway_host: + nullable: true + type: string + gateway_port: + nullable: true + type: string + identifier: + type: string + infra_provider_type: + $ref: '#/components/schemas/EnumInfraProviderType' + memory: + nullable: true + type: string + metadata: + additionalProperties: + type: string + nullable: true + type: object + name: + type: string + network: + nullable: true + type: string + region: + items: + type: string + nullable: true + type: array + template_identifier: + nullable: true + type: string + type: object JobProgress: properties: failure: @@ -8288,6 +10177,11 @@ components: time: type: integer type: object + OpenapiActionGitspaceRequest: + properties: + action: + $ref: '#/components/schemas/EnumGitspaceActionType' + type: object OpenapiAdminUsersCreateRequest: properties: display_name: @@ -8440,6 +10334,59 @@ components: deprecated: true type: string type: object + OpenapiCreateGitspaceRequest: + properties: + branch: + type: string + code_repo_ref: + nullable: true + type: string + code_repo_type: + $ref: '#/components/schemas/EnumGitspaceCodeRepoType' + code_repo_url: + type: string + devcontainer_path: + nullable: true + type: string + ide: + $ref: '#/components/schemas/EnumIDEType' + identifier: + type: string + metadata: + additionalProperties: + type: string + nullable: true + type: object + name: + type: string + resource_identifier: + type: string + resource_space_ref: + type: string + space_ref: + type: string + type: object + OpenapiCreateInfraProviderConfigRequest: + properties: + identifier: + type: string + metadata: + additionalProperties: + type: string + nullable: true + type: object + name: + type: string + resources: + items: + $ref: '#/components/schemas/InfraproviderResourceInput' + nullable: true + type: array + space_ref: + type: string + type: + $ref: '#/components/schemas/EnumInfraProviderType' + type: object OpenapiCreatePipelineRequest: properties: config_path: @@ -8553,7 +10500,8 @@ components: identifier: type: string lifetime: - $ref: '#/components/schemas/TimeDuration' + nullable: true + type: integer uid: deprecated: true type: string @@ -8656,6 +10604,13 @@ components: password: type: string type: object + OpenapiLookupRepoGitspaceRequest: + properties: + space_ref: + type: string + url: + type: string + type: object OpenapiMergePullReq: properties: bypass_rules: @@ -8709,6 +10664,16 @@ components: $ref: '#/components/schemas/ApiFileDiffRequest' nullable: true type: array + OpenapiPullReqAssignLabelInput: + properties: + label_id: + type: integer + value: + type: string + value_id: + nullable: true + type: integer + type: object OpenapiRegisterRequest: properties: display_name: @@ -9064,7 +11029,6 @@ components: type: array type: object ProtectionPattern: - nullable: true properties: default: type: boolean @@ -9129,7 +11093,8 @@ components: payload: type: string sha: - $ref: '#/components/schemas/ShaSHA' + description: Git object hash + type: string type: object RepoCommitTag: properties: @@ -9160,10 +11125,8 @@ components: sha: type: string type: - $ref: '#/components/schemas/RepoContentType' + type: string type: object - RepoContentType: - type: string RepoFileContent: properties: data: @@ -9250,6 +11213,8 @@ components: type: integer size_updated: type: integer + state: + type: integer updated: type: integer type: object @@ -9284,9 +11249,15 @@ components: nullable: true type: boolean type: object - ShaSHA: - description: Git object hash - type: string + ScmCodeRepositoryResponse: + properties: + branch: + type: string + is_private: + type: boolean + url: + type: string + type: object SpaceExportProgressOutput: properties: repos: @@ -9339,6 +11310,8 @@ components: type: object SystemConfigOutput: properties: + gitspace_enabled: + type: boolean public_resource_creation_enabled: type: boolean ssh_enabled: @@ -9346,9 +11319,6 @@ components: user_signup_allowed: type: boolean type: object - TimeDuration: - nullable: true - type: integer TypesChangeStats: properties: changes: @@ -9470,7 +11440,7 @@ components: path: type: string status: - $ref: '#/components/schemas/EnumFileDiffStatus' + type: string type: object TypesCommitFilesResponse: properties: @@ -9511,9 +11481,15 @@ components: type: object TypesDiffStats: properties: + additions: + nullable: true + type: integer commits: nullable: true type: integer + deletions: + nullable: true + type: integer files_changed: nullable: true type: integer @@ -9583,7 +11559,7 @@ components: started: type: integer status: - $ref: '#/components/schemas/EnumCIStatus' + type: string target: type: string timestamp: @@ -9595,6 +11571,92 @@ components: updated: type: integer type: object + TypesGitspaceConfig: + properties: + branch: + type: string + code_repo_ref: + nullable: true + type: string + code_repo_type: + $ref: '#/components/schemas/EnumGitspaceCodeRepoType' + code_repo_url: + type: string + created: + type: integer + devcontainer_path: + nullable: true + type: string + ide: + $ref: '#/components/schemas/EnumIDEType' + identifier: + type: string + instance: + $ref: '#/components/schemas/TypesGitspaceInstance' + name: + type: string + resource_identifier: + type: string + space_path: + type: string + state: + $ref: '#/components/schemas/EnumGitspaceStateType' + updated: + type: integer + user_id: + type: string + type: object + TypesGitspaceEventResponse: + properties: + created: + type: integer + entity_type: + $ref: '#/components/schemas/EnumGitspaceEntityType' + event: + $ref: '#/components/schemas/EnumGitspaceEventType' + event_time: + type: string + message: + type: string + query_key: + type: string + timestamp: + type: integer + type: object + TypesGitspaceInstance: + properties: + access_key: + nullable: true + type: string + access_type: + $ref: '#/components/schemas/EnumGitspaceAccessType' + created: + type: integer + identifier: + type: string + last_used: + type: integer + machine_user: + nullable: true + type: string + resource_usage: + nullable: true + type: string + space_path: + type: string + state: + $ref: '#/components/schemas/EnumGitspaceInstanceStateType' + total_time_used: + type: integer + tracked_changes: + nullable: true + type: string + updated: + type: integer + url: + nullable: true + type: string + type: object TypesIdentity: properties: email: @@ -9602,6 +11664,191 @@ components: name: type: string type: object + TypesInfraProviderConfig: + properties: + created: + type: integer + identifier: + type: string + metadata: + additionalProperties: + type: string + nullable: true + type: object + name: + type: string + resources: + items: + $ref: '#/components/schemas/TypesInfraProviderResource' + nullable: true + type: array + space_path: + type: string + type: + $ref: '#/components/schemas/EnumInfraProviderType' + updated: + type: integer + type: object + TypesInfraProviderResource: + properties: + config_identifier: + type: string + cpu: + nullable: true + type: string + created: + type: integer + disk: + nullable: true + type: string + gateway_host: + nullable: true + type: string + gateway_port: + nullable: true + type: string + identifier: + type: string + infra_provider_type: + $ref: '#/components/schemas/EnumInfraProviderType' + memory: + nullable: true + type: string + metadata: + additionalProperties: + type: string + nullable: true + type: object + name: + type: string + network: + nullable: true + type: string + region: + type: string + space_path: + type: string + template_identifier: + nullable: true + type: string + updated: + type: integer + type: object + TypesLabel: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + created: + type: integer + created_by: + type: integer + description: + type: string + id: + type: integer + key: + type: string + repo_id: + nullable: true + type: integer + scope: + type: integer + space_id: + nullable: true + type: integer + type: + $ref: '#/components/schemas/EnumLabelType' + updated: + type: integer + updated_by: + type: integer + value_count: + type: integer + type: object + TypesLabelAssignment: + properties: + assigned: + nullable: true + type: boolean + assigned_value: + $ref: '#/components/schemas/TypesLabelValueInfo' + color: + $ref: '#/components/schemas/EnumLabelColor' + id: + type: integer + key: + type: string + scope: + type: integer + type: + $ref: '#/components/schemas/EnumLabelType' + values: + items: + $ref: '#/components/schemas/TypesLabelValueInfo' + type: array + type: object + TypesLabelPullReqAssignmentInfo: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + id: + type: integer + key: + type: string + scope: + type: integer + value: + nullable: true + type: string + value_color: + $ref: '#/components/schemas/EnumLabelColor' + value_count: + type: integer + value_id: + nullable: true + type: integer + type: object + TypesLabelValue: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + created: + type: integer + created_by: + type: integer + id: + type: integer + label_id: + type: integer + updated: + type: integer + updated_by: + type: integer + value: + type: string + type: object + TypesLabelValueInfo: + properties: + color: + nullable: true + type: string + id: + nullable: true + type: integer + value: + nullable: true + type: string + type: object + TypesLabelWithValues: + properties: + label: + $ref: '#/components/schemas/TypesLabel' + values: + items: + $ref: '#/components/schemas/TypesLabelValue' + nullable: true + type: array + type: object TypesListCommitResponse: properties: commits: @@ -9788,10 +12035,14 @@ components: type: integer is_draft: type: boolean + labels: + items: + $ref: '#/components/schemas/TypesLabelPullReqAssignmentInfo' + type: array merge_base_sha: type: string merge_check_status: - $ref: '#/components/schemas/EnumMergeCheckStatus' + type: string merge_conflicts: items: type: string @@ -9925,6 +12176,24 @@ components: sha: type: string type: object + TypesPullReqLabel: + properties: + created: + type: integer + created_by: + type: integer + label_id: + type: integer + pullreq_id: + type: integer + updated: + type: integer + updated_by: + type: integer + value_id: + nullable: true + type: integer + type: object TypesPullReqReviewer: properties: added_by: @@ -9947,11 +12216,17 @@ components: type: object TypesPullReqStats: properties: + additions: + nullable: true + type: integer commits: nullable: true type: integer conversations: type: integer + deletions: + nullable: true + type: integer files_changed: nullable: true type: integer @@ -9992,8 +12267,6 @@ components: type: integer identifier: type: string - importing: - type: boolean is_empty: type: boolean num_closed_pulls: @@ -10014,6 +12287,8 @@ components: type: integer size_updated: type: integer + state: + type: integer updated: type: integer type: object @@ -10048,10 +12323,8 @@ components: state: $ref: '#/components/schemas/EnumRuleState' type: - $ref: '#/components/schemas/TypesRuleType' + type: string type: object - TypesRuleType: - type: string TypesRuleViolations: properties: bypassable: @@ -10074,6 +12347,50 @@ components: nullable: true type: array type: object + TypesSaveLabelInput: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + description: + type: string + id: + type: integer + key: + type: string + type: + $ref: '#/components/schemas/EnumLabelType' + type: object + TypesSaveLabelValueInput: + properties: + color: + $ref: '#/components/schemas/EnumLabelColor' + id: + type: integer + value: + type: string + type: object + TypesScopeData: + properties: + repository: + $ref: '#/components/schemas/TypesRepository' + scope: + type: integer + space: + $ref: '#/components/schemas/TypesSpace' + type: object + TypesScopesLabels: + properties: + label_data: + items: + $ref: '#/components/schemas/TypesLabelAssignment' + nullable: true + type: array + scope_data: + items: + $ref: '#/components/schemas/TypesScopeData' + nullable: true + type: array + type: object TypesSecret: properties: created: @@ -10183,7 +12500,7 @@ components: started: type: integer status: - $ref: '#/components/schemas/EnumCIStatus' + type: string steps: items: $ref: '#/components/schemas/TypesStep' @@ -10222,7 +12539,7 @@ components: started: type: integer status: - $ref: '#/components/schemas/EnumCIStatus' + type: string stopped: type: integer type: object @@ -10239,7 +12556,7 @@ components: space_id: type: integer type: - $ref: '#/components/schemas/EnumResolverType' + type: string updated: type: integer type: object @@ -10257,7 +12574,7 @@ components: principal_id: type: integer type: - $ref: '#/components/schemas/EnumTokenType' + type: string type: object TypesTokenResponse: properties: diff --git a/web/src/services/config.ts b/web/src/services/config.ts index cd57a322a..695f13d41 100644 --- a/web/src/services/config.ts +++ b/web/src/services/config.ts @@ -92,6 +92,14 @@ export const getUsingFetch = < return res.text().then(text => Promise.reject(text)) } + if (res.status === 504) { + return res.text().then(text => Promise.reject(text)) + } + + if (res.status === 404) { + return res.text().then(text => Promise.reject(text)) + } + return res.text() }) } diff --git a/web/src/utils/GitUtils.ts b/web/src/utils/GitUtils.ts index 78a6f0437..64a2c1c55 100644 --- a/web/src/utils/GitUtils.ts +++ b/web/src/utils/GitUtils.ts @@ -124,7 +124,13 @@ export enum SettingsTab { webhooks = 'webhook', general = '/', branchProtection = 'rules', - security = 'security' + security = 'security', + labels = 'labels' +} + +export enum SpaceSettingsTab { + general = '/', + labels = 'labels' } export enum VulnerabilityScanningType { diff --git a/web/src/utils/Utils.ts b/web/src/utils/Utils.ts index 75585daf0..afa085fcf 100644 --- a/web/src/utils/Utils.ts +++ b/web/src/utils/Utils.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Intent, IToaster, IToastProps, Position, Toaster } from '@blueprintjs/core' +import { IconName, Intent, IToaster, IToastProps, Position, Toaster } from '@blueprintjs/core' import { get } from 'lodash-es' import moment from 'moment' import langMap from 'lang-map' @@ -28,7 +28,10 @@ import type { TypesRuleViolations, TypesViolation, TypesCodeOwnerEvaluationEntry, - TypesListCommitResponse + TypesListCommitResponse, + RepoRepositoryOutput, + TypesLabel, + TypesLabelValue } from 'services/code' import type { GitInfoProps } from './GitUtils' @@ -49,6 +52,14 @@ export enum FeatureType { RELEASED = 'released' } +export enum REPO_EXPORT_STATE { + FINISHED = 'finished', + FAILED = 'failed', + CANCELED = 'canceled', + RUNNING = 'running', + SCHEDULED = 'scheduled' +} + export const LIST_FETCHING_LIMIT = 20 export const DEFAULT_DATE_FORMAT = 'MM/DD/YYYY hh:mm a' export const DEFAULT_BRANCH_NAME = 'main' @@ -747,3 +758,122 @@ export function removeSpecificTextOptimized( viewRef?.current?.dispatch({ changes }) } } + +export const enum LabelType { + DYNAMIC = 'dynamic', + STATIC = 'static' +} + +export enum ColorName { + Red = 'red', + Green = 'green', + Yellow = 'yellow', + Blue = 'blue', + Pink = 'pink', + Purple = 'purple', + Violet = 'violet', + Indigo = 'indigo', + Cyan = 'cyan', + Orange = 'orange', + Brown = 'brown', + Mint = 'mint', + Lime = 'lime' +} + +export interface ColorDetails { + stroke: string + background: string + text: string + backgroundWithoutStroke: string +} +export const colorsPanel: Record = { + [ColorName.Red]: { background: '#FFF7F7', stroke: '#F3A9AA', text: '#C7292F', backgroundWithoutStroke: '#FFE8EB' }, + [ColorName.Green]: { background: '#E9F9EE', stroke: '#85CBA2', text: '#16794C', backgroundWithoutStroke: '#E8F9ED' }, + [ColorName.Yellow]: { background: '#FFF9ED', stroke: '#E4B86F', text: '#92582D', backgroundWithoutStroke: '#FFF3D1' }, + [ColorName.Blue]: { background: '#F1FCFF', stroke: '#7BC8E0', text: '#236E93', backgroundWithoutStroke: '#E0F9FF' }, + [ColorName.Pink]: { background: '#FFF7FC', stroke: '#ECA8D2', text: '#C41B87', backgroundWithoutStroke: '#FEECF7' }, + [ColorName.Purple]: { background: '#FFF8FF', stroke: '#DFAAE3', text: '#9C2AAD', backgroundWithoutStroke: '#FCEDFC' }, + [ColorName.Violet]: { background: '#FBFAFF', stroke: '#C1B4F3', text: '#5645AF', backgroundWithoutStroke: '#F3F0FF' }, + [ColorName.Indigo]: { background: '#F8FAFF', stroke: '#A9BDF5', text: '#3250B2', backgroundWithoutStroke: '#EDF2FF' }, + [ColorName.Cyan]: { background: '#F2FCFD', stroke: '#7DCBD9', text: '#0B7792', backgroundWithoutStroke: '#E4F9FB' }, + [ColorName.Orange]: { background: '#FFF8F4', stroke: '#FFA778', text: '#995137', backgroundWithoutStroke: '#FFEDD5' }, + [ColorName.Brown]: { background: '#FCF9F6', stroke: '#DBB491', text: '#805C43', backgroundWithoutStroke: '#F8EFE7' }, + [ColorName.Mint]: { background: '#EFFEF9', stroke: '#7FD0BD', text: '#247469', backgroundWithoutStroke: '#DDFBF3' }, + [ColorName.Lime]: { background: '#F7FCF0', stroke: '#AFC978', text: '#586729', backgroundWithoutStroke: '#EDFADA' } + // Add more colors when required +} + +export const getColorsObj = (colorKey: ColorName): ColorDetails => { + return colorsPanel[colorKey] +} +export const getScopeIcon = (scope: any, standalone: boolean) => { + if (scope === 0) return undefined + if (scope === 1 && standalone) return 'nav-project' as IconName + if (scope === 1 && !standalone) return 'Account' as IconName + if (scope === 2) return 'nav-organization' as IconName + if (scope === 3) return 'nav-project' as IconName + return undefined +} + +export function customEncodeURIComponent(str: string) { + return encodeURIComponent(str).replace(/!/g, '%21') +} + +export interface LabelTypes extends TypesLabel { + labelValues?: TypesLabelValue[] +} + +export enum LabelFilterType { + LABEL = 'label', + VALUE = 'value' +} + +export interface LabelFilterObj { + labelId: number + valueId?: number + type: LabelFilterType + labelObj: TypesLabel + valueObj?: TypesLabelValue +} + +export enum LabelsPageScope { + ACCOUNT = 'acc', + ORG = 'org', + PROJECT = 'project', + SPACE = 'space', + REPOSITORY = 'repo' +} + +export interface LabelListingProps { + currentPageScope: LabelsPageScope + repoMetadata?: RepoRepositoryOutput + space?: string + activeTab?: string +} + +export const getScopeData = (space: string, scope: number, standalone: boolean) => { + const accountIdentifier = space?.split('/')[0] + const orgIdentifier = space?.split('/')[1] + const projectIdentifier = space?.split('/')[2] + if (standalone) { + return { scopeRef: space, scopeIcon: 'nav-project' as IconName, scopeId: space } + } + switch (scope) { + case 1: + return { scopeRef: accountIdentifier as string, scopeIcon: 'Account' as IconName, scopeId: accountIdentifier } + case 2: + return { + scopeRef: `${accountIdentifier}/${orgIdentifier}` as string, + scopeIcon: 'nav-organization' as IconName, + scopeId: orgIdentifier + } + case 3: + return { + scopeRef: `${accountIdentifier}/${orgIdentifier}/${projectIdentifier}` as string, + scopeIcon: 'nav-project' as IconName, + scopeId: projectIdentifier + } + default: + return { scopeRef: space, scopeIcon: 'nav-project' as IconName, scopeId: scope } + } +}