Skip to content

Commit

Permalink
fix more merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
abe garcia committed Jun 27, 2023
2 parents 4550c06 + b62dcf4 commit 13eb9d7
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 29 deletions.
3 changes: 2 additions & 1 deletion spin-observatory-plugin-deck/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@rollup/plugin-url": "6.0.0",
"@spinnaker/core": "0.23.0",
"@spinnaker/pluginsdk": "0.3.0",
"@spinnaker/pluginsdk-peerdeps": "0.13.0",
"@spinnaker/pluginsdk-peerdeps": "0.14.0",
"@spinnaker/presentation": "0.2.1",
"@types/react-dom": "18.0.11",
"@uirouter/core": "6.0.4",
Expand All @@ -44,6 +44,7 @@
"react-virtualized-select": "^3.1.3",
"rollup": "2.45.2",
"rxjs": "6.6.7",
"sass": "^1.62.1",
"typescript": "4.9.5"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.retrigger-button {
width: 7rem;
color: #fff;
background-color: var(--color-accent);
&:hover {
background-color: var(--button-primary-hover-bg);
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import Button from '@material-ui/core/Button';
import React, { useState } from 'react';
import { Button, makeStyles } from '@material-ui/core';
import React from 'react';

export const RetriggerButton = () => {
const [hover, setHover] = useState(false);
const useStyles = makeStyles({
'retrigger-button': {
width: '7rem',
color: '#fff',
backgroundColor: 'var(--color-accent)',
},
'retrigger-button:hover': {
backgroundColor: 'var(--button-primary-hover-bg)',
},
});

const handleHover = () => setHover((prevHover) => !prevHover);

return (
<div>
<Button
onMouseEnter={handleHover}
onMouseLeave={handleHover}
style={{
width: '7rem',
color: 'white',
backgroundColor: hover ? 'var(--button-primary-hover-bg)' : 'var(--color-accent)',
}}
>
Retrigger
</Button>
</div>
);
export const RetriggerButton = ({ disabled, onClick }: { disabled: boolean; onClick: () => void }) => {
const styles = useStyles();
return <Button className={styles['retrigger-button']}>Retrigger</Button>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ import type { ChangeEvent } from 'react';
import React, { useState } from 'react';

import type { IExecution } from '@spinnaker/core';
import { Executions } from '@spinnaker/core/dist/pipeline/executions/Executions';

import { ExecutionRow } from './ExecutionRow';
import { PaginationActions } from './PaginationActions';
import { TableHeaders } from './TableHeaders';
import { ActionButtonsContainer, PauseResumeButton, RetriggerButton } from '../actions';
import { DEFAULT_ROWS_PER_PAGE } from './constants';
import { retriggerExecutions } from '../../services/BroadsideService';

const useStyles = makeStyles({
tableContainer: { borderRadius: 'inherit' },
Expand All @@ -34,6 +36,7 @@ interface IExecutionsTableProps {

export const ExecutionsTable = ({ executions, parameters, refreshExecutions }: IExecutionsTableProps) => {
const [selectedExecutionIds, setSelectedExecutionIds] = useState<string[]>([]);
const [retriggerInProgress, setRetriggerInProgress] = useState(false);
const [currentPage, setPage] = useState(0);
const [rowsPerPage, setRowsPerPage] = useState(DEFAULT_ROWS_PER_PAGE);
const styles = useStyles();
Expand Down Expand Up @@ -70,6 +73,23 @@ export const ExecutionsTable = ({ executions, parameters, refreshExecutions }: I
setSelectedExecutionIds(newSelected);
};

const handleRetrigger = () => {
setRetriggerInProgress(true);
// retriggerExecutions({ executions: selectedExecutions })
// .then((res) => {
// // eslint-disable-next-line no-console
// console.log('retriggered: ', res);
// setRetriggerInProgress(false);
// })
// .catch((e) => {
// //TODO: surface this error
// console.error('error retriggering: ', e);
// })
// .finally(() => {
// setRetriggerInProgress(false);
// });
};

const isSelected = (name: string) => selectedExecutionIds.indexOf(name) !== -1;

return (
Expand Down Expand Up @@ -97,7 +117,7 @@ export const ExecutionsTable = ({ executions, parameters, refreshExecutions }: I
<TableCell colSpan={2}>
<ActionButtonsContainer>
<PauseResumeButton executionIds={selectedExecutionIds} refreshExecutions={refreshExecutions} />
<RetriggerButton />
<RetriggerButton disabled={selectedExecutionIds.length === 0} onClick={handleRetrigger} />
</ActionButtonsContainer>
</TableCell>
<TablePagination
Expand Down
27 changes: 27 additions & 0 deletions spin-observatory-plugin-deck/src/services/BroadsideService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { IExecution } from '@spinnaker/core';
import { REST } from '@spinnaker/core';
// http://broadside.cd:80
const BROADSIDE_URI = 'http://broadside.cd:80/v1/broadsides';

// See https://github.com/one-thd/broadside/blob/main/api/swagger.yml#L206
export const retriggerExecutions = ({ executions }: { executions: IExecution[] }): Promise<any[]> => {
/***
* application: "clipper"
* pipelineNameOrId: "Generate Clipper X.509 Key Pair"
* amount: 50
* delay: 100
* pipelineBaseParameters: '{ "parameterName": "custom data" }'
* pipelineMultiParameters: '[ { "multiParameterName": "custom data" } ]'
*/
// eslint-disable-next-line no-console
console.log({ executions });
return Promise.all(
executions.map(async (execution) => {
return await REST(BROADSIDE_URI).post({
application: execution.application,
pipelineNameOrId: execution.pipelineConfigId,
pipelineBaseParameters: execution.trigger.parameters,
});
}),
);
};
26 changes: 20 additions & 6 deletions spin-observatory-plugin-deck/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1431,10 +1431,10 @@
resolved "https://registry.yarnpkg.com/@spinnaker/mocks/-/mocks-1.0.7.tgz#3e30fde4d691b310910e7fa5201c7424609042c0"
integrity sha512-WXoNtZoFZFNDTrckCbbTShxoRN088IN+awWweNNv89EU4GsMX8HnnG/9J6N9rAt0R3ZgzhJmaNG06/JHHBzxEw==

"@spinnaker/pluginsdk-peerdeps@0.13.0":
version "0.13.0"
resolved "https://registry.yarnpkg.com/@spinnaker/pluginsdk-peerdeps/-/pluginsdk-peerdeps-0.13.0.tgz#5435e3061a78791c023259ae2dd6f6b030f5328d"
integrity sha512-2Tlh8brwSOsZxKJDedPhR/BKnfwSy3GDknW8t4cvI9RwQ/JTLlPHwb45CAhXgO6bPjZMZFylYjoMXd7sAX4zNQ==
"@spinnaker/pluginsdk-peerdeps@0.14.0":
version "0.14.0"
resolved "https://registry.yarnpkg.com/@spinnaker/pluginsdk-peerdeps/-/pluginsdk-peerdeps-0.14.0.tgz#a6a87c778cb04cd829280bdb45c55feeb3917c28"
integrity sha512-xnVmlR5vCcQ+Tl/7Ye7x7G28puE0PICg2EVxhuXPOZ59RMw1r8Mh+MmB4rYSvvcILI5dDgyQ+aa6MyiayRh6Nw==

"@spinnaker/[email protected]":
version "0.3.0"
Expand Down Expand Up @@ -2405,7 +2405,7 @@ cheerio@^1.0.0-rc.3:
parse5 "^7.0.0"
parse5-htmlparser2-tree-adapter "^7.0.0"

chokidar@^3.5.1:
"chokidar@>=3.0.0 <4.0.0", chokidar@^3.5.1:
version "3.5.3"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==
Expand Down Expand Up @@ -4082,6 +4082,11 @@ image-size@~0.5.0:
resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c"
integrity sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==

immutable@^4.0.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.0.tgz#eb1738f14ffb39fd068b1dbe1296117484dd34be"
integrity sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==

import-cwd@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-3.0.0.tgz#20845547718015126ea9b3676b7592fb8bd4cf92"
Expand Down Expand Up @@ -6550,6 +6555,15 @@ safe-regex-test@^1.0.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==

sass@^1.62.1:
version "1.62.1"
resolved "https://registry.yarnpkg.com/sass/-/sass-1.62.1.tgz#caa8d6bf098935bc92fc73fa169fb3790cacd029"
integrity sha512-NHpxIzN29MXvWiuswfc1W3I0N8SXBd8UR26WntmDlRYf0bSADnwnOjsyMZ3lMezSlArD33Vs3YFhp7dWvL770A==
dependencies:
chokidar ">=3.0.0 <4.0.0"
immutable "^4.0.0"
source-map-js ">=0.6.2 <2.0.0"

scheduler@^0.19.1:
version "0.19.1"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196"
Expand Down Expand Up @@ -6740,7 +6754,7 @@ slice-ansi@^4.0.0:
astral-regex "^2.0.0"
is-fullwidth-code-point "^3.0.0"

source-map-js@^1.0.2:
"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==
Expand Down

0 comments on commit 13eb9d7

Please sign in to comment.