supported container on connection (#736)
This commit is contained in:
parent
e39efb1d68
commit
10ea9b418a
7 changed files with 77 additions and 46 deletions
|
|
@ -83,6 +83,16 @@ QJsonObject ContainersModel::getContainerConfig(const int containerIndex)
|
|||
return qvariant_cast<QJsonObject>(data(index(containerIndex), ConfigRole));
|
||||
}
|
||||
|
||||
bool ContainersModel::isSupportedByCurrentPlatform(const int containerIndex)
|
||||
{
|
||||
return qvariant_cast<bool>(data(index(containerIndex), IsSupportedRole));
|
||||
}
|
||||
|
||||
bool ContainersModel::isServiceContainer(const int containerIndex)
|
||||
{
|
||||
return qvariant_cast<amnezia::ServiceType>(data(index(containerIndex), ServiceTypeRole) == ServiceType::Other);
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> ContainersModel::roleNames() const
|
||||
{
|
||||
QHash<int, QByteArray> roles;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ public slots:
|
|||
|
||||
QJsonObject getContainerConfig(const int containerIndex);
|
||||
|
||||
bool isSupportedByCurrentPlatform(const int containerIndex);
|
||||
bool isServiceContainer(const int containerIndex);
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
|
|
|
|||
|
|
@ -405,8 +405,9 @@ void ServersModel::addContainerConfig(const int containerIndex, const QJsonObjec
|
|||
server.insert(config_key::containers, containers);
|
||||
|
||||
auto defaultContainer = server.value(config_key::defaultContainer).toString();
|
||||
if ((ContainerProps::containerFromString(defaultContainer) == DockerContainer::None
|
||||
|| ContainerProps::containerService(container) != ServiceType::Other)) {
|
||||
if (ContainerProps::containerFromString(defaultContainer) == DockerContainer::None
|
||||
&& ContainerProps::containerService(container) != ServiceType::Other
|
||||
&& ContainerProps::isSupportedByCurrentPlatform(container)) {
|
||||
server.insert(config_key::defaultContainer, ContainerProps::containerToString(container));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue