Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed prefix where not necessary #6799

Merged
merged 3 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- TDB

### Removed
- TDB
- Outdated using of hostname when access git/opencv/analytics from UI (<https://github.com/opencv/cvat/pull/6799>)

### Fixed
- Zooming canvas when scrooling comments list in an issue (<https://github.com/opencv/cvat/pull/6758>)
Expand Down
11 changes: 3 additions & 8 deletions cvat-ui/src/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import Modal from 'antd/lib/modal';
import Text from 'antd/lib/typography/Text';
import Select from 'antd/lib/select';

import { getCore } from 'cvat-core-wrapper';
import config from 'config';

import { CVATLogo } from 'icons';
Expand All @@ -42,13 +41,10 @@ import { CombinedState } from 'reducers';
import { usePlugins } from 'utils/hooks';
import SettingsModal from './settings-modal/settings-modal';

const core = getCore();

interface Tool {
name: string;
description: string;
server: {
host: string;
version: string;
};
core: {
Expand Down Expand Up @@ -107,7 +103,6 @@ function mapStateToProps(state: CombinedState): StateToProps {
name: server.name as string,
description: server.description as string,
server: {
host: core.config.backendAPI.slice(0, -7),
version: server.version as string,
},
canvas: {
Expand Down Expand Up @@ -259,7 +254,7 @@ function HeaderContainer(props: Props): JSX.Element {
icon={<ControlOutlined />}
key='admin_page'
onClick={(): void => {
window.open(`${tool.server.host}/admin`, '_blank');
window.open('/admin', '_blank');
}}
>
Admin page
Expand Down Expand Up @@ -482,10 +477,10 @@ function HeaderContainer(props: Props): JSX.Element {
<Button
className={getButtonClassName('analytics')}
type='link'
href={`${tool.server.host}/analytics`}
href='/analytics'
onClick={(event: React.MouseEvent): void => {
event.preventDefault();
window.open(`${tool.server.host}/analytics`, '_blank');
window.open('/analytics', '_blank');
}}
>
Analytics
Expand Down
13 changes: 6 additions & 7 deletions cvat-ui/src/utils/git-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { getCore } from 'cvat-core-wrapper';

const core = getCore();
const baseURL = core.config.backendAPI.slice(0, -7);

interface GitPlugin {
name: string;
Expand Down Expand Up @@ -47,7 +46,7 @@ function waitForClone({ data: cloneResponse }: any): Promise<void> {
return new Promise((resolve, reject): void => {
async function checkCallback(): Promise<void> {
core.server
.request(`${baseURL}/git/repository/check/${cloneResponse.rq_id}`, {
.request(`/git/repository/check/${cloneResponse.rq_id}`, {
method: 'GET',
})
.then(({ data }: any): void => {
Expand Down Expand Up @@ -89,7 +88,7 @@ async function cloneRepository(this: any, plugin: GitPlugin, createdTask: any):
}

core.server
.request(`${baseURL}/git/repository/create/${createdTask.id}`, {
.request(`/git/repository/create/${createdTask.id}`, {
method: 'POST',
headers: {
'Content-type': 'application/json',
Expand Down Expand Up @@ -144,7 +143,7 @@ export function registerGitPlugin(): void {
}

export async function getReposData(tid: number): Promise<ReposData | null> {
const response = (await core.server.request(`${baseURL}/git/repository/get/${tid}`, {
const response = (await core.server.request(`/git/repository/get/${tid}`, {
method: 'GET',
})).data;

Expand All @@ -166,13 +165,13 @@ export async function getReposData(tid: number): Promise<ReposData | null> {
export function syncRepos(tid: number): Promise<void> {
return new Promise((resolve, reject): void => {
core.server
.request(`${baseURL}/git/repository/push/${tid}`, {
.request(`/git/repository/push/${tid}`, {
method: 'GET',
})
.then(({ data: syncResponse }: any): void => {
async function checkSync(): Promise<void> {
const id = syncResponse.rq_id;
const response = (await core.server.request(`${baseURL}/git/repository/check/${id}`, {
const response = (await core.server.request(`/git/repository/check/${id}`, {
method: 'GET',
})).data;

Expand Down Expand Up @@ -200,7 +199,7 @@ export function syncRepos(tid: number): Promise<void> {
export async function changeRepo(taskId: number, type: string, value: any): Promise<void> {
return new Promise((resolve, reject): void => {
core.server
.request(`${baseURL}/git/repository/${taskId}`, {
.request(`/git/repository/${taskId}`, {
method: 'PATCH',
headers: {
'Content-type': 'application/json',
Expand Down
6 changes: 1 addition & 5 deletions cvat-ui/src/utils/opencv-wrapper/opencv-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
//
// SPDX-License-Identifier: MIT

import { getCore } from 'cvat-core-wrapper';
import HistogramEqualizationImplementation, { HistogramEqualization } from './histogram-equalization';
import TrackerMImplementation from './tracker-mil';
import IntelligentScissorsImplementation, { IntelligentScissors } from './intelligent-scissors';
import { OpenCVTracker } from './opencv-interfaces';

const core = getCore();
const baseURL = core.config.backendAPI.slice(0, -7);

export interface Segmentation {
intelligentScissorsFactory: (onChangeToolsBlockerState:(event:string)=>void) => IntelligentScissors;
}
Expand Down Expand Up @@ -64,7 +60,7 @@ export class OpenCVWrapper {
}

private async inject(): Promise<void> {
const response = await fetch(`${baseURL}/assets/opencv.js`);
const response = await fetch('/assets/opencv.js');
if (response.status !== 200) {
throw new Error(`Response status ${response.status}. ${response.statusText}`);
}
Expand Down
Loading