feat: [CDE-143]: updated vs code plugin url (#2229)

* feat: [CDE-143]: Updated URL for VSCode plugin url
* feat: [CDE-143]: updated vs code plugin url
This commit is contained in:
Deepesh Kumar 2024-07-16 06:08:27 +00:00 committed by Harness
parent dc77767afa
commit 1711ee098a
2 changed files with 11 additions and 9 deletions

View File

@ -304,10 +304,10 @@ const ActionMenu = ({
const { getString } = useStrings() const { getString } = useStrings()
const { showError } = useToaster() const { showError } = useToaster()
const { instance, ide, identifier = '', space_path = '', state } = data const { instance, ide, identifier = '', space_path = '', state } = data
const { identifier: id, url = '' } = instance || {} const { url = '' } = instance || {}
const history = useHistory() const history = useHistory()
const { routes } = useAppContext() const { routes } = useAppContext()
const pathparamsList = instance?.space_path?.split('/') || [] const pathparamsList = space_path?.split('/') || []
const projectIdentifier = pathparamsList[pathparamsList.length - 1] || '' const projectIdentifier = pathparamsList[pathparamsList.length - 1] || ''
const topBorder = state === GitspaceStatus.RUNNING && !actionLoading ? { top: true } : {} const topBorder = state === GitspaceStatus.RUNNING && !actionLoading ? { top: true } : {}
const disabledActionButtons = [GitspaceStatus.STARTING, GitspaceStatus.STOPPING].includes(state as GitspaceStatus) const disabledActionButtons = [GitspaceStatus.STARTING, GitspaceStatus.STOPPING].includes(state as GitspaceStatus)
@ -326,7 +326,7 @@ const ActionMenu = ({
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
if (ide === IDEType.VSCODE) { if (ide === IDEType.VSCODE) {
window.open(`vscode://harness-inc.gitspaces/${projectIdentifier}/${id}`, '_blank') window.open(`vscode://harness-inc.gitspaces/${projectIdentifier}/${identifier}?gitness`, '_blank')
} else { } else {
window.open(url || '', '_blank') window.open(url || '', '_blank')
} }
@ -661,15 +661,12 @@ export const ListGitspaces = ({ data, refreshList }: { data: TypesGitspaceConfig
<TableV2<TypesGitspaceConfig> <TableV2<TypesGitspaceConfig>
className={css.table} className={css.table}
onRowClick={row => { onRowClick={row => {
const pathparamsList = row?.instance?.space_path?.split('/') || [] const pathparamsList = row?.space_path?.split('/') || []
const projectIdentifier = pathparamsList[pathparamsList.length - 1] || '' const projectIdentifier = pathparamsList[pathparamsList.length - 1] || ''
if (row?.state === GitspaceStatus.RUNNING) { if (row?.state === GitspaceStatus.RUNNING) {
if (row?.ide === IDEType.VSCODE) { if (row?.ide === IDEType.VSCODE) {
window.open( window.open(`vscode://harness-inc.gitspaces/${projectIdentifier}/${row?.identifier}?gitness`, '_blank')
`vscode://harness-inc.gitspaces/${projectIdentifier}/${row?.instance?.identifier}`,
'_blank'
)
} else { } else {
window.open(row?.instance?.url || '', '_blank') window.open(row?.instance?.url || '', '_blank')
} }

View File

@ -303,7 +303,12 @@ export const GitspaceDetails = () => {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
if (data?.ide === StandaloneIDEType.VSCODE) { if (data?.ide === StandaloneIDEType.VSCODE) {
window.open(`vscode://harness-inc.gitspaces/${data?.identifier}`, '_blank') const pathparamsList = data?.space_path?.split('/') || []
const projectIdentifier = pathparamsList[pathparamsList.length - 1] || ''
window.open(
`vscode://harness-inc.gitspaces/${projectIdentifier}/${data?.identifier}?gitness`,
'_blank'
)
} else { } else {
window.open(data?.instance?.url || '', '_blank') window.open(data?.instance?.url || '', '_blank')
} }