Skip to content

Commit

Permalink
UX fixes as well as api session timeout handling fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lphiri committed May 25, 2014
1 parent ae5064b commit 49b620e
Show file tree
Hide file tree
Showing 10 changed files with 889 additions and 705 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,22 @@ angular.module('RedhatAccess', [
$httpProvider.defaults.headers.common = {
'X-CSRF-TOKEN': $('meta[name=csrf-token]').attr('content')
};

var authInteceptor = ['$q',
function ($q) {
return {
'response': function (response) {
return response;
},
'responseError': function (rejection) {
if (rejection.status === 401) {
location.reload();
}
return $q.reject(rejection);
}
};
}
];
$httpProvider.interceptors.push(authInteceptor);
}
]).run(['TITLE_VIEW_CONFIG',
'$http', 'securityService', 'hideMachinesDropdown', 'NEW_DEFAULTS',
Expand All @@ -41,44 +56,43 @@ angular.module('RedhatAccess', [
hideMachinesDropdown.value = true;
NEW_DEFAULTS.product = "Red Hat Satellite or Proxy"; //TODO read from server config
NEW_DEFAULTS.version = "6.0 Beta"; //TODO read from server config
$http({
method: 'GET',
url: 'configuration'
}).
success(function (data, status, headers, config) {
if (data) {
if (data.strataHostName) {
strata.setStrataHostname(data.strataHostName);
} else {
console.log("Invalid configuration object " + data);
}
if (data.strataClientId) {
strata.setRedhatClientID(data.strataClientId);
} else {
strata.setRedhatClientID("foreman-strata-client");
console.log("Invalid configuration object " + data);
}
}
securityService.validateLogin(false).then(
function (authedUser) {
console.log("logged in user is " + authedUser)
},
function (error) {
console.log("Unable to get user credentials");
});
}).
error(function (data, status, headers, config) {
console.log("Failed to read app configuration");
strata.setRedhatClientID("foreman-strata-client");
securityService.validateLogin(false).then(
function (authedUser) {
console.log("logged in user is " + authedUser)
},
function (error) {
console.log("Unable to get user credentials");
});
});

// $http({
// method: 'GET',
// url: 'configuration'
// }).
// success(function (data, status, headers, config) {
// if (data) {
// if (data.strataHostName) {
// strata.setStrataHostname(data.strataHostName);
// } else {
// console.log("Invalid configuration object " + data);
// }
// if (data.strataClientId) {
// strata.setRedhatClientID(data.strataClientId);
// } else {
// strata.setRedhatClientID("foreman-strata-client");
// console.log("Invalid configuration object " + data);
// }
// }
// securityService.validateLogin(false).then(
// function (authedUser) {
// console.log("logged in user is " + authedUser)
// },
// function (error) {
// console.log("Unable to get user credentials");
// });
// }).
// error(function (data, status, headers, config) {
// console.log("Failed to read app configuration");
// strata.setRedhatClientID("foreman-strata-client");
// securityService.validateLogin(false).then(
// function (authedUser) {
// console.log("logged in user is " + authedUser)
// },
// function (error) {
// console.log("Unable to get user credentials");
// });
// });
}
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ def create
:status => 500
end
end

def api_request?
true
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@ def index
render :json => { :strataHostName => strata_host,:strataClientId => client_id }.to_json,
:layout => false
end

def api_request?
true
end

end
end
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@ def get_available_logs
def is_valid_file? file
@@log_files.include?(file) && File.exist?(file) && File.readable?(file) && File.size(file) > 0
end

def api_request?
true
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
</div>
<%= stylesheet_link_tag 'redhat_access/application'%>
<%= javascript_include_tag 'redhat_access/application' %>
<%= javascript_tag do %>
strata.setStrataHostname('<%= REDHAT_ACCESS_CONFIG[:strata_host] %>');
strata.setRedhatClientID('<%= "foreman_plugin_#{REDHAT_ACCESS_CONFIG[:deployment]}_#{RedhatAccess::VERSION}" %>');
<% end %>
2 changes: 1 addition & 1 deletion redhat-access/lib/redhat_access/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module RedhatAccess
VERSION = "0.0.3"
VERSION = "0.0.4"
end
1 change: 1 addition & 0 deletions redhat-access/redhat_access.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ Gem::Specification.new do |s|
# s.add_dependency "jquery-rails"
#-------------s.add_dependency "angular-rails-templates", ">= 0.0.4"
s.add_development_dependency "sqlite3"
#s.add_development_dependency "redhat_access_lib"
end
6 changes: 5 additions & 1 deletion redhat-access/rubygem-foreman-redhat_access.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
%endif

Name: %{?scl_prefix}rubygem-foreman-%{gem_name}
Version: 0.0.3
Version: 0.0.4
Release: 1%{?dist}
Summary: Foreman engine to access Red Hat knowledge base
Group: Development/Languages
Expand Down Expand Up @@ -111,6 +111,10 @@ cp -pa .%{rubygem_redhat_access_dir}/config/config.yml.example %{buildroot}/etc/
/usr/bin

%changelog
* Wed May 14 2014 Rex White <[email protected]> - 0.0.4-1
- Resolves: bz1084590
- Updated for UX comments

* Wed May 14 2014 Rex White <[email protected]> - 0.0.3-1
- Resolves: bz1084590

Expand Down
Loading

0 comments on commit 49b620e

Please sign in to comment.