Skip to content

Commit fef7863

Browse files
authored
Adjusted edit / delete tags modal styles (#1939)
1 parent 427b9b4 commit fef7863

File tree

7 files changed

+171
-97
lines changed

7 files changed

+171
-97
lines changed

portal-ui/src/icons/AddNewTagIcon.tsx

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,57 +20,23 @@ import { SVGProps } from "react";
2020
const AddNewTagIcon = (props: SVGProps<SVGSVGElement>) => (
2121
<svg
2222
xmlns="http://www.w3.org/2000/svg"
23-
width="284.616"
24-
height="49.568"
2523
className={"min-icon"}
2624
viewBox="0 0 256 256"
2725
{...props}
2826
>
29-
<defs>
30-
<clipPath id="clip-path">
31-
<rect
32-
id="Rectángulo_1041"
33-
data-name="Rectángulo 1041"
34-
width="256"
35-
height="242.667"
36-
fill="none"
37-
/>
38-
</clipPath>
39-
<clipPath id="clip-Add_New_Tag">
40-
<rect width="256" height="256" />
41-
</clipPath>
42-
</defs>
43-
<g
44-
id="Add_New_Tag"
45-
data-name="Add New Tag"
46-
clipPath="url(#clip-Add_New_Tag)"
47-
>
48-
<rect width="256" height="256" fill="#fff" />
49-
<g id="Add_New_Tag_Icon" data-name="Add New Tag Icon">
50-
<g id="Add_New_" data-name="Add New " transform="translate(0 7.836)">
51-
<g id="Grupo_2429" data-name="Grupo 2429" clipPath="url(#clip-path)">
52-
<path
53-
id="Trazado_7190"
54-
data-name="Trazado 7190"
55-
d="M227.22,126.576A53.114,53.114,0,1,0,155.674,55.03L109.365,8.722A29.86,29.86,0,0,0,88.94,0L29.97.032A30.021,30.021,0,0,0,0,29.99l0,59.2a29.8,29.8,0,0,0,8.7,20.186L133.237,233.909a29.806,29.806,0,0,0,21.266,8.758v0a29.813,29.813,0,0,0,21.25-8.743l58.162-58.157a30.211,30.211,0,0,0-.018-42.511ZM60.958,76.033A15.072,15.072,0,1,1,76.031,60.96,15.091,15.091,0,0,1,60.958,76.033m100.274,3.334A41.967,41.967,0,1,1,203.2,121.334a41.967,41.967,0,0,1-41.967-41.967"
56-
fill="#4ccb92"
57-
/>
58-
<path
59-
id="Trazado_7191"
60-
data-name="Trazado 7191"
61-
d="M316.362,94.258H303.2v13.164H290.033v13.165H303.2v13.165h13.164V120.587h13.164V107.422H316.362Z"
62-
transform="translate(-106.58 -34.638)"
63-
fill="#4ccb92"
64-
/>
65-
</g>
27+
<g>
28+
<g transform="translate(0 7.836)">
29+
<g>
30+
<path
31+
d="M227.22,126.576A53.114,53.114,0,1,0,155.674,55.03L109.365,8.722A29.86,29.86,0,0,0,88.94,0L29.97.032A30.021,30.021,0,0,0,0,29.99l0,59.2a29.8,29.8,0,0,0,8.7,20.186L133.237,233.909a29.806,29.806,0,0,0,21.266,8.758v0a29.813,29.813,0,0,0,21.25-8.743l58.162-58.157a30.211,30.211,0,0,0-.018-42.511ZM60.958,76.033A15.072,15.072,0,1,1,76.031,60.96,15.091,15.091,0,0,1,60.958,76.033m100.274,3.334A41.967,41.967,0,1,1,203.2,121.334a41.967,41.967,0,0,1-41.967-41.967"
32+
fill="#4ccb92"
33+
/>
34+
<path
35+
d="M316.362,94.258H303.2v13.164H290.033v13.165H303.2v13.165h13.164V120.587h13.164V107.422H316.362Z"
36+
transform="translate(-106.58 -34.638)"
37+
fill="#4ccb92"
38+
/>
6639
</g>
67-
<rect
68-
id="Rectángulo_1042"
69-
data-name="Rectángulo 1042"
70-
width="256"
71-
height="256"
72-
fill="none"
73-
/>
7440
</g>
7541
</g>
7642
</svg>

portal-ui/src/icons/EditTagIcon.tsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// This file is part of MinIO Console Server
2+
// Copyright (c) 2021 MinIO, Inc.
3+
//
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Affero General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Affero General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Affero General Public License
15+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
17+
import * as React from "react";
18+
import { SVGProps } from "react";
19+
20+
const EditTagIcon = (props: SVGProps<SVGSVGElement>) => (
21+
<svg
22+
xmlns="http://www.w3.org/2000/svg"
23+
className={"min-icon"}
24+
viewBox="0 0 256 256"
25+
{...props}
26+
>
27+
<g transform="translate(0 0)">
28+
<g transform="translate(0 0)">
29+
<path
30+
d="M224.54,131.96c26.08-14.98,35.99-47.67,22.62-74.61-11.77-25.71-42.15-37.02-67.87-25.25-.96,.44-1.9,.91-2.83,1.4-9.84,5.4-17.74,13.74-22.62,23.85L108.09,9.09C102.84,3.49,95.57,.22,87.9,0H29.63C12.83,.49-.41,14.46,0,31.25v61.73c.19,7.83,3.25,15.33,8.6,21.05l123.12,129.87c10.78,11.6,28.92,12.27,40.52,1.49,.52-.48,1.01-.98,1.49-1.49l57.48-60.63c11.52-12.53,11.52-31.8,0-44.32l-6.68-6.98ZM60.25,79.27c-8.45-.23-15.12-7.27-14.89-15.72-.23-8.45,6.44-15.49,14.89-15.72,8.45,.24,15.11,7.27,14.89,15.72,.22,8.45-6.44,15.48-14.89,15.72m99.09,3.47h0c-.61-23.53,17.95-43.11,41.47-43.75,23.53,.64,42.09,20.22,41.47,43.75,.61,23.53-17.95,43.11-41.47,43.75-23.53-.64-42.09-20.22-41.47-43.75"
31+
fill="#4ccb92"
32+
/>
33+
<path
34+
d="M217.93,64.76c-1.49-1.66-3.62-2.61-5.85-2.61-2.24,.02-4.37,.94-5.92,2.55l-21.93,23.19c-.31,.32-.52,.72-.59,1.16l-2.28,11.67c-.15,.73,.07,1.48,.59,2.01,.41,.4,.96,.62,1.53,.61,.14,.04,.29,.04,.44,0l10.98-2.24c.42-.08,.81-.3,1.1-.62l21.93-23.19c3.22-3.52,3.22-8.92,0-12.45v-.07Z"
35+
fill="#4ccb92"
36+
/>
37+
</g>
38+
</g>
39+
</svg>
40+
);
41+
42+
export default EditTagIcon;

portal-ui/src/icons/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,4 @@ export { default as NetworkGetIcon } from "./NetworkGetIcon";
188188
export { default as NetworkPutIcon } from "./NetworkPutIcon";
189189
export { default as RemoveAllIcon } from "./RemoveAllIcon";
190190
export { default as CancelledIcon } from "./CancelledIcon";
191+
export { default as EditTagIcon } from "./EditTagIcon";

portal-ui/src/screens/Console/Buckets/ListBuckets/Objects/ObjectDetails/TagsModal.tsx

Lines changed: 106 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ import {
3333
modalStyleUtils,
3434
spacingUtils,
3535
} from "../../../../Common/FormComponents/common/styleLibrary";
36-
import { TagsIcon } from "../../../../../../icons";
36+
import {
37+
AddNewTagIcon,
38+
DisabledIcon,
39+
EditTagIcon,
40+
} from "../../../../../../icons";
3741
import { IFileInfo } from "./types";
3842
import { IAM_SCOPES } from "../../../../../../common/SecureComponent/permissions";
3943
import { SecureComponent } from "../../../../../../common/SecureComponent";
@@ -56,9 +60,32 @@ const styles = (theme: Theme) =>
5660
fontSize: 18,
5761
fontWeight: "bold",
5862
color: "#000",
59-
margin: "20px 0",
63+
margin: "35px 0",
6064
paddingBottom: 15,
61-
borderBottom: "#E2E2E2 2px solid",
65+
display: "flex",
66+
alignItems: "center",
67+
"& > svg": {
68+
marginRight: 10,
69+
},
70+
},
71+
tagsForLabel: {
72+
fontSize: 16,
73+
margin: "20px 0 30px",
74+
whiteSpace: "nowrap",
75+
overflow: "hidden",
76+
textOverflow: "ellipsis",
77+
width: "100%",
78+
},
79+
currentTagsContainer: {
80+
fontSize: 14,
81+
fontWeight: "normal",
82+
},
83+
noTagsForObject: {
84+
color: "#858585",
85+
},
86+
deleteTag: {
87+
color: "#C83B51",
88+
marginLeft: 5,
6289
},
6390
...formFieldStyles,
6491
...modalStyleUtils,
@@ -152,40 +179,59 @@ const AddTagModal = ({
152179
setDeleteEnabled(false);
153180
};
154181

182+
const tagsFor = (plural: boolean) => (
183+
<div className={classes.tagsForLabel}>
184+
Tag{plural ? "s" : ""} for: <strong>{currentItem}</strong>
185+
</div>
186+
);
187+
155188
return (
156189
<Fragment>
157190
<ModalWrapper
158191
modalOpen={modalOpen}
159-
title={deleteEnabled ? `Delete Tag` : `Edit Tags for ${currentItem}`}
192+
title={
193+
deleteEnabled ? (
194+
<span style={{ color: "#C83B51" }}>Delete Tag</span>
195+
) : (
196+
`Edit Tags`
197+
)
198+
}
160199
onClose={() => {
161200
onCloseAndUpdate(true);
162201
}}
163-
titleIcon={<TagsIcon />}
202+
titleIcon={
203+
deleteEnabled ? (
204+
<DisabledIcon style={{ fill: "#C83B51" }} />
205+
) : (
206+
<EditTagIcon />
207+
)
208+
}
164209
>
165210
{deleteEnabled ? (
166211
<Fragment>
167212
<Grid container>
213+
{tagsFor(false)}
168214
Are you sure you want to delete the tag{" "}
169-
<b className={classes.wrapText}>
215+
<b className={classes.deleteTag}>
170216
{deleteKey} : {deleteLabel}
171-
</b>{" "}
172-
from {currentItem}?
217+
</b>{" "}?
173218
<Grid item xs={12} className={classes.modalButtonBar}>
174219
<Button
175220
type="button"
176221
variant="outlined"
177222
color="primary"
178223
onClick={cancelDelete}
179224
>
180-
No
225+
Cancel
181226
</Button>
182227
<Button
183228
type="submit"
184229
variant="outlined"
185230
color="secondary"
186231
onClick={deleteTagProcess}
232+
id={"deleteTag"}
187233
>
188-
Yes
234+
Delete Tag
189235
</Button>
190236
</Grid>
191237
</Grid>
@@ -200,44 +246,56 @@ const AddTagModal = ({
200246
sx={{
201247
display: "flex",
202248
flexFlow: "column",
249+
width: "100%",
203250
}}
204251
>
205-
<strong>Current Tags:</strong>
206-
{currTagKeys.length === 0 ? "No Tags for this object" : ""}
207-
<Box>
208-
{currTagKeys.map((tagKey: string, index: number) => {
209-
const tag = get(currentTags, `${tagKey}`, "");
210-
if (tag !== "") {
211-
return (
212-
<SecureComponent
213-
key={`chip-${index}`}
214-
scopes={[IAM_SCOPES.S3_DELETE_OBJECT_TAGGING]}
215-
resource={bucketName}
216-
matchAll
217-
errorProps={{
218-
deleteIcon: null,
219-
onDelete: null,
220-
}}
221-
>
222-
<Chip
223-
style={{
224-
textTransform: "none",
225-
marginRight: "5px",
252+
{tagsFor(true)}
253+
<div className={classes.currentTagsContainer}>
254+
Current Tags:
255+
<br />
256+
{currTagKeys.length === 0 ? (
257+
<span className={classes.noTagsForObject}>
258+
There are no tags for this object
259+
</span>
260+
) : (
261+
<Fragment />
262+
)}
263+
<Box sx={{ marginTop: "5px", marginBottom: "15px" }}>
264+
{currTagKeys.map((tagKey: string, index: number) => {
265+
const tag = get(currentTags, `${tagKey}`, "");
266+
if (tag !== "") {
267+
return (
268+
<SecureComponent
269+
key={`chip-${index}`}
270+
scopes={[IAM_SCOPES.S3_DELETE_OBJECT_TAGGING]}
271+
resource={bucketName}
272+
matchAll
273+
errorProps={{
274+
deleteIcon: null,
275+
onDelete: null,
226276
}}
227-
size="small"
228-
label={`${tagKey} : ${tag}`}
229-
color="primary"
230-
deleteIcon={<CloseIcon />}
231-
onDelete={() => {
232-
onDeleteTag(tagKey, tag);
233-
}}
234-
/>
235-
</SecureComponent>
236-
);
237-
}
238-
return null;
239-
})}
240-
</Box>
277+
>
278+
<Chip
279+
style={{
280+
textTransform: "none",
281+
marginRight: "5px",
282+
marginBottom: "5px",
283+
}}
284+
size="small"
285+
label={`${tagKey} : ${tag}`}
286+
color="primary"
287+
deleteIcon={<CloseIcon />}
288+
onDelete={() => {
289+
onDeleteTag(tagKey, tag);
290+
}}
291+
/>
292+
</SecureComponent>
293+
);
294+
}
295+
return null;
296+
})}
297+
</Box>
298+
</div>
241299
</Box>
242300
</SecureComponent>
243301
<SecureComponent
@@ -247,7 +305,7 @@ const AddTagModal = ({
247305
>
248306
<Grid container>
249307
<Grid item xs={12} className={classes.newTileHeader}>
250-
Add New Tag
308+
<AddNewTagIcon /> Add New Tag
251309
</Grid>
252310
<Grid item xs={12} className={classes.formFieldRow}>
253311
<InputBoxWrapper
@@ -292,8 +350,9 @@ const AddTagModal = ({
292350
isSending
293351
}
294352
onClick={addTagProcess}
353+
id="saveTag"
295354
>
296-
Save new Tag
355+
Save
297356
</Button>
298357
</Grid>
299358
</Grid>

portal-ui/src/screens/Console/Common/FormComponents/common/styleLibrary.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ export const deleteDialogStyles = {
12051205
justifyContent: "space-between",
12061206
},
12071207
titleText: {
1208-
fontSize: "1rem",
1208+
fontSize: 20,
12091209
fontWeight: 600,
12101210
display: "flex",
12111211
alignItems: "center",

portal-ui/src/screens/Console/Common/IconsScreen.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,12 @@ const IconsScreen = ({ classes }: IIconsScreenSimple) => {
409409
EditIcon
410410
</Grid>
411411

412+
<Grid item xs={3} sm={2} md={1}>
413+
<cicons.EditTagIcon />
414+
<br />
415+
EditTagIcon
416+
</Grid>
417+
412418
<Grid item xs={3} sm={2} md={1}>
413419
<cicons.EditTenantIcon />
414420
<br />

portal-ui/tests/permissions-3/bucketObjectTags.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ test
4747
.click(Selector("button").withText("Tags"))
4848
.typeText("#newTagKey", "tag1")
4949
.typeText("#newTagLabel", "test")
50-
.click(Selector("button:enabled").withText("Save New Tag"))
50+
.click(Selector("#saveTag:enabled"))
5151
.click(Selector("button").withText("Tags"))
5252
.expect(Selector(".MuiChip-label").withText("tag1 : test").exists)
5353
.ok()
5454
.click(Selector(".MuiChip-deleteIcon"))
55-
.click(Selector("button").withText("Yes"))
55+
.click(Selector("#deleteTag"))
5656
.click(Selector("button").withText("Tags"))
5757
.expect(Selector(".MuiChip-label").withText("tag1 : test").exists)
5858
.notOk();
@@ -85,7 +85,7 @@ test
8585
.click(Selector("button").withText("Tags"))
8686
.typeText("#newTagKey", "tag1")
8787
.typeText("#newTagLabel", "test")
88-
.click(Selector("button:enabled").withText("Save New Tag"))
88+
.click(Selector("#saveTag:enabled"))
8989
.click(Selector("button").withText("Tags"))
9090
.expect(Selector(".MuiChip-label").withText("tag1 : test").exists)
9191
.notOk();

0 commit comments

Comments
 (0)