Просмотр исходного кода

added icons for viewer and editor, fixed add permission team avatar

Patrick O'Carroll 7 лет назад
Родитель
Сommit
b363e160d9

+ 1 - 1
public/app/core/components/Permissions/AddPermissions.tsx

@@ -48,7 +48,7 @@ class AddPermissions extends Component<IProps, any> {
       permissions.newItem.setTeam(null, null);
       permissions.newItem.setTeam(null, null);
       return;
       return;
     }
     }
-    return permissions.newItem.setTeam(team.id, team.name);
+    return permissions.newItem.setTeam(team.id, team.name, team.avatarUrl);
   }
   }
 
 
   permissionPicked(permission: OptionWithDescription) {
   permissionPicked(permission: OptionWithDescription) {

+ 6 - 2
public/app/core/components/Permissions/PermissionsListItem.tsx

@@ -8,13 +8,18 @@ const setClassNameHelper = inherited => {
 };
 };
 
 
 function ItemAvatar({ item }) {
 function ItemAvatar({ item }) {
+  console.log(item);
   if (item.userAvatarUrl) {
   if (item.userAvatarUrl) {
     return <img className="filter-table__avatar" src={item.userAvatarUrl} />;
     return <img className="filter-table__avatar" src={item.userAvatarUrl} />;
   }
   }
   if (item.teamAvatarUrl) {
   if (item.teamAvatarUrl) {
     return <img className="filter-table__avatar" src={item.teamAvatarUrl} />;
     return <img className="filter-table__avatar" src={item.teamAvatarUrl} />;
   }
   }
-  return <span style={{ width: '25px' }} className={item.icon} />;
+  if (item.role === 'Editor') {
+    return <i style={{ width: '25px', fontSize: '1.5rem' }} className="gicon gicon-editor" />;
+  }
+
+  return <i style={{ width: '25px', fontSize: '1.5rem' }} className="gicon gicon-viewer" />;
 }
 }
 
 
 function ItemDescription({ item }) {
 function ItemDescription({ item }) {
@@ -28,7 +33,6 @@ function ItemDescription({ item }) {
 }
 }
 
 
 export default observer(({ item, removeItem, permissionChanged, itemIndex, folderInfo }) => {
 export default observer(({ item, removeItem, permissionChanged, itemIndex, folderInfo }) => {
-  console.log(item);
   const handleRemoveItem = evt => {
   const handleRemoveItem = evt => {
     evt.preventDefault();
     evt.preventDefault();
     removeItem(itemIndex);
     removeItem(itemIndex);

+ 5 - 1
public/app/stores/PermissionsStore/PermissionsStore.ts

@@ -31,6 +31,7 @@ export const NewPermissionsItem = types
     userId: types.maybe(types.number),
     userId: types.maybe(types.number),
     userLogin: types.maybe(types.string),
     userLogin: types.maybe(types.string),
     userAvatarUrl: types.maybe(types.string),
     userAvatarUrl: types.maybe(types.string),
+    teamAvatarUrl: types.maybe(types.string),
     teamId: types.maybe(types.number),
     teamId: types.maybe(types.number),
     team: types.maybe(types.string),
     team: types.maybe(types.string),
     permission: types.optional(types.number, 1),
     permission: types.optional(types.number, 1),
@@ -58,11 +59,12 @@ export const NewPermissionsItem = types
       self.teamId = null;
       self.teamId = null;
       self.team = null;
       self.team = null;
     },
     },
-    setTeam(teamId: number, team: string) {
+    setTeam(teamId: number, team: string, teamAvatarUrl: string) {
       self.userId = null;
       self.userId = null;
       self.userLogin = null;
       self.userLogin = null;
       self.teamId = teamId;
       self.teamId = teamId;
       self.team = team;
       self.team = team;
+      self.teamAvatarUrl = teamAvatarUrl;
     },
     },
     setPermission(permission: number) {
     setPermission(permission: number) {
       self.permission = permission;
       self.permission = permission;
@@ -124,12 +126,14 @@ export const PermissionsStore = types
           userLogin: undefined,
           userLogin: undefined,
           userId: undefined,
           userId: undefined,
           userAvatarUrl: undefined,
           userAvatarUrl: undefined,
+          teamAvatarUrl: undefined,
           role: undefined,
           role: undefined,
         };
         };
         switch (self.newItem.type) {
         switch (self.newItem.type) {
           case aclTypeValues.GROUP.value:
           case aclTypeValues.GROUP.value:
             item.team = self.newItem.team;
             item.team = self.newItem.team;
             item.teamId = self.newItem.teamId;
             item.teamId = self.newItem.teamId;
+            item.teamAvatarUrl = self.newItem.teamAvatarUrl;
             break;
             break;
           case aclTypeValues.USER.value:
           case aclTypeValues.USER.value:
             item.userLogin = self.newItem.userLogin;
             item.userLogin = self.newItem.userLogin;

+ 19 - 0
public/img/icons_dark_theme/icon_editor.svg

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="64px" height="64px" viewBox="-479 353 64 64" style="enable-background:new -479 353 64 64;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#E3E2E2;}
+</style>
+<g>
+	<path class="st0" d="M-470.4,410h34.4c4.7,0,8.6-3.8,8.6-8.6v-17.3l-4.2,4.2v13.1c0,2.4-1.9,4.3-4.3,4.3h-34.4
+		c-2.4,0-4.3-1.9-4.3-4.3V376c0-2.4,1.9-4.3,4.3-4.3h32.1l4.2-4.2h-36.3c-4.7,0-8.6,3.8-8.6,8.6v25.5
+		C-479,406.2-475.2,410-470.4,410z"/>
+	
+		<rect x="-438.3" y="364.5" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 -1008.7032 339.9824)" class="st0" width="8.7" height="28.8"/>
+	<path class="st0" d="M-425.5,364.3l6.2,6.2l1.4-1.4l1.6-1.6c1.7-1.7,1.7-4.5,0-6.2c-1.7-1.7-4.5-1.7-6.2,0l-1.6,1.6L-425.5,364.3z"
+		/>
+	<polygon class="st0" points="-444.8,393.9 -442.3,393.5 -448.5,387.3 -448.9,389.8 -449.8,394.8 	"/>
+</g>
+</svg>

+ 17 - 0
public/img/icons_dark_theme/icon_viewer.svg

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="64px" height="64px" viewBox="-479 353 64 64" style="enable-background:new -479 353 64 64;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#E2E2E2;}
+</style>
+<path class="st0" d="M-415.1,384c-0.4-0.7-9.5-16.6-31.6-16.6c0,0-0.1,0-0.1,0c0,0,0,0,0,0c0,0-0.1,0-0.1,0
+	c-22,0.1-31.3,15.9-31.6,16.6c-0.3,0.6-0.3,1.3,0,1.9c0.4,0.7,9.6,16.5,31.6,16.6c0,0,0.1,0,0.1,0c0,0,0,0,0,0c0,0,0.1,0,0.1,0
+	c22.2,0,31.2-16,31.6-16.6C-414.8,385.3-414.8,384.6-415.1,384z M-446.9,399.3c-7.9,0-14.3-6.4-14.3-14.3c0-7.9,6.4-14.3,14.3-14.3
+	c7.9,0,14.3,6.4,14.3,14.3C-432.6,392.9-439,399.3-446.9,399.3z"/>
+<g>
+	<path class="st0" d="M-446.9,378.3c-0.9,0-1.8,0.2-2.6,0.5c1.2,0.4,2,1.5,2,2.9c0,1.7-1.4,3-3,3c-1.2,0-2.2-0.7-2.7-1.7
+		c-0.2,0.6-0.3,1.3-0.3,2c0,3.7,3,6.7,6.7,6.7c3.7,0,6.7-3,6.7-6.7S-443.2,378.3-446.9,378.3z"/>
+</g>
+</svg>

+ 19 - 0
public/img/icons_light_theme/icon_editor.svg

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="64px" height="64px" viewBox="-479 353 64 64" style="enable-background:new -479 353 64 64;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#52545C;}
+</style>
+<g>
+	<path class="st0" d="M-470.4,410h34.4c4.7,0,8.6-3.8,8.6-8.6v-17.3l-4.2,4.2v13.1c0,2.4-1.9,4.3-4.3,4.3h-34.4
+		c-2.4,0-4.3-1.9-4.3-4.3V376c0-2.4,1.9-4.3,4.3-4.3h32.1l4.2-4.2h-36.3c-4.7,0-8.6,3.8-8.6,8.6v25.5
+		C-479,406.2-475.2,410-470.4,410z"/>
+	
+		<rect x="-438.3" y="364.5" transform="matrix(-0.7071 -0.7071 0.7071 -0.7071 -1008.7032 339.9824)" class="st0" width="8.7" height="28.8"/>
+	<path class="st0" d="M-425.5,364.3l6.2,6.2l1.4-1.4l1.6-1.6c1.7-1.7,1.7-4.5,0-6.2c-1.7-1.7-4.5-1.7-6.2,0l-1.6,1.6L-425.5,364.3z"
+		/>
+	<polygon class="st0" points="-444.8,393.9 -442.3,393.5 -448.5,387.3 -448.9,389.8 -449.8,394.8 	"/>
+</g>
+</svg>

+ 17 - 0
public/img/icons_light_theme/icon_viewer.svg

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 19.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="64px" height="64px" viewBox="-479 353 64 64" style="enable-background:new -479 353 64 64;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#52545C;}
+</style>
+<path class="st0" d="M-415.1,384c-0.4-0.7-9.5-16.6-31.6-16.6c0,0-0.1,0-0.1,0c0,0,0,0,0,0c0,0-0.1,0-0.1,0
+	c-22,0.1-31.3,15.9-31.6,16.6c-0.3,0.6-0.3,1.3,0,1.9c0.4,0.7,9.6,16.5,31.6,16.6c0,0,0.1,0,0.1,0c0,0,0,0,0,0c0,0,0.1,0,0.1,0
+	c22.2,0,31.2-16,31.6-16.6C-414.8,385.3-414.8,384.6-415.1,384z M-446.9,399.3c-7.9,0-14.3-6.4-14.3-14.3c0-7.9,6.4-14.3,14.3-14.3
+	c7.9,0,14.3,6.4,14.3,14.3C-432.6,392.9-439,399.3-446.9,399.3z"/>
+<g>
+	<path class="st0" d="M-446.9,378.3c-0.9,0-1.8,0.2-2.6,0.5c1.2,0.4,2,1.5,2,2.9c0,1.7-1.4,3-3,3c-1.2,0-2.2-0.7-2.7-1.7
+		c-0.2,0.6-0.3,1.3-0.3,2c0,3.7,3,6.7,6.7,6.7c3.7,0,6.7-3,6.7-6.7S-443.2,378.3-446.9,378.3z"/>
+</g>
+</svg>

+ 8 - 0
public/sass/base/_icons.scss

@@ -120,6 +120,10 @@
   background-image: url('../img/icons_#{$theme-name}_theme/icon_data_sources.svg');
   background-image: url('../img/icons_#{$theme-name}_theme/icon_data_sources.svg');
 }
 }
 
 
+.gicon-editor {
+  background-image: url('../img/icons_#{$theme-name}_theme/icon_editor.svg');
+}
+
 .gicon-folder-new {
 .gicon-folder-new {
   background-image: url('../img/icons_#{$theme-name}_theme/icon_add_folder.svg');
   background-image: url('../img/icons_#{$theme-name}_theme/icon_add_folder.svg');
 }
 }
@@ -180,6 +184,10 @@
   background-image: url('../img/icons_#{$theme-name}_theme/icon_variable.svg');
   background-image: url('../img/icons_#{$theme-name}_theme/icon_variable.svg');
 }
 }
 
 
+.gicon-viewer {
+  background-image: url('../img/icons_#{$theme-name}_theme/icon_viewer.svg');
+}
+
 .gicon-zoom-out {
 .gicon-zoom-out {
   background-image: url('../img/icons_#{$theme-name}_theme/icon_zoom_out.svg');
   background-image: url('../img/icons_#{$theme-name}_theme/icon_zoom_out.svg');
 }
 }