@@ -157,9 +157,9 @@
Details
Status
-
- {{ item.resource_status }}
-
+
diff --git a/client/app/shared/icon-status.component.js b/client/app/shared/icon-status.component.js
new file mode 100644
index 000000000..8e0e6e1ee
--- /dev/null
+++ b/client/app/shared/icon-status.component.js
@@ -0,0 +1,50 @@
+export const IconStatusComponent = {
+ controllerAs: 'vm',
+ controller: ComponentController,
+ bindings: {
+ status: '<',
+ success: '',
+ error: '',
+ queued: '',
+ inprogress: '',
+ },
+ template: `
+
+
+
+
+
+ `,
+};
+
+/** @ngInject */
+function ComponentController(lodash) {
+ const vm = this;
+ vm.$onChanges = function() {
+ vm.status = lodash.capitalize(vm.status);
+
+ angular.extend(vm, {
+ isSuccess: vm.success ? vm.success.some((status) => status.toLowerCase() === vm.status.toLowerCase()) : false,
+ isError: vm.error ? vm.error.some((status) => status.toLowerCase() === vm.status.toLowerCase()) : false,
+ isQueued: vm.queued ? vm.queued.some((status) => status.toLowerCase() === vm.status.toLowerCase()) : false,
+ isInprogress: vm.inprogress ? vm.inprogress.some((status) => status.toLowerCase() === vm.status.toLowerCase()) : false,
+ });
+ vm.isUnknown = !vm.isSuccess && !vm.isError && !vm.isQueued && !vm.isInprogress;
+ };
+}
diff --git a/client/app/shared/icon-status.component.spec.js b/client/app/shared/icon-status.component.spec.js
new file mode 100644
index 000000000..aa2c3908e
--- /dev/null
+++ b/client/app/shared/icon-status.component.spec.js
@@ -0,0 +1,47 @@
+describe('Component: Icon-status', () => {
+ let parentScope, $compile;
+
+ beforeEach(module('app.services', 'app.shared'));
+
+ beforeEach(inject(function(_$compile_, _$rootScope_) {
+ $compile = _$compile_;
+ parentScope = _$rootScope_.$new();
+ }));
+
+ const compileHtml = function(markup, scope) {
+ let element = angular.element(markup);
+ $compile(element)(scope);
+ scope.$digest();
+ return element;
+ };
+
+ it('should display success when status matches success', () => {
+ const renderedElement = compileHtml(angular.element(``), parentScope);
+
+ expect(renderedElement[0].querySelectorAll('.pficon-ok').length).to.eq(1);
+ });
+
+ it('should display error when status matches error', () => {
+ const renderedElement = compileHtml(angular.element(``), parentScope);
+
+ expect(renderedElement[0].querySelectorAll('.pficon-error-circle-o').length).to.eq(1);
+ });
+
+ it('should display pending when status matches pending', () => {
+ const renderedElement = compileHtml(angular.element(``), parentScope);
+
+ expect(renderedElement[0].querySelectorAll('.fa-hourglass-half').length).to.eq(1);
+ });
+
+ it('should display spinner when status is matches inprogress', () => {
+ const renderedElement = compileHtml(angular.element(``), parentScope);
+
+ expect(renderedElement[0].querySelectorAll('.spinner').length).to.eq(1);
+ });
+
+ it('should display unknown when status unknown', () => {
+ const renderedElement = compileHtml(angular.element(``), parentScope);
+
+ expect(renderedElement[0].querySelectorAll('.pficon-help').length).to.eq(1);
+ });
+});
diff --git a/client/app/shared/shared.module.js b/client/app/shared/shared.module.js
index 3ee6734ac..b1cc77144 100644
--- a/client/app/shared/shared.module.js
+++ b/client/app/shared/shared.module.js
@@ -7,6 +7,7 @@ import {CustomDropdownComponent} from "./custom-dropdown/custom-dropdown.compone
import {DialogContentComponent} from "./dialog-content/dialog-content.component.js";
import {ElapsedTime} from "./elapsedTime.filter.js";
import {IconListComponent} from "./icon-list/icon-list.component.js";
+import {IconStatusComponent} from './icon-status.component.js';
import {LoadingComponent} from "./loading.component.js";
import {PaginationComponent} from "./pagination/pagination.component.js";
import {SSCardComponent} from "./ss-card/ss-card.component.js";
@@ -30,6 +31,7 @@ export const SharedModule = angular
.component('dialogContent', DialogContentComponent)
.component('explorerPagination', PaginationComponent)
.component('iconList', IconListComponent)
+ .component('iconStatus', IconStatusComponent)
.component('loading', LoadingComponent)
.component('ssCard', SSCardComponent)
.component('taggingWidget', TaggingComponent)