提交 e8f4652b 编写于 作者: C Christopher Walker 提交者: Sebastian Florek

Make roles zero state consistent with other cluster resources (#2336)

* removed zero-state logic and display on roles

* remove controller state
上级 fb3ca16b
......@@ -28,12 +28,4 @@ export class RoleListController {
/** @export {!angular.Resource} */
this.roleListResource = kdRoleListResource;
}
/**
* @return {boolean}
* @export
*/
shouldShowZeroState() {
return this.roleList.items === null || this.roleList.items.length === 0;
}
}
......@@ -18,11 +18,9 @@ limitations under the License.
<kd-content-card>
<kd-content>
<kd-role-card-list ng-if="!$ctrl.shouldShowZeroState()"
role-list="$ctrl.roleList"
<kd-role-card-list role-list="$ctrl.roleList"
role-list-resource="$ctrl.roleListResource"
with-statuses="false">
</kd-role-card-list>
<kd-zero-state ng-if="$ctrl.shouldShowZeroState()"></kd-zero-state>
</kd-content>
</kd-content-card>
......@@ -16,17 +16,8 @@ import {RoleListController} from 'role/list/controller';
import roleModule from 'role/module';
describe('Role controller', () => {
/**
* @type {!RoleListController}
*/
let ctrl;
beforeEach(() => {
angular.mock.module(roleModule.name);
angular.mock.inject(($controller) => {
ctrl = $controller(RoleListController, {roleList: {items: []}});
});
});
it('should initialize role controller', angular.mock.inject(($controller) => {
......@@ -36,24 +27,4 @@ describe('Role controller', () => {
expect(ctrl.roleList.items).toBe(ctrls);
}));
it('should show zero state', () => {
expect(ctrl.shouldShowZeroState()).toBe(true);
});
it('should hide zero state', () => {
// given
ctrl.roleList = {items: ['mock']};
// then
expect(ctrl.shouldShowZeroState()).toBe(false);
});
it('should show zero state if returned items is null', () => {
// given
ctrl.roleList = {items: null};
// then
expect(ctrl.shouldShowZeroState()).toBe(true);
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册