Skip to content

Commit

Permalink
style: fix task card, menu and dropdown styles to be uniform [DET-3286]…
Browse files Browse the repository at this point in the history
… (#723)
  • Loading branch information
Caleb Hoyoul Kang authored Jun 17, 2020
1 parent 112ed39 commit bdf0036
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 23 deletions.
32 changes: 16 additions & 16 deletions webui/react/src/components/TaskActionDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ const TaskActionDropdown: React.FC<Props> = ({ task }: Props) => {
params.domEvent.stopPropagation();
try {
switch (params.key) { // Cases should match menu items.
case 'kill':
await killTask(task);
if (task.type === TaskType.Experiment) {
// We don't provide immediate updates for command types yet.
await updateExperimentLocally(exp => ({ ...exp, state: RunState.StoppingCanceled }));
}
case 'activate':
await setExperimentState({
experimentId: parseInt(task.id),
state: RunState.Active,
});
await updateExperimentLocally(exp => ({ ...exp, state: RunState.Active }));
break;
case 'archive':
await archiveExperiment(parseInt(task.id), !task.archived);
Expand All @@ -69,20 +69,20 @@ const TaskActionDropdown: React.FC<Props> = ({ task }: Props) => {
});
await updateExperimentLocally(exp => ({ ...exp, state: RunState.StoppingCanceled }));
break;
case 'kill':
await killTask(task);
if (task.type === TaskType.Experiment) {
// We don't provide immediate updates for command types yet.
await updateExperimentLocally(exp => ({ ...exp, state: RunState.StoppingCanceled }));
}
break;
case 'pause':
await setExperimentState({
experimentId: parseInt(task.id),
state: RunState.Paused,
});
await updateExperimentLocally(exp => ({ ...exp, state: RunState.Paused }));
break;
case 'activate':
await setExperimentState({
experimentId: parseInt(task.id),
state: RunState.Active,
});
await updateExperimentLocally(exp => ({ ...exp, state: RunState.Active }));
break;
}
} catch (e) {
handleError({
Expand All @@ -100,11 +100,11 @@ const TaskActionDropdown: React.FC<Props> = ({ task }: Props) => {

const menu = (
<Menu onClick={handleMenuClick}>
{isKillable && <Menu.Item key="kill">Kill</Menu.Item>}
{isArchivable && <Menu.Item key="archive">Archive</Menu.Item>}
{isPausable && <Menu.Item key="pause">Pause</Menu.Item>}
{isResumable && <Menu.Item key="activate">Activate</Menu.Item>}
{isPausable && <Menu.Item key="pause">Pause</Menu.Item>}
{isArchivable && <Menu.Item key="archive">Archive</Menu.Item>}
{isCancelable && <Menu.Item key="cancel">Cancel</Menu.Item>}
{isKillable && <Menu.Item key="kill">Kill</Menu.Item>}
</Menu>
);

Expand Down
1 change: 1 addition & 0 deletions webui/react/src/components/TaskCard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
border-width: var(--theme-sizes-border-width);
color: var(--theme-colors-monochrome-5);
display: block;
overflow: hidden;
overflow-wrap: break-word;
padding: var(--theme-sizes-layout-big);
padding-right: 0;
Expand Down
25 changes: 19 additions & 6 deletions webui/react/src/styles/antd.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
html {
/* Breadcrumb */

.ant-breadcrumb {
align-items: center;
display: flex;
}

/* Button */

.ant-btn[disabled],
Expand All @@ -13,6 +20,14 @@ html {
justify-content: center;
}

/* Dropdown */

.ant-dropdown-menu {
border: solid var(--theme-sizes-border-width) var(--theme-colors-monochrome-12);
border-radius: var(--theme-sizes-border-radius);
box-shadow: var(--theme-shadow);
}

/* Form */

.ant-form-item-explain {
Expand Down Expand Up @@ -54,12 +69,10 @@ html {
.ant-select.ant-select-open > .ant-select-arrow {
transform: rotate(180deg);
}

/* Breadcrumb */

.ant-breadcrumb {
align-items: center;
display: flex;
.ant-select-dropdown {
border: solid var(--theme-sizes-border-width) var(--theme-colors-monochrome-12);
border-radius: var(--theme-sizes-border-radius);
box-shadow: var(--theme-shadow);
}

/* Space */
Expand Down
2 changes: 1 addition & 1 deletion webui/react/src/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const lightTheme: Theme = {
family: 'Objektiv Mk3',
},
outline: '0 0 0.4rem 0 #009bde',
shadow: '0.2rem 0.2rem 0.4rem 0 #cccccc',
shadow: '0.2rem 0.2rem 0.4rem 0 rgba(0, 0, 0, 0.25)',
sizes: {
border: {
radius: '0.4rem',
Expand Down

0 comments on commit bdf0036

Please sign in to comment.