Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Pipeline Runs #921

Merged
merged 31 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4daee83
remove application-creation redux module
Richard87 Jan 10, 2024
1e829ba
migrate pipeline-run component
Richard87 Jan 10, 2024
0386a98
migrate pipeline-run component
Richard87 Jan 10, 2024
bfe6e0d
migrate pipeline-run components
Richard87 Jan 11, 2024
bb9d2b3
migrate pipeline-run components
Richard87 Jan 11, 2024
50da13b
cleanup
Richard87 Jan 11, 2024
00222d4
migrate page-pipeline-run-task and page-pipelin-run
Richard87 Jan 11, 2024
87757cd
cleanup pipeline logs and reducers
Richard87 Jan 14, 2024
d2eaa29
cleanup
Richard87 Jan 14, 2024
35368b6
migrate create job form
Richard87 Jan 14, 2024
a6ddd8c
cleanup state
Richard87 Jan 14, 2024
824e7f6
bugfixes in dev
Richard87 Jan 14, 2024
3539e7e
cleanup page step
Richard87 Jan 15, 2024
efe5e6a
bugfix missing props
Richard87 Jan 15, 2024
25a890c
create a new DurationToNow component to avoid useNow() in big compone…
Richard87 Jan 15, 2024
b4cb92a
cleanup
Richard87 Jan 15, 2024
fd7643e
cleanup
Richard87 Jan 15, 2024
d4f3916
add enum types
Richard87 Jan 15, 2024
8845d03
add enum types
Richard87 Jan 15, 2024
0da65f0
cleanup unused models
Richard87 Jan 15, 2024
1de3b75
removed unused package
Richard87 Jan 15, 2024
83a520e
removed unused package
Richard87 Jan 15, 2024
eb7fdce
use regular server.dev.conf
Richard87 Jan 16, 2024
0d9f2d7
bugfix select branch
Richard87 Jan 16, 2024
ff70b16
Merge branch 'master' into migrate-pipeline-runs
Richard87 Jan 16, 2024
507fa0e
oppdatert react-router
Richard87 Jan 16, 2024
7aa348f
Merge branch 'master' into migrate-pipeline-runs
Richard87 Jan 16, 2024
f4fb576
Update src/components/page-deployment/index.tsx
Richard87 Jan 17, 2024
39f7a43
fjernet `keepUnusedDataFor`
Richard87 Jan 17, 2024
0c06c3b
use isSuccess
Richard87 Jan 17, 2024
8bafb9b
Merge branch 'master' into migrate-pipeline-runs
Richard87 Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"miragejs": "^0.1.48",
"mock-socket": "^9.3.1",
"prettier": "^3.1.1",
"redux-saga-test-plan": "^4.0.6",
"swagger-proptypes": "^7.0.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
Expand Down
2 changes: 1 addition & 1 deletion proxy/server.dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ server {

location /api/ {
proxy_pass https://server-radix-api-qa.dev.radix.equinor.com;
# proxy_pass https://localhost:3002;
# proxy_pass http://172.20.0.1:3002;
proxy_set_header Authorization "Bearer $http_x_forwarded_access_token";
proxy_set_header x-forwarded-access-token "";
}
Expand Down
89 changes: 0 additions & 89 deletions src/api/api-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import { merge } from 'lodash';
import { Observable, of } from 'rxjs';
import { ajax, AjaxResponse } from 'rxjs/ajax';
import { map, catchError } from 'rxjs/operators';

import { AsyncState } from '../effects/effect-types';
import { RequestState } from '../state/state-utils/request-states';
import { NetworkException } from '../utils/exception';

export type RadixRequestInit = Omit<RequestInit, 'body' | 'method'>;
Expand Down Expand Up @@ -96,43 +90,8 @@ export async function getText(
return fetchPlain(url, { ...options, method: 'GET' });
}

/**
* DELETE remote resource
* @param {string} url Full URL
*/
export async function deleteRequest(
url: string,
options?: RadixRequestInit
): Promise<string> {
return fetchPlain(url, { ...options, method: 'DELETE' });
}

/**
* POST action
* @param {string} url Full URL
*/
export async function postRequest(
url: string,
options?: RadixRequestInit
): Promise<string> {
return fetchPlain(url, { ...options, method: 'POST' });
}

// --- JSON requests -----------------------------------------------------------

/**
* @callback JsonFetcher
* @param {string} url The URL to the resource
* @returns {Promise}
*/

/**
* @callback JsonFetcherWithBody
* @param {string} url The URL to the resource
* @param {*} data Data to send to server
* @returns {Promise}
*/

/**
* Fetch (and optionally, send) JSON
* @param {string} url Full URL to fetch
Expand Down Expand Up @@ -226,51 +185,3 @@ export const putJson: <T>(
options: RadixRequestInit | undefined,
data: unknown
) => Promise<T> = makeJsonRequester('PUT');

/**
* PATCH JSON to remote resource
* @function
* @type {JsonFetcherWithBody}
*/
export const patchJson: <T>(
url: string,
options: RadixRequestInit | undefined,
data: unknown
) => Promise<T> = makeJsonRequester('PATCH');

// --- AJAX JSON requests ------------------------------------------------------

function ajaxRequest<T>(
request$: Observable<AjaxResponse<T>>
): Observable<AsyncState<T>> {
return request$.pipe(
map(({ response }) => ({
status: RequestState.SUCCESS,
data: response,
})),
catchError((err) =>
of({
status: RequestState.FAILURE,
data: null as T,
error: err.message,
})
)
);
}

export function ajaxGet<T>(
url: string,
contentType = 'application/json'
): Observable<AsyncState<T>> {
const headers: Record<string, string> = { 'Content-Type': contentType };
return ajaxRequest(ajax.get<T>(url, headers));
}

export function ajaxPost<T>(
url: string,
body: unknown,
contentType = 'application/json'
): Observable<AsyncState<T>> {
const headers: Record<string, string> = { 'Content-Type': contentType };
return ajaxRequest(ajax.post<T>(url, body, headers));
}
119 changes: 0 additions & 119 deletions src/api/apps.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/api/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { createRadixApiUrl } from './api-config';
import { deleteJson, postJson } from './api-helpers';

import { RawModel } from '../models/model-types';
import { JobSummaryModel } from '../models/radix-api/jobs/job-summary';
import { ScheduledJobRequestModel } from '../models/radix-api/environments/scheduled-job-request';
import { ScheduledBatchRequestModel } from '../models/radix-api/environments/scheduled-batch-request';
import { JobSummary } from '../store/radix-api';

export type PipelineNames = 'build' | 'build-deploy' | 'deploy' | 'promote';

Expand Down Expand Up @@ -53,11 +53,11 @@ export async function createJob<T extends PipelineNames>({
? PipelineParametersDeploy
: [T] extends ['promote']
? PipelineParametersPromote
: {})): Promise<RawModel<JobSummaryModel>> {
: {})): Promise<RawModel<JobSummary>> {
const encAppName = encodeURIComponent(appName);
const encPipelineName = encodeURIComponent(pipelineName);

return await postJson<RawModel<JobSummaryModel>>(
return await postJson<RawModel<JobSummary>>(
createRadixApiUrl(
`${apiPaths.apps}/${encAppName}/pipelines/${encPipelineName}`
),
Expand Down
27 changes: 1 addition & 26 deletions src/api/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,42 +60,17 @@ function generateApiResource<
};
}

/* eslint-disable prettier/prettier */
// NB: The keys here must match the Redux action prefixes for the resources in
// the /state/{resource}/action-types.js files
export const apiResources = {
APP: generateApiResource<[appName: string]>(
'/applications/:appName'
),
APP: generateApiResource<[appName: string]>('/applications/:appName'),
DEPLOYMENTS: generateApiResource<[appName: string]>(
'/applications/:appName/deployments'
),
APPLICATION_ALERTING: generateApiResource<[appName: string]>(
'/applications/:appName/alerting'
),
ENVIRONMENT_ALERTING: generateApiResource<[appName: string, envName: string]>(
'/applications/:appName/environments/:envName/alerting'
),
JOB: generateApiResource<[appName: string, jobName: string]>(
'/applications/:appName/jobs/:jobName'
),
PIPELINE_RUN_TASK_STEPS: generateApiResource<[appName: string, jobName: string, pipelineRunName: string, taskName: string]>(
'/applications/:appName/jobs/:jobName/pipelineruns/:pipelineRunName/tasks/:taskName/steps'
),
PIPELINE_RUN_TASK: generateApiResource<[appName: string, jobName: string, pipelineRunName: string, taskName: string]>(
'/applications/:appName/jobs/:jobName/pipelineruns/:pipelineRunName/tasks/:taskName'
),
PIPELINE_RUN_TASKS: generateApiResource<[appName: string, jobName: string, pipelineRunName: string]>(
'/applications/:appName/jobs/:jobName/pipelineruns/:pipelineRunName/tasks'
),
PIPELINE_RUN: generateApiResource<[appName: string, jobName: string, pipelineRunName: string]>(
'/applications/:appName/jobs/:jobName/pipelineruns/:pipelineRunName'
),
PIPELINE_RUNS: generateApiResource<[appName: string, jobName: string]>(
'/applications/:appName/jobs/:jobName/pipelineruns'
),
};
/* eslint-enable prettier/prettier */

export async function subscribe<
P extends ApiMessageType,
Expand Down
4 changes: 1 addition & 3 deletions src/components/app-list-item/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { Typography } from '@equinor/eds-core-react';

import { AppListItem, AppListItemProps, FavouriteClickedHandler } from '.';

import { RadixJobCondition } from '../../models/radix-api/jobs/radix-job-condition';

const noop: FavouriteClickedHandler = (evt) => evt.preventDefault();

const testData: Array<{ description: string } & AppListItemProps> = [
Expand All @@ -20,7 +18,7 @@ const testData: Array<{ description: string } & AppListItemProps> = [
name: 'test-job',
created: new Date().toISOString(),
started: new Date().toISOString(),
status: RadixJobCondition.Running,
status: 'Running',
pipeline: 'build-deploy',
},
},
Expand Down
Loading