def get_object(self): ds_id = self.kwargs["data_source_id"] try: return saharaclient.data_source_get(self.request, ds_id) except Exception: msg = _('Unable to retrieve details for data source "%s".') % ds_id redirect = reverse( "horizon:project:data_processing.data_sources:data-sources") exceptions.handle(self.request, msg, redirect=redirect)
def get_context_data(self, request): data_source_id = self.tab_group.kwargs['data_source_id'] try: data_source = saharaclient.data_source_get(request, data_source_id) except Exception as e: data_source = {} LOG.error("Unable to fetch data source details: %s" % str(e)) return {"data_source": data_source}
def __init__(self, request, context_seed, entry_point, *args, **kwargs): self.data_source_id = context_seed["data_source_id"] data_source = saharaclient.data_source_get(request, self.data_source_id) super(EditDataSource, self).__init__(request, context_seed, entry_point, *args, **kwargs) for step in self.steps: if isinstance(step, create.GeneralConfig): fields = step.action.fields for field in fields: if self.FIELD_MAP[field]: fields[field].initial = getattr( data_source, self.FIELD_MAP[field], None)
def __init__(self, request, context_seed, entry_point, *args, **kwargs): self.data_source_id = context_seed["data_source_id"] data_source = saharaclient.data_source_get(request, self.data_source_id) super(EditDataSource, self).__init__(request, context_seed, entry_point, *args, **kwargs) for step in self.steps: if isinstance(step, create.GeneralConfig): fields = step.action.fields for field in fields: if self.FIELD_MAP[field]: fields[field].initial = getattr(data_source, self.FIELD_MAP[field], None)