debian-mirror-gitlab/app/assets/javascripts/graphql_shared/utils.js

17 lines
446 B
JavaScript
Raw Normal View History

2020-03-13 15:44:24 +05:30
/**
* Ids generated by GraphQL endpoints are usually in the format
* gid://gitlab/Environments/123. This method extracts Id number
* from the Id path
*
* @param {String} gid GraphQL global ID
* @returns {Number}
*/
export const getIdFromGraphQLId = (gid = '') =>
2021-01-29 00:20:46 +05:30
parseInt(`${gid}`.replace(/gid:\/\/gitlab\/.*\//g, ''), 10) || null;
2020-03-13 15:44:24 +05:30
2021-01-29 00:20:46 +05:30
export const MutationOperationMode = {
Append: 'APPEND',
Remove: 'REMOVE',
Replace: 'REPLACE',
};