Skip to content

Commit

Permalink
Configurable method for check plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev committed Dec 4, 2019
1 parent 1267255 commit ee0e889
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cvat-ui/src/utils/plugin-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const core = getCore();
class PluginChecker {
public static async check(plugin: SupportedPlugins): Promise<boolean> {
const serverHost = core.config.backendAPI.slice(0, -7);
const isReachable = async (url: string): Promise<boolean> => {
const isReachable = async (url: string, method: string): Promise<boolean> => {
try {
await core.server.request(url, {
method: 'OPTIONS',
method,
});
return true;
} catch (error) {
Expand All @@ -20,19 +20,19 @@ class PluginChecker {

switch (plugin) {
case SupportedPlugins.GIT_INTEGRATION: {
return isReachable(`${serverHost}/git/repository/meta/get`);
return isReachable(`${serverHost}/git/repository/meta/get`, 'OPTIONS');
}
case SupportedPlugins.AUTO_ANNOTATION: {
return isReachable(`${serverHost}/auto_annotation/meta/get`);
return isReachable(`${serverHost}/auto_annotation/meta/get`, 'OPTIONS');
}
case SupportedPlugins.TF_ANNOTATION: {
return isReachable(`${serverHost}/tensorflow/annotation/meta/get`);
return isReachable(`${serverHost}/tensorflow/annotation/meta/get`, 'OPTIONS');
}
case SupportedPlugins.TF_SEGMENTATION: {
return isReachable(`${serverHost}/tensorflow/segmentation/meta/get`);
return isReachable(`${serverHost}/tensorflow/segmentation/meta/get`, 'OPTIONS');
}
case SupportedPlugins.ANALYTICS: {
return isReachable(`${serverHost}/analytics/app/kibana`);
return isReachable(`${serverHost}/analytics/app/kibana`, 'GET');
}
default:
return false;
Expand Down

0 comments on commit ee0e889

Please sign in to comment.