Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Remove custom styles from notifications #100

Merged
merged 3 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,7 @@ LABEL org.opencontainers.image.title="Volumes Backup & Share" \
]" \
com.docker.desktop.extension.icon="https://raw.githubusercontent.com/docker/volumes-backup-extension/main/icon.svg" \
com.docker.extension.changelog="<ul>\
<li>Improved volume list performance.</li> \
<li>Added support to import backups from any .tar.gz.</li> \
<li>Changed the clone operation to copy the volume labels as well.</li> \
<li>Fixed a bug where the clone operation will not validate whether the destination volume already existed.</li> \
<li>Added error tracking to detect issues before users report them.</li> \
<li>Fixed new vulnerabilities detected in the Dockerfile.</li> \
<li>Fixed an issue with notifications and the new Design System.</li> \
</ul>" \
com.docker.extension.categories="volumes"

Expand Down
1 change: 1 addition & 0 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ export function App() {
return;
}
calculateVolumeSize(recalculateVolumeSize);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [recalculateVolumeSize]);

const handleTransferDialogClose = () => {
Expand Down
23 changes: 4 additions & 19 deletions ui/src/NotificationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const NotificationProvider: FC = ({ children }) => {
{actions.map((action) => (
<Button
key={action.name}
variant="text"
onClick={() => {
if (action.onClick) action.onClick();
setOpen(false);
Expand All @@ -85,32 +86,16 @@ export const NotificationProvider: FC = ({ children }) => {
message={values.message}
action={buildActions(values.actions || [DEFAULT_ACTION])}
sx={{
"& .MuiButton-root": {
color: useLightTheme
? (theme) => theme.palette.docker.blue[500]
: "white",
"&:hover": {
backgroundColor: (theme) => {
if (values.type === "error") {
return useLightTheme
? theme.palette.docker.red[200]
: theme.palette.docker.red[100];
}

return useLightTheme
? "white"
: theme.palette.docker.grey[200];
},
},
},
backgroundColor: (theme) => {
if (values.type === "error") {
return useLightTheme
? theme.palette.docker.red[100] // red-100 should be "#FDEAEA" but it's not 🤷‍♂️
: theme.palette.docker.red[200];
}

return useLightTheme ? "white" : theme.palette.docker.grey[200];
return useLightTheme
? theme.palette.common.white
: theme.palette.docker.grey[200];
},
color: (theme) => theme.palette.text.primary,
borderRadius: "4px !important",
Expand Down
13 changes: 7 additions & 6 deletions vm/internal/handler/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,16 @@ func TestPullVolume(t *testing.T) {
t.Log(string(response))

if strings.Contains(string(response), "error") {
return err
return fmt.Errorf("error pushing image %s", string(response))
}

t.Log("image pushed successfully")
return nil
})
if err != nil {
t.Fatal(err)
}

// The sleep is to ensure the image is present in the registry after the `ImagePush` operation.
time.Sleep(3 * time.Second)

_, err = cli.ImageRemove(context.Background(), imageID, types.ImageRemoveOptions{
Force: true,
})
Expand All @@ -169,8 +167,11 @@ func TestPullVolume(t *testing.T) {
t.Fatal(err)
}

// Pull volume from registry
err = h.PullVolume(c)
// Ths is to ensure the image is present in the registry after the `ImagePush` operation, might take a bit of time.
err = retry(10, 1*time.Second, func() error {
// Pull volume from registry
return h.PullVolume(c)
})

require.NoError(t, err)
require.Equal(t, http.StatusCreated, rec.Code)
Expand Down
2 changes: 1 addition & 1 deletion vm/internal/handler/save_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ func TestSaveVolume(t *testing.T) {
require.Len(t, summary, 1)
require.Equal(t, imageID, summary[0].RepoTags[0])
t.Logf("Image size after saving volume into it: %d", summary[0].Size)
require.Regexp(t, `124\d{4}`, strconv.FormatInt(summary[0].Size, 10), "the image size should be around 1.24MB")
require.Regexp(t, `\d{7}`, strconv.FormatInt(summary[0].Size, 10), "the image size should be between 1 and 10 MB")
}