From 1fdc0eaaa3c5b83dc50254901a87e76c5fe3e04d Mon Sep 17 00:00:00 2001 From: Nigel Wilson Date: Mon, 11 Apr 2022 16:26:38 +0100 Subject: [PATCH 01/35] Added new B18 template that uses xpdf dc page and drop down menu --- .../src/js/app/store/modules/store.menus.js | 2 ++ .../js/modules/dc/components/dc-wrapper.vue | 2 ++ .../modules/types/b18/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/b18/menu.js | 29 +++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 client/src/js/modules/types/b18/dc/datacollections.js create mode 100644 client/src/js/modules/types/b18/menu.js diff --git a/client/src/js/app/store/modules/store.menus.js b/client/src/js/app/store/modules/store.menus.js index b215be9ad..077f25061 100644 --- a/client/src/js/app/store/modules/store.menus.js +++ b/client/src/js/app/store/modules/store.menus.js @@ -6,6 +6,7 @@ import SaxsMenu from 'modules/types/saxs/menu.js' import SmMenu from 'modules/types/sm/menu.js' import TomoMenu from 'modules/types/tomo/menu.js' import XpdfMenu from 'modules/types/xpdf/menu.js' +import B18Menu from 'modules/types/b18/menu.js' const menuStore = { namespaced: true, @@ -19,6 +20,7 @@ const menuStore = { 'sm': SmMenu, 'tomo': TomoMenu, 'xpdf': XpdfMenu, + 'b18': B18Menu, } }), diff --git a/client/src/js/modules/dc/components/dc-wrapper.vue b/client/src/js/modules/dc/components/dc-wrapper.vue index 55b76417e..b269e6dbf 100644 --- a/client/src/js/modules/dc/components/dc-wrapper.vue +++ b/client/src/js/modules/dc/components/dc-wrapper.vue @@ -35,6 +35,7 @@ import EmDcList from 'modules/types/em/dc-list/em-dc-list.vue' import POWDCList from 'modules/types/pow/dc/datacollections' import SAXSDCList from 'modules/types/saxs/dc/datacollections' import XPDFDCList from 'modules/types/xpdf/dc/datacollections' +import B18DCList from 'modules/types/b18/dc/datacollections' import DCCol from 'collections/datacollections' import Proposal from 'models/proposal' @@ -49,6 +50,7 @@ let dc_views = { pow: POWDCList, saxs: SAXSDCList, xpdf: XPDFDCList, + b18: B18DCList, } export default { diff --git a/client/src/js/modules/types/b18/dc/datacollections.js b/client/src/js/modules/types/b18/dc/datacollections.js new file mode 100644 index 000000000..315fa10dd --- /dev/null +++ b/client/src/js/modules/types/b18/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for B18 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/b18/menu.js b/client/src/js/modules/types/b18/menu.js new file mode 100644 index 000000000..127a86b09 --- /dev/null +++ b/client/src/js/modules/types/b18/menu.js @@ -0,0 +1,29 @@ +/** + * The menu specification for XPDF pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + shipments: 'Shipments', + assign: 'Assign Sample Changers', + containers: 'Sample Changers', + instances: 'Instances', + xsamples: 'Samples', + phases: 'Phases', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) From ee7fb7d0d6b9935607146e7130ebbdc2a3b14745 Mon Sep 17 00:00:00 2001 From: Nigel Wilson Date: Wed, 20 Apr 2022 11:11:32 +0100 Subject: [PATCH 02/35] Removed XPDF menu items from B18 menu template --- client/src/js/modules/types/b18/menu.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/client/src/js/modules/types/b18/menu.js b/client/src/js/modules/types/b18/menu.js index 127a86b09..b9566388b 100644 --- a/client/src/js/modules/types/b18/menu.js +++ b/client/src/js/modules/types/b18/menu.js @@ -8,12 +8,6 @@ define([], function() { menu: { dc: 'View All Data', visits: 'Visits', - shipments: 'Shipments', - assign: 'Assign Sample Changers', - containers: 'Sample Changers', - instances: 'Instances', - xsamples: 'Samples', - phases: 'Phases', contacts: 'Lab Contacts', }, From 381eef221f8d6d7c22b120d6481675e8e80c30d5 Mon Sep 17 00:00:00 2001 From: Nigel Wilson Date: Thu, 28 Apr 2022 16:27:50 +0100 Subject: [PATCH 03/35] WIP - Created individual beamline templates for most beamlines under xpdf. Needs testing after adding UserGroups and Permissions to ISPyB. --- .../src/js/app/store/modules/store.menus.js | 19 +++++++++++ .../js/modules/dc/components/dc-wrapper.vue | 18 +++++++++++ client/src/js/modules/types/b18/menu.js | 2 +- .../modules/types/i08-1/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/i08-1/menu.js | 23 +++++++++++++ .../modules/types/i08/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/i08/menu.js | 23 +++++++++++++ .../modules/types/i11/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/i11/menu.js | 23 +++++++++++++ .../modules/types/i14/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/i14/menu.js | 23 +++++++++++++ .../modules/types/i16/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/i16/menu.js | 23 +++++++++++++ .../modules/types/i18/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/i18/menu.js | 23 +++++++++++++ .../modules/types/i20-1/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/i20-1/menu.js | 23 +++++++++++++ .../modules/types/i20/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/i20/menu.js | 23 +++++++++++++ .../modules/types/k11/dc/datacollections.js | 32 +++++++++++++++++++ client/src/js/modules/types/k11/menu.js | 23 +++++++++++++ 21 files changed, 533 insertions(+), 1 deletion(-) create mode 100644 client/src/js/modules/types/i08-1/dc/datacollections.js create mode 100644 client/src/js/modules/types/i08-1/menu.js create mode 100644 client/src/js/modules/types/i08/dc/datacollections.js create mode 100644 client/src/js/modules/types/i08/menu.js create mode 100644 client/src/js/modules/types/i11/dc/datacollections.js create mode 100644 client/src/js/modules/types/i11/menu.js create mode 100644 client/src/js/modules/types/i14/dc/datacollections.js create mode 100644 client/src/js/modules/types/i14/menu.js create mode 100644 client/src/js/modules/types/i16/dc/datacollections.js create mode 100644 client/src/js/modules/types/i16/menu.js create mode 100644 client/src/js/modules/types/i18/dc/datacollections.js create mode 100644 client/src/js/modules/types/i18/menu.js create mode 100644 client/src/js/modules/types/i20-1/dc/datacollections.js create mode 100644 client/src/js/modules/types/i20-1/menu.js create mode 100644 client/src/js/modules/types/i20/dc/datacollections.js create mode 100644 client/src/js/modules/types/i20/menu.js create mode 100644 client/src/js/modules/types/k11/dc/datacollections.js create mode 100644 client/src/js/modules/types/k11/menu.js diff --git a/client/src/js/app/store/modules/store.menus.js b/client/src/js/app/store/modules/store.menus.js index 077f25061..142d8699d 100644 --- a/client/src/js/app/store/modules/store.menus.js +++ b/client/src/js/app/store/modules/store.menus.js @@ -7,6 +7,16 @@ import SmMenu from 'modules/types/sm/menu.js' import TomoMenu from 'modules/types/tomo/menu.js' import XpdfMenu from 'modules/types/xpdf/menu.js' import B18Menu from 'modules/types/b18/menu.js' +import I16Menu from 'modules/types/i16/menu.js' +import I14Menu from 'modules/types/i14/menu.js' +import I18Menu from 'modules/types/i18/menu.js' +import I08Menu from 'modules/types/i08/menu.js' +import I08_1Menu from 'modules/types/i08-1/menu.js' +import I11Menu from 'modules/types/i11/menu.js' +import K11Menu from 'modules/types/k11/menu.js' +import I20Menu from 'modules/types/i20/menu.js' +import I20_1Menu from 'modules/types/i20-1/menu.js' + const menuStore = { namespaced: true, @@ -21,6 +31,15 @@ const menuStore = { 'tomo': TomoMenu, 'xpdf': XpdfMenu, 'b18': B18Menu, + 'i16': I16Menu, + 'i14': I14Menu, + 'i18': I18Menu, + 'i08': I08Menu, + 'i08-1': I08_1Menu, + 'i11': I11Menu, + 'k11': K11Menu, + 'i20': I20Menu, + 'i20-1': I20_1Menu, } }), diff --git a/client/src/js/modules/dc/components/dc-wrapper.vue b/client/src/js/modules/dc/components/dc-wrapper.vue index b269e6dbf..f2b556b0a 100644 --- a/client/src/js/modules/dc/components/dc-wrapper.vue +++ b/client/src/js/modules/dc/components/dc-wrapper.vue @@ -36,6 +36,15 @@ import POWDCList from 'modules/types/pow/dc/datacollections' import SAXSDCList from 'modules/types/saxs/dc/datacollections' import XPDFDCList from 'modules/types/xpdf/dc/datacollections' import B18DCList from 'modules/types/b18/dc/datacollections' +import I16DCList from 'modules/types/i16/dc/datacollections' +import I14DCList from 'modules/types/i14/dc/datacollections' +import I18DCList from 'modules/types/i18/dc/datacollections' +import I08DCList from 'modules/types/i08/dc/datacollections' +import I08_1DCList from 'modules/types/i08-1/dc/datacollections' +import I11DCList from 'modules/types/i11/dc/datacollections' +import K11DCList from 'modules/types/k11/dc/datacollections' +import I20DCList from 'modules/types/i20/dc/datacollections' +import I20_1DCList from 'modules/types/i20-1/dc/datacollections' import DCCol from 'collections/datacollections' import Proposal from 'models/proposal' @@ -51,6 +60,15 @@ let dc_views = { saxs: SAXSDCList, xpdf: XPDFDCList, b18: B18DCList, + i16: I16DCList, + i14: I14DCList, + i18: I18DCList, + i08: I08DCList, + i08_1: I08_1DCList, + i11: I11DCList, + k11: K11DCList, + i20: I20DCList, + i20_1: I20_1DCList, } export default { diff --git a/client/src/js/modules/types/b18/menu.js b/client/src/js/modules/types/b18/menu.js index b9566388b..6a6d9d735 100644 --- a/client/src/js/modules/types/b18/menu.js +++ b/client/src/js/modules/types/b18/menu.js @@ -1,5 +1,5 @@ /** - * The menu specification for XPDF pages + * The menu specification for b18 pages */ define([], function() { diff --git a/client/src/js/modules/types/i08-1/dc/datacollections.js b/client/src/js/modules/types/i08-1/dc/datacollections.js new file mode 100644 index 000000000..00d297634 --- /dev/null +++ b/client/src/js/modules/types/i08-1/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for I08-1 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/i08-1/menu.js b/client/src/js/modules/types/i08-1/menu.js new file mode 100644 index 000000000..144a43ffc --- /dev/null +++ b/client/src/js/modules/types/i08-1/menu.js @@ -0,0 +1,23 @@ +/** + * The menu specification for i08-1 pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) diff --git a/client/src/js/modules/types/i08/dc/datacollections.js b/client/src/js/modules/types/i08/dc/datacollections.js new file mode 100644 index 000000000..35ad4e403 --- /dev/null +++ b/client/src/js/modules/types/i08/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for I08 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/i08/menu.js b/client/src/js/modules/types/i08/menu.js new file mode 100644 index 000000000..b3955f923 --- /dev/null +++ b/client/src/js/modules/types/i08/menu.js @@ -0,0 +1,23 @@ +/** + * The menu specification for i08 pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) diff --git a/client/src/js/modules/types/i11/dc/datacollections.js b/client/src/js/modules/types/i11/dc/datacollections.js new file mode 100644 index 000000000..24851d9d0 --- /dev/null +++ b/client/src/js/modules/types/i11/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for I11 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/i11/menu.js b/client/src/js/modules/types/i11/menu.js new file mode 100644 index 000000000..2ea0aba8c --- /dev/null +++ b/client/src/js/modules/types/i11/menu.js @@ -0,0 +1,23 @@ +/** + * The menu specification for i11 pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) diff --git a/client/src/js/modules/types/i14/dc/datacollections.js b/client/src/js/modules/types/i14/dc/datacollections.js new file mode 100644 index 000000000..309a7ff03 --- /dev/null +++ b/client/src/js/modules/types/i14/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for I14 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/i14/menu.js b/client/src/js/modules/types/i14/menu.js new file mode 100644 index 000000000..93de9ee8e --- /dev/null +++ b/client/src/js/modules/types/i14/menu.js @@ -0,0 +1,23 @@ +/** + * The menu specification for i14 pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) diff --git a/client/src/js/modules/types/i16/dc/datacollections.js b/client/src/js/modules/types/i16/dc/datacollections.js new file mode 100644 index 000000000..3adc3b6b9 --- /dev/null +++ b/client/src/js/modules/types/i16/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for I16 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/i16/menu.js b/client/src/js/modules/types/i16/menu.js new file mode 100644 index 000000000..e3f4e1f22 --- /dev/null +++ b/client/src/js/modules/types/i16/menu.js @@ -0,0 +1,23 @@ +/** + * The menu specification for i16 pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) diff --git a/client/src/js/modules/types/i18/dc/datacollections.js b/client/src/js/modules/types/i18/dc/datacollections.js new file mode 100644 index 000000000..724d23a69 --- /dev/null +++ b/client/src/js/modules/types/i18/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for I18 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/i18/menu.js b/client/src/js/modules/types/i18/menu.js new file mode 100644 index 000000000..4e977e8b0 --- /dev/null +++ b/client/src/js/modules/types/i18/menu.js @@ -0,0 +1,23 @@ +/** + * The menu specification for i18 pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) diff --git a/client/src/js/modules/types/i20-1/dc/datacollections.js b/client/src/js/modules/types/i20-1/dc/datacollections.js new file mode 100644 index 000000000..c1dcda88f --- /dev/null +++ b/client/src/js/modules/types/i20-1/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for I20-1 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/i20-1/menu.js b/client/src/js/modules/types/i20-1/menu.js new file mode 100644 index 000000000..eebf37bad --- /dev/null +++ b/client/src/js/modules/types/i20-1/menu.js @@ -0,0 +1,23 @@ +/** + * The menu specification for i20-1 pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) diff --git a/client/src/js/modules/types/i20/dc/datacollections.js b/client/src/js/modules/types/i20/dc/datacollections.js new file mode 100644 index 000000000..eb3cc5f10 --- /dev/null +++ b/client/src/js/modules/types/i20/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for I20 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/i20/menu.js b/client/src/js/modules/types/i20/menu.js new file mode 100644 index 000000000..587e0396d --- /dev/null +++ b/client/src/js/modules/types/i20/menu.js @@ -0,0 +1,23 @@ +/** + * The menu specification for i20 pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) diff --git a/client/src/js/modules/types/k11/dc/datacollections.js b/client/src/js/modules/types/k11/dc/datacollections.js new file mode 100644 index 000000000..20b791337 --- /dev/null +++ b/client/src/js/modules/types/k11/dc/datacollections.js @@ -0,0 +1,32 @@ +/** + * The view of all data collections for K11 + * Copied directly from XPDF for easier pattern following + * See dc-wrapper.vue for mapping file to templates + */ +define([ + 'modules/dc/datacollections', + 'modules/types/gen/dc/dclist', + 'modules/types/xpdf/dc/dc', + 'templates/types/xpdf/dc/dclist.html', + ], function( + DataCollections, + DCList, + DCItemView, + template) { + + var XpdfDCList = DCList.extend({ + dcViews: { + data: DCItemView, + }, + apStatus: true, + }) + + return DataCollections.extend({ + dcListView: XpdfDCList, + template: template, + filters: false, + sampleChanger: false, + + }) + +}) diff --git a/client/src/js/modules/types/k11/menu.js b/client/src/js/modules/types/k11/menu.js new file mode 100644 index 000000000..14490d4bf --- /dev/null +++ b/client/src/js/modules/types/k11/menu.js @@ -0,0 +1,23 @@ +/** + * The menu specification for k11 pages + */ + +define([], function() { + + return { + menu: { + dc: 'View All Data', + visits: 'Visits', + contacts: 'Lab Contacts', + }, + + extra: { + + }, + + admin: { + + }, + } + +}) From c14085167843b65e7af62e90fc7e2f99692d8fd4 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Thu, 25 Nov 2021 11:26:26 +0000 Subject: [PATCH 04/35] feature: add warning message to dewar dispatch page --- .gitignore | 2 - api/src/Page/Shipment.php | 2 +- .../modules/shipment/models/dewarhistory.js | 44 +++++++++++++------ .../src/js/modules/shipment/views/dispatch.js | 21 +++++++-- .../src/js/templates/shipment/dispatch.html | 2 +- 5 files changed, 50 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 2aa66075e..02a7814d3 100644 --- a/.gitignore +++ b/.gitignore @@ -30,5 +30,3 @@ client/index.html api/config.php api/vendor api/src/MockUAS.php - -./idea diff --git a/api/src/Page/Shipment.php b/api/src/Page/Shipment.php index cbbb5e839..67b721c24 100644 --- a/api/src/Page/Shipment.php +++ b/api/src/Page/Shipment.php @@ -337,7 +337,7 @@ function _get_history() { array_push($args, $start); array_push($args, $end); - $rows = $this->db->paginate("SELECT s.shippingid, s.shippingname as shipment, CONCAT(CONCAT(CONCAT(p.proposalcode, p.proposalnumber), '-'), b.visit_number) as visit, b.beamlinename as bl, b.beamlineoperator as localcontact, h.dewarid, h.dewarstatus,h.storagelocation,TO_CHAR(h.arrivaldate, 'DD-MM-YYYY HH24:MI') as arrival + $rows = $this->db->paginate("SELECT s.shippingid, s.shippingname as shipment, CONCAT(CONCAT(CONCAT(p.proposalcode, p.proposalnumber), '-'), b.visit_number) as visit, b.beamlinename as bl, b.beamlineoperator as localcontact, h.dewarid, h.dewarstatus,h.storagelocation,TO_CHAR(h.arrivaldate, 'DD-MM-YYYY HH24:MI') as arrival, d.comments FROM dewartransporthistory h INNER JOIN dewar d ON d.dewarid = h.dewarid INNER JOIN shipping s ON d.shippingid = s.shippingid diff --git a/client/src/js/modules/shipment/models/dewarhistory.js b/client/src/js/modules/shipment/models/dewarhistory.js index 908a33b31..0af4664c9 100644 --- a/client/src/js/modules/shipment/models/dewarhistory.js +++ b/client/src/js/modules/shipment/models/dewarhistory.js @@ -1,19 +1,35 @@ define(['backbone'], function(Backbone) { - return Backbone.Model.extend({ - idAttribute: 'DEWARTRANSPORTHISTORYID', - urlRoot: '/shipment/dewars/history', - - validation: { - BARCODE: { + return Backbone.Model.extend({ + idAttribute: 'DEWARTRANSPORTHISTORYID', + urlRoot: '/shipment/dewars/history', + + initialize(attrs, options) { + this.formatComments() + }, + + formatComments() { + const comments = this.get('COMMENTS') + if (comments) { + const parsedComment = JSON.parse(comments) + if (parsedComment) { + this.set('COMMENTS', parsedComment) + } else { + this.set('COMMENTS', comments) + } + } + }, + + validation: { + BARCODE: { required: true, - pattern: 'wwdash', - }, + pattern: 'wwdash', + }, - LOCATION: { - required: true, - pattern: 'wwsdash', - } - } - }) + LOCATION: { + required: true, + pattern: 'wwsdash', + } + } + }) }) \ No newline at end of file diff --git a/client/src/js/modules/shipment/views/dispatch.js b/client/src/js/modules/shipment/views/dispatch.js index 22f745be4..290dd8795 100644 --- a/client/src/js/modules/shipment/views/dispatch.js +++ b/client/src/js/modules/shipment/views/dispatch.js @@ -46,7 +46,8 @@ define(['marionette', 'views/form', accountNumber: 'input[NAME=DELIVERYAGENT_AGENTCODE]', courier: 'input[name=DELIVERYAGENT_AGENTNAME]', - useAnotherCourierAccount: 'input[name=USE_ANOTHER_COURIER_ACCOUNT]' + useAnotherCourierAccount: 'input[name=USE_ANOTHER_COURIER_ACCOUNT]', + dispatchState: '.dispatch-state' }, @@ -113,8 +114,22 @@ define(['marionette', 'views/form', this.history = new DewarHistory(null, { queryParams: { did: this.getOption('dewar').get('DEWARID') }}) this.history.fetch().done(function() { - var h = self.history.at(0) - if (h) self.ui.loc.val(h.get('STORAGELOCATION')) + const history = self.history.at(0) + console.log({ history }) + const location = history ? history.get('STORAGELOCATION') : null + const historyComment = history ? history.get('COMMENTS') : null + const restrictedLocations = ['i03', 'i04', 'i04-1', 'i024'] + + if (location) { + self.ui.loc.val(location) + if (restrictedLocations.includes(location.toLowerCase())) { + self.ui.dispatchState.text('Warning: This dewar is still on the beamline. We recommend waiting until the dewar returns to storage before requesting it\'s return. Dewars are not topped up with LN2 after a return is requested.') + } else if (location.startsWith('tray-') && historyComment && historyComment.checked) { + self.ui.dispatchState.text('Warning: This dewar has not had it\'s contents checked. We recommend asking your local contact to check the dewar\'s contents before requesting it\'s return. Dewars are not topped up with LN2 after a return is requested.') + } else { + self.ui.dispatchState.text('Please note, dewars are not topped up with LN2 after a return is requested.') + } + } }) // Shipping option should be a backbone model this.shipping = options.shipping diff --git a/client/src/js/templates/shipment/dispatch.html b/client/src/js/templates/shipment/dispatch.html index f3369c8c2..53c62261b 100644 --- a/client/src/js/templates/shipment/dispatch.html +++ b/client/src/js/templates/shipment/dispatch.html @@ -1,7 +1,7 @@

Request Dewar Dispatch

+
-
    From 4d0a25c876e30b1ca184308422ff9c90efcdd8c3 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Thu, 25 Nov 2021 12:07:05 +0000 Subject: [PATCH 05/35] fix: change logic for displaying warning for unchecked dewar --- client/src/js/modules/shipment/views/dispatch.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/js/modules/shipment/views/dispatch.js b/client/src/js/modules/shipment/views/dispatch.js index 290dd8795..05abbd7ff 100644 --- a/client/src/js/modules/shipment/views/dispatch.js +++ b/client/src/js/modules/shipment/views/dispatch.js @@ -123,11 +123,14 @@ define(['marionette', 'views/form', if (location) { self.ui.loc.val(location) if (restrictedLocations.includes(location.toLowerCase())) { - self.ui.dispatchState.text('Warning: This dewar is still on the beamline. We recommend waiting until the dewar returns to storage before requesting it\'s return. Dewars are not topped up with LN2 after a return is requested.') - } else if (location.startsWith('tray-') && historyComment && historyComment.checked) { - self.ui.dispatchState.text('Warning: This dewar has not had it\'s contents checked. We recommend asking your local contact to check the dewar\'s contents before requesting it\'s return. Dewars are not topped up with LN2 after a return is requested.') + self.ui.dispatchState.text("Warning: This dewar is still on the beamline. We recommend waiting until the dewar returns to storage before requesting it's return. Dewars are not topped up with LN2 after a return is requested.") + } else if ( + location.startsWith('tray-') && + (!historyComment || (typeof historyComment === 'object' && !historyComment.checked)) + ) { + self.ui.dispatchState.text("Warning: This dewar has not had it's contents checked. We recommend asking your local contact to check the dewar's contents before requesting it's return. Dewars are not topped up with LN2 after a return is requested.") } else { - self.ui.dispatchState.text('Please note, dewars are not topped up with LN2 after a return is requested.') + self.ui.dispatchState.text("Please note, dewars are not topped up with LN2 after a return is requested.") } } }) From 02b1493d2cb7aa46ef7d3183264c2126c66ae4b3 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Thu, 25 Nov 2021 13:02:31 +0000 Subject: [PATCH 06/35] fix: set default state for dewars with no history --- client/src/js/modules/shipment/views/dispatch.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/src/js/modules/shipment/views/dispatch.js b/client/src/js/modules/shipment/views/dispatch.js index 05abbd7ff..b15b92c8f 100644 --- a/client/src/js/modules/shipment/views/dispatch.js +++ b/client/src/js/modules/shipment/views/dispatch.js @@ -132,6 +132,8 @@ define(['marionette', 'views/form', } else { self.ui.dispatchState.text("Please note, dewars are not topped up with LN2 after a return is requested.") } + } else { + self.ui.dispatchState.text("Please note, dewars are not topped up with LN2 after a return is requested.") } }) // Shipping option should be a backbone model From a20168308ed6f64152ffd614ddbe19f7a06d82dc Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Thu, 25 Nov 2021 13:10:53 +0000 Subject: [PATCH 07/35] fix: remove extra else conditions --- client/src/js/modules/shipment/views/dispatch.js | 4 ---- client/src/js/templates/shipment/dispatch.html | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/client/src/js/modules/shipment/views/dispatch.js b/client/src/js/modules/shipment/views/dispatch.js index b15b92c8f..8167adae3 100644 --- a/client/src/js/modules/shipment/views/dispatch.js +++ b/client/src/js/modules/shipment/views/dispatch.js @@ -129,11 +129,7 @@ define(['marionette', 'views/form', (!historyComment || (typeof historyComment === 'object' && !historyComment.checked)) ) { self.ui.dispatchState.text("Warning: This dewar has not had it's contents checked. We recommend asking your local contact to check the dewar's contents before requesting it's return. Dewars are not topped up with LN2 after a return is requested.") - } else { - self.ui.dispatchState.text("Please note, dewars are not topped up with LN2 after a return is requested.") } - } else { - self.ui.dispatchState.text("Please note, dewars are not topped up with LN2 after a return is requested.") } }) // Shipping option should be a backbone model diff --git a/client/src/js/templates/shipment/dispatch.html b/client/src/js/templates/shipment/dispatch.html index 53c62261b..fa1827148 100644 --- a/client/src/js/templates/shipment/dispatch.html +++ b/client/src/js/templates/shipment/dispatch.html @@ -1,5 +1,7 @@

    Request Dewar Dispatch

    -
    +
    + Please note, dewars are not topped up with LN2 after a return is requested. +
    From cdc6fdb6b9bf05474628aaf213a5e93fc5967da3 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Tue, 10 May 2022 13:06:23 +0100 Subject: [PATCH 08/35] refactor: remove console.log statement --- client/src/js/modules/shipment/views/dispatch.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/client/src/js/modules/shipment/views/dispatch.js b/client/src/js/modules/shipment/views/dispatch.js index 8167adae3..32d2952c7 100644 --- a/client/src/js/modules/shipment/views/dispatch.js +++ b/client/src/js/modules/shipment/views/dispatch.js @@ -70,13 +70,11 @@ define(['marionette', 'views/form', }) }, - success: function(model, response, options) { - console.log('success from dispatch req') + success: function() { app.trigger('shipment:show', this.getOption('dewar').get('SHIPPINGID')) }, - failure: function(model, response, options) { - console.log('failure from dispatch req') + failure: function() { app.alert({ message: 'Something went wrong registering this dispatch request, please try again'}) }, @@ -115,7 +113,6 @@ define(['marionette', 'views/form', this.history = new DewarHistory(null, { queryParams: { did: this.getOption('dewar').get('DEWARID') }}) this.history.fetch().done(function() { const history = self.history.at(0) - console.log({ history }) const location = history ? history.get('STORAGELOCATION') : null const historyComment = history ? history.get('COMMENTS') : null const restrictedLocations = ['i03', 'i04', 'i04-1', 'i024'] From 62ed118f5b0bea87262e2c8374d2cc969464eae6 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Wed, 23 Feb 2022 11:11:32 +0000 Subject: [PATCH 09/35] feature: add control room messages for beamlines on data collection page --- api/src/Page/Status.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/src/Page/Status.php b/api/src/Page/Status.php index 411520adf..43dc35b58 100644 --- a/api/src/Page/Status.php +++ b/api/src/Page/Status.php @@ -42,10 +42,13 @@ function _get_pvs() { if (!$this->has_arg('bl')) $this->_error('No beamline specified'); - $ring_pvs = array('Ring Current' => 'SR-DI-DCCT-01:SIGNAL', - //'Ring State' => 'CS-CS-MSTAT-01:MODE', - 'Refill' => 'SR-CS-FILL-01:COUNTDOWN' - ); + $ring_pvs = array( + 'Ring Current' => 'SR-DI-DCCT-01:SIGNAL', + //'Ring State' => 'CS-CS-MSTAT-01:MODE', + 'Refill' => 'SR-CS-FILL-01:COUNTDOWN', + 'Machine Status Message 1' => 'CS-CS-MSTAT-01:MESS01', + 'Machine Status Message 2' => 'CS-CS-MSTAT-01:MESS02', + ); if (!array_key_exists($this->arg('bl'), $bl_pvs)) $this->_error('No such beamline'); From debadffbfbbac97715fa3e94cf654cc10fef8e40 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Wed, 23 Feb 2022 11:55:37 +0000 Subject: [PATCH 10/35] fix: set the pvs to format and return string values --- api/src/Page/Status.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/api/src/Page/Status.php b/api/src/Page/Status.php index 43dc35b58..008f5d835 100644 --- a/api/src/Page/Status.php +++ b/api/src/Page/Status.php @@ -46,14 +46,15 @@ function _get_pvs() { 'Ring Current' => 'SR-DI-DCCT-01:SIGNAL', //'Ring State' => 'CS-CS-MSTAT-01:MODE', 'Refill' => 'SR-CS-FILL-01:COUNTDOWN', - 'Machine Status Message 1' => 'CS-CS-MSTAT-01:MESS01', - 'Machine Status Message 2' => 'CS-CS-MSTAT-01:MESS02', ); if (!array_key_exists($this->arg('bl'), $bl_pvs)) $this->_error('No such beamline'); - $pvs = array_merge($ring_pvs, $bl_pvs[$this->arg('bl')]); - $vals = $this->pv(array_values($pvs)); + $pvs = array_merge($ring_pvs, $bl_pvs[$this->arg('bl')], array( + 'Machine Status Message 1' => 'CS-CS-MSTAT-01:MESS01', + 'Machine Status Message 2' => 'CS-CS-MSTAT-01:MESS02', + )); + $vals = $this->pv(array_values($pvs), false, true); $return = array(); foreach ($pvs as $k => $pv) { From 0462640ac4b8e6c1d7e2847a237e1344ad1dd88d Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Wed, 23 Feb 2022 15:59:30 +0000 Subject: [PATCH 11/35] fix: set beamline messages in separate logic --- api/src/Page/Status.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/api/src/Page/Status.php b/api/src/Page/Status.php index 008f5d835..141e6e60a 100644 --- a/api/src/Page/Status.php +++ b/api/src/Page/Status.php @@ -47,20 +47,27 @@ function _get_pvs() { //'Ring State' => 'CS-CS-MSTAT-01:MODE', 'Refill' => 'SR-CS-FILL-01:COUNTDOWN', ); + + $messages_pvs = array( + 'Machine Status Message 1' => 'CS-CS-MSTAT-01:MESS01', + 'Machine Status Message 2' => 'CS-CS-MSTAT-01:MESS02', + ); if (!array_key_exists($this->arg('bl'), $bl_pvs)) $this->_error('No such beamline'); - $pvs = array_merge($ring_pvs, $bl_pvs[$this->arg('bl')], array( - 'Machine Status Message 1' => 'CS-CS-MSTAT-01:MESS01', - 'Machine Status Message 2' => 'CS-CS-MSTAT-01:MESS02', - )); - $vals = $this->pv(array_values($pvs), false, true); + $pvs = array_merge($ring_pvs, $bl_pvs[$this->arg('bl')]); + $vals = $this->pv(array_values($pvs), false, false); + $messages_val = $this->pv(array_values($messages_pvs), false, true); $return = array(); foreach ($pvs as $k => $pv) { if ($k == 'Hutch') $return[$k] = $vals[$pv] == 7 ? 'Open' : 'Locked'; else $return[$k] = $vals[$pv]; } + + foreach ($messages_pvs as $k => $v) { + $return[$k] = $messages_val[$v]; + } $this->_output($return); From 846c2d8e1bda1173e7340faafa0abc3eafc31a5c Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Wed, 23 Feb 2022 16:40:43 +0000 Subject: [PATCH 12/35] fix: set preg_split limit for pvs --- api/src/Page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/Page.php b/api/src/Page.php index 23b7908d5..32b55c8fc 100644 --- a/api/src/Page.php +++ b/api/src/Page.php @@ -568,7 +568,7 @@ function pv($pvs, $full=false, $string=false) { exec($bl_pv_prog . ($string ? ' -S' : '') .' ' . implode(' ', $pvs) . ' 2>/dev/null', $ret); $output = array(); foreach ($ret as $i => $v) { - $lis = preg_split('/\s+/', $v); + $lis = preg_split('/\s+/', $v, 2); $output[$lis[0]] = sizeof($lis) > 1 ? ($full ? array_slice($lis,1) : $lis[1]) : ''; } From ca734f6e49ec0a12dd6a97625c4eb8f1b7bef50a Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Thu, 24 Feb 2022 10:31:09 +0000 Subject: [PATCH 13/35] feature: separate machine status messages from other pvs --- api/src/Page/Status.php | 36 +++++++++++++++------------ client/src/css/partials/_content.scss | 12 +++++++++ client/src/js/collections/pvs.js | 5 +++- client/src/js/templates/status.html | 3 ++- client/src/js/views/pvs-stream.js | 30 ++++++++++++++++++++++ client/src/js/views/status.js | 5 +++- 6 files changed, 72 insertions(+), 19 deletions(-) create mode 100644 client/src/js/views/pvs-stream.js diff --git a/api/src/Page/Status.php b/api/src/Page/Status.php index 141e6e60a..04e85894e 100644 --- a/api/src/Page/Status.php +++ b/api/src/Page/Status.php @@ -13,6 +13,7 @@ class Status extends Page 'st' => '\d\d-\d\d-\d\d\d\d', 'en' => '\d\d-\d\d-\d\d\d\d', 'c' => '\d+', + 'mmsg' => '\d+', // Used for fetching only the Machine Status Message for Beamline PVs ); public static $dispatch = array(array('/pvs/:bl', 'get', '_get_pvs'), @@ -49,28 +50,31 @@ function _get_pvs() { ); $messages_pvs = array( - 'Machine Status Message 1' => 'CS-CS-MSTAT-01:MESS01', - 'Machine Status Message 2' => 'CS-CS-MSTAT-01:MESS02', + 'Machine Status 1' => 'CS-CS-MSTAT-01:MESS01', + 'Machine Status 2' => 'CS-CS-MSTAT-01:MESS02', ); - + if (!array_key_exists($this->arg('bl'), $bl_pvs)) $this->_error('No such beamline'); - - $pvs = array_merge($ring_pvs, $bl_pvs[$this->arg('bl')]); - $vals = $this->pv(array_values($pvs), false, false); - $messages_val = $this->pv(array_values($messages_pvs), false, true); - + $return = array(); - foreach ($pvs as $k => $pv) { - if ($k == 'Hutch') $return[$k] = $vals[$pv] == 7 ? 'Open' : 'Locked'; - else $return[$k] = $vals[$pv]; - } - foreach ($messages_pvs as $k => $v) { - $return[$k] = $messages_val[$v]; + if ($this->has_arg('mmsg')) { + $messages_val = $this->pv(array_values($messages_pvs), false, true); + + foreach ($messages_pvs as $k => $v) { + $return[$k] = $messages_val[$v]; + } + } else { + $pvs = array_merge($ring_pvs, $bl_pvs[$this->arg('bl')]); + $vals = $this->pv(array_values($pvs), false, false); + + foreach ($pvs as $k => $pv) { + if ($k == 'Hutch') $return[$k] = $vals[$pv] == 7 ? 'Open' : 'Locked'; + else $return[$k] = $vals[$pv]; + } } - + $this->_output($return); - } diff --git a/client/src/css/partials/_content.scss b/client/src/css/partials/_content.scss index 2c341bc1f..375b9b363 100644 --- a/client/src/css/partials/_content.scss +++ b/client/src/css/partials/_content.scss @@ -1556,6 +1556,18 @@ div.status.oavs { } } +.streamed-pvs { + .pv { + &.on { + background: $content-active; + } + + &.off { + background: $content-inactive; + } + } +} + .log.gda ul { height: 250px; diff --git a/client/src/js/collections/pvs.js b/client/src/js/collections/pvs.js index 3770539e7..9cbf3a313 100644 --- a/client/src/js/collections/pvs.js +++ b/client/src/js/collections/pvs.js @@ -2,10 +2,13 @@ define(['backbone', 'models/pv'], function(Backbone, PV) { return Backbone.Collection.extend({ model: PV, - url: function() { return '/status/pvs/'+this.bl }, + url: function() { + return '/status/pvs/'+this.bl + (this.mmsg ? '?mmsg=1' : '') + }, initialize: function(models, options) { this.bl = options.bl + this.mmsg = options.mmsg this.running = true this.refresh_thread = null diff --git a/client/src/js/templates/status.html b/client/src/js/templates/status.html index 02a5c631d..d4051c238 100644 --- a/client/src/js/templates/status.html +++ b/client/src/js/templates/status.html @@ -1,7 +1,8 @@

    <%-BL%> Webcams & Beamline Status

    - +
    +
    webcam1
    webcam2
    <% if (BL =='i02') { %> diff --git a/client/src/js/views/pvs-stream.js b/client/src/js/views/pvs-stream.js new file mode 100644 index 000000000..aa87a0d22 --- /dev/null +++ b/client/src/js/views/pvs-stream.js @@ -0,0 +1,30 @@ +define(['marionette', 'collections/pvs'], function(Marionette, PVs) { + + + const PVStreamItemView = Marionette.ItemView.extend({ + template: _.template(`

    <%- NAME %>

    <%- VALUE %>

    `), + className: function() { + return 'tw-w-full pv ' + this.model.get('CLASS') + }, + + modelEvents: { + 'change': 'render', + }, + }) + + + return Marionette.CollectionView.extend({ + childView: PVStreamItemView, + + initialize: function(options) { + this.collection = new PVs(null, { bl: options.bl, mmsg: 1 }) + this.collection.fetch() + }, + + onDestroy: function() { + this.collection.stop() + } + }) + + +}) \ No newline at end of file diff --git a/client/src/js/views/status.js b/client/src/js/views/status.js index a28265535..65543cb94 100644 --- a/client/src/js/views/status.js +++ b/client/src/js/views/status.js @@ -1,8 +1,9 @@ define(['marionette', 'views/pvs', + 'views/pvs-stream', 'utils', 'templates/status.html', - ], function(Marionette, PVView, utils, template) { + ], function(Marionette, PVView, StreamedPVView, utils, template) { return Marionette.LayoutView.extend({ @@ -21,6 +22,7 @@ define(['marionette', regions: { pvs: '.pvs', + 'streamed-pvs': '.streamed-pvs' }, ui: { @@ -38,6 +40,7 @@ define(['marionette', this.ui.status.slideToggle('fast', 'swing', function() { if (self.ui.status.is(':visible')) { self.pvs.show(new PVView({ bl: self.getOption('bl') })) + self['streamed-pvs'].show(new StreamedPVView({ bl: self.getOption('bl') })) self.$el.find('.webcam img').each(function(i,w) { var url = app.apiurl+'/image/cam/bl/'+self.getOption('bl')+'/n/'+i utils.sign({ From dd90eb81bb28cf4aaa1822dbba509f2eafe40f61 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Thu, 24 Feb 2022 10:45:59 +0000 Subject: [PATCH 14/35] fix: add more css classes to pvs stream view --- client/src/js/views/pvs-stream.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/js/views/pvs-stream.js b/client/src/js/views/pvs-stream.js index aa87a0d22..d48db973f 100644 --- a/client/src/js/views/pvs-stream.js +++ b/client/src/js/views/pvs-stream.js @@ -2,9 +2,9 @@ define(['marionette', 'collections/pvs'], function(Marionette, PVs) { const PVStreamItemView = Marionette.ItemView.extend({ - template: _.template(`

    <%- NAME %>

    <%- VALUE %>

    `), + template: _.template(`

    <%- NAME %>

    <%- VALUE %>

    `), className: function() { - return 'tw-w-full pv ' + this.model.get('CLASS') + return 'tw-w-full pv tw-my-4 tw-p-3 tw-rounded' + this.model.get('CLASS') }, modelEvents: { From ba9e2494dda82d7320e7f980b69314138f5a8829 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Thu, 24 Feb 2022 11:01:25 +0000 Subject: [PATCH 15/35] fix: add space to css classes --- client/src/js/views/pvs-stream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/js/views/pvs-stream.js b/client/src/js/views/pvs-stream.js index d48db973f..83778cc25 100644 --- a/client/src/js/views/pvs-stream.js +++ b/client/src/js/views/pvs-stream.js @@ -4,7 +4,7 @@ define(['marionette', 'collections/pvs'], function(Marionette, PVs) { const PVStreamItemView = Marionette.ItemView.extend({ template: _.template(`

    <%- NAME %>

    <%- VALUE %>

    `), className: function() { - return 'tw-w-full pv tw-my-4 tw-p-3 tw-rounded' + this.model.get('CLASS') + return 'tw-w-full pv tw-my-4 tw-p-3 tw-rounded ' + this.model.get('CLASS') }, modelEvents: { From dc0252d96c1c896420139940cc71ee275109afc2 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Mon, 28 Feb 2022 12:34:14 +0000 Subject: [PATCH 16/35] feature: add links to select visit by beamlines --- client/src/css/partials/_content.scss | 2 +- .../src/js/modules/calendar/views/calendar.js | 147 ++++++++++++------ .../templates/calendar/calendar-wrapper.html | 2 + 3 files changed, 103 insertions(+), 48 deletions(-) create mode 100644 client/src/js/templates/calendar/calendar-wrapper.html diff --git a/client/src/css/partials/_content.scss b/client/src/css/partials/_content.scss index 2c341bc1f..f51bf088b 100644 --- a/client/src/css/partials/_content.scss +++ b/client/src/css/partials/_content.scss @@ -19,7 +19,7 @@ .content { padding-bottom: 1%; - & > h1 { + h1 { padding: 10px 0; margin-bottom: 15px; word-wrap: break-word; diff --git a/client/src/js/modules/calendar/views/calendar.js b/client/src/js/modules/calendar/views/calendar.js index 7e314e31e..9354cbb8b 100644 --- a/client/src/js/modules/calendar/views/calendar.js +++ b/client/src/js/modules/calendar/views/calendar.js @@ -1,4 +1,4 @@ -define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/calendar.html'], function(Marionette, Backbone, Visits, template) { +define(['marionette', 'backbone', 'collections/visits', 'collections/bls', 'views/filter', 'templates/calendar/calendar.html', 'templates/calendar/calendar-wrapper.html'], function(Marionette, Backbone, Visits, Beamlines, FilterView, calendarTemplate, template) { // humm DISABLE_DAY_SCROLL = false @@ -19,7 +19,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale className: function() { var c = [] if (this.model.get('ENISO') < new Date()) c.push('past') - if (this.model.get('ACTIVE') == 1) c.push('active') + if (this.model.get('ACTIVE') === 1) c.push('active') return c.join(' ') }, @@ -37,7 +37,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale childView: EventItemView, childViewContainer: 'ul', - initialize: function(options) { + initialize: function() { this.collection = new Backbone.Collection(this.model.get('visits')) }, }) @@ -58,7 +58,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale } }, - initialize: function(options) { + initialize: function() { var hours = _.uniq(_.map(this.model.get('visits'), function(m) { var sessionStartISO = m.get('STISO') return sessionStartISO.hour @@ -68,7 +68,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale _.each(hours, function(h) { hc.push({ hour: h, visits: _.filter(this.model.get('visits'), function(m) { var sessionStartISO = m.get('STISO') - return sessionStartISO.hour == h + return sessionStartISO.hour === h }) }) }, this) @@ -79,13 +79,13 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale }, onRender: function() { - if (this.model.get('type') == 'day') this.$el.attr('data-day', this.model.get('date').getDate()) + if (this.model.get('type') === 'day') this.$el.attr('data-day', this.model.get('date').getDate()) }, getTemplate: function() { - if (this.model.get('type') == 'head') { + if (this.model.get('type') === 'head') { return _.template('<%-dayNames[day]%>') - } else if (this.model.get('type') == 'day') { + } else if (this.model.get('type') === 'day') { return _.template('<%-dayNames[date.getDay()]%> <%-date.getDate()%> <%-monthNames[date.getMonth()]%>
      ') } else { return _.template(' ') @@ -95,15 +95,15 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale className: function() { var classes = [] - if (this.model.get('type') == 'head') { + if (this.model.get('type') === 'head') { classes.push('head') - if (this.model.get('day') == 0 || this.model.get('day') == 6) classes.push('wend') + if (this.model.get('day') === 0 || this.model.get('day') === 6) classes.push('wend') - } else if (this.model.get('type') == 'day') { + } else if (this.model.get('type') === 'day') { var t = new Date() - if (this.model.get('date').getTime() == new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime()) classes.push('today') + if (this.model.get('date').getTime() === new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime()) classes.push('today') - if (this.model.get('visits').length == 0) classes.push('no_event') + if (this.model.get('visits').length === 0) classes.push('no_event') } else classes.push('noday') @@ -141,7 +141,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale var classes = [] var t = new Date() - if (this.model.get('date').getTime() == new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime()) classes.push('today') + if (this.model.get('date').getTime() === new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime()) classes.push('today') if (this.model.get('visits').length) classes.push('event') @@ -168,7 +168,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale }, - initialize: function(options) { + initialize: function() { this.onScroll = _.debounce(this.onScroll, 100) this.lastDay = null }, @@ -178,12 +178,12 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale var first = this.collection.at(0) if (first) { var d = first.get('date') - if (now.getMonth() == d.getMonth() && now.getFullYear() == d.getFullYear()) this.doGotoDay(null, now.getDate()) + if (now.getMonth() === d.getMonth() && now.getFullYear() === d.getFullYear()) this.doGotoDay(null, now.getDate()) else $('.calendar_main').animate({scrollTop: 0 }) } }, - onScroll: function(e) { + onScroll: function() { if (DISABLE_DAY_SCROLL) return DISABLE_ITEM_SCROLL = true @@ -193,7 +193,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale }) if (di) day = di.model.get('date').getDate() - if (day != this.lastDay && day) this.doGotoDay(null, day) + if (day !== this.lastDay && day) this.doGotoDay(null, day) this.lastDay = day setTimeout(function() { @@ -202,18 +202,13 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale }, doGotoDay: function(child, day) { - console.log('day', day) var dp = $('.calendar_main li[data-day='+day+']').offset().top $('.calendar_main').animate({scrollTop: dp-$('.calendar_main').offset().top+$('.calendar_main').scrollTop() }) }, }) - - - - return Marionette.CompositeView.extend({ - template: template, - className: 'content', + var CalendarCompositeView = Marionette.CompositeView.extend({ + template: calendarTemplate, childView: DayItemView, childViewContainer: 'ul.calendar_main', @@ -235,7 +230,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale }, - onScroll: function(e) { + onScroll: function() { if (DISABLE_ITEM_SCROLL) return DISABLE_DAY_SCROLL = true @@ -245,7 +240,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale }, this) if (di) day = di.model.get('date').getDate() - if (day && this.lastDay != day) this.gotoDay(day) + if (day && this.lastDay !== day) this.gotoDay(day) this.lastDay = day setTimeout(function() { @@ -270,7 +265,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale }, prevMonth: function() { - if (this.month == 0) { + if (this.month === 0) { this.month = 11 this.year-- } else this.month-- @@ -278,29 +273,28 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale }, nextMonth: function() { - if (this.month == 11) { + if (this.month === 11) { this.year++ this.month = 0 } else this.month++ this.generateMonth() }, - - + initialize: function(options) { this.lastDay = null this.onScroll = _.debounce(this.onScroll, 100) this.collection = new Backbone.Collection() this.days = new Backbone.Collection() - - var d = new Date() + + const d = new Date() + this.year = options.y !== undefined ? options.y : d.getFullYear() this.month = options.m !== undefined ? options.m : d.getMonth() - - var self = this - var queryParams = { - year: function() { return self.year }, - month: function() { - var m = self.month + 1 + + const queryParams = { + year: () => { return this.year }, + month: () => { + const m = this.month + 1 return m < 10 ? ('0'+m) : m }, all: options.all, @@ -313,11 +307,11 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale queryParams: queryParams, state: { pageSize: 9999 } }) - + this.listenTo(this.visits, 'request', this.displaySpinner) this.listenTo(this.visits, 'sync', this.removeSpinner) this.listenTo(this.visits, 'error', this.removeSpinner) - + this.generateMonth() }, @@ -355,7 +349,6 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale }, generateLinks: function() { - console.log(this.month, this.year) this.ui.mnext.text(Months[(this.month+1)%12]) // javascript modulus doesnt work for negative numbers :( this.ui.mprev.text(Months[((this.month-1%12)+12)%12]) @@ -374,15 +367,13 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale var daysinmonth = new Date(this.year, this.month+1, 0).getDate() var startday = new Date(this.year, this.month, 1).getDay() var endday = new Date(this.year, this.month, daysinmonth).getDay() - - console.log(daysinmonth, startday, endday) var days = [] _.each(_.range(7), function(d) { days.push({ type: 'head', day: (((d+1)%7)+7)%7 }) }) - _.each(_.range((((startday-1)%7)+7)%7), function(d) { + _.each(_.range((((startday-1)%7)+7)%7), function() { days.push({ type: 'pre' }) }) @@ -395,7 +386,7 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale days.push({ type: 'day', date: date, visits: visits }) }, this) - _.each(_.range(6%endday), function(d) { + _.each(_.range(6%endday), function() { days.push({ type: 'post' }) }) @@ -403,9 +394,71 @@ define(['marionette', 'backbone', 'collections/visits', 'templates/calendar/cale this.generateLinks() this.days.reset(this.collection.where({ type: 'day' })) - console.log(this.days) }, }) + return Marionette.LayoutView.extend({ + template: template, + className: 'content', + beamline: 'all', + + regions: { + calendar: '.calendar-wrapper', + bl: '.type' + }, + + initialize: function(options) { + this.beamline = options.bl || 'all' + this.beamlines = new Beamlines(null, { ty: app.type }) + this.displayBeamlines() + }, + + displayBeamlines: function() { + this.beamlines.fetch().done(() => { + const beamlinesList = this.beamlines.toJSON().map((beamline) => ({ id: beamline['BEAMLINE'], name: beamline['BEAMLINE'] })) + this.displayBeamlinesView = new FilterView({ + url: false, + value: this.beamline, + name: 'bl', + filters: [{ id: 'all', name: 'All' }, ...beamlinesList] + }) + + this.listenTo(this.displayBeamlinesView, 'selected:change', this.handleBeamlineChange) + this.bl.show(this.displayBeamlinesView) + }) + }, + + handleBeamlineChange(beamline) { + const regexExp = new RegExp(/\/bl\/.*/) + let url = window.location.pathname + + if (beamline !== 'all') { + url = url.replace(regexExp, '')+'/bl/'+ beamline + window.history.pushState({}, '', url) + } else { + this.beamline = '' + url = url.replace(regexExp, '') + window.history.pushState({}, '', url) + } + this.beamline = beamline + + this.showCalenderView() + }, + + showCalenderView() { + this.calendarView = new CalendarCompositeView({ + all: this.getOption('all'), + bl: this.beamline !== 'all' ? this.beamline : '' , + y: this.getOption('y'), + m: this.getOption('m') + }) + + this.calendar.show(this.calendarView) + }, + + onRender() { + this.showCalenderView() + } + }) }) diff --git a/client/src/js/templates/calendar/calendar-wrapper.html b/client/src/js/templates/calendar/calendar-wrapper.html new file mode 100644 index 000000000..87d093b7e --- /dev/null +++ b/client/src/js/templates/calendar/calendar-wrapper.html @@ -0,0 +1,2 @@ +
      +
      From 52d612ba04492f055efcd6fbf5dfa93436d69969 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Thu, 10 Mar 2022 12:58:29 +0000 Subject: [PATCH 17/35] refactor: change calendar page to vue component --- client/src/js/app/components/filter-pills.vue | 48 ++++ .../modules/calendar/views/calendar-view.vue | 264 ++++++++++++++++++ .../views/components/calendar-day-events.vue | 46 +++ .../views/components/calendar-day.vue | 103 +++++++ 4 files changed, 461 insertions(+) create mode 100644 client/src/js/app/components/filter-pills.vue create mode 100644 client/src/js/modules/calendar/views/calendar-view.vue create mode 100644 client/src/js/modules/calendar/views/components/calendar-day-events.vue create mode 100644 client/src/js/modules/calendar/views/components/calendar-day.vue diff --git a/client/src/js/app/components/filter-pills.vue b/client/src/js/app/components/filter-pills.vue new file mode 100644 index 000000000..b13b29587 --- /dev/null +++ b/client/src/js/app/components/filter-pills.vue @@ -0,0 +1,48 @@ + + diff --git a/client/src/js/modules/calendar/views/calendar-view.vue b/client/src/js/modules/calendar/views/calendar-view.vue new file mode 100644 index 000000000..fa8ce39d2 --- /dev/null +++ b/client/src/js/modules/calendar/views/calendar-view.vue @@ -0,0 +1,264 @@ + + + \ No newline at end of file diff --git a/client/src/js/modules/calendar/views/components/calendar-day-events.vue b/client/src/js/modules/calendar/views/components/calendar-day-events.vue new file mode 100644 index 000000000..e4e6c7791 --- /dev/null +++ b/client/src/js/modules/calendar/views/components/calendar-day-events.vue @@ -0,0 +1,46 @@ + + + \ No newline at end of file diff --git a/client/src/js/modules/calendar/views/components/calendar-day.vue b/client/src/js/modules/calendar/views/components/calendar-day.vue new file mode 100644 index 000000000..b8d9514ee --- /dev/null +++ b/client/src/js/modules/calendar/views/components/calendar-day.vue @@ -0,0 +1,103 @@ + + + \ No newline at end of file From 7e10561e97bce03851495c7ac53f3436401e12e7 Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Thu, 10 Mar 2022 13:02:18 +0000 Subject: [PATCH 18/35] refactor: change beamline status page to vue component --- .gitignore | 3 - client/package-lock.json | 49 ++-- client/src/js/app/components/pv-item.vue | 49 ++++ client/src/js/app/index.js | 2 +- client/src/js/app/store/store.js | 3 +- client/src/js/modules/calendar/routes.js | 23 +- client/src/js/modules/status/routes.js | 5 + .../status/views/beamline-status-view.vue | 240 ++++++++++++++++++ .../status/views/components/motor-view.vue | 155 +++++++++++ client/src/js/modules/status/views/motors.js | 11 +- client/src/js/modules/status/views/status.js | 3 +- client/tailwind.config.js | 22 +- 12 files changed, 501 insertions(+), 64 deletions(-) create mode 100644 client/src/js/app/components/pv-item.vue create mode 100644 client/src/js/modules/status/views/beamline-status-view.vue create mode 100644 client/src/js/modules/status/views/components/motor-view.vue diff --git a/.gitignore b/.gitignore index 2aa66075e..2639ded3f 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,3 @@ client/index.html api/config.php api/vendor -api/src/MockUAS.php - -./idea diff --git a/client/package-lock.json b/client/package-lock.json index 0288a437f..d42f37736 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -7991,6 +7991,11 @@ "resolved": "https://registry.npmjs.org/pick-by-alias/-/pick-by-alias-1.2.0.tgz", "integrity": "sha1-X3yysfIabh6ISgyHhVqko3NhEHs=" }, + "picocolors": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", + "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==" + }, "picomatch": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", @@ -8521,13 +8526,12 @@ }, "dependencies": { "postcss": { - "version": "7.0.36", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.36.tgz", - "integrity": "sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw==", + "version": "7.0.39", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.39.tgz", + "integrity": "sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==", "requires": { - "chalk": "^2.4.2", - "source-map": "^0.6.1", - "supports-color": "^6.1.0" + "picocolors": "^0.2.1", + "source-map": "^0.6.1" } } } @@ -11863,35 +11867,12 @@ "integrity": "sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==" }, "postcss": { - "version": "7.0.36", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.36.tgz", - "integrity": "sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw==", + "version": "7.0.39", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.39.tgz", + "integrity": "sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==", "requires": { - "chalk": "^2.4.2", - "source-map": "^0.6.1", - "supports-color": "^6.1.0" - }, - "dependencies": { - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "dependencies": { - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - } - } - } + "picocolors": "^0.2.1", + "source-map": "^0.6.1" } }, "postcss-nested": { diff --git a/client/src/js/app/components/pv-item.vue b/client/src/js/app/components/pv-item.vue new file mode 100644 index 000000000..44ff857b6 --- /dev/null +++ b/client/src/js/app/components/pv-item.vue @@ -0,0 +1,49 @@ + + \ No newline at end of file diff --git a/client/src/js/app/index.js b/client/src/js/app/index.js index db0f12149..ef5128f06 100644 --- a/client/src/js/app/index.js +++ b/client/src/js/app/index.js @@ -3,12 +3,12 @@ var FontAwesome = require('font-awesome/css/font-awesome.css') import Vue from 'vue' import VeeValidate from 'vee-validate' +import PortalVue from 'portal-vue' import Main from 'app/layouts/main.vue' import MaintenanceView from 'app/layouts/maintenance.vue' import store from 'app/store/store' import router from 'app/router/router' -import PortalVue from 'portal-vue' import MarionetteApp from 'app/marionette-application.js' diff --git a/client/src/js/app/store/store.js b/client/src/js/app/store/store.js index d50936d22..97b088c1f 100644 --- a/client/src/js/app/store/store.js +++ b/client/src/js/app/store/store.js @@ -1,5 +1,6 @@ import Vue from 'vue' import Vuex from 'vuex' +import Backbone from 'backbone' // VueX modules // TODO - adopt vue-enterprise-boiler plate design @@ -18,10 +19,8 @@ import config from 'config.json' import MarionetteApplication from 'app/marionette-application.js' import { resolve } from 'promise' import { reject } from 'promise' -import Backbone from "backbone"; Vue.use(Vuex) -Vue.config.devtools = !config.production const store = new Vuex.Store({ modules: { diff --git a/client/src/js/modules/calendar/routes.js b/client/src/js/modules/calendar/routes.js index f4ef68379..f9a34b590 100644 --- a/client/src/js/modules/calendar/routes.js +++ b/client/src/js/modules/calendar/routes.js @@ -4,7 +4,7 @@ import MarionetteApplication from 'app/marionette-application.js' import MarionetteView from 'app/views/marionette/marionette-wrapper.vue' import Page from 'app/layouts/page.vue' -import CalendarView from 'modules/calendar/views/calendar.js' +import CalendarView from 'modules/calendar/views/calendar-view.vue' import CurrentView from 'modules/calendar/views/current.js' // Initialize MarionetteApplication if not already existing @@ -48,23 +48,16 @@ const routes = [ { path: '', name: 'cal', - component: MarionetteView, - props: { - mview: CalendarView, - options: { - all: 1, - } - } + component: CalendarView, + props: () => ({ + bl: '' + }) }, { path: 'bl/:bl', - component: MarionetteView, - props: route => ({ - mview: CalendarView, - options: { - all: 1, - bl: route.params.bl - } + component: CalendarView, + props: route => ({ + bl: route.params.bl }) } ] diff --git a/client/src/js/modules/status/routes.js b/client/src/js/modules/status/routes.js index bbe79b9f8..b3128065f 100644 --- a/client/src/js/modules/status/routes.js +++ b/client/src/js/modules/status/routes.js @@ -1,6 +1,7 @@ import MarionetteView from 'app/views/marionette/marionette-wrapper.vue' import StatusView from 'modules/status/views/status' +import BeamlineStatusView from 'modules/status/views/beamline-status-view.vue' const routes = [ { @@ -13,6 +14,10 @@ const routes = [ }, breadcrumbs: [{ title: 'Beamline Status' }, { title: route.params.bl }] }) + }, + { + path: '/status-vue/bl/:bl', + component: BeamlineStatusView, } ] diff --git a/client/src/js/modules/status/views/beamline-status-view.vue b/client/src/js/modules/status/views/beamline-status-view.vue new file mode 100644 index 000000000..473c69a65 --- /dev/null +++ b/client/src/js/modules/status/views/beamline-status-view.vue @@ -0,0 +1,240 @@ + + + \ No newline at end of file diff --git a/client/src/js/modules/status/views/components/motor-view.vue b/client/src/js/modules/status/views/components/motor-view.vue new file mode 100644 index 000000000..8af1c4d11 --- /dev/null +++ b/client/src/js/modules/status/views/components/motor-view.vue @@ -0,0 +1,155 @@ + + + + \ No newline at end of file diff --git a/client/src/js/modules/status/views/motors.js b/client/src/js/modules/status/views/motors.js index c8090fedc..c0017eb57 100644 --- a/client/src/js/modules/status/views/motors.js +++ b/client/src/js/modules/status/views/motors.js @@ -50,12 +50,12 @@ define(['marionette', _.each(statuses, function(b, k) { var bd = this.$el.find('.button.'+k.toLowerCase()) _.each(b, function(s, v) { - this.model.get('val')[k] == v ? bd.addClass(s) : bd.removeClass(s) + this.model.get('val')[k] === v ? bd.addClass(s) : bd.removeClass(s) }, this) }, this) var b = this.$el.find('.button.ffe') - var ffe = (this.model.get('MSTA') & 1<<6) == 1<<6 + var ffe = (this.model.get('MSTA') & 1<<6) === 1<<6 ffe ? b.addClass('inactive') : b.removeClass('inactive') }, }) @@ -63,13 +63,12 @@ define(['marionette', return Marionette.CollectionView.extend({ getChildView: function(m) { - return m.get('t') == 1 ? MotorView : ToggleView + return m.get('t') === 1 ? MotorView : ToggleView }, - initialize: function(options) { + initialize: function() { this.collection = new Motors(null, { bl: this.getOption('bl'), epid: this.getOption('epid') }) - - var self = this + this.collection.fetch()//.done(function() { console.log(self.collection) }) }, diff --git a/client/src/js/modules/status/views/status.js b/client/src/js/modules/status/views/status.js index 06ee8906b..3967e771a 100644 --- a/client/src/js/modules/status/views/status.js +++ b/client/src/js/modules/status/views/status.js @@ -54,8 +54,7 @@ define(['marionette', } }, - initialize: function(options) { - }, + initialize: function(options) {}, onRender: function() { this.ep.show(new EpicsPagesView({ bl: this.getOption('bl') })) diff --git a/client/tailwind.config.js b/client/tailwind.config.js index 68cee99ba..7f0fa2199 100644 --- a/client/tailwind.config.js +++ b/client/tailwind.config.js @@ -25,6 +25,11 @@ module.exports = { }, // Adding a prefix so its clear where we are overriding styles prefix: 'tw-', + variants: { + overflow: ['responsive', 'hover', 'focus'], + height: ['responsive', 'hover', 'focus'], + position: ['responsive', 'hover', 'focus'] + }, theme: { extend: { fontFamily: { @@ -49,6 +54,14 @@ module.exports = { // '5xl': '3rem', // '6xl': '4rem', }, + width: { + '1/7': '14.2857143%', + '2/7': '28.5714286%', + '3/7': '42.8571429%', + '4/7': '57.1428571%', + '5/7': '71.4285714%', + '6/7': '85.7142857%', + }, backgroundImage: { 'header-site-logo': "url('~images/diamond_gs_small.png')", 'footer-site-logo': "url('~images/ispyb_gs_medium.png')", @@ -138,6 +151,8 @@ module.exports = { 'table-pages-disable-color': '#ababab', // Plot 'plot-legend-background': '#dddddd', + 'motor-value-background': '#bcbcbc', + 'motor-readback-text': '#71a56c', // Modal 'modal-header-background': '#e9e9e9', @@ -150,8 +165,13 @@ module.exports = { 'grid-scanned': '#fdfd96', 'loaded-by-robot': '#ff6961', 'dark-amber': '#d9bf98' + }, + zIndex: { + '75': 75, + '100': 100, + '9999': 9999 } - } + }, }, plugins: [] } From eb9e56ac02819e46db9db586ccd4ed86de7afdea Mon Sep 17 00:00:00 2001 From: Victor Nwaiwu Date: Fri, 11 Mar 2022 18:11:31 +0000 Subject: [PATCH 19/35] refactor: remove calendar-day event and delete marionette files for calendar and beamline status --- .../modules/calendar/views/calendar-view.vue | 108 +++++++++++++++--- .../views/components/calendar-day-events.vue | 43 ++++++- .../views/components/calendar-day.vue | 103 ----------------- client/src/js/modules/status/controller.js | 18 --- client/src/js/modules/status/router.js | 15 --- client/src/js/modules/status/routes.js | 14 --- .../status/views/components/motor-view.vue | 2 - .../src/js/modules/status/views/epicspages.js | 37 ------ client/src/js/modules/status/views/gdalog.js | 35 ------ client/src/js/modules/status/views/motors.js | 80 ------------- client/src/js/modules/status/views/status.js | 93 --------------- client/src/js/templates/status/pvmotor.html | 17 --- client/src/js/templates/status/pvtoggle.html | 3 - client/src/js/templates/status/status.html | 28 ----- client/webpack.config.js | 5 +- 15 files changed, 133 insertions(+), 468 deletions(-) delete mode 100644 client/src/js/modules/calendar/views/components/calendar-day.vue delete mode 100644 client/src/js/modules/status/controller.js delete mode 100644 client/src/js/modules/status/router.js delete mode 100644 client/src/js/modules/status/views/epicspages.js delete mode 100644 client/src/js/modules/status/views/gdalog.js delete mode 100644 client/src/js/modules/status/views/motors.js delete mode 100644 client/src/js/modules/status/views/status.js delete mode 100644 client/src/js/templates/status/pvmotor.html delete mode 100644 client/src/js/templates/status/pvtoggle.html delete mode 100644 client/src/js/templates/status/status.html diff --git a/client/src/js/modules/calendar/views/calendar-view.vue b/client/src/js/modules/calendar/views/calendar-view.vue index fa8ce39d2..a6c6ffb6d 100644 --- a/client/src/js/modules/calendar/views/calendar-view.vue +++ b/client/src/js/modules/calendar/views/calendar-view.vue @@ -1,6 +1,6 @@