-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* OrganizationListView ### What's done: * Added new user settings window that shows the list of user's organizations * Added new icon for organizations * Added new endpoint "/organizations/by-user/not-deleted" (#731)
- Loading branch information
1 parent
35e0c57
commit 1eadfbd
Showing
9 changed files
with
161 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
save-cloud-common/src/commonMain/kotlin/org/cqfn/save/info/OrganizationInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.cqfn.save.info | ||
|
||
import org.cqfn.save.domain.Role | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
/** | ||
* Represents all data related to the Organization | ||
* | ||
* @property name organization name | ||
* @property userRoles map that matches usernames and roles | ||
* @property avatar avatar of organization | ||
*/ | ||
@Serializable | ||
data class OrganizationInfo( | ||
val name: String, | ||
val userRoles: Map<String, Role> = emptyMap(), | ||
val avatar: String? = null, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...cqfn/save/frontend/components/views/usersettingsview/UserSettingsOrganizationsMenuView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.cqfn.save.frontend.components.views.usersettingsview | ||
|
||
import org.cqfn.save.domain.Role | ||
import org.cqfn.save.frontend.components.basic.cardComponent | ||
import org.cqfn.save.v1 | ||
|
||
import react.FC | ||
import react.dom.* | ||
import react.fc | ||
|
||
@Suppress("MISSING_KDOC_TOP_LEVEL", "TOO_LONG_FUNCTION") | ||
class UserSettingsOrganizationsMenuView : UserSettingsView() { | ||
override fun renderMenu(): FC<UserSettingsProps> = fc { props -> | ||
child(cardComponent(isBordered = false, hasBg = true) { | ||
div("d-sm-flex align-items-center justify-content-center mb-4 mt-4") { | ||
h1("h3 mb-0 mt-2 text-gray-800") { | ||
+"Organizations" | ||
} | ||
} | ||
|
||
ul(classes = "list-group list-group-flush") { | ||
for (organizationInfo in state.selfOrganizationInfos) { | ||
li("list-group-item") { | ||
div("row justify-content-between align-items-center") { | ||
div("align-items-center ml-3") { | ||
img(classes = "avatar avatar-user width-full border color-bg-default rounded-circle") { | ||
attrs.src = organizationInfo.avatar?.let { | ||
"/api/$v1/avatar$it" | ||
} ?: "img/company.svg" | ||
attrs.height = "60" | ||
attrs.width = "60" | ||
} | ||
a(classes = "ml-2", href = "#/${organizationInfo.name}") { | ||
+organizationInfo.name | ||
} | ||
} | ||
div("mr-3") { | ||
val role = state.userInfo?.name?.let { | ||
organizationInfo.userRoles[it] | ||
} ?: Role.NONE | ||
+role.formattedName | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters