fix(CommunityPermissionsViewPage): prevent from modifying singleton's data from storybook's page

This commit is contained in:
Michał Cieślak 2023-02-23 14:46:03 +01:00 committed by Michał
parent ec51fbe0e0
commit aff97d741e
2 changed files with 60 additions and 56 deletions

View File

@ -31,14 +31,15 @@ SplitView {
store: CommunitiesStore {
id: mockedCommunity
readonly property var permissionsModel:
PermissionsModel.permissionsModel
readonly property ListModel permissionsModel: ListModel {
Component.onCompleted: append(PermissionsModel.permissionsModelData)
}
readonly property var assetsModel: AssetsModel {
readonly property AssetsModel assetsModel: AssetsModel {
id: assetsModel
}
readonly property var collectiblesModel: CollectiblesModel {
readonly property CollectiblesModel collectiblesModel: CollectiblesModel {
id: collectiblesModel
}
}

View File

@ -9,64 +9,67 @@ import AppLayouts.Chat.controls.community 1.0
QtObject {
id: root
readonly property var permissionsModel: ListModel {
Component.onCompleted:
append([
{
holdingsListModel: root.createHoldingsModel1(),
channelsListModel: root.createChannelsModel1(),
permissionType: PermissionTypes.Type.Admin,
isPrivate: true
},
{
holdingsListModel: root.createHoldingsModel2(),
channelsListModel: root.createChannelsModel2(),
permissionType: PermissionTypes.Type.Member,
isPrivate: false
}
])
readonly property var permissionsModelData: [
{
holdingsListModel: root.createHoldingsModel1(),
channelsListModel: root.createChannelsModel1(),
permissionType: PermissionTypes.Type.Admin,
isPrivate: true
},
{
holdingsListModel: root.createHoldingsModel2(),
channelsListModel: root.createChannelsModel2(),
permissionType: PermissionTypes.Type.Member,
isPrivate: false
}
]
readonly property var shortPermissionsModelData: [
{
holdingsListModel: root.createHoldingsModel3(),
channelsListModel: root.createChannelsModel1(),
permissionType: PermissionTypes.Type.Admin,
isPrivate: true,
}
]
readonly property var longPermissionsModelData: [
{
holdingsListModel: root.createHoldingsModel4(),
channelsListModel: root.createChannelsModel1(),
permissionType: PermissionTypes.Type.Admin,
isPrivate: true
},
{
holdingsListModel: root.createHoldingsModel3(),
channelsListModel: root.createChannelsModel2(),
permissionType: PermissionTypes.Type.Member,
isPrivate: false
},
{
holdingsListModel: root.createHoldingsModel2(),
channelsListModel: root.createChannelsModel2(),
permissionType: PermissionTypes.Type.Member,
isPrivate: false
},
{
channelsListModel: root.createChannelsModel2(),
holdingsListModel: root.createHoldingsModel1(),
permissionType: PermissionTypes.Type.Member,
isPrivate: false
}
]
readonly property ListModel permissionsModel: ListModel {
Component.onCompleted: append(permissionsModelData)
}
readonly property var shortPermissionsModel: ListModel {
Component.onCompleted:
append([
{
holdingsListModel: root.createHoldingsModel3(),
channelsListModel: root.createChannelsModel1(),
permissionType: PermissionTypes.Type.Admin,
isPrivate: true,
}
])
Component.onCompleted: append(shortPermissionsModelData)
}
readonly property var longPermissionsModel: ListModel {
Component.onCompleted:
append([
{
holdingsListModel: root.createHoldingsModel4(),
channelsListModel: root.createChannelsModel1(),
permissionType: PermissionTypes.Type.Admin,
isPrivate: true
},
{
holdingsListModel: root.createHoldingsModel3(),
channelsListModel: root.createChannelsModel2(),
permissionType: PermissionTypes.Type.Member,
isPrivate: false
},
{
holdingsListModel: root.createHoldingsModel2(),
channelsListModel: root.createChannelsModel2(),
permissionType: PermissionTypes.Type.Member,
isPrivate: false
},
{
channelsListModel: root.createChannelsModel2(),
holdingsListModel: root.createHoldingsModel1(),
permissionType: PermissionTypes.Type.Member,
isPrivate: false
}
])
Component.onCompleted: append(longPermissionsModelData)
}
function createHoldingsModel1() {