Added a watermark.

master
Pacman Ghost 2 years ago
parent 01be3e9880
commit 20f03c2dc1
  1. 14
      asl_articles/tests/test_db_report.py
  2. 14
      asl_articles/tests/utils.py
  3. BIN
      web/public/images/watermark.png
  4. 8
      web/src/App.css
  5. 14
      web/src/App.js
  6. 2
      web/src/DbReport.css

@ -10,7 +10,7 @@ from asl_articles.tests.test_publications import edit_publication
from asl_articles.tests.test_articles import edit_article
from asl_articles.tests.utils import init_tests, \
select_main_menu_option, select_sr_menu_option, check_ask_dialog, \
do_search, find_search_result, \
do_search, find_search_result, get_search_results, \
wait_for, wait_for_elem, find_child, find_children
# ---------------------------------------------------------------------
@ -36,10 +36,11 @@ def test_db_report( webdriver, flask_app, dbconn ):
assert image_sizes == {}
# add some images
results = do_search( SEARCH_ALL )
publ_sr = find_search_result( "Avalon Hill", results )
do_search( SEARCH_ALL )
publ_sr = find_search_result( "Avalon Hill", wait=2 )
fname = os.path.join( os.path.split(__file__)[0], "fixtures/images/1.gif" )
edit_publisher( publ_sr, { "image": fname } )
results = get_search_results()
pub_sr = find_search_result( "ASL Journal (1)", results )
fname = os.path.join( os.path.split(__file__)[0], "fixtures/images/2.gif" )
edit_publication( pub_sr, { "image": fname } )
@ -78,11 +79,12 @@ def test_db_report( webdriver, flask_app, dbconn ):
}
# delete all the publishers (and associated objects), then check the updated report
results = do_search( SEARCH_ALL )
publ_sr = find_search_result( "Avalon Hill", results )
do_search( SEARCH_ALL )
publ_sr = find_search_result( "Avalon Hill", wait=2 )
select_sr_menu_option( publ_sr, "delete" )
check_ask_dialog( "Delete this publisher?", "ok" )
publ_sr = find_search_result( "Multiman Publishing" )
results = get_search_results()
publ_sr = find_search_result( "Multiman Publishing", results )
select_sr_menu_option( publ_sr, "delete" )
check_ask_dialog( "Delete this publisher?", "ok" )
row_counts, links, dupe_images, image_sizes = _get_db_report()

@ -132,13 +132,15 @@ def get_search_result_names( results=None ):
results = get_search_results()
return [ find_child( ".name", r ).text for r in results ]
def find_search_result( name, results=None ):
def find_search_result( name, results=None, wait=0 ):
"""Find a search result."""
if not results:
results = get_search_results()
results = [ r for r in results if find_child( ".name", r ).text == name ]
assert len(results) == 1
return results[0]
def find_sr():
matches = [
r for r in results or get_search_results()
if find_child( ".name", r ).text == name
]
return matches[0] if len(matches) == 1 else None
return wait_for( wait, find_sr )
def check_search_result( sr, check, expected ):
"""Check a search result in the UI."""

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

@ -18,6 +18,14 @@
[data-reach-menu-list] .divider { height: 0 ; margin: 2px 0 ; border-top: 1px solid #aaa ; }
[data-reach-menu-list] img { height: 100% ; margin-top: -0.1em ; margin-right: 0.5em ; }
#watermark {
position: fixed ; right: 0 ; bottom: 0 ;
height: 30% ;
opacity: 0 ; z-index: -999 ;
transition: opacity 5s ;
}
#watermark img { height: 100% ; }
.MuiDialogTitle-root { padding: 10px 16px 6px 16px !important ; }
.MuiDialogContent-root>div { margin-bottom: 1em ; }
.MuiDialogContent-root p { margin-top: 0.5em ; }

@ -129,11 +129,13 @@ export class App extends React.Component
<SearchForm onSearch={this.onSearch.bind(this)} ref={this._searchFormRef} />
</div>
{menu}
{ this.state.showDbReport && <DbReport /> }
<SearchResults ref={this._searchResultsRef}
seqNo = {this.state.searchSeqNo}
searchResults = {this.state.searchResults}
/>
{ this.state.showDbReport
? <DbReport />
: <SearchResults ref={this._searchResultsRef}
seqNo = {this.state.searchSeqNo}
searchResults = {this.state.searchResults}
/>
}
</div> ) ;
}
return ( <div> {content}
@ -155,6 +157,7 @@ export class App extends React.Component
{ this._fakeUploads && <div>
<textarea id="_stored_msg-upload_" ref="_stored_msg-upload_" defaultValue="" hidden={true} />
</div> }
<div id="watermark" ref="watermark"> <img src="/images/watermark.png" alt="watermark" /> </div>
</div> ) ;
}
@ -537,6 +540,7 @@ export class App extends React.Component
}
_onStartupComplete() {
// startup has completed, we're ready to go
this.refs.watermark.style.opacity = 0.2 ;
if ( this.props.warning )
this.showWarningToast( this.props.warning ) ;
if ( this.props.doSearch )

@ -1,6 +1,6 @@
#db-report {
border: 1px solid #ccc ; border-radius: 8px ;
background: #fff ; padding: 0.5em ;
padding: 0.5em ;
}
#db-report .section { margin-top: 1em ; }
#db-report .section:first-of-type { margin-top: 0 ; }

Loading…
Cancel
Save