@@ -1320,53 +1320,56 @@ window.ManageAppsView = countlyView.extend({
1320
1320
}
1321
1321
1322
1322
/**
1323
- * initial screen prepare method
1324
- * add first app elements and hide other things
1325
- */
1323
+ * initial screen prepare method
1324
+ * add first app elements and hide other things
1325
+ */
1326
1326
function firstApp ( ) {
1327
1327
store . set ( 'first_app' , true ) ;
1328
1328
// hide sidebar & app navigation and app management bar
1329
1329
// make unclickable countly logo
1330
1330
// re-align elements
1331
1331
$ ( '#top-bar > div.logo-container > a' ) . attr ( 'href' , 'javascript:void(0)' ) ;
1332
- $ ( '#top-bar > div.right-menu > div:nth-child(1)' ) . css ( { 'opacity' : '0' , 'pointer-events' : 'none' } ) ;
1333
1332
$ ( "#sidebar" ) . addClass ( "hidden" ) ;
1334
1333
$ ( "#app-navigation" ) . css ( { 'opacity' : '0' , 'pointer-events' : 'none' } ) ;
1335
1334
$ ( "#hide-sidebar-button" ) . hide ( ) ;
1336
1335
$ ( '#app-management-bar' ) . hide ( ) ;
1336
+ $ ( '#dashboard-selection' ) . css ( { 'opacity' : '0' , 'pointer-events' : 'none' } ) ;
1337
1337
$ ( '#content-container' ) . css ( { 'margin-left' : '0px' } ) ;
1338
- var width = $ ( 'body' ) . width ( ) ;
1339
1338
// create first app screen elements
1340
1339
$ ( '#content' ) . prepend ( '<div id="first-app-welcome"></div>' ) ;
1341
1340
$ ( '#first-app-welcome' ) . append ( '<h1 id="first-app-welcome-header" data-localize="management-applications.create-first-app-title"></h1>' ) ;
1342
1341
$ ( '#first-app-welcome' ) . append ( '<p id="first-app-description" data-localize="management-applications.create-first-app-description"></p>' ) ;
1343
- $ ( '#content > div.widget' ) . addClass ( 'widget-first-app-state' ) ;
1344
- $ ( '#content > div.widget' ) . css ( { 'width' : width / ( 3 ) + 'px' } ) ;
1345
- $ ( '#first-app-welcome' ) . css ( { 'width' : width / ( 3.5 ) + 'px' , 'margin-left' : '10%' } ) ;
1342
+ if ( $ ( window ) . width ( ) === 1024 || $ ( window ) . width ( ) === 1280 ) {
1343
+ $ ( '#content > div.widget' ) . css ( { 'width' : '40%' , 'margin-left' : '5%' , 'margin-right' : '5%' , 'float' : 'left' , 'margin-top' : '2%' } ) ;
1344
+ $ ( '#first-app-welcome' ) . css ( { 'width' : '30%' , 'margin-left' : '10%' , 'margin-right' : '5%' , 'float' : 'left' , 'margin-top' : '10%' } ) ;
1345
+ }
1346
+ else {
1347
+ $ ( '#content > div.widget' ) . css ( { 'width' : '30%' , 'margin-left' : '5%' , 'margin-right' : '15%' , 'float' : 'left' , 'margin-top' : '2%' } ) ;
1348
+ $ ( '#first-app-welcome' ) . css ( { 'width' : '30%' , 'margin-left' : '15%' , 'margin-right' : '5%' , 'float' : 'left' , 'margin-top' : '10%' } ) ;
1349
+ }
1346
1350
1347
1351
$ ( '#add-new-app' ) . hide ( ) ;
1348
1352
// make visible first app form
1349
1353
$ ( '#add-first-app' ) . css ( { 'display' : 'block' } ) ;
1350
1354
}
1351
1355
1352
1356
/**
1353
- * make things normal after first app create process
1354
- */
1357
+ * make things normal after first app create process
1358
+ */
1355
1359
function afterFirstApp ( ) {
1356
1360
$ ( "#sidebar" ) . removeClass ( "hidden" ) ;
1357
1361
$ ( "#app-navigation" ) . css ( { 'opacity' : '1' , 'pointer-events' : 'auto' } ) ;
1362
+ $ ( '#dashboard-selection' ) . css ( { 'opacity' : '1' , 'pointer-events' : 'auto' } ) ;
1358
1363
$ ( "#hide-sidebar-button" ) . show ( ) ;
1359
1364
$ ( '#app-management-bar' ) . show ( ) ;
1360
1365
var widthOfSidebar = $ ( '#sidebar' ) . width ( ) ;
1361
1366
$ ( '#content-container' ) . css ( { 'margin-left' : widthOfSidebar + 'px' } ) ;
1362
-
1363
1367
$ ( '#first-app-welcome' ) . remove ( ) ;
1364
1368
$ ( '#add-first-app' ) . hide ( ) ;
1365
- $ ( '#content > div.widget' ) . removeClass ( 'widget-first-app-state' ) ;
1369
+ $ ( '#content > div.widget' ) . css ( { 'margin-left' : '199px' , 'margin-right' : '0%' , 'width' : 'auto' , 'float' : 'none' , 'margin-top' : '0%' } ) ;
1366
1370
1367
1371
$ ( '#add-first-app' ) . css ( { 'display' : 'none' } ) ;
1368
1372
$ ( '#top-bar > div.logo-container > a' ) . attr ( 'href' , '/dashboard#/' ) ;
1369
- $ ( '#top-bar > div.right-menu > div:nth-child(1)' ) . css ( { 'opacity' : '1' , 'pointer-events' : 'auto' } ) ;
1370
1373
store . set ( 'first_app' , false ) ;
1371
1374
}
1372
1375
@@ -1518,7 +1521,7 @@ window.ManageAppsView = countlyView.extend({
1518
1521
/** function creates users manage links
1519
1522
* @param {array } users - list of users
1520
1523
* @returns {string } - html string
1521
- */
1524
+ */
1522
1525
function joinUsers ( users ) {
1523
1526
var ret = "" ;
1524
1527
if ( users && users . length ) {
@@ -1761,6 +1764,21 @@ window.ManageAppsView = countlyView.extend({
1761
1764
}
1762
1765
}
1763
1766
1767
+ /**
1768
+ * prepare unauthorize screen for users
1769
+ * who don't have rights to access applications
1770
+ * */
1771
+ function prepareUnauthorizeScreen ( ) {
1772
+ $ ( '#top-bar > div.logo-container > a' ) . attr ( 'href' , 'javascript:void(0)' ) ;
1773
+ $ ( "#sidebar" ) . addClass ( "hidden" ) ;
1774
+ $ ( "#app-navigation" ) . css ( { 'opacity' : '0' , 'pointer-events' : 'none' } ) ;
1775
+ $ ( "#hide-sidebar-button" ) . hide ( ) ;
1776
+ $ ( '#app-management-bar' ) . hide ( ) ;
1777
+ $ ( '#dashboard-selection' ) . css ( { 'opacity' : '0' , 'pointer-events' : 'none' } ) ;
1778
+ $ ( '#content-container' ) . css ( { 'margin-left' : '0px' } ) ;
1779
+ $ ( '#content' ) . html ( "<div class='manage-app-no-rights'><img src='images/dashboard/icon-no-rights.svg'><h1 class='manage-app-no-rights-title'>" + jQuery . i18n . map [ 'management-applications.contact-an-admin' ] + "</h1><p class='manage-app-no-rights-description'>" + jQuery . i18n . map [ 'management-applications.dont-access' ] + "</p></div>" ) ;
1780
+ }
1781
+
1764
1782
/** initializes countly code
1765
1783
* @param {string } app_id - app id
1766
1784
* @param {string } server - server address
@@ -1792,7 +1810,12 @@ window.ManageAppsView = countlyView.extend({
1792
1810
} ) ;
1793
1811
}
1794
1812
1795
- initAppManagement ( appId ) ;
1813
+ if ( ! countlyGlobal . member . global_admin && $ . isEmptyObject ( countlyGlobal . apps ) && $ . isEmptyObject ( countlyGlobal . admin_apps ) ) {
1814
+ prepareUnauthorizeScreen ( ) ;
1815
+ }
1816
+ else {
1817
+ initAppManagement ( appId ) ;
1818
+ }
1796
1819
store . get ( 'first_app' ) ? initCountrySelect ( "#first-app-add-timezone" ) : initCountrySelect ( "#app-add-timezone" ) ;
1797
1820
1798
1821
$ ( "#clear-app-data" ) . click ( function ( ) {
@@ -2119,32 +2142,38 @@ window.ManageAppsView = countlyView.extend({
2119
2142
}
2120
2143
2121
2144
var appName = store . get ( 'first_app' ) ? $ ( "#first-app-add-name" ) . val ( ) : $ ( "#app-add-name" ) . val ( ) ,
2122
- type = store . get ( 'first_app' ) ? $ ( '#first-app-add-type' ) . data ( 'value' ) + "" : $ ( "#app-add-type" ) . data ( "value" ) + "" ,
2123
- category = store . get ( 'first_app' ) ? $ ( "#first-app-add-category" ) . data ( "value" ) + "" : $ ( "#app-add-category" ) . data ( "value" ) + "" ,
2145
+ type = store . get ( 'first_app' ) ? $ ( '#first-app-add-type' ) . data ( 'value' ) : $ ( "#app-add-type" ) . data ( "value" ) + "" ,
2146
+ category = store . get ( 'first_app' ) ? $ ( "#first-app-add-category" ) . data ( "value" ) : $ ( "#app-add-category" ) . data ( "value" ) + "" ,
2124
2147
timezone = store . get ( 'first_app' ) ? $ ( "#first-app-add-timezone #first-app-timezone" ) . val ( ) : $ ( "#app-add-timezone #app-timezone" ) . val ( ) ,
2125
2148
country = store . get ( 'first_app' ) ? $ ( "#first-app-add-timezone #first-app-country" ) . val ( ) : $ ( "#app-add-timezone #app-country" ) . val ( ) ;
2126
2149
2127
2150
$ ( ".required" ) . fadeOut ( ) . remove ( ) ;
2128
- var reqSpan = $ ( "<span>" ) . addClass ( "required" ) . text ( "*" ) ;
2151
+ $ ( ".required-first-app" ) . fadeOut ( ) . remove ( ) ;
2152
+ var reqSpan = store . get ( 'first_app' ) ? $ ( "<span>" ) . addClass ( "required-first-app" ) . text ( "*" ) : $ ( "<span>" ) . addClass ( "required" ) . text ( "*" ) ;
2129
2153
2130
2154
if ( ! appName ) {
2131
- store . get ( 'first_app' ) ? $ ( "#first-app-add-name" ) . after ( reqSpan . clone ( ) ) : $ ( "#app-add-name" ) . after ( reqSpan . clone ( ) ) ;
2155
+ store . get ( 'first_app' ) ? $ ( "#first-app-add-name" ) . before ( reqSpan . clone ( ) ) : $ ( "#app-add-name" ) . after ( reqSpan . clone ( ) ) ;
2132
2156
}
2133
2157
2134
2158
if ( ! type ) {
2135
- store . get ( 'first_app' ) ? $ ( "#first -app-add- type" ) . parents ( ".cly-select ") . after ( reqSpan . clone ( ) ) : $ ( "#app-add-type" ) . parents ( ".cly-select" ) . after ( reqSpan . clone ( ) ) ;
2159
+ store . get ( 'first_app' ) ? $ ( "#select -app-type-label " ) . before ( reqSpan . clone ( ) ) : $ ( "#app-add-type" ) . parents ( ".cly-select" ) . after ( reqSpan . clone ( ) ) ;
2136
2160
}
2137
2161
2138
2162
/*if (!category) {
2139
2163
$("#app-add-category").parents(".cly-select").after(reqSpan.clone());
2140
2164
}*/
2141
2165
2142
2166
if ( ! timezone ) {
2143
- store . get ( 'first_app' ) ? $ ( "#first-app-add-timezone #first-app-timezone" ) . after ( reqSpan . clone ( ) ) : $ ( "#app-add-timezone #app-timezone" ) . after ( reqSpan . clone ( ) ) ;
2167
+ store . get ( 'first_app' ) ? $ ( "#first-app-add-timezone" ) . before ( reqSpan . clone ( ) ) : $ ( "#app-add-timezone #app-timezone" ) . after ( reqSpan . clone ( ) ) ;
2168
+ }
2169
+
2170
+ if ( $ ( ".required-first-app" ) . length ) {
2171
+ $ ( ".required-first-app" ) . fadeIn ( ) ;
2172
+ return false ;
2144
2173
}
2145
2174
2146
2175
if ( $ ( ".required" ) . length ) {
2147
- $ ( ".required" ) . fadeIn ( ) ;
2176
+ $ ( ".required-first-app " ) . fadeIn ( ) ;
2148
2177
return false ;
2149
2178
}
2150
2179
@@ -2249,7 +2278,6 @@ window.ManageAppsView = countlyView.extend({
2249
2278
}
2250
2279
} ) ;
2251
2280
} ) ;
2252
-
2253
2281
}
2254
2282
} ) ;
2255
2283
@@ -3363,15 +3391,15 @@ window.EventsBlueprintView = countlyView.extend({
3363
3391
render : {
3364
3392
item : function ( item ) {
3365
3393
return '<div>' +
3366
- countlyCommon . encodeHtml ( item . key ) +
3367
- '</div>' ;
3394
+ countlyCommon . encodeHtml ( item . key ) +
3395
+ '</div>' ;
3368
3396
} ,
3369
3397
option : function ( item ) {
3370
3398
var label = item . key ;
3371
3399
//var caption = item.key;
3372
3400
return '<div>' +
3373
- '<span class="label">' + label + '</span>' +
3374
- '</div>' ;
3401
+ '<span class="label">' + label + '</span>' +
3402
+ '</div>' ;
3375
3403
}
3376
3404
} ,
3377
3405
createFilter : function ( ) {
0 commit comments