forked from cloudforet-io/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: change info according API docs in dashboard service (#1)
Signed-off-by: Seolmin Kwon <seolmin@mz.co.kr>
- Loading branch information
Showing
5 changed files
with
48 additions
and
116 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from spaceone.dashboard.info.common_info import * | ||
from spaceone.dashboard.info.domain_dashboard_info import * | ||
from spaceone.dashboard.info.project_dashboard_info import * | ||
from spaceone.dashboard.info.widget_info import * | ||
from spaceone.dashboard.info.custom_widget_info import * |
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,34 @@ | ||
import functools | ||
from spaceone.api.dashboard.v1 import custom_widget_pb2 | ||
from spaceone.core.pygrpc.message_type import * | ||
from spaceone.core import utils | ||
from spaceone.dashboard.model.custom_widget_model import CustomWidget | ||
|
||
__all__ = ['CustomWidgetInfo', 'CustomWidgetsInfo'] | ||
|
||
|
||
def CustomWidgetInfo(custom_widget_vo: CustomWidget, minimal=False): | ||
info = { | ||
'custom_widget_id': custom_widget_vo.widget_id, | ||
'widget_id': custom_widget_vo.widget_id, | ||
'name': custom_widget_vo.name, | ||
'version': custom_widget_vo.version, | ||
'user_id': custom_widget_vo.user_id, | ||
'domain_id': custom_widget_vo.domain_id | ||
} | ||
|
||
if not minimal: | ||
info.update({ | ||
'widget_options': change_struct_type(custom_widget_vo.widget_options), | ||
'inherit_options': change_struct_type(custom_widget_vo.inherit_options), | ||
'tags': change_struct_type(custom_widget_vo.tags), | ||
'created_at': utils.datetime_to_iso8601(custom_widget_vo.created_at), | ||
'updated_at': utils.datetime_to_iso8601(custom_widget_vo.updated_at) | ||
}) | ||
|
||
return custom_widget_pb2.CustomWidgetInfo(**info) | ||
|
||
|
||
def CustomWidgetsInfo(custom_widget_vos, total_count, **kwargs): | ||
return custom_widget_pb2.CustomWidgetsInfo(results=list( | ||
map(functools.partial(CustomWidgetInfo, **kwargs), custom_widget_vos)), total_count=total_count) |
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 was deleted.
Oops, something went wrong.