-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nexus): nexus trigger selectable in UI (#7381)
- Loading branch information
Showing
7 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
app/scripts/modules/core/src/pipeline/config/triggers/nexus/NexusTrigger.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as React from 'react'; | ||
|
||
import { FormikFormField, ReactSelectInput, useLatestPromise } from 'core/presentation'; | ||
|
||
import { NexusReaderService } from './nexusReader.service'; | ||
|
||
export function NexusTrigger() { | ||
const fetchNames = useLatestPromise(() => NexusReaderService.getNexusNames(), []); | ||
|
||
const validationStatus = fetchNames.status === 'REJECTED' ? 'error' : null; | ||
const validationMessage = | ||
fetchNames.status === 'REJECTED' | ||
? `Error fetching nexus names: ${fetchNames.error.data.status} ${fetchNames.error.data.error}` | ||
: null; | ||
|
||
return ( | ||
<FormikFormField | ||
name="nexusSearchName" | ||
label="Nexus Name" | ||
touched={true} | ||
fastField={false} | ||
validationMessage={validationMessage} | ||
validationStatus={validationStatus} | ||
input={props => ( | ||
<ReactSelectInput | ||
{...props} | ||
isLoading={status === 'PENDING'} | ||
placeholder="Select Nexus search name..." | ||
stringOptions={fetchNames.result} | ||
clearable={false} | ||
/> | ||
)} | ||
/> | ||
); | ||
} |
12 changes: 12 additions & 0 deletions
12
app/scripts/modules/core/src/pipeline/config/triggers/nexus/nexus.trigger.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Registry } from 'core/registry'; | ||
import { NexusTrigger } from './NexusTrigger'; | ||
import { ArtifactTypePatterns, excludeAllTypesExcept } from 'core/artifact'; | ||
|
||
Registry.pipeline.registerTrigger({ | ||
label: 'Nexus', | ||
description: 'Executes the pipeline on a Nexus repo update', | ||
key: 'nexus', | ||
component: NexusTrigger, | ||
validators: [], | ||
excludedArtifactTypePatterns: excludeAllTypesExcept(ArtifactTypePatterns.MAVEN_FILE), | ||
}); |
11 changes: 11 additions & 0 deletions
11
app/scripts/modules/core/src/pipeline/config/triggers/nexus/nexusReader.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { IPromise } from 'angular'; | ||
|
||
import { API } from 'core/api/ApiService'; | ||
|
||
export class NexusReaderService { | ||
public static getNexusNames(): IPromise<string[]> { | ||
return API.one('nexus') | ||
.one('names') | ||
.get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters