@@ -29,6 +29,7 @@ import { selectBuildVersion } from 'common/services/useBuildVersion'
2929import { getStore } from 'common/store'
3030import { TRACKED_UTMS , UtmsType } from 'common/types/utms'
3131import { TimeUnit } from 'components/release-pipelines/constants'
32+ import getUserDisplayName from './getUserDisplayName'
3233
3334const semver = require ( 'semver' )
3435
@@ -278,58 +279,6 @@ const Utils = Object.assign({}, require('./base/_utils'), {
278279 timeUnit : TimeUnit . MINUTE ,
279280 }
280281 } ,
281- getExistingWaitForTime : (
282- waitFor : string | undefined ,
283- ) :
284- | {
285- amountOfTime : number
286- timeUnit : ( typeof TimeUnit ) [ keyof typeof TimeUnit ]
287- }
288- | undefined => {
289- if ( ! waitFor ) {
290- return
291- }
292-
293- const timeParts = waitFor . split ( ':' )
294-
295- if ( timeParts . length != 3 ) return
296-
297- const [ hours , minutes , seconds ] = timeParts
298-
299- const amountOfMinutes = Number ( minutes )
300- const amountOfHours = Number ( hours )
301- const amountOfSeconds = Number ( seconds )
302-
303- if ( amountOfHours + amountOfMinutes + amountOfSeconds === 0 ) {
304- return
305- }
306-
307- // Days
308- if (
309- amountOfHours % 24 === 0 &&
310- amountOfMinutes === 0 &&
311- amountOfSeconds === 0
312- ) {
313- return {
314- amountOfTime : amountOfHours / 24 ,
315- timeUnit : TimeUnit . DAY ,
316- }
317- }
318-
319- // Hours
320- if ( amountOfHours > 0 && amountOfMinutes === 0 && amountOfSeconds === 0 ) {
321- return {
322- amountOfTime : amountOfHours ,
323- timeUnit : TimeUnit . HOUR ,
324- }
325- }
326-
327- // Minutes
328- return {
329- amountOfTime : amountOfMinutes ,
330- timeUnit : TimeUnit . MINUTE ,
331- }
332- } ,
333282 getFeatureStatesEndpoint ( _project : ProjectType ) {
334283 const project = _project || ProjectStore . model
335284 if ( project && project . use_edge_identities ) {
@@ -416,53 +365,6 @@ const Utils = Object.assign({}, require('./base/_utils'), {
416365 defaultFlags . integration_data ,
417366 )
418367 } ,
419- getExistingWaitForTime : (
420- waitFor : string | undefined ,
421- ) : { amountOfTime : number ; timeUnit : ( typeof TimeUnit ) [ keyof typeof TimeUnit ] } | undefined => {
422- if ( ! waitFor ) {
423- return
424- }
425-
426- const timeParts = waitFor . split ( ':' )
427-
428- if ( timeParts . length != 3 ) return
429-
430- const [ hours , minutes , seconds ] = timeParts
431-
432- const amountOfMinutes = Number ( minutes )
433- const amountOfHours = Number ( hours )
434- const amountOfSeconds = Number ( seconds )
435-
436- if ( amountOfHours + amountOfMinutes + amountOfSeconds === 0 ) {
437- return
438- }
439-
440- // Days
441- if (
442- amountOfHours % 24 === 0 &&
443- amountOfMinutes === 0 &&
444- amountOfSeconds === 0
445- ) {
446- return {
447- amountOfTime : amountOfHours / 24 ,
448- timeUnit : TimeUnit . DAY ,
449- }
450- }
451-
452- // Hours
453- if ( amountOfHours > 0 && amountOfMinutes === 0 && amountOfSeconds === 0 ) {
454- return {
455- amountOfTime : amountOfHours ,
456- timeUnit : TimeUnit . HOUR ,
457- }
458- }
459-
460- // Minutes
461- return {
462- amountOfTime : amountOfMinutes ,
463- timeUnit : TimeUnit . MINUTE ,
464- }
465- } ,
466368 getIsEdge ( ) {
467369 const model = ProjectStore . model as null | ProjectType
468370
@@ -515,6 +417,7 @@ const Utils = Object.assign({}, require('./base/_utils'), {
515417 }
516418 return `/organisation/${ orgId } /projects`
517419 } ,
420+
518421 getOrganisationIdFromUrl ( match : any ) {
519422 const organisationId = match ?. params ?. organisationId
520423 return organisationId ? parseInt ( organisationId ) : null
@@ -801,11 +704,7 @@ const Utils = Object.assign({}, require('./base/_utils'), {
801704 )
802705 if ( window . $crisp ) {
803706 $crisp . push ( [ 'set' , 'user:email' , user . email ] )
804- $crisp . push ( [
805- 'set' ,
806- 'user:nickname' ,
807- `${ user . first_name } ${ user . last_name } ` ,
808- ] )
707+ $crisp . push ( [ 'set' , 'user:nickname' , `${ getUserDisplayName ( user ) } ` ] )
809708 if ( otherOrgs . length ) {
810709 $crisp . push ( [
811710 'set' ,
0 commit comments