diff --git a/src/api/__tests__/validations.test.js b/src/api/__tests__/validations.test.js deleted file mode 100644 index cdb9774..0000000 --- a/src/api/__tests__/validations.test.js +++ /dev/null @@ -1,36 +0,0 @@ -import nock from 'nock'; -import { conchApi } from '@src/config'; -import { getValidations } from '../validations'; - -// Fixture -import validations from '@src/__fixtures__/validations.js'; - -localStorage.setItem('token', 'my-token'); - -describe('validations API', () => { - describe('getValidations', () => { - let response; - - beforeEach(() => { - response = {}; - - nock(conchApi) - .get('/validation') - .reply(200, validations); - }); - - test('should return a status of 200', async () => { - expect.assertions(1); - response = await getValidations(); - expect(response.status).toEqual(200); - }); - - test('should return valid data', async () => { - expect.assertions(2); - response = await getValidations(); - const validations = response.data; - expect(typeof validations).toBe('object'); - expect(Array.isArray(validations)).toBeTruthy(); - }); - }); -}); diff --git a/src/api/validations.js b/src/api/validations.js deleted file mode 100644 index 866cce3..0000000 --- a/src/api/validations.js +++ /dev/null @@ -1,12 +0,0 @@ -import { requestWithToken } from './request.js'; - -export const getValidations = () => { - return requestWithToken({ - method: 'GET', - url: '/validation', - }); -}; - -export default { - getValidations, -}; diff --git a/src/router.js b/src/router.js index 56520a9..732e65d 100644 --- a/src/router.js +++ b/src/router.js @@ -1,6 +1,7 @@ import Vue from 'vue'; import Router from 'vue-router'; import Devices from './views/Devices/Devices.vue'; +import Device from './views/Devices/Device.vue'; import DataCenters from './views/DataCenterBrowser/DataCenters.vue'; import SignIn from './views/SignIn/SignIn.vue'; import UserManagement from './views/UserManagement/UserManagement.vue'; @@ -47,7 +48,7 @@ export default new Router({ // when /device/:deviceId is matched path: ':deviceId', name: 'device', - component: Devices, + component: Device, }, ], }, diff --git a/src/store/__tests__/actions.test.js b/src/store/__tests__/actions.test.js index 807c685..513f971 100644 --- a/src/store/__tests__/actions.test.js +++ b/src/store/__tests__/actions.test.js @@ -149,11 +149,4 @@ describe('actions', () => { expect(commit).toHaveBeenCalledWith('setUsers', []); }); }); - - describe('setValidations', () => { - test('it sets the validations', () => { - actions.setValidations({ commit }, {}); - expect(commit).toHaveBeenCalledWith('setValidations', {}); - }); - }); }); diff --git a/src/store/__tests__/mutations.test.js b/src/store/__tests__/mutations.test.js index fe6bab2..76fab2a 100644 --- a/src/store/__tests__/mutations.test.js +++ b/src/store/__tests__/mutations.test.js @@ -12,7 +12,6 @@ import rackLayout from '@src/__fixtures__/rackLayout.js'; import rackRooms from '@src/__fixtures__/rackRooms.js'; import userAuthTokens from '@src/__fixtures__/userAuthTokens.js'; import users from '@src/__fixtures__/users.js'; -import validations from '@src/__fixtures__/validations.js'; describe('mutations', () => { let state; @@ -217,13 +216,4 @@ describe('mutations', () => { expect(state).toMatchObject({ users }); }); }); - - describe('setValidations', () => { - test('it adds validations to the state', () => { - state = { validations: [] }; - - mutations.setValidations(state, validations); - expect(state).toMatchObject({ validations }); - }); - }); }); diff --git a/src/store/actions.js b/src/store/actions.js index 6154c18..cc630b0 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -149,10 +149,6 @@ export const setUsers = ({ commit }, users) => { commit('setUsers', users); }; -export const setValidations = ({ commit }, validations) => { - commit('setValidations', validations); -}; - export default { clearActiveDevice, clearActiveRoomName, @@ -191,5 +187,4 @@ export default { setShowDeviceInRack, setUserAuthTokens, setUsers, - setValidations, }; diff --git a/src/store/mutations.js b/src/store/mutations.js index 315682f..19e12ee 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -151,10 +151,6 @@ export const setUsers = (state, users) => { state.users = users; }; -export const setValidations = (state, validations) => { - state.validations = validations; -}; - export default { clearActiveDevice, clearActiveRoomName, @@ -193,5 +189,4 @@ export default { setShowDeviceInRack, setUserAuthTokens, setUsers, - setValidations, }; diff --git a/src/store/state.js b/src/store/state.js index ff080b4..5ddee54 100644 --- a/src/store/state.js +++ b/src/store/state.js @@ -31,7 +31,6 @@ export const initialState = () => { userAuthTokens: [], userOrganizations: [], users: [], - validations: [], }; }; @@ -67,7 +66,6 @@ export const state = { userAuthTokens: [], userOrganizations: [], users: [], - validations: [], }; export default { diff --git a/src/styles/components/_cards.scss b/src/styles/components/_cards.scss new file mode 100644 index 0000000..79efced --- /dev/null +++ b/src/styles/components/_cards.scss @@ -0,0 +1,19 @@ +.card { + &.is-rounded-1 { + border-radius: 3px; + + .card-footer { + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; + } + } + + &.is-rounded-2 { + border-radius: 4px; + + .card-footer { + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; + } + } +} diff --git a/src/styles/components/_device-browser.scss b/src/styles/components/_device-browser.scss index 53dd0ec..12edc50 100644 --- a/src/styles/components/_device-browser.scss +++ b/src/styles/components/_device-browser.scss @@ -1,66 +1,76 @@ .device-browser { - .device-search { - flex-grow: 1; + .device-search { + flex-grow: 1; - input.search { - background-color: $dark; - border-color: $grey; - border-radius: 4px; - color: #bdcbdb; - height: 46px; - margin-bottom: 20px; - min-width: 350px; + input.search { + background-color: $dark; + border-color: $grey; + border-radius: 4px; + color: #bdcbdb; + margin-bottom: 20px; + min-width: 350px; - &::placeholder { - color: $grey-light; - } + &::placeholder { + color: #bdcbdb; + } - &:focus { - border: 1px solid $blue; - box-shadow: none; - } - } + &:focus { + border: 1px solid $blue; + box-shadow: none; + } + } + } - span.icon.is-left { - top: 6px; - left: 2px; + .button.search { + font-weight: bold; + padding-right: 20px; + padding-left: 20px; + } - .material-icons { - font-size: 28px; - } - } - } + .device-details { + position: sticky; + top: 0; - .button.search { - font-weight: bold; - height: 46px; - padding-right: 20px; - padding-left: 20px; - } + .box.serial-number { + background-color: $dark; + } + } - .device-details { - position: sticky; - top: 0; + .card { + cursor: pointer; - .box.serial-number { - background-color: $dark; - } - } + &.is-parent { + background-color: #1a2531; + transition: all 0.1s ease; - .empty-state { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; + &:hover { + background-color: #1f2a36; + border: 1px solid #5a6977; + // transform: scale(1.02); + transition: all 0.1s ease; + } + } - img { - margin: 30px auto; - } + .card-content { + padding: 20px; - .empty-state-heading { - color: $white; - font-size: 24px; - margin-bottom: 30px; - } - } + .content { + .card { + align-items: center; + display: flex; + justify-content: space-between; + padding: 10px; + + &:not(:last-of-type) { + margin-bottom: 12px; + } + + p.is-title { + font-weight: bold; + margin-bottom: 0.2em; + } + } + } + } + } } diff --git a/src/styles/main.scss b/src/styles/main.scss index f872429..d54edb2 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -37,6 +37,7 @@ @import './components/base-modal'; @import './components/build'; @import './components/builds'; +@import './components/cards'; @import './components/confirmation-modal'; @import './components/create-build-modal'; @import './components/create-token-modal'; diff --git a/src/views/DeviceInspector/__tests__/DeviceInspector.test.js b/src/views/DeviceInspector/__tests__/DeviceInspector.test.js deleted file mode 100644 index b991264..0000000 --- a/src/views/DeviceInspector/__tests__/DeviceInspector.test.js +++ /dev/null @@ -1,66 +0,0 @@ -import Vuex from 'vuex'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; -import DeviceInspector from '../DeviceInspector.vue'; - -// Fixture -import activeDevice from '@src/__fixtures__/activeDevice.js'; - -const localVue = createLocalVue(); -localVue.use(Vuex); - -jest.mock('../../../api/request.js'); - -describe('DeviceInspector.vue', () => { - let actions; - let getters; - let state; - let store; - let wrapper; - - beforeEach(() => { - actions = { - clearShowDeviceInRack: jest.fn(), - setActiveDeviceDetails: jest.fn(), - setActiveDeviceSettings: jest.fn(), - setActiveDeviceValidations: jest.fn(), - setActiveRoomName: jest.fn(), - setRackLayout: jest.fn(), - setValidations: jest.fn(), - }; - getters = { activeDeviceId: jest.fn() }; - state = { activeDevice }; - store = new Vuex.Store({ actions, getters, state }); - wrapper = shallowMount(DeviceInspector, { localVue, store }); - }); - - test('should display a loading indicator if there is no activeDevice', () => { - state.activeDevice = {}; - - expect(wrapper.find('spinner-stub').exists()).toBeTruthy(); - expect(wrapper.find('.tabs-container').exists()).toBeFalsy(); - }); - - test('should display tabs if there is an activeDevice', () => { - expect(wrapper.find('.tabs-container').exists()).toBeTruthy(); - }); - - test('should display the Overview Tab by default on inital render', () => { - expect(wrapper.find('overviewtab-stub').exists()).toBeTruthy(); - }); - - test('should call setActiveTab method with new active tab when tab is clicked', () => { - const spy = jest.spyOn(wrapper.vm, 'setActiveTab'); - const settingsTab = wrapper.findAll('a').at(2); - - settingsTab.trigger('click'); - - expect(spy).toHaveBeenCalledWith('SettingsTab'); - }); - - test('should call clearShowDeviceInRack if showDeviceInRack is true on mount', () => { - state.showDeviceInRack = true; - shallowMount(DeviceInspector, { localVue, store }); - - expect(actions.clearShowDeviceInRack).toHaveBeenCalled(); - }); -}); diff --git a/src/views/DeviceInspector/DeviceInspector.vue b/src/views/Devices/Device.vue similarity index 50% rename from src/views/DeviceInspector/DeviceInspector.vue rename to src/views/Devices/Device.vue index 2a4d28a..32a2a36 100644 --- a/src/views/DeviceInspector/DeviceInspector.vue +++ b/src/views/Devices/Device.vue @@ -1,9 +1,6 @@