當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript URLUtils.qualifyUrl函數代碼示例

本文整理匯總了TypeScript中util/URLUtils.qualifyUrl函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript qualifyUrl函數的具體用法?TypeScript qualifyUrl怎麽用?TypeScript qualifyUrl使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了qualifyUrl函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: list

 list(streamId: String, skip: Number, limit: Number) {
     var failCallback = (error) => {
         UserNotification.error("Fetching alerts failed with status: " + error.message,
             "Could not retrieve alerts.");
     };
     var url = URLUtils.qualifyUrl(ApiRoutes.AlertsApiController.list(streamId, skip, limit).url);
     return fetch('GET', url).catch(failCallback);
 }
開發者ID:JJediny,項目名稱:graylog2-server,代碼行數:8,代碼來源:AlertsStore.ts

示例2: listForAlert

    listForAlert(streamId: String, alertId: String) {
        var failCallback = (error) => {
            UserNotification.error("Fetching alarm callback history failed with status: " + error,
                "Could not retrieve alarm callback history.");
        };
        var url = URLUtils.qualifyUrl(jsRoutes.controllers.api.AlarmCallbackHistoryApiController.list(streamId, alertId).url);

        return fetch('GET', url)
          .then(
            response => response.histories,
            failCallback
          );
    }
開發者ID:RootR90,項目名稱:graylog2-server,代碼行數:13,代碼來源:AlarmCallbackHistoryStore.ts

示例3: loadMessage

interface Field {
    name: string;
    value: string;
}

interface Message {
    id: string;
    index: number;
    fields: Array<Field>;
}

var MessagesStore = {
    loadMessage(index: string, messageId: string): Promise<Message> {
        var url = ApiRoutes.MessagesController.single(index.trim(), messageId.trim()).url;
        const promise = fetch('GET', URLUtils.qualifyUrl(url))
            .then(response => {
                const message = response.message;
                const fields = message.fields;
                const filteredFields = MessageFieldsFilter.filterFields(fields);
                const newMessage = {
                    id: message.id,
                    timestamp: moment(message.timestamp).unix(),
                    filtered_fields: filteredFields,
                    formatted_fields: filteredFields,
                    fields: fields,
                    index: response.index,
                    source_node_id: fields.gl2_source_node,
                    source_input_id: fields.gl2_source_input,
                    stream_ids: message.streams,
                };
開發者ID:GMarciales,項目名稱:graylog2-server,代碼行數:30,代碼來源:MessagesStore.ts

示例4: fetch

            case 'absolute':
                timerange['from'] = originalSearchURLParams.get('from');
                timerange['to'] = originalSearchURLParams.get('to');
                break;
            case 'keyword':
                timerange['keyword'] = originalSearchURLParams.get('keyword');
                break;
        }

        var url = ApiRoutes.UniversalSearchApiController.fieldTerms(
            rangeType,
            originalSearchURLParams.get('q') || '*',
            field,
            timerange,
            streamId
        ).url;

        url = URLUtils.qualifyUrl(url);

        var promise = fetch('GET', url);
        promise.catch(error => {
            UserNotification.error('Loading quick values failed with status: ' + error,
                'Could not load quick values');
        });

        return promise;
    },
};

module.exports = FieldQuickValuesStore;
開發者ID:3nity-sol,項目名稱:graylog2-server,代碼行數:30,代碼來源:FieldQuickValuesStore.ts

示例5: require

/// <reference path="../../../declarations/bluebird/bluebird.d.ts" />

import jsRoutes = require('routing/jsRoutes');
const URLUtils = require('util/URLUtils');
const fetch = require('logic/rest/FetchProvider').default;

const UserNotification = require('util/UserNotification');

export interface UsageStatsOptOutState {
    opt_out: boolean
}

export var UsageStatsOptOutStore = {
    pluginEnabled(): Promise<boolean> {
        var url = URLUtils.qualifyUrl(jsRoutes.controllers.api.UsageStatsApiController.pluginEnabled().url);
        var promise = fetch('GET', url);

        promise = promise
            .then(response => {
                return response.enabled;
            })
            .catch(() => {
                // When the plugin is not loaded the CORS options request will fail and we can't tell at this point
                // what was the cause for the problem. Therefore, we return false and don't notify the user.
                return false;
            });

        return promise;
    },
    getOptOutState(): Promise<UsageStatsOptOutState> {
        var url = URLUtils.qualifyUrl(jsRoutes.controllers.api.UsageStatsApiController.setOptOutState().url);
開發者ID:RootR90,項目名稱:graylog2-server,代碼行數:31,代碼來源:UsageStatsOptOutStore.ts

示例6: loadSources

    let sourcesArray = [];
    $.each(sources, (name, count) => {
        total += count;
        sourcesArray.push({name: StringUtils.escapeHTML(name), message_count: count})
    });
    sourcesArray.forEach((d) => {
        d.percentage = d.message_count / total * 100;
    });
    return sourcesArray;
};

const SourcesStore = {
    SOURCES_URL: '/sources',

    loadSources(range: number, callback: (sources: Array<Source>) => void) {
        let url = URLUtils.qualifyUrl(this.SOURCES_URL);
        if (typeof range !== 'undefined') {
            url += "?range=" + range;
        }
        fetch('GET', url)
            .then(response => {
                var sources = processSourcesData(response.sources);
                callback(sources);
            })
            .catch((errorThrown) => {
                UserNotification.error("Loading of sources data failed with status: " + errorThrown + ". Try reloading the page.",
                    "Could not load sources data");
            });
    }
};
開發者ID:3nity-sol,項目名稱:graylog2-server,代碼行數:30,代碼來源:SourcesStore.ts

示例7: require

/// <reference path="../../../declarations/bluebird/bluebird.d.ts" />

import ApiRoutes = require('routing/ApiRoutes');
const URLUtils = require('util/URLUtils');
const UserNotification = require('util/UserNotification');
const fetch = require('logic/rest/FetchProvider').default;

const ToolsStore = {
    testNaturalDate(text: string): Promise<string[]> {
        const url = ApiRoutes.ToolsApiController.naturalDateTest(text).url;
        const promise = fetch('GET', URLUtils.qualifyUrl(url));

        promise.catch((errorThrown) => {
            if (errorThrown.additional.status !== 422) {
                UserNotification.error("Loading keyword preview failed with status: " + errorThrown,
                    "Could not load keyword preview");
            }
        });

        return promise;
    },
    testGrok(pattern: string, namedCapturesOnly: boolean, string: string): Promise<Object> {
        const url = ApiRoutes.ToolsApiController.grokTest().url;
        const promise = fetch('POST', URLUtils.qualifyUrl(url), {pattern: pattern, string: string, named_captures_only: namedCapturesOnly});

        promise.catch((errorThrown) => {
            UserNotification.error('Details: ' + errorThrown,
                'We were not able to run the grok extraction. Please check your parameters.');
        });

        return promise;
開發者ID:mcenirm-forks,項目名稱:graylog2-server,代碼行數:31,代碼來源:ToolsStore.ts

示例8: require

/// <reference path="../../../declarations/bluebird/bluebird.d.ts" />

import ApiRoutes = require('routing/ApiRoutes');
const URLUtils = require('util/URLUtils');
const UserNotification = require('util/UserNotification');
const fetch = require('logic/rest/FetchProvider').default;

const ToolsStore = {
    testNaturalDate(text: string): Promise<string[]> {
        const url = ApiRoutes.ToolsApiController.naturalDateTest(text).url;
        const promise = fetch('GET', URLUtils.qualifyUrl(url));

        promise.catch((errorThrown) => {
            if (errorThrown.additional.status !== 422) {
                UserNotification.error("Loading keyword preview failed with status: " + errorThrown,
                    "Could not load keyword preview");
            }
        });

        return promise;
    },
    testGrok(pattern: string, string: string): Promise<Object> {
        const url = ApiRoutes.ToolsApiController.grokTest().url;
        const promise = fetch('POST', URLUtils.qualifyUrl(url), {pattern: pattern, string: string});

        promise.catch((errorThrown) => {
            UserNotification.error('Details: ' + errorThrown,
                'We were not able to run the grok extraction. Please check your parameters.');
        });

        return promise;
開發者ID:GMarciales,項目名稱:graylog2-server,代碼行數:31,代碼來源:ToolsStore.ts

示例9: require

const fetch = require('logic/rest/FetchProvider').default;

interface Role {
  name: string;
  description: string;
  permissions: string[];
}

interface RoleMembership {
  role: string;
  users: UsersStore.User[];
}

const RolesStore = {
  loadRoles(): Promise<string[]> {
    const promise = fetch('GET', URLUtils.qualifyUrl(ApiRoutes.RolesApiController.listRoles().url))
      .then(
        response => response.roles,
        error => {
          if (error.additional.status !== 404) {
            UserNotification.error("Loading role list failed with status: " + error,
              "Could not load role list");
          }
        }
      );

    return promise;
  },

  createRole(role: Role): Promise<Role> {
    const url = URLUtils.qualifyUrl(ApiRoutes.RolesApiController.createRole().url);
開發者ID:mcenirm-forks,項目名稱:graylog2-server,代碼行數:31,代碼來源:RolesStore.ts

示例10: editUserFormUrl

}

export interface Token {
  token_name: string;
  token: string;
  last_access: string;
}

export interface ChangePasswordRequest {
  old_password: string;
  password: string;
}

export const UsersStore = {
  editUserFormUrl(username: string) {
    return URLUtils.qualifyUrl("/system/users/edit/" + username);
  },

  create(request: any): Promise<string[]> {
    const url = URLUtils.qualifyUrl(ApiRoutes.UsersApiController.create().url);
    const promise = fetch('POST', url, request);
    return promise;
  },

  loadUsers(): Promise<User[]> {
    const url = URLUtils.qualifyUrl(ApiRoutes.UsersApiController.list().url);
    const promise = fetch('GET', url)
      .then(
        response => response.users,
        (error) => {
          if (error.additional.status !== 404) {
開發者ID:Graylog2,項目名稱:graylog2-server,代碼行數:31,代碼來源:UsersStore.ts


注:本文中的util/URLUtils.qualifyUrl函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。